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

Base class of FMTActualDevelopment and FMTFuturDevelopment representing a forest stand. More...

#include <FMTDevelopment.h>

Inheritance diagram for Core::FMTDevelopment:
[legend]
Collaboration diagram for Core::FMTDevelopment:
[legend]

Public Member Functions

 FMTDevelopment (FMTDevelopment &&rhs)
 Move copy constructor.
 
FMTDevelopmentoperator= (FMTDevelopment &&rhs)
 Move assignment operator for FMTDevelopment.
 
int getAge () const
 Get the age of the development.
 
uint8_t getShortAge () const
 Get the age of the development as a short int.
 
int getLock () const
 Get the lock of the development.
 
int getPeriod () const
 Get the period of the development.
 
const Core::FMTMaskgetMask () const
 Get a const reference to the mask of the development.
 
Core::FMTMask getMaskCopy () const
 Get a copy of the mask of the development.
 
void setAge (const int &lage)
 Set the age of the development.
 
void setLock (const int &llock)
 Set the lock of the development.
 
void setPeriod (const int &lperiod)
 Set the period of the development.
 
void setMask (const Core::FMTMask &p_mask)
 Set the mask of the development.
 
 FMTDevelopment ()
 Default constructor for FMTDevelopment.
 
virtual ~FMTDevelopment ()=default
 Default virtual destructor for FMTDevelopment.
 
 FMTDevelopment (const FMTMask &p_mask, const int &p_age, const int &p_lock)
 Construct a development from a mask, an age and a lock level.
 
 FMTDevelopment (const FMTMask &p_mask, const int &p_age, const int &p_lock, const int &p_period)
 Construct a development from a mask, an age, a lock level and a period.
 
 FMTDevelopment (const FMTDevelopment &rhs)
 Copy constructor for FMTDevelopment.
 
virtual std::unique_ptr< FMTDevelopmentclone () const
 Virtual clone function for FMTDevelopment.
 
FMTDevelopmentoperator= (const FMTDevelopment &rhs)
 Copy assignment operator for FMTDevelopment.
 
bool operator== (const FMTDevelopment &rhs) const
 Equality comparison operator of FMTDevelopment.
 
bool operator!= (const FMTDevelopment &rhs) const
 Inequality comparison operator of FMTDevelopment.
 
bool operator< (const FMTDevelopment &rhs) const
 Less than comparison operator of FMTDevelopment.
 
FMTFuturDevelopment grow () const
 Return a grown copy of this development, increasing the age and period and decreasing the lock level if it was greater than 0.
 
FMTYieldRequest getYieldRequest (const Graph::FMTGraphVertexToYield *graphyieldrequest=nullptr) const
 Get a yield request for this development, without reference to a graph unless one is provided.
 
std::string getNonOperabilityInfo (const FMTAction &p_action, const Core::FMTYields &p_yields, const Graph::FMTGraphVertexToYield *p_yieldRequest) const
 Check why this developpement is not operable for p_action and return the info.
 
bool operable (const FMTAction &action, const Core::FMTYields &ylds, const Graph::FMTGraphVertexToYield *graphyieldrequest=nullptr) const
 Check if this development is operable to an action based on multiple yields.
 
bool anyOperable (const std::vector< const FMTAction * > &actions, const Core::FMTYields &ylds, const Graph::FMTGraphVertexToYield *graphyieldrequest=nullptr) const
 Check if this development is operable to any of the actions based on multiple yields.
 
virtual operator std::string () const
 Return the string representation of the development as in the area section.
 
virtual double getArea () const
 Return the area of the development.
 
FMTDevelopment clearLock () const
 Return a copy of this development with the lock level set to 0.
 
std::vector< FMTDevelopmentPathoperate (const FMTAction &action, const FMTTransition &Transition, const Core::FMTYields &ylds, const std::vector< FMTTheme > &themes) const
 Return the development paths resulting from operating this development with an action and a transition based on yields and sorted themes.
 
double getInventoryCoef (const Core::FMTYields &ylds, const std::string &target_yield, const Graph::FMTGraphVertexToYield *graphyieldrequest=nullptr) const
 Return the inventory coefficient of the development for a given yield based on the yields.
 
double getHarvestCoef (const std::vector< FMTDevelopmentPath > &topaths, const FMTAction &action, const Core::FMTYields &ylds, const std::string &target_yield, const Graph::FMTGraphVertexToYield *graphyieldrequest=nullptr) const
 Return the harvest coefficient of the development for a given yield following multiple development paths for an action based on yields.
 
bool is (const FMTSpec &specification, const Core::FMTYields &ylds, const Graph::FMTGraphVertexToYield *graphyieldrequest=nullptr) const
 Check if this development respects a specification based on multiple yields.
 
bool worthTestingOperability (const FMTAction &action) const
 Return true if it is worth testing operability for the action, used for optimization.
 
std::vector< int > anyWorthTestingOperability (const std::vector< const FMTAction * > &actions, const FMTAction &firstaction) const
 Return the pointer distances from the first action of the actions worth testing for operability.
 
std::vector< bool > isAnyWorthTestingOperability (const std::vector< const FMTAction * > &actions, const std::vector< FMTAction > &allactions) const noexcept
 Return a vector of booleans, true if the corresponding action is worth testing for operability.
 
size_t hash () const
 Return the hash of the development combining its mask, age, lock and period.
 
- 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)
 

Friends

class boost::serialization::access
 Serialize the FMTDevelopment through its base FMTObject for multiprocessing across multiple cpus (pickle in Python).
 

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

Base class of FMTActualDevelopment and FMTFuturDevelopment representing a forest stand.

Holds the age, period of existence, lock level, and a mask describing the growth, spatial reference and other information of the stand.

Constructor & Destructor Documentation

◆ FMTDevelopment() [1/5]

Core::FMTDevelopment::FMTDevelopment ( FMTDevelopment &&  rhs)

Move copy constructor.

Parameters
[in]rhsdevelopment to swap

◆ FMTDevelopment() [2/5]

Core::FMTDevelopment::FMTDevelopment ( )

Default constructor for FMTDevelopment.

◆ ~FMTDevelopment()

virtual Core::FMTDevelopment::~FMTDevelopment ( )
virtualdefault

Default virtual destructor for FMTDevelopment.

◆ FMTDevelopment() [3/5]

Core::FMTDevelopment::FMTDevelopment ( const FMTMask p_mask,
const int &  p_age,
const int &  p_lock 
)

Construct a development from a mask, an age and a lock level.

Parameters
[in]p_maskthe mask.
[in]p_agethe age.
[in]p_lockthe lock level.

◆ FMTDevelopment() [4/5]

Core::FMTDevelopment::FMTDevelopment ( const FMTMask p_mask,
const int &  p_age,
const int &  p_lock,
const int &  p_period 
)

Construct a development from a mask, an age, a lock level and a period.

Parameters
[in]p_maskthe mask.
[in]p_agethe age.
[in]p_lockthe lock level.
[in]p_periodthe period.

◆ FMTDevelopment() [5/5]

Core::FMTDevelopment::FMTDevelopment ( const FMTDevelopment rhs)

Copy constructor for FMTDevelopment.

Parameters
[in]rhsthe FMTDevelopment to copy.

Member Function Documentation

◆ anyOperable()

bool Core::FMTDevelopment::anyOperable ( const std::vector< const FMTAction * > &  actions,
const Core::FMTYields ylds,
const Graph::FMTGraphVertexToYield graphyieldrequest = nullptr 
) const

Check if this development is operable to any of the actions based on multiple yields.

Parameters
[in]actionsthe actions.
[in]yldsthe yields.
[in]graphyieldrequestan optional graph vertex to yield.
Returns
true if the development is operable to any action else false.

◆ anyWorthTestingOperability()

std::vector< int > Core::FMTDevelopment::anyWorthTestingOperability ( const std::vector< const FMTAction * > &  actions,
const FMTAction firstaction 
) const

Return the pointer distances from the first action of the actions worth testing for operability.

Parameters
[in]actionsthe actions.
[in]firstactionthe first action.
Returns
the distances of the actions worth testing.

◆ clearLock()

FMTDevelopment Core::FMTDevelopment::clearLock ( ) const

Return a copy of this development with the lock level set to 0.

Returns
the development with a cleared lock.

◆ clone()

virtual std::unique_ptr< FMTDevelopment > Core::FMTDevelopment::clone ( ) const
virtual

Virtual clone function for FMTDevelopment.

Returns
a unique pointer to the cloned development.

Reimplemented in Core::FMTActualDevelopment, and Core::FMTFuturDevelopment.

◆ getAge()

int Core::FMTDevelopment::getAge ( ) const
inline

Get the age of the development.

Returns
the age of the development.

◆ getArea()

virtual double Core::FMTDevelopment::getArea ( ) const
virtual

Return the area of the development.

Returns
the area of the development.

Reimplemented in Core::FMTActualDevelopment, and Core::FMTFuturDevelopment.

◆ getHarvestCoef()

double Core::FMTDevelopment::getHarvestCoef ( const std::vector< FMTDevelopmentPath > &  topaths,
const FMTAction action,
const Core::FMTYields ylds,
const std::string &  target_yield,
const Graph::FMTGraphVertexToYield graphyieldrequest = nullptr 
) const

Return the harvest coefficient of the development for a given yield following multiple development paths for an action based on yields.

Parameters
[in]topathsthe development paths.
[in]actionthe action.
[in]yldsthe yields.
[in]target_yieldthe target yield.
[in]graphyieldrequestan optional graph vertex to yield.
Returns
the harvest coefficient.

◆ getInventoryCoef()

double Core::FMTDevelopment::getInventoryCoef ( const Core::FMTYields ylds,
const std::string &  target_yield,
const Graph::FMTGraphVertexToYield graphyieldrequest = nullptr 
) const

Return the inventory coefficient of the development for a given yield based on the yields.

Parameters
[in]yldsthe yields.
[in]target_yieldthe target yield.
[in]graphyieldrequestan optional graph vertex to yield.
Returns
the inventory coefficient.

◆ getLock()

int Core::FMTDevelopment::getLock ( ) const
inline

Get the lock of the development.

Returns
the lock of the development.

◆ getMask()

const Core::FMTMask & Core::FMTDevelopment::getMask ( ) const
inline

Get a const reference to the mask of the development.

Returns
a const reference to the mask of the development.

◆ getMaskCopy()

Core::FMTMask Core::FMTDevelopment::getMaskCopy ( ) const
inline

Get a copy of the mask of the development.

Returns
a copy of the mask of the development.

◆ getNonOperabilityInfo()

std::string Core::FMTDevelopment::getNonOperabilityInfo ( const FMTAction p_action,
const Core::FMTYields p_yields,
const Graph::FMTGraphVertexToYield p_yieldRequest 
) const

Check why this developpement is not operable for p_action and return the info.

Parameters
[in]p_actionthe action to test
[in]p_yieldsthe yields
[in]p_yieldRequesta yield request
Returns
the of info string or empty if is operable.

◆ getPeriod()

int Core::FMTDevelopment::getPeriod ( ) const
inline

Get the period of the development.

Returns
the period of the development.

◆ getShortAge()

uint8_t Core::FMTDevelopment::getShortAge ( ) const
inline

Get the age of the development as a short int.

Returns
the age of the development as a short int.

◆ getYieldRequest()

FMTYieldRequest Core::FMTDevelopment::getYieldRequest ( const Graph::FMTGraphVertexToYield graphyieldrequest = nullptr) const

Get a yield request for this development, without reference to a graph unless one is provided.

Parameters
[in]graphyieldrequestan optional graph vertex to yield.
Returns
the yield request.

◆ grow()

FMTFuturDevelopment Core::FMTDevelopment::grow ( ) const

Return a grown copy of this development, increasing the age and period and decreasing the lock level if it was greater than 0.

Returns
the grown development.

◆ hash()

size_t Core::FMTDevelopment::hash ( ) const
inline

Return the hash of the development combining its mask, age, lock and period.

Returns
the hash value.

◆ is()

bool Core::FMTDevelopment::is ( const FMTSpec &  specification,
const Core::FMTYields ylds,
const Graph::FMTGraphVertexToYield graphyieldrequest = nullptr 
) const

Check if this development respects a specification based on multiple yields.

Parameters
[in]specificationthe specification.
[in]yldsthe yields.
[in]graphyieldrequestan optional graph vertex to yield.
Returns
true if the development respects the specification else false.

◆ isAnyWorthTestingOperability()

std::vector< bool > Core::FMTDevelopment::isAnyWorthTestingOperability ( const std::vector< const FMTAction * > &  actions,
const std::vector< FMTAction > &  allactions 
) const
noexcept

Return a vector of booleans, true if the corresponding action is worth testing for operability.

Parameters
[in]actionsthe actions.
[in]allactionsall the actions.
Returns
a vector of booleans, true if worth testing operability.

◆ operable()

bool Core::FMTDevelopment::operable ( const FMTAction action,
const Core::FMTYields ylds,
const Graph::FMTGraphVertexToYield graphyieldrequest = nullptr 
) const

Check if this development is operable to an action based on multiple yields.

Parameters
[in]actionthe action.
[in]yldsthe yields.
[in]graphyieldrequestan optional graph vertex to yield.
Returns
true if the development is operable to the action else false.

◆ operate()

std::vector< FMTDevelopmentPath > Core::FMTDevelopment::operate ( const FMTAction action,
const FMTTransition Transition,
const Core::FMTYields ylds,
const std::vector< FMTTheme > &  themes 
) const

Return the development paths resulting from operating this development with an action and a transition based on yields and sorted themes.

Parameters
[in]actionthe action.
[in]Transitionthe transition.
[in]yldsthe yields.
[in]themesthe sorted themes.
Returns
the resulting development paths.

◆ operator std::string()

virtual Core::FMTDevelopment::operator std::string ( ) const
virtual

Return the string representation of the development as in the area section.

Returns
the string representation of the development.

Reimplemented in Core::FMTActualDevelopment.

◆ operator!=()

bool Core::FMTDevelopment::operator!= ( const FMTDevelopment rhs) const

Inequality comparison operator of FMTDevelopment.

Parameters
[in]rhsthe development to compare with.
Returns
true if both developments are different else false.

◆ operator<()

bool Core::FMTDevelopment::operator< ( const FMTDevelopment rhs) const

Less than comparison operator of FMTDevelopment.

Parameters
[in]rhsthe development to compare with.
Returns
true if this development is less than rhs else false.

◆ operator=() [1/2]

FMTDevelopment & Core::FMTDevelopment::operator= ( const FMTDevelopment rhs)

Copy assignment operator for FMTDevelopment.

Parameters
[in]rhsthe FMTDevelopment to copy.
Returns
a reference to this FMTDevelopment.

◆ operator=() [2/2]

FMTDevelopment & Core::FMTDevelopment::operator= ( FMTDevelopment &&  rhs)

Move assignment operator for FMTDevelopment.

Parameters
[in]rhsthe development to move from.
Returns
a reference to this FMTDevelopment.

◆ operator==()

bool Core::FMTDevelopment::operator== ( const FMTDevelopment rhs) const

Equality comparison operator of FMTDevelopment.

Parameters
[in]rhsthe development to compare with.
Returns
true if both developments are equal else false.

◆ setAge()

void Core::FMTDevelopment::setAge ( const int &  lage)

Set the age of the development.

Parameters
[in]lagethe age to set.

◆ setLock()

void Core::FMTDevelopment::setLock ( const int &  llock)

Set the lock of the development.

Parameters
[in]llockthe lock to set.

◆ setMask()

void Core::FMTDevelopment::setMask ( const Core::FMTMask p_mask)

Set the mask of the development.

Parameters
[in]p_maskthe mask to set.

◆ setPeriod()

void Core::FMTDevelopment::setPeriod ( const int &  lperiod)

Set the period of the development.

Parameters
[in]lperiodthe period to set.

◆ worthTestingOperability()

bool Core::FMTDevelopment::worthTestingOperability ( const FMTAction action) const

Return true if it is worth testing operability for the action, used for optimization.

Parameters
[in]actionthe action.
Returns
true if it is worth testing operability else false.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTDevelopment through its base FMTObject for multiprocessing across multiple cpus (pickle in Python).

Template Parameters
Archivethe archive type.
Parameters
[in,out]arthe archive to serialize to or from.
[in]versionthe serialization version.

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