|
FFSM++
1.1.0
French Forest Sector Model ++
|
#include <ModelRegion.h>


Public Member Functions | |
| ModelRegion (ThreadManager *MTHREAD_h, int regId_h, string regSName_h, string regLName_h, int regLevel_h, int parRegId_h, bool isResidual_h) | |
| Constructor. More... | |
| ~ModelRegion () | |
| void | setRegId (int regId_h) |
| void | setRegSName (string regSName_h) |
| void | setRegLName (string regLName_h) |
| void | setRegLevel (int regLevel_h) |
| void | setParRegId (int parRegId_h) |
| void | setIsResidual (bool isResidual_h) |
| void | setParent (ModelRegion *parRegion_h) |
| void | setChildren (vector< ModelRegion * > children_h) |
| void | addForData (forData *data_h) |
| Childrens are all the lvel-1 region that are parts of this region. More... | |
| void | addProdData (prodData *data_h) |
| void | setMyPixels () |
| It sets a double link pixels <–> region. More... | |
| void | swap (const int &swap_what) |
| int | getRegId () const |
| string | getRegSName () const |
| string | getRegLName () const |
| int | getRegLevel () const |
| int | getParRegId () const |
| bool | getIsResidual () const |
| ModelRegion * | getParent () |
| vector< ModelRegion * > | getChildren (bool excludeResidual=true) |
| Returns a pointer to the parent regions. More... | |
| vector< ModelRegion * > | getSiblings (bool excludeResidual=true) |
| Return a vector of pointers to the siblings regions. More... | |
| double | getVolumes () |
| vector< double > | getVolumes (int fType_h) |
| double | getValue (string layerName, int op=OP_SUM) |
| return the values of its own pixels for the specified layer. Possible operations: OP_SUM or OP_AVG More... | |
| vector< vector< double > > | getVolumes (int fType_h, string dClass_h) |
| double | getArea (const string &fType_h, const string &dClass_h) |
| Get area by ft and dc (from pixel->area matrix) More... | |
| double | getArea (const string &fType_h) |
| Get area by ft (from pixel->area matrix) More... | |
| double | getArea (const int &ft_pos, const int &dc_pos) |
| Get area by ft and dc positions (from pixel->area matrix) More... | |
| double | getArea (const int &ft_pos) |
| Get area by ft position (from pixel->area matrix) More... | |
| double | getArea () |
| Get whole forest area (from pixel->area matrix) More... | |
| int | getNChildren (bool excludeResidual=true) |
| vector< Pixel * > | getMyPixels () |
Public Member Functions inherited from BaseClass | |
| BaseClass () | |
| ~BaseClass () | |
| void | msgOut (const int &msgCode_h, const string &msg_h, const bool &refreshGUI_h=true) const |
| Overloaded function to print the output log. More... | |
| void | msgOut (const int &msgCode_h, const int &msg_h, const bool &refreshGUI_h=true) const |
| Overloaded function to print the output log. More... | |
| void | msgOut (const int &msgCode_h, const double &msg_h, const bool &refreshGUI_h=true) const |
| Overloaded function to print the output log. More... | |
| int | s2i (const string &string_h) const |
| string to integer conversion More... | |
| double | s2d (const string &string_h) const |
| string to double conversion More... | |
| double | s2d (const string &string_h, const bool &replaceComma) const |
| string to double conversion More... | |
| bool | s2b (const string &string_h) const |
| string to bool conversion More... | |
| string | i2s (const int &int_h) const |
| integer to string conversion More... | |
| string | d2s (const double &double_h) const |
| double to string conversion More... | |
| string | b2s (const bool &bool_h) const |
| bool to string conversion More... | |
| vector< int > | s2i (const vector< string > &string_h) const |
| string to integer conversion (vector) More... | |
| vector< double > | s2d (const vector< string > &string_h, const bool &replaceComma=false) const |
| string to double conversion (vector) More... | |
| vector< bool > | s2b (const vector< string > &string_h) const |
| string to bool conversion (vector) More... | |
| vector< string > | i2s (const vector< int > &int_h) const |
| integer to string conversion (vector) More... | |
| vector< string > | d2s (const vector< double > &double_h) const |
| double to string conversion (vector) More... | |
| vector< string > | b2s (const vector< bool > &bool_h) const |
| bool to string conversion (vector) More... | |
| int | getType (const string &type_h) const |
| Return a type according to enum TYPE_* from a string (eg: "string" -> TYPE_STRING (2)) More... | |
| void | refreshGUI () const |
| Ping to periodically return the control to the GUI. More... | |
| template<typename T > | |
| string | toString (const T &x) const |
| template<typename T > | |
| T | stringTo (const std::string &s) const |
| int | vSum (const vector< int > &vector_h) const |
| double | vSum (const vector< double > &vector_h) const |
| int | vSum (const vector< vector< int > > &vector_h) const |
| double | vSum (const vector< vector< double > > &vector_h) const |
| void | tokenize (const string &str, vector< string > &tokens, const string &delimiter=" ") const |
| Tokenize a string using a delimiter (default is space) More... | |
| void | untokenize (string &str, vector< string > &tokens, const string &delimiter=" ") const |
| template<typename K , typename V > | |
| V | findMap (const map< K, V > &mymap, const K &key, const int &error_level=MSG_CRITICAL_ERROR, const V ¬FoundValue=numeric_limits< V >::min()) const |
| Lookup a map for a value. Return the value starting from the key. More... | |
| template<typename K , typename V > | |
| void | changeMapValue (map< K, V > &mymap, const K &key, const V &value, const int &error_level=MSG_CRITICAL_ERROR) |
| Change the value stored in a map given the key and the new value. More... | |
| template<typename K , typename V > | |
| void | incrMapValue (map< K, V > &mymap, const K &key, const V &value, const int &error_level=MSG_CRITICAL_ERROR) |
| Increments a value stored in a map of the specified value, given the key. More... | |
| template<typename K , typename V > | |
| void | incrOrAddMapValue (map< K, V > &mymap, const K &key, const V &value) |
| Increments a value stored in a map of the specified value, given the key. More... | |
| template<typename K , typename V > | |
| void | resetMapValues (map< K, V > &mymap, const V &value) |
| Reset all values stored in a map to the specified one. More... | |
| template<typename K , typename V > | |
| map< K, V > | vectorToMap (const vector< K > &keys, const V &value=0.0) |
| Returns a map built using the given vector and the given (scalar) value as keys/values pairs. More... | |
| template<typename T > | |
| vector< T > | positionsToContent (const vector< T > &vector_h, const vector< int > &positions) |
| Return a vector of content from a vector and a vector of positions (int) More... | |
| template<typename V > | |
| void | debugMap (const map< iisskey, V > &mymap) |
| Debug a map. More... | |
| template<typename K , typename V > | |
| void | debugMap (const map< K, V > &mymap, const K &key) |
| template<typename K > | |
| int | getMaxPos (const vector< K > &v) |
| Returns the position of the maximum element in the vector (the last one in case of multiple equivalent maxima) More... | |
| template<typename K > | |
| int | getMinPos (const vector< K > &v) |
| Returns the position of the minimum element in the vector (the first one in case of multiple equivalent minima) More... | |
| template<typename K > | |
| K | getMax (const vector< K > &v) |
| Returns the value of the maximum element in the vector (the last one in case of multiple equivalent maxima) More... | |
| template<typename K > | |
| K | getMin (const vector< K > &v) |
| Returns the value of the minimum element in the vector (the first one in case of multiple equivalent minima) More... | |
| template<typename K > | |
| double | getAvg (const vector< K > &v) |
| Returns the average of the elements in the vector. More... | |
| template<typename K > | |
| double | getSd (const vector< K > &v, bool sample=true) |
| template<typename K > | |
| int | getPos (const K &element, const vector< K > &v, const int &msgCode_h=MSG_CRITICAL_ERROR) |
| template<typename K > | |
| bool | inVector (const K &element, const vector< K > &v) |
| double | normSample (const double &avg, const double &stdev, const double &minval=NULL, const double &maxval=NULL) const |
| Sample from a normal distribution with bounds. Slower (double time, but still you see the diff only after milion of loops). More... | |
| template<typename K > | |
| K | normSample (normal_distribution< K > &d, std::mt19937 &gen, const K &minval=NULL, const K &maxval=NULL) const |
| Sample from a normal distribution with bounds. Faster (half time) as the normal_distribution is made only once. More... | |
| template<typename T > | |
| std::string | toString (const T &x) const |
Public Attributes | |
| vector< double > | inResByAnyCombination |
| Vector of inventory resource for each possible combination of primary products. This store both alive timber and death one. More... | |
Private Attributes | |
| int | regId |
| Regional unique ID. More... | |
| string | regSName |
| A short name of the region. More... | |
| string | regLName |
| Region long name;. More... | |
| int | regLevel |
| The level of the region. 1: country, 2: regions. More... | |
| int | parRegId |
| Id of the parent region;. More... | |
| bool | isResidual |
| A flag if this region should be explicitelly modelled or it is just a residual. More... | |
| ModelRegion * | parRegion |
| Pointer to the parent region. More... | |
| vector< ModelRegion * > | chRegions |
| Vector of level-1 children regions. More... | |
| vector< forData * > | forDataVector |
| Vector of pointers of forestry data (owned by ModelData) More... | |
| vector< prodData * > | prodDataVector |
| Vector of pointers of product data (owned by ModelData) More... | |
| vector< Pixel * > | myPixels |
| Vector of pixels for this region. More... | |
Additional Inherited Members | |
Protected Attributes inherited from BaseClass | |
| ThreadManager * | MTHREAD |
| Pointer to the Thread manager. More... | |
Definition at line 45 of file ModelRegion.h.
| ModelRegion | ( | ThreadManager * | MTHREAD_h, |
| int | regId_h, | ||
| string | regSName_h, | ||
| string | regLName_h, | ||
| int | regLevel_h, | ||
| int | parRegId_h, | ||
| bool | isResidual_h | ||
| ) |
Constructor.
The constructor of REGION instances want:
| MTHREAD_h | Pointer to the main thread manager |
Definition at line 34 of file ModelRegion.cpp.

| ~ModelRegion | ( | ) |
Definition at line 51 of file ModelRegion.cpp.
|
inline |
Childrens are all the lvel-1 region that are parts of this region.
Definition at line 60 of file ModelRegion.h.
|
inline |
Definition at line 61 of file ModelRegion.h.
| double getArea | ( | const string & | fType_h, |
| const string & | dClass_h | ||
| ) |
Get area by ft and dc (from pixel->area matrix)
Definition at line 125 of file ModelRegion.cpp.
Referenced by ModelCoreSpatial::runManagementModule().


| double getArea | ( | const string & | fType_h | ) |
Get area by ft (from pixel->area matrix)
Definition at line 149 of file ModelRegion.cpp.

| double getArea | ( | const int & | ft_pos, |
| const int & | dc_pos | ||
| ) |
Get area by ft and dc positions (from pixel->area matrix)
Definition at line 163 of file ModelRegion.cpp.
| double getArea | ( | const int & | ft_pos | ) |
Get area by ft position (from pixel->area matrix)
Definition at line 172 of file ModelRegion.cpp.

| double getArea | ( | ) |
Get whole forest area (from pixel->area matrix)
Definition at line 181 of file ModelRegion.cpp.
Referenced by getArea().


| vector< ModelRegion * > getChildren | ( | bool | excludeResidual = true | ) |
Returns a pointer to the parent regions.
Return a vector of pointers to the direct child regions
Definition at line 55 of file ModelRegion.cpp.
Referenced by ModelData::applyOverrides(), Output::commonInit(), Opt::get_nlp_info(), getNChildren(), and ModelData::getRegionIds().


|
inline |
Definition at line 71 of file ModelRegion.h.
Referenced by getChildren().

|
inline |
Definition at line 86 of file ModelRegion.h.
Referenced by ModelCoreSpatial::cachePixelExogenousData(), ModelCoreSpatial::computeCumulativeData(), ModelCoreSpatial::computeInventary(), Gis::getAllPlotsByRegion(), getArea(), ModelData::getAvailableAliveTimber(), ModelCoreSpatial::loadExogenousForestLayers(), Output::printDebugPixelValues(), ModelCoreSpatial::resetPixelValues(), ModelCoreSpatial::runBiologicalModule(), ModelCoreSpatial::runManagementModule(), and ModelCoreSpatial::sumRegionalForData().

| int getNChildren | ( | bool | excludeResidual = true | ) |
Definition at line 69 of file ModelRegion.cpp.
Referenced by ModelData::applyOverrides(), ModelData::getForData(), ModelData::getProdData(), ModelData::setForData(), and ModelData::setProdData().


|
inline |
Definition at line 72 of file ModelRegion.h.
Referenced by Pixel::getMyRegion().

|
inline |
Definition at line 70 of file ModelRegion.h.
|
inline |
Definition at line 66 of file ModelRegion.h.
Referenced by Pixel::getMultiplier(), and getSiblings().

|
inline |
Definition at line 69 of file ModelRegion.h.
|
inline |
Definition at line 68 of file ModelRegion.h.
|
inline |
Definition at line 67 of file ModelRegion.h.
Referenced by ModelData::regId2RegSName(), ModelData::regSName2RegId(), and ModelCoreSpatial::runBiologicalModule().

| vector< ModelRegion * > getSiblings | ( | bool | excludeResidual = true | ) |
Return a vector of pointers to the siblings regions.
Definition at line 85 of file ModelRegion.cpp.
Referenced by ModelCoreSpatial::computeEconomicBalances().


| double getValue | ( | string | layerName, |
| int | op = OP_SUM |
||
| ) |
return the values of its own pixels for the specified layer. Possible operations: OP_SUM or OP_AVG
Definition at line 191 of file ModelRegion.cpp.
Referenced by ModelCoreSpatial::initializePixelArea(), ModelCoreSpatial::initializePixelVolumes(), ModelCoreSpatial::runBiologicalModule(), and ModelCore::updateMapAreas().


| double getVolumes | ( | ) |
Definition at line 104 of file ModelRegion.cpp.
| vector< double > getVolumes | ( | int | fType_h | ) |
Definition at line 110 of file ModelRegion.cpp.
| vector< vector< double > > getVolumes | ( | int | fType_h, |
| string | dClass_h | ||
| ) |
Definition at line 117 of file ModelRegion.cpp.
|
inline |
Definition at line 59 of file ModelRegion.h.
|
inline |
Definition at line 57 of file ModelRegion.h.
| void setMyPixels | ( | ) |
It sets a double link pixels <–> region.
Definition at line 215 of file ModelRegion.cpp.

|
inline |
Definition at line 58 of file ModelRegion.h.
|
inline |
Definition at line 56 of file ModelRegion.h.
|
inline |
Definition at line 52 of file ModelRegion.h.
|
inline |
Definition at line 55 of file ModelRegion.h.
|
inline |
Definition at line 54 of file ModelRegion.h.
|
inline |
Definition at line 53 of file ModelRegion.h.
| void swap | ( | const int & | swap_what | ) |
Definition at line 229 of file ModelRegion.cpp.
|
private |
Vector of level-1 children regions.
Definition at line 99 of file ModelRegion.h.
Referenced by getChildren().
|
private |
Vector of pointers of forestry data (owned by ModelData)
Definition at line 100 of file ModelRegion.h.
| vector<double> inResByAnyCombination |
Vector of inventory resource for each possible combination of primary products. This store both alive timber and death one.
Definition at line 86 of file ModelRegion.h.
Referenced by ModelCoreSpatial::computeInventary(), Opt::copyInventoryResourses(), ModelRegion(), and ModelCoreSpatial::runMarketModule().
|
private |
A flag if this region should be explicitelly modelled or it is just a residual.
Definition at line 97 of file ModelRegion.h.
Referenced by ModelRegion().
|
private |
Vector of pixels for this region.
Definition at line 102 of file ModelRegion.h.
Referenced by getArea(), getValue(), setMyPixels(), and swap().
|
private |
Id of the parent region;.
Definition at line 96 of file ModelRegion.h.
Referenced by getSiblings(), and ModelRegion().
|
private |
Pointer to the parent region.
Definition at line 98 of file ModelRegion.h.
|
private |
Vector of pointers of product data (owned by ModelData)
Definition at line 101 of file ModelRegion.h.
|
private |
Regional unique ID.
Definition at line 92 of file ModelRegion.h.
Referenced by getSiblings(), ModelRegion(), and setMyPixels().
|
private |
The level of the region. 1: country, 2: regions.
Definition at line 95 of file ModelRegion.h.
Referenced by ModelRegion(), and setMyPixels().
|
private |
|
private |
A short name of the region.
Definition at line 93 of file ModelRegion.h.
Referenced by ModelRegion().