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

FMTList containing multiple yield handlers as seen in the yield section, holding the information related to forest productivity. More...

#include <FMTYields.h>

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

Public Member Functions

void generateDefaultYields (const std::vector< Core::FMTTheme > &themes)
 Generate the default yields such as _TSLA in the yield class.
 
void swap (FMTYields &rhs)
 Swap this FMTYields with another.
 
bool gotYieldType (FMTyldtype type) const
 Return true if the yield section has a given yield type.
 
void setActionsMappingToModelHandlers (const std::vector< int > &actionids)
 Clear and replace the actions mapping of every yield model handler.
 
std::vector< std::string > getAllYieldNames () const
 Return all the yield names from the list.
 
 FMTYields ()
 Default constructor for FMTYields.
 
 ~FMTYields ()=default
 Default destructor for FMTYields.
 
 FMTYields (const FMTYields &rhs)
 Copy constructor for FMTYields.
 
FMTYieldsoperator= (const FMTYields &rhs)
 Copy assignment operator for FMTYields.
 
void clearCache () final
 Clear the caching from all FMTData.
 
void clearRandomYieldsCache ()
 Clear the cache of all random yield models.
 
bool isYld (const std::string &value, bool fromsource=false) const
 Return true if the yield section contains a given non null yield.
 
bool isNullYld (const std::string &value) const
 Return true if the yield section contains a given null yield.
 
int getAge (const FMTYieldRequest &request, const FMTSpec &spec) const
 Get the yields values for a development from a set of yield requests.
 
std::map< std::string, std::map< std::string, std::vector< double > > > getAllYields (const FMTTheme &target, FMTyldtype type) const
 Return a map of all the yield values for a given yield handler type, used for generating a text file of yields for GCBM.
 
bool operator== (const FMTYields &rhs) const
 Equality comparison operator of FMTYields.
 
bool operator!= (const FMTYields &rhs) const
 Inequality comparison operator of FMTYields.
 
void update () override
 Update the yield names and null yield names caching, as required by FMTList.
 
void reserve (const FMTYields &p_other)
 Reserve memory based on another FMTYields.
 
FMTYields preSolve (const FMTMaskFilter &filter, const std::vector< FMTTheme > &originalthemes, const std::vector< FMTTheme > &newthemes) const
 Return a presolved FMTYields section, removing useless data.
 
void preSolveRef (const FMTMaskFilter &p_filter, const std::vector< FMTTheme > &p_originalThemes, const std::vector< FMTTheme > &p_newThemes)
 Presolve the FMTYields section in place, removing useless data.
 
std::vector< std::string > getStacked () const
 Return the yields as a vector of strings.
 
FMTYields getFromFactor (const double &factor, std::vector< std::string >yieldnames=std::vector< std::string >()) const
 Multiply the yields section by a factor and return a new yields section.
 
double get (const FMTYieldRequest &request, const std::string &yld) const
 Get the yield value for a development from a yield request.
 
void pushBackAgeHandler (const FMTMask &mask, const FMTAgeYieldHandler &value)
 Push back an age yield handler, for R.
 
void pushBackTimeHandler (const FMTMask &mask, const FMTTimeYieldHandler &value)
 Push back a time yield handler, for R.
 
void clear ()
 Clear all the yield data.
 

Static Public Member Functions

static const std::string & getNullYield ()
 Return the null yield.
 
static int getMaxBase (const std::vector< const FMTYieldHandler * > &handlers)
 Return the maximum age seen in the yield handlers.
 

Friends

class Models::FMTModel
 
class Models::FMTNssModel
 
class boost::serialization::access
 Serialize the FMTYields through its base FMTList for multiprocessing across multiple cpus (pickle in Python).
 
class FMTYieldRequest
 

Detailed Description

FMTList containing multiple yield handlers as seen in the yield section, holding the information related to forest productivity.

Used to check if a development is operable to an action, calculate outputs and constraints, and disturb a forest stand in a transition.

Constructor & Destructor Documentation

◆ FMTYields() [1/2]

Core::FMTYields::FMTYields ( )

Default constructor for FMTYields.

◆ ~FMTYields()

Core::FMTYields::~FMTYields ( )
default

Default destructor for FMTYields.

◆ FMTYields() [2/2]

Core::FMTYields::FMTYields ( const FMTYields rhs)

Copy constructor for FMTYields.

Parameters
[in]rhsthe FMTYields to copy.

Member Function Documentation

◆ clear()

void Core::FMTYields::clear ( )

Clear all the yield data.

◆ clearCache()

void Core::FMTYields::clearCache ( )
final

Clear the caching from all FMTData.

◆ clearRandomYieldsCache()

void Core::FMTYields::clearRandomYieldsCache ( )

Clear the cache of all random yield models.

◆ generateDefaultYields()

void Core::FMTYields::generateDefaultYields ( const std::vector< Core::FMTTheme > &  themes)

Generate the default yields such as _TSLA in the yield class.

Parameters
[in]themesthe themes.

◆ get()

double Core::FMTYields::get ( const FMTYieldRequest request,
const std::string &  yld 
) const

Get the yield value for a development from a yield request.

Parameters
[in]requestthe yield request.
[in]yldthe yield name.
Returns
the yield value.

◆ getAge()

int Core::FMTYields::getAge ( const FMTYieldRequest request,
const FMTSpec &  spec 
) const

Get the yields values for a development from a set of yield requests.

Returns
a map of yield names to their values.

Get the yield value for a development, looking at age, period, lock and mask.

Returns
the yield value.

Get the yields used and their values for a development and a specification.

Returns
the yields and their values.

Return the new age of a development when disturbed by a transition specification.

Parameters
[in]requestthe yield request.
[in]specthe specification.
Returns
the new age.

◆ getAllYieldNames()

std::vector< std::string > Core::FMTYields::getAllYieldNames ( ) const

Return all the yield names from the list.

Returns
all the yield names.

◆ getAllYields()

std::map< std::string, std::map< std::string, std::vector< double > > > Core::FMTYields::getAllYields ( const FMTTheme target,
FMTyldtype  type 
) const

Return a map of all the yield values for a given yield handler type, used for generating a text file of yields for GCBM.

Parameters
[in]targetthe target theme.
[in]typethe yield handler type.
Returns
a map of mask to yield names and their values.

◆ getFromFactor()

FMTYields Core::FMTYields::getFromFactor ( const double &  factor,
std::vector< std::string >  yieldnames = std::vector< std::string >() 
) const

Multiply the yields section by a factor and return a new yields section.

Parameters
[in]factorthe factor.
[in]yieldnamesthe yield names to multiply, all if empty.
Returns
the multiplied yields.

◆ getMaxBase()

static int Core::FMTYields::getMaxBase ( const std::vector< const FMTYieldHandler * > &  handlers)
static

Return the maximum age seen in the yield handlers.

Parameters
[in]handlersthe yield handlers.
Returns
the maximum age among the yield handlers.

◆ getNullYield()

static const std::string & Core::FMTYields::getNullYield ( )
static

Return the null yield.

Returns
the null yield value.

◆ getStacked()

std::vector< std::string > Core::FMTYields::getStacked ( ) const

Return the yields as a vector of strings.

Returns
the yields as strings.

◆ gotYieldType()

bool Core::FMTYields::gotYieldType ( FMTyldtype  type) const

Return true if the yield section has a given yield type.

Parameters
[in]typethe yield type.
Returns
true if the yield section has the type else false.

◆ isNullYld()

bool Core::FMTYields::isNullYld ( const std::string &  value) const

Return true if the yield section contains a given null yield.

Parameters
[in]valuethe yield name.
Returns
true if the yield is a null yield else false.

◆ isYld()

bool Core::FMTYields::isYld ( const std::string &  value,
bool  fromsource = false 
) const

Return true if the yield section contains a given non null yield.

Parameters
[in]valuethe yield name.
[in]fromsourceif true checks the sources.
Returns
true if the yield is present else false.

◆ operator!=()

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

Inequality comparison operator of FMTYields.

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

◆ operator=()

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

Copy assignment operator for FMTYields.

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

◆ operator==()

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

Equality comparison operator of FMTYields.

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

◆ preSolve()

FMTYields Core::FMTYields::preSolve ( const FMTMaskFilter filter,
const std::vector< FMTTheme > &  originalthemes,
const std::vector< FMTTheme > &  newthemes 
) const

Return a presolved FMTYields section, removing useless data.

Parameters
[in]filterthe mask filter.
[in]originalthemesthe original themes.
[in]newthemesthe presolved themes.
Returns
the presolved yields.

◆ preSolveRef()

void Core::FMTYields::preSolveRef ( const FMTMaskFilter p_filter,
const std::vector< FMTTheme > &  p_originalThemes,
const std::vector< FMTTheme > &  p_newThemes 
)

Presolve the FMTYields section in place, removing useless data.

Parameters
[in]p_filterthe mask filter.
[in]p_originalThemesthe original themes.
[in]p_newThemesthe presolved themes.

◆ pushBackAgeHandler()

void Core::FMTYields::pushBackAgeHandler ( const FMTMask mask,
const FMTAgeYieldHandler value 
)

Push back an age yield handler, for R.

Parameters
[in]maskthe mask.
[in]valuethe age yield handler.

◆ pushBackTimeHandler()

void Core::FMTYields::pushBackTimeHandler ( const FMTMask mask,
const FMTTimeYieldHandler value 
)

Push back a time yield handler, for R.

Parameters
[in]maskthe mask.
[in]valuethe time yield handler.

◆ reserve()

void Core::FMTYields::reserve ( const FMTYields p_other)

Reserve memory based on another FMTYields.

Parameters
[in]p_otherthe other yields.

◆ setActionsMappingToModelHandlers()

void Core::FMTYields::setActionsMappingToModelHandlers ( const std::vector< int > &  actionids)

Clear and replace the actions mapping of every yield model handler.

Parameters
[in]actionidsthe new action ids.

◆ swap()

void Core::FMTYields::swap ( FMTYields rhs)

Swap this FMTYields with another.

Parameters
[in,out]rhsthe FMTYields to swap with.

◆ update()

void Core::FMTYields::update ( )
override

Update the yield names and null yield names caching, as required by FMTList.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTYields through its base FMTList 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.

◆ FMTYieldRequest

friend class FMTYieldRequest
friend

◆ Models::FMTModel

friend class Models::FMTModel
friend

◆ Models::FMTNssModel

friend class Models::FMTNssModel
friend

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