FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Spatial::FMTSpatialGraphs Class Reference

Container of the line graphs of a spatially explicit model, organized by constraint family, with a base solution tracker. More...

#include <FMTSpatialGraphs.h>

Inheritance diagram for Spatial::FMTSpatialGraphs:
[legend]
Collaboration diagram for Spatial::FMTSpatialGraphs:
[legend]

Public Types

using const_iterator = std::map< Graph::FMTLineGraph, FMTGraphInfo >::const_iterator
 

Public Member Functions

 FMTSpatialGraphs ()=default
 Default constructor for FMTSpatialGraphs.
 
 FMTSpatialGraphs (const FMTSpatialGraphs &p_rhs)=default
 Default copy constructor for FMTSpatialGraphs.
 
FMTSpatialGraphsoperator= (const FMTSpatialGraphs &)=default
 Default copy assignment operator for FMTSpatialGraphs.
 
 FMTSpatialGraphs (const Models::FMTModel &p_model, double p_CellSize)
 Construct a FMTSpatialGraphs from a model and a cell size, building all the line graphs.
 
double getConstraintsValue (size_t NonSpatialConstraintId, const FMTSolutionTracker &p_solution) const
 Return the value of a non spatial constraint for a solution.
 
FMTVirtualLineGraph getVirtualGraph (const Graph::FMTLineGraph &p_LineGraph)
 Return the virtual line graph of a line graph.
 
FMTVirtualLineGraph setVirtualGraph (const Graph::FMTLineGraph &p_LineGraph)
 Set and return the virtual line graph of a line graph.
 
FMTSolutionTracker getBaseSolution () const
 Return the base solution tracker.
 
const_iterator getIterator (const Graph::FMTLineGraph &p_Graph, size_t p_family) const
 Return the iterator of a graph in a constraint family.
 
const_iterator setIterator (const Graph::FMTLineGraph &p_Graph, size_t p_family)
 Add a graph to a constraint family and return its iterator.
 
const_iterator setNaturalGrowthIterator (size_t p_family)
 Add the natural growth graph to a constraint family and return its iterator.
 
const Models::FMTModelgetModel () const
 Return the model of the spatial graphs.
 
std::map< std::string, double > getOutput (const FMTSolutionTracker &p_Solution, const Core::FMTOutput &p_output, int p_period, Core::FMToutputlevel level) const
 Return the output value of a solution for a period.
 
void setModel (const Models::FMTModel &p_model)
 Set the model of the spatial graphs.
 
void addToSolution (FMTSolutionTracker &p_solution, size_t p_family, const_iterator p_iterator)
 Add a graph to a solution for a constraint family.
 
void removeToSolution (FMTSolutionTracker &p_solution, size_t p_family, const_iterator p_iterator)
 Remove a graph from a solution for a constraint family.
 
bool isNotNull (size_t p_family, const_iterator p_iterator) const
 Return true if a graph iterator of a constraint family is not null.
 
std::vector< Core::FMTSchedulegetSchedules (const FMTSolutionTracker &p_Solution, bool WithLock=false) const
 Return the schedules of a spatial solution.
 
const_iterator getBaseIterator (size_t p_family) const
 Return the base graph iterator of a constraint family.
 
const_iterator getLastPeriodIterator (size_t p_family, const_iterator p_iterator) const
 Return the last period graph iterator of a graph in a constraint family.
 
void swap (FMTSpatialGraphs &p_Other)
 Swap this FMTSpatialGraphs with another one.
 
size_t getNumberOfCategories (int p_themeId) const
 Return the number of categories of a theme.
 
size_t getCategoryOf (int p_themeId, size_t p_family) const
 Return the category of a theme for a constraint family.
 
void deleteNonCompleteGraphs ()
 Delete the graphs that are not complete.
 
void enableSolutionTracker (FMTSolutionTracker &p_tracker) const
 Enable the tracking of the constraint values on a solution tracker.
 
- Public Member Functions inherited from Core::FMTObject
 FMTObject ()
 Default constructor for FMTObject.
 
virtual ~FMTObject ()
 Default virtual destructor for FMTObject.
 
 FMTObject (const std::unique_ptr< Exception::FMTExceptionHandler > exhandler)
 Construct a FMTObject passing in the exception handler of another FMTObject.
 
 FMTObject (const FMTObject &rhs)
 Copy constructor for FMTObject.
 
FMTObjectoperator= (const FMTObject &rhs)
 Copy assignment operator for FMTObject.
 
virtual void passInLogger (const std::unique_ptr< Logging::FMTLogger > &logger)
 Pass in the logger of another FMTObject.
 
void passInExceptionHandler (const std::unique_ptr< Exception::FMTExceptionHandler > &exhandler)
 Pass in the exception handler of another FMTObject.
 
void redirectLogToFile (const std::string &location)
 Redirect the log to a specific file, appending to it.
 
virtual void setDefaultLogger ()
 Create and set a default logger to the FMTObject.
 
virtual void setQuietLogger ()
 Create and set a quiet logger to the FMTObject.
 
virtual void setTaskLogger ()
 Create and set a task logger to the FMTObject.
 
virtual void setDebugLogger ()
 Create and set a debug logger to the FMTObject.
 
void setDefaultExceptionHandler ()
 Create and set a default exception handler to the FMTObject.
 
void setQuietExceptionHandler ()
 Create and set a quiet exception handler to the FMTObject.
 
void setDebugExceptionHandler ()
 Create and set a debug exception handler to the FMTObject.
 
void setFreeExceptionHandler ()
 Create and set a free exception handler to the FMTObject.
 
void disableNestedExceptions ()
 Disable the nested exception throw of the exception handler.
 
void enableNestedExceptions ()
 Enable the nested exception throw of the exception handler.
 
void setErrorsToWarnings (const std::vector< Exception::FMTexc > &errors)
 Set a list of errors to be cast to warnings on the exception handler.
 
void setMaxWarningsBeforeSilenced (const size_t &maxwarningcount)
 Set the number of warnings raised before being silenced.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::FMTObject
static Logging::FMTLoggergetLogger ()
 get a pointer to the actual logger.
 
static Exception::FMTExceptionHandlergetExceptionHandler ()
 get a pointer to the actual exception handler.
 
static std::string getRuntimeLocation ()
 Return the location of the FMT shared library.
 
static unsigned long long getAvailableMemory ()
 Return the available memory in bytes.
 
static void setTerminateStack ()
 will write the stack in the log when terminate called and raise a function failed.
 
static void setAbortStack ()
 will write the stack in the log when abort called with SIGABRT and raise a function failed.
 
- Protected Member Functions inherited from Core::FMTObject
template<class Archive >
void forceSave (Archive &ar, const unsigned int version) const
 Force the serialization to save useful information, which the default FMTObject serialization does not.
 
template<class Archive >
void forceLoad (Archive &ar, const unsigned int version)
 Force the serialization to load useful information, which the default FMTObject serialization does not.
 
void checkSignals () const
 Check if the user has sent a ctrl-c signal using boost::python to FMT.
 
void setCplHandler ()
 Pass the FMT exception handler to the GDAL exception handler (GDAL only).
 
- Static Protected Member Functions inherited from Core::FMTObject
static std::chrono::time_point< std::chrono::high_resolution_clock > getClock ()
 Return a clock of the current time.
 
template<class chrono >
static double getDuration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock as a double.
 
static std::string getDurationInSeconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock in seconds as a string.
 
static void _logStack ()
 Log the stack trace...
 
static void _terminate ()
 Raise an error with the boost stacktrace.
 
static void _abort (int p_signal)
 Raise an error with the boost stacktrace on abort.
 
- Static Protected Attributes inherited from Core::FMTObject
static std::unique_ptr< Exception::FMTExceptionHandler_exhandler
 A shared pointer to the exception handler.
 
static std::unique_ptr< Logging::FMTLogger_logger
 A shared pointer to the logger.
 

Detailed Description

Container of the line graphs of a spatially explicit model, organized by constraint family, with a base solution tracker.

It builds the graphs from a model, stores the constraint values of each graph and provides the outputs and schedules of a spatial solution.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ FMTSpatialGraphs() [1/3]

Spatial::FMTSpatialGraphs::FMTSpatialGraphs ( )
default

Default constructor for FMTSpatialGraphs.

◆ FMTSpatialGraphs() [2/3]

Spatial::FMTSpatialGraphs::FMTSpatialGraphs ( const FMTSpatialGraphs p_rhs)
default

Default copy constructor for FMTSpatialGraphs.

Parameters
[in]p_rhsthe FMTSpatialGraphs to copy.

◆ FMTSpatialGraphs() [3/3]

Spatial::FMTSpatialGraphs::FMTSpatialGraphs ( const Models::FMTModel p_model,
double  p_CellSize 
)

Construct a FMTSpatialGraphs from a model and a cell size, building all the line graphs.

Parameters
[in]p_modelthe model.
[in]p_CellSizethe cell size.

Member Function Documentation

◆ addToSolution()

void Spatial::FMTSpatialGraphs::addToSolution ( FMTSolutionTracker p_solution,
size_t  p_family,
const_iterator  p_iterator 
)

Add a graph to a solution for a constraint family.

Parameters
[in,out]p_solutionthe solution.
[in]p_familythe constraint family.
[in]p_iteratorthe graph iterator.

◆ deleteNonCompleteGraphs()

void Spatial::FMTSpatialGraphs::deleteNonCompleteGraphs ( )

Delete the graphs that are not complete.

◆ enableSolutionTracker()

void Spatial::FMTSpatialGraphs::enableSolutionTracker ( FMTSolutionTracker p_tracker) const

Enable the tracking of the constraint values on a solution tracker.

Parameters
[in,out]p_trackerthe solution tracker.

◆ getBaseIterator()

const_iterator Spatial::FMTSpatialGraphs::getBaseIterator ( size_t  p_family) const

Return the base graph iterator of a constraint family.

Parameters
[in]p_familythe constraint family.
Returns
the base graph iterator.

◆ getBaseSolution()

FMTSolutionTracker Spatial::FMTSpatialGraphs::getBaseSolution ( ) const

Return the base solution tracker.

Returns
the base solution.

◆ getCategoryOf()

size_t Spatial::FMTSpatialGraphs::getCategoryOf ( int  p_themeId,
size_t  p_family 
) const

Return the category of a theme for a constraint family.

Parameters
[in]p_themeIdthe theme id.
[in]p_familythe constraint family.
Returns
the category.

◆ getConstraintsValue()

double Spatial::FMTSpatialGraphs::getConstraintsValue ( size_t  NonSpatialConstraintId,
const FMTSolutionTracker p_solution 
) const

Return the value of a non spatial constraint for a solution.

Parameters
[in]NonSpatialConstraintIdthe non spatial constraint id.
[in]p_solutionthe solution.
Returns
the constraint value.

◆ getIterator()

const_iterator Spatial::FMTSpatialGraphs::getIterator ( const Graph::FMTLineGraph p_Graph,
size_t  p_family 
) const

Return the iterator of a graph in a constraint family.

Parameters
[in]p_Graphthe graph.
[in]p_familythe constraint family.
Returns
the graph iterator.

◆ getLastPeriodIterator()

const_iterator Spatial::FMTSpatialGraphs::getLastPeriodIterator ( size_t  p_family,
const_iterator  p_iterator 
) const

Return the last period graph iterator of a graph in a constraint family.

Parameters
[in]p_familythe constraint family.
[in]p_iteratorthe graph iterator.
Returns
the last period graph iterator.

◆ getModel()

const Models::FMTModel & Spatial::FMTSpatialGraphs::getModel ( ) const

Return the model of the spatial graphs.

Returns
the model.

◆ getNumberOfCategories()

size_t Spatial::FMTSpatialGraphs::getNumberOfCategories ( int  p_themeId) const

Return the number of categories of a theme.

Parameters
[in]p_themeIdthe theme id.
Returns
the number of categories.

◆ getOutput()

std::map< std::string, double > Spatial::FMTSpatialGraphs::getOutput ( const FMTSolutionTracker p_Solution,
const Core::FMTOutput p_output,
int  p_period,
Core::FMToutputlevel  level 
) const

Return the output value of a solution for a period.

Parameters
[in]p_Solutionthe solution.
[in]p_outputthe output.
[in]p_periodthe period.
[in]levelthe output level.
Returns
a map of names to values.

◆ getSchedules()

std::vector< Core::FMTSchedule > Spatial::FMTSpatialGraphs::getSchedules ( const FMTSolutionTracker p_Solution,
bool  WithLock = false 
) const

Return the schedules of a spatial solution.

Parameters
[in]p_Solutionthe solution.
[in]WithLockif true includes the locked developments.
Returns
the schedules.

◆ getVirtualGraph()

FMTVirtualLineGraph Spatial::FMTSpatialGraphs::getVirtualGraph ( const Graph::FMTLineGraph p_LineGraph)

Return the virtual line graph of a line graph.

Parameters
[in]p_LineGraphthe line graph.
Returns
the virtual line graph.

◆ isNotNull()

bool Spatial::FMTSpatialGraphs::isNotNull ( size_t  p_family,
const_iterator  p_iterator 
) const

Return true if a graph iterator of a constraint family is not null.

Parameters
[in]p_familythe constraint family.
[in]p_iteratorthe graph iterator.
Returns
true if the iterator is not null else false.

◆ operator=()

FMTSpatialGraphs & Spatial::FMTSpatialGraphs::operator= ( const FMTSpatialGraphs )
default

Default copy assignment operator for FMTSpatialGraphs.

Returns
a reference to this FMTSpatialGraphs.

◆ removeToSolution()

void Spatial::FMTSpatialGraphs::removeToSolution ( FMTSolutionTracker p_solution,
size_t  p_family,
const_iterator  p_iterator 
)

Remove a graph from a solution for a constraint family.

Parameters
[in,out]p_solutionthe solution.
[in]p_familythe constraint family.
[in]p_iteratorthe graph iterator.

◆ setIterator()

const_iterator Spatial::FMTSpatialGraphs::setIterator ( const Graph::FMTLineGraph p_Graph,
size_t  p_family 
)

Add a graph to a constraint family and return its iterator.

Parameters
[in]p_Graphthe graph.
[in]p_familythe constraint family.
Returns
the graph iterator.

◆ setModel()

void Spatial::FMTSpatialGraphs::setModel ( const Models::FMTModel p_model)

Set the model of the spatial graphs.

Parameters
[in]p_modelthe model.

◆ setNaturalGrowthIterator()

const_iterator Spatial::FMTSpatialGraphs::setNaturalGrowthIterator ( size_t  p_family)

Add the natural growth graph to a constraint family and return its iterator.

Parameters
[in]p_familythe constraint family.
Returns
the natural growth graph iterator.

◆ setVirtualGraph()

FMTVirtualLineGraph Spatial::FMTSpatialGraphs::setVirtualGraph ( const Graph::FMTLineGraph p_LineGraph)

Set and return the virtual line graph of a line graph.

Parameters
[in]p_LineGraphthe line graph.
Returns
the virtual line graph.

◆ swap()

void Spatial::FMTSpatialGraphs::swap ( FMTSpatialGraphs p_Other)

Swap this FMTSpatialGraphs with another one.

Parameters
[in,out]p_Otherthe FMTSpatialGraphs to swap with.

The documentation for this class was generated from the following file: