FFSM++
1.1.0
French Forest Sector Model ++
|
Regional data, including macros and settings. More...
#include <ModelData.h>
Public Member Functions | |
ModelData (ThreadManager *MTHREAD_h) | |
~ModelData () | |
void | loadInput () |
Unzip the OpenOffice input file (NEW 2008.05.13) More... | |
LLData | getTableFromFile (string tablename, string filename_h) |
Load and return a data table from a file (instead that from a spreadsheet sheet) More... | |
vector< string > | getScenarios () |
int | getScenarioIndex () |
bool | delDir (QString dirname) |
Recursivelly delete a directory. More... | |
void | setScenarioData () |
Set the infos about this scenario (long description and overriding tables) More... | |
void | setDefaultSettings () |
void | setScenarioSettings () |
void | createRegions () |
void | setDefaultForData () |
void | setScenarioForData () |
void | setDefaultProdData () |
void | setScenarioProdData () |
void | setDefaultProductResourceMatrixLink () |
void | setScenarioProductResourceMatrixLink () |
void | setForestTypes () |
void | setReclassificationRules () |
void | setDefaultPathogenRules () |
void | setScenarioPathogenRules () |
void | applyOverrides () |
Cancel all reg1 level data and trasform them in reg2 level if not already existing. More... | |
void | applyDebugMode () |
Works only a specified subset of regions and products. More... | |
void | setSpace () |
string | getOutputDirectory () const |
Return a vector of objects that together provide the specified resource in the specified quantity. More... | |
int | getFilenamesByDir (const string &dir, vector< string > &files, const string &filter="") |
Return a list of files in a directory. More... | |
string | getFilenameByType (string type_h) |
LLData | getTable (string tableName_h, int debugLevel=MSG_CRITICAL_ERROR) |
vector< IFiles > | getIFilesVector () const |
string | getBaseDirectory () const |
ModelRegion * | getRegion (int regId_h) |
bool | regionExist (const int ®Id_h) const |
vector< ModelRegion * > | getAllRegions (bool excludeResidual=true) |
vector< int > | getRegionIds (int level_h, bool excludeResidual=true) |
vector< vector< int > > | getRegionIds (bool excludeResidual=true) |
string | regId2RegSName (const int ®Id_h) const |
int | regSName2RegId (const string ®SName_h) const |
int | getNForTypes () |
int | getNReclRules () |
forType * | getForType (int position) |
forType * | getForType (string &forTypeId_h) |
int | getForTypeCounter (string &forTypeId_h, bool all=false) |
By default it doesn't return forTypes used only as input. More... | |
vector< string > | getForTypeIds (bool all=false) |
By default it doesn't return forTypes used only as input. More... | |
string | getForTypeParentId (const string &forTypeId_h) |
vector< string > | getForTypeChilds (const string &forTypeId_h) |
vector< int > | getForTypeChilds_pos (const string &forTypeId_h, bool all=false) |
vector< string > | getForTypeParents () |
int | getNForTypesChilds (const string &forTypeId_h) |
reclRule * | getReclRule (int position) |
vector< string > | getDiameterClasses (bool productionOnly=false) |
const bool | assessProdPossibility (const string &prod_h, const string &forType_h, const string &dClass_h) |
A simple function to assess if a specified product can be made by a certain forest type and diameter class. More... | |
const int | getMaxYearUsableDeathTimber (const string &prod_h, const string &forType_h, const string &dClass_h) |
const int | getMaxYearUsableDeathTimber () |
void | setErrorLevel (int errorLevel_h) |
int | getErrorLevel () |
bool | getTempBool () |
void | setTempBool (bool tempBool_h) |
bool | getValueFoundBool () |
void | setValueFoundBool (bool valueFoundBool_h) |
vector< vector< int > > | createCombinationsVector (const int &nItems) |
Return a vector containing any possible combination of nItems items (including any possible subset). The returned vector has in each slot the items present in that specific combination. More... | |
double | getTimedData (const vector< double > &dated_vector, const int &year_h) const |
Return the value for the specified year in a timelly ordered vector, taking the last value if this is smaller than the required position. More... | |
void | setTimedData (const double &value_h, vector< double > &dated_vector, const int &year_h, const int &MSG_LEVEL=MSG_WARNING) |
int | getIntSetting (const string &name_h, int position=0, int reg=WORLD) const |
double | getDoubleSetting (const string &name_h, int position=0, int reg=WORLD) const |
string | getStringSetting (const string &name_h, int position=0, int reg=WORLD) const |
bool | getBoolSetting (const string &name_h, int position=0, int reg=WORLD) const |
vector< int > | getIntVectorSetting (const string &name_h, int reg=WORLD) const |
vector< double > | getDoubleVectorSetting (const string &name_h, int reg=WORLD) const |
vector< string > | getStringVectorSetting (const string &name_h, int reg=WORLD) const |
vector< bool > | getBoolVectorSetting (const string &name_h, int reg=WORLD) const |
const double | getProdData (const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const string &freeDim_h="") |
const double | getForData (const string &type_h, const int ®Id_h, const string &forType_h, const string &freeDim_h, const int &year=DATA_NOW) |
void | setProdData (const double &value_h, const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const bool &allowCreate=false, const string &freeDim_h="") |
void | setForData (const double &value_h, const string &type_h, const int ®Id_h, const string &forType_h, const string &freeDim_h, const int &year=DATA_NOW, const bool &allowCreate=false) |
string | makeKeyProdData (const string &parName, const string ®Id, const string &prod, const string &freeDim="") const |
string | makeKeyForData (const string &parName, const string ®Id, const string &forType, const string &diamClass) const |
void | unpackKeyProdData (const string &key, string &parName, int ®Id, string &prod, string &freeDim) const |
void | unpackKeyForData (const string &key, string &parName, int ®Id, string &forType, string &diamClass) const |
vector< pathRule * > | getPathMortalityRule (const string &forType, const string &dC) |
Return the pathogen mortality rule(s) associated with a given ft and dc (plural as more than a single pathogen could be found) More... | |
double | calculateAnnualisedEquivalent (const double &amount_h, const int &years_h, const double &ir) const |
Calculate the annual equivalent flow. More... | |
double | calculateAnnualisedEquivalent (const double &amount_h, const double &years_h, const double &ir) const |
Transform the double to the highest integer and call calculateAnnualisedEquivalent(double amount_h, int years_h) More... | |
void | setOutputDirectory (const char *output_dirname_h) |
void | setBaseDiretory (string baseDirectory_h) |
void | addSetting (string name_h, vector< string > values_h, int type_h, string comment_h) |
void | addSetting (string name_h, string value_h, int type_h, string comment_h) |
void | cacheSettings () |
Called after input reading, it fix frequently used data;. More... | |
int | getCachedInitialYear () |
void | deathTimberInventory_incrOrAdd (const iisskey &thekey, double value_h) |
void | deathTimberInventory_incr (const iisskey &thekey, double value_h) |
double | deathTimberInventory_get (const iisskey &thekey) |
map< iisskey, double > * | getDeathTimberInventory () |
double | getAvailableDeathTimber (const vector< string > &primProd_h, int regId_h, int year_h) |
Returns the timber available for a given set of primary products as stored in the deathTimberInventory map. More... | |
double | getAvailableAliveTimber (const vector< string > &primProd_h, int regId_h) |
Returns the timber available for a given set of primary products as stored in the px->vol_l vector. More... | |
vector< int > | getAllocableProductIdsFromDeathTimber (const int ®Id_h, const string &ft, const string &dc, const int &harvesting_year, int request_year=DATA_NOW) |
Returns the ids of the primary products that is possible to obtain using the timber recorded death in the specific year, ft, dc combination. More... | |
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 | |
scenarioData | scenario |
Private Member Functions | |
string | getBaseData (const string &name_h, int type_h, int position=0, int regId_h=WORLD) |
vector< string > | getVectorBaseData (const string &name_h, int type_h, int regId_h=WORLD) |
bool | dataMapCheckExist (const DataMap &map, const string &search_for, const bool &exactMatch=true) const |
double | dataMapGetValue (const DataMap &map, const string &search_for, const int &year_h, const bool &exactMatch=true) |
int | dataMapSetValue (DataMap &map, const string &search_for, const double &value_h, const int &year_h, const bool &exactMatch=true) |
Private Attributes | |
string | inputFilename |
string | outputDirname |
string | baseDirectory |
map< string, vector< double > > | forDataMap |
Forestry data. More... | |
map< string, vector< double > > | prodDataMap |
Product data. More... | |
vector< forToProd > | forToProdVector |
Vector of coefficients from forest resources to primary products. More... | |
vector< IFiles > | iFilesVector |
List of all input files. Simple (struct) More... | |
vector< BasicData > | programSettingsVector |
Setting data. Simple (struct) More... | |
vector< LLData > | LLDataVector |
Vector of Low Level Data. More... | |
vector< ModelRegion > | regionsVector |
Vector of modelled regions. More... | |
vector< forType > | forTypes |
Vector of forest types. More... | |
vector< reclRule > | reclRules |
Vector of reclassification rules. More... | |
vector< pathRule > | pathRules |
Vector of pathogen rules. More... | |
vector< vector< int > > | l2r |
Region2 ids. More... | |
map< iisskey, double > | deathTimberInventory |
Map that register the death of biomass still usable as timber by year, l2_region, forest type and diameter class [Mm^3 wood]. More... | |
vector< string > | diamClasses |
Diameter classes. More... | |
int | cached_initialYear |
vector< string > | priProducts |
vector< string > | secProducts |
vector< string > | allProducts |
bool | tempBool |
a temporary bool variable used for various functions More... | |
bool | valueFoundBool |
a bool used in getForData() and getProdData() to communicate they didn't found a variable More... | |
InputNode | mainDocument |
For each agricultural soil type (as defined in the setting "agrLandTypes") this list define the objects that can be placed on that soil type. More... | |
int | errorLevel |
Friends | |
void | Output::printForestData (bool finalFlush) |
void | Output::printProductData (bool finalFlush) |
Additional Inherited Members | |
Protected Attributes inherited from BaseClass | |
ThreadManager * | MTHREAD |
Pointer to the Thread manager. More... | |
Regional data, including macros and settings.
All regional data are within this class. It may have linked other data-classes.
On some variables ModelData has just the definition of the objects, but the values may change at the agent-level. This is why each agent has a "personal copy" of them.
Definition at line 80 of file ModelData.h.
ModelData | ( | ThreadManager * | MTHREAD_h | ) |
Definition at line 61 of file ModelData.cpp.
~ModelData | ( | ) |
Definition at line 68 of file ModelData.cpp.
void addSetting | ( | string | name_h, |
vector< string > | values_h, | ||
int | type_h, | ||
string | comment_h | ||
) |
Definition at line 281 of file ModelData.cpp.
Referenced by addSetting().
void addSetting | ( | string | name_h, |
string | value_h, | ||
int | type_h, | ||
string | comment_h | ||
) |
Definition at line 298 of file ModelData.cpp.
void applyDebugMode | ( | ) |
Works only a specified subset of regions and products.
The applyDebugMode flag all level2 regions not in the "debugRegions" option as "residual" (so they are in the map but not in the model code) and remove the primary and secondary products that are not included in the debugPriProducts and debugSecProducts options.
Definition at line 957 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void applyOverrides | ( | ) |
Cancel all reg1 level data and trasform them in reg2 level if not already existing.
Definition at line 749 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
const bool assessProdPossibility | ( | const string & | prod_h, |
const string & | forType_h, | ||
const string & | dClass_h | ||
) |
A simple function to assess if a specified product can be made by a certain forest type and diameter class.
Definition at line 441 of file ModelData.cpp.
Referenced by getAllocableProductIdsFromDeathTimber(), getAvailableAliveTimber(), and getAvailableDeathTimber().
void cacheSettings | ( | ) |
Called after input reading, it fix frequently used data;.
Definition at line 305 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
double calculateAnnualisedEquivalent | ( | const double & | amount_h, |
const int & | years_h, | ||
const double & | ir | ||
) | const |
Calculate the annual equivalent flow.
calculating the discount factor
Revenues at years n will be transforemed as average year rate as
av.y.rev = rev(n)/ ( (1+ir)^(n-1)+(1+ir)^(n-2)+(1+ir)^(n-3)+...+(1+ir)^(n-n) )
Objective is to have the present value of the final harvest (A) equal to the sum pf the present values of yearly activities (B):
Definition at line 1961 of file ModelData.cpp.
Referenced by calculateAnnualisedEquivalent(), ModelCore::runManagementModule(), and ModelCoreSpatial::runManagementModule().
double calculateAnnualisedEquivalent | ( | const double & | amount_h, |
const double & | years_h, | ||
const double & | ir | ||
) | const |
Transform the double to the highest integer and call calculateAnnualisedEquivalent(double amount_h, int years_h)
Definition at line 2000 of file ModelData.cpp.
vector< vector< int > > createCombinationsVector | ( | const int & | nItems | ) |
Return a vector containing any possible combination of nItems items (including any possible subset). The returned vector has in each slot the items present in that specific combination.
ModelData::createCombinationsVector Return a vector containing any possible combination of nItems items (including all subsets).
For example with nItems = 3: 0: []; 1: [0]; 2: [1]; 3: [0,1]; 4: [2]; 5: [0,2]; 6: [1,2]; 7: [0,1,2]
nItems | number of items to create p |
Definition at line 2055 of file ModelData.cpp.
Referenced by ModelCoreSpatial::computeInventary(), and ModelCoreSpatial::runMarketModule().
void createRegions | ( | ) |
Definition at line 317 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
|
private |
Definition at line 1812 of file ModelData.cpp.
Referenced by applyOverrides().
|
private |
Definition at line 1844 of file ModelData.cpp.
Referenced by getForData(), and getProdData().
|
private |
Definition at line 1872 of file ModelData.cpp.
Referenced by setForData(), and setProdData().
|
inline |
Definition at line 197 of file ModelData.h.
Referenced by ModelCoreSpatial::allocateHarvesting().
|
inline |
Definition at line 196 of file ModelData.h.
|
inline |
Definition at line 195 of file ModelData.h.
Referenced by ModelCoreSpatial::allocateHarvesting(), ModelCoreSpatial::initialiseDeathTimber(), and ModelCoreSpatial::runBiologicalModule().
bool delDir | ( | QString | dirname | ) |
Recursivelly delete a directory.
Definition at line 1769 of file ModelData.cpp.
Referenced by loadInput().
vector< int > getAllocableProductIdsFromDeathTimber | ( | const int & | regId_h, |
const string & | ft, | ||
const string & | dc, | ||
const int & | harvesting_year, | ||
int | request_year = DATA_NOW |
||
) |
Returns the ids of the primary products that is possible to obtain using the timber recorded death in the specific year, ft, dc combination.
Definition at line 2105 of file ModelData.cpp.
Referenced by ModelCoreSpatial::allocateHarvesting().
vector< ModelRegion * > getAllRegions | ( | bool | excludeResidual = true | ) |
Definition at line 379 of file ModelData.cpp.
Referenced by ModelRegion::getSiblings().
double getAvailableAliveTimber | ( | const vector< string > & | primProd_h, |
int | regId_h | ||
) |
Returns the timber available for a given set of primary products as stored in the px->vol_l vector.
Definition at line 2124 of file ModelData.cpp.
Referenced by ModelCoreSpatial::computeInventary().
double getAvailableDeathTimber | ( | const vector< string > & | primProd_h, |
int | regId_h, | ||
int | year_h | ||
) |
Returns the timber available for a given set of primary products as stored in the deathTimberInventory map.
Definition at line 2076 of file ModelData.cpp.
Referenced by ModelCoreSpatial::computeInventary().
|
private |
Returns the value stored in the settings database.
Regional overriding.
Concerning the param regId_h: it expect either world (default), a L2 or L1 region. Settings in the memory are stored also with data in one or more of these levels (e.g. we may have a general WORLD value and then a more specific L2 value. The function is done such that if WORLD is used to query it, it returns only a world value, if L1 is used instead, it looks for this L1 value and then eventually (if nothing is found) for WORLD. Finally, if L2 is used, it query, in the order, for L2, L1 or world levels.
Definition at line 1015 of file ModelData.cpp.
Referenced by getBoolSetting(), getDoubleSetting(), getIntSetting(), and getStringSetting().
|
inline |
Definition at line 118 of file ModelData.h.
Referenced by Output::commonInit(), Layers::print(), and Layers::printBinMap().
bool getBoolSetting | ( | const string & | name_h, |
int | position = 0 , |
||
int | reg = WORLD |
||
) | const |
Definition at line 1117 of file ModelData.cpp.
Referenced by ModelCoreSpatial::allocateHarvesting(), applyDebugMode(), applyOverrides(), ModelCoreSpatial::assignSpMultiplierPropToVols(), ModelCoreSpatial::cacheDynamicSettings(), ModelCoreSpatial::cachePixelExogenousData(), ModelCore::cacheSettings(), Output::commonInit(), getAllocableProductIdsFromDeathTimber(), getAvailableDeathTimber(), Pixel::getPathMortality(), Pixel::getSTData(), ModelCoreSpatial::initializePixelArea(), ModelCoreSpatial::initializePixelVolumes(), Output::initOutputForestData(), ModelCoreSpatial::loadExogenousForestLayers(), Output::printDetailedHV(), Scheduler::run(), ModelCoreSpatial::runBiologicalModule(), ModelCore::runManagementModule(), ModelCoreSpatial::runManagementModule(), ModelCoreSpatial::runMarketModule(), setDefaultPathogenRules(), setForestTypes(), Init::setInitLevel1(), Init::setInitLevel3(), ModelCoreSpatial::sumRegionalForData(), and ModelCoreSpatial::updateMapAreas().
vector< bool > getBoolVectorSetting | ( | const string & | name_h, |
int | reg = WORLD |
||
) | const |
Definition at line 1133 of file ModelData.cpp.
|
inline |
Definition at line 187 of file ModelData.h.
Referenced by Scheduler::run().
|
inline |
Definition at line 198 of file ModelData.h.
vector< string > getDiameterClasses | ( | bool | productionOnly = false | ) |
Definition at line 1191 of file ModelData.cpp.
Referenced by getForData(), and setForData().
double getDoubleSetting | ( | const string & | name_h, |
int | position = 0 , |
||
int | reg = WORLD |
||
) | const |
Definition at line 1109 of file ModelData.cpp.
Referenced by ModelCoreSpatial::cacheDynamicSettings(), ModelCoreSpatial::cachePixelExogenousData(), ModelCore::cacheSettings(), Pixel::getMultiplier(), Pixel::getSTData(), Carbon::registerTransports(), ModelCore::runManagementModule(), ModelCoreSpatial::runManagementModule(), and ModelCoreSpatial::runMarketModule().
vector< double > getDoubleVectorSetting | ( | const string & | name_h, |
int | reg = WORLD |
||
) | const |
Definition at line 1125 of file ModelData.cpp.
|
inline |
Definition at line 144 of file ModelData.h.
Referenced by ModelCoreSpatial::runManagementModule().
std::string getFilenameByType | ( | std::string | type_h | ) |
Definition at line 1175 of file ModelData.cpp.
int getFilenamesByDir | ( | const string & | dir, |
vector< string > & | files, | ||
const string & | filter = "" |
||
) |
Return a list of files in a directory.
Get a list of files in a directory
Definition at line 2011 of file ModelData.cpp.
const double getForData | ( | const string & | type_h, |
const int & | regId_h, | ||
const string & | forType_h, | ||
const string & | freeDim_h, | ||
const int & | year = DATA_NOW |
||
) |
Basic function to retrieve forest-related data. It addmits the following "filters": Name of the specific parameter requested Look for a level1 or level2 region If specified, look exactly for the specified forest type, otherwise accept the keyword FT_ALL for summing all of them Normally used for diameter class, but occasionally used for other uses (changed 20140514). It accepts three keywords, for summing up all diameters, production-ready diameters or sub-production ones, namelly DIAM_ALL, DIAM_PROD, DIAM_FIRST.\ If a diameter-independed variable is required, put it in the data with an empty diameter class and retrieve it here using DIAM_ALL. Unless specified, get the value of the current year. If array is smaller (e.g. because it is time-independent), get the last value.
Definition at line 1281 of file ModelData.cpp.
Referenced by Pixel::getMultiplier(), Carbon::getStock(), ModelCore::gfd(), ModelCoreSpatial::gfd(), Carbon::initialiseDeathBiomassStocks(), Output::printForestData(), Carbon::registerDeathBiomass(), Carbon::registerHarvesting(), and ModelCoreSpatial::runManagementModule().
|
inline |
Definition at line 128 of file ModelData.h.
Referenced by getForTypeChilds_pos(), ModelCoreSpatial::loadExogenousForestLayers(), and ModelCoreSpatial::runManagementModule().
forType * getForType | ( | string & | forTypeId_h | ) |
Definition at line 73 of file ModelData.cpp.
vector< string > getForTypeChilds | ( | const string & | forTypeId_h | ) |
Definition at line 98 of file ModelData.cpp.
Referenced by ModelCoreSpatial::runManagementModule(), and ModelCoreSpatial::sumRegionalForData().
vector< int > getForTypeChilds_pos | ( | const string & | forTypeId_h, |
bool | all = false |
||
) |
Definition at line 109 of file ModelData.cpp.
Referenced by ModelCoreSpatial::sumRegionalForData().
int getForTypeCounter | ( | string & | forTypeId_h, |
bool | all = false |
||
) |
By default it doesn't return forTypes used only as input.
Definition at line 81 of file ModelData.cpp.
vector< string > getForTypeIds | ( | bool | all = false | ) |
By default it doesn't return forTypes used only as input.
Definition at line 430 of file ModelData.cpp.
Referenced by ModelCore::cacheSettings(), ModelCoreSpatial::cacheSettings(), Output::commonInit(), ModelRegion::getArea(), getAvailableAliveTimber(), getAvailableDeathTimber(), getForData(), getForTypeChilds_pos(), getForTypeCounter(), Pixel::getSpModifier(), Carbon::getStock(), Carbon::initialiseDeathBiomassStocks(), Pixel::Pixel(), ModelCoreSpatial::runManagementModule(), setForData(), ModelCore::updateMapAreas(), ModelCoreSpatial::updateMapAreas(), and ModelCoreSpatial::updateOtherMapData().
string getForTypeParentId | ( | const string & | forTypeId_h | ) |
Definition at line 90 of file ModelData.cpp.
Referenced by ModelCoreSpatial::runManagementModule().
vector< string > getForTypeParents | ( | ) |
Definition at line 122 of file ModelData.cpp.
Referenced by Output::printForestData(), and ModelCoreSpatial::sumRegionalForData().
|
inline |
Definition at line 117 of file ModelData.h.
int getIntSetting | ( | const string & | name_h, |
int | position = 0 , |
||
int | reg = WORLD |
||
) | const |
Definition at line 1105 of file ModelData.cpp.
Referenced by ModelCore::cacheSettings(), ModelCoreSpatial::cacheSettings(), cacheSettings(), Output::commonInit(), Output::getOutputFieldDelimiter(), Pixel::getPathMortality(), Carbon::getStock(), Carbon::HWP_eol2energy(), Output::print(), Layers::print(), Scheduler::run(), ModelCore::runManagementModule(), ModelCoreSpatial::runMarketModule(), and Init::setInitLevel1().
vector< int > getIntVectorSetting | ( | const string & | name_h, |
int | reg = WORLD |
||
) | const |
Definition at line 1121 of file ModelData.cpp.
Referenced by applyDebugMode(), and Output::commonInit().
const int getMaxYearUsableDeathTimber | ( | const string & | prod_h, |
const string & | forType_h, | ||
const string & | dClass_h | ||
) |
Definition at line 468 of file ModelData.cpp.
Referenced by ModelCoreSpatial::allocateHarvesting().
const int getMaxYearUsableDeathTimber | ( | ) |
Definition at line 456 of file ModelData.cpp.
Referenced by getAllocableProductIdsFromDeathTimber(), and getAvailableDeathTimber().
|
inline |
Definition at line 126 of file ModelData.h.
int getNForTypesChilds | ( | const string & | forTypeId_h | ) |
Definition at line 135 of file ModelData.cpp.
Referenced by ModelCoreSpatial::runManagementModule().
|
inline |
Definition at line 127 of file ModelData.h.
|
inline |
Return a vector of objects that together provide the specified resource in the specified quantity.
Definition at line 113 of file ModelData.h.
Referenced by Output::commonInit(), Layers::print(), and Layers::printBinMap().
vector< pathRule * > getPathMortalityRule | ( | const string & | forType, |
const string & | dC | ||
) |
Return the pathogen mortality rule(s) associated with a given ft and dc (plural as more than a single pathogen could be found)
Definition at line 2034 of file ModelData.cpp.
Referenced by Pixel::getPathMortality().
const double getProdData | ( | const string & | type_h, |
const int & | regId_h, | ||
const string & | prodId_h, | ||
const int & | year = DATA_NOW , |
||
const string & | freeDim_h = "" |
||
) |
Basic function to retrieve products-related data. It addmits the following "filters": Name of the specific parameter requested Look for level1 or level 2 region. Product. It accept three keywords, for summing up all products, primary products or secondary products, namelly PROD_ALL, PROD_PRI, PROD_SEC. Unless specified, get the value of the current year. If array is smaller (e.g. because it is time-independent), get the last value. If specified, look exactly for it, otherwise simply doesn't filter for it.
Definition at line 1216 of file ModelData.cpp.
Referenced by Carbon::getStock(), ModelCore::gpd(), ModelCoreSpatial::gpd(), Carbon::HWP_eol2energy(), Carbon::initialiseProductsStocks(), Output::printProductData(), and Carbon::registerProducts().
|
inline |
Definition at line 137 of file ModelData.h.
ModelRegion * getRegion | ( | int | regId_h | ) |
Definition at line 346 of file ModelData.cpp.
Referenced by applyOverrides(), ModelCoreSpatial::assignSpMultiplierPropToVols(), ModelCoreSpatial::cachePixelExogenousData(), Output::commonInit(), ModelCoreSpatial::computeCumulativeData(), ModelCoreSpatial::computeEconomicBalances(), ModelCoreSpatial::computeInventary(), createRegions(), getAvailableAliveTimber(), getBaseData(), getForData(), getProdData(), getRegionIds(), getVectorBaseData(), ModelCoreSpatial::initializePixelArea(), ModelCoreSpatial::initializePixelVolumes(), ModelCoreSpatial::loadExogenousForestLayers(), Output::printDebugPixelValues(), regId2RegSName(), regSName2RegId(), ModelCoreSpatial::resetPixelValues(), ModelCoreSpatial::runBiologicalModule(), ModelCoreSpatial::runManagementModule(), ModelCoreSpatial::runMarketModule(), setForData(), setProdData(), ModelCoreSpatial::sumRegionalForData(), ModelCore::updateMapAreas(), and ModelCoreSpatial::updateMapAreas().
vector< int > getRegionIds | ( | int | level_h, |
bool | excludeResidual = true |
||
) |
Definition at line 366 of file ModelData.cpp.
Referenced by ModelCore::cacheSettings(), ModelCoreSpatial::cacheSettings(), Output::commonInit(), getRegionIds(), Carbon::HWP_eol2energy(), Carbon::initialiseEmissionCounters(), Output::printDebugOutput(), Output::printDebugPixelValues(), regSName2RegId(), ModelCore::updateMapAreas(), ModelCoreSpatial::updateMapAreas(), and ModelCoreSpatial::updateOtherMapData().
vector< vector< int > > getRegionIds | ( | bool | excludeResidual = true | ) |
Definition at line 390 of file ModelData.cpp.
int getScenarioIndex | ( | ) |
Definition at line 157 of file ModelData.cpp.
vector< string > getScenarios | ( | ) |
Definition at line 146 of file ModelData.cpp.
Referenced by getScenarioIndex().
string getStringSetting | ( | const string & | name_h, |
int | position = 0 , |
||
int | reg = WORLD |
||
) | const |
Definition at line 1113 of file ModelData.cpp.
Referenced by ModelCoreSpatial::cacheDynamicSettings(), ModelCore::cacheSettings(), Output::commonInit(), ModelCoreSpatial::runManagementModule(), ModelCore::runMarketModule(), ModelCoreSpatial::runMarketModule(), setDefaultSettings(), and setScenarioSettings().
vector< string > getStringVectorSetting | ( | const string & | name_h, |
int | reg = WORLD |
||
) | const |
Definition at line 1129 of file ModelData.cpp.
Referenced by applyDebugMode(), ModelCore::cacheSettings(), ModelCoreSpatial::cacheSettings(), cacheSettings(), Output::commonInit(), ModelRegion::getArea(), Pixel::getMultiplier(), Carbon::getStock(), Carbon::HWP_eol2energy(), Carbon::initialiseProductsStocks(), ModelRegion::ModelRegion(), and Output::printDebugPixelValues().
LLData getTable | ( | string | tableName_h, |
int | debugLevel = MSG_CRITICAL_ERROR |
||
) |
Definition at line 1801 of file ModelData.cpp.
Referenced by createRegions(), getScenarios(), setDefaultForData(), setDefaultPathogenRules(), setDefaultProdData(), setDefaultProductResourceMatrixLink(), setDefaultSettings(), setForestTypes(), setReclassificationRules(), setScenarioData(), setScenarioForData(), setScenarioPathogenRules(), setScenarioProdData(), setScenarioProductResourceMatrixLink(), and setScenarioSettings().
LLData getTableFromFile | ( | string | tablename, |
string | filename_h | ||
) |
Load and return a data table from a file (instead that from a spreadsheet sheet)
Definition at line 1731 of file ModelData.cpp.
Referenced by loadInput(), and setScenarioSettings().
|
inline |
Definition at line 145 of file ModelData.h.
Referenced by ModelCoreSpatial::runManagementModule().
double getTimedData | ( | const vector< double > & | dated_vector, |
const int & | year_h | ||
) | const |
Return the value for the specified year in a timelly ordered vector, taking the last value if this is smaller than the required position.
Definition at line 1480 of file ModelData.cpp.
Referenced by dataMapGetValue().
|
inline |
Definition at line 147 of file ModelData.h.
|
private |
Definition at line 1073 of file ModelData.cpp.
Referenced by getBoolVectorSetting(), getDoubleVectorSetting(), getIntVectorSetting(), and getStringVectorSetting().
void loadInput | ( | ) |
Unzip the OpenOffice input file (NEW 2008.05.13)
Definition at line 1527 of file ModelData.cpp.
Referenced by MainProgram::MainProgram(), and LLData::nheaders().
|
inline |
Definition at line 173 of file ModelData.h.
Referenced by applyOverrides(), getForData(), setDefaultForData(), setForData(), and setScenarioForData().
|
inline |
Definition at line 172 of file ModelData.h.
Referenced by applyOverrides(), getProdData(), setDefaultProdData(), setProdData(), and setScenarioProdData().
string regId2RegSName | ( | const int & | regId_h | ) | const |
Definition at line 408 of file ModelData.cpp.
Referenced by Output::printCarbonBalance(), Output::printDebugOutput(), Output::printDetailedHV(), Output::printForestData(), and Output::printProductData().
bool regionExist | ( | const int & | regId_h | ) | const |
Definition at line 356 of file ModelData.cpp.
Referenced by applyOverrides().
int regSName2RegId | ( | const string & | regSName_h | ) | const |
Definition at line 414 of file ModelData.cpp.
|
inline |
Definition at line 183 of file ModelData.h.
Referenced by MainProgram::MainProgram().
void setDefaultForData | ( | ) |
Definition at line 481 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setDefaultPathogenRules | ( | ) |
Definition at line 678 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setDefaultProdData | ( | ) |
Definition at line 531 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setDefaultProductResourceMatrixLink | ( | ) |
Definition at line 618 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setDefaultSettings | ( | ) |
Definition at line 194 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
|
inline |
Definition at line 143 of file ModelData.h.
Referenced by ModelCore::computeCumulativeData(), ModelCoreSpatial::computeCumulativeData(), Output::print(), Output::printFinalOutput(), and ModelCoreSpatial::runManagementModule().
void setForData | ( | const double & | value_h, |
const string & | type_h, | ||
const int & | regId_h, | ||
const string & | forType_h, | ||
const string & | freeDim_h, | ||
const int & | year = DATA_NOW , |
||
const bool & | allowCreate = false |
||
) |
Definition at line 1412 of file ModelData.cpp.
Referenced by ModelCore::sfd(), and ModelCoreSpatial::sfd().
void setForestTypes | ( | ) |
Definition at line 648 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setOutputDirectory | ( | const char * | output_dirname_h | ) |
Definition at line 990 of file ModelData.cpp.
Referenced by setDefaultSettings(), and setScenarioSettings().
void setProdData | ( | const double & | value_h, |
const string & | type_h, | ||
const int & | regId_h, | ||
const string & | prodId_h, | ||
const int & | year = DATA_NOW , |
||
const bool & | allowCreate = false , |
||
const string & | freeDim_h = "" |
||
) |
Basic function to set products-related data. It can change an existing value or extend in time a serie, but it requires the keys (par. name/regId/prodId/freedim) to be already present in the data. New value to change with/add It addmits the following "filters": Name of the specific parameter requested Set a specific level 2 region, or all its childred l2 region if a reg1 level is specified. Product. It accept three keywords, for changing/inserting the new value to all products, primary products or secondary products, namelly PROD_ALL, PROD_PRI, PROD_SEC. Unless specified, set the value of the current year. If array is smaller (e.g. because it is time-independent) fill all the values till the requested one. If true, allow creation of new data if not found. Default false (rise an error) If specified, look exactly for it, otherwise simply doesn't filter for it.
Definition at line 1352 of file ModelData.cpp.
Referenced by ModelCore::spd(), and ModelCoreSpatial::spd().
void setReclassificationRules | ( | ) |
Definition at line 663 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setScenarioData | ( | ) |
Set the infos about this scenario (long description and overriding tables)
Definition at line 170 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setScenarioForData | ( | ) |
Definition at line 500 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setScenarioPathogenRules | ( | ) |
Definition at line 706 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setScenarioProdData | ( | ) |
Definition at line 561 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setScenarioProductResourceMatrixLink | ( | ) |
Definition at line 632 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setScenarioSettings | ( | ) |
Definition at line 224 of file ModelData.cpp.
Referenced by Init::setInitLevel1().
void setSpace | ( | ) |
|
inline |
Definition at line 146 of file ModelData.h.
Referenced by ModelCoreSpatial::runManagementModule().
void setTimedData | ( | const double & | value_h, |
vector< double > & | dated_vector, | ||
const int & | year_h, | ||
const int & | MSG_LEVEL = MSG_WARNING |
||
) |
Definition at line 1501 of file ModelData.cpp.
Referenced by dataMapSetValue(), setForData(), and setProdData().
|
inline |
Definition at line 148 of file ModelData.h.
void unpackKeyForData | ( | const string & | key, |
string & | parName, | ||
int & | regId, | ||
string & | forType, | ||
string & | diamClass | ||
) | const |
Definition at line 1922 of file ModelData.cpp.
Referenced by applyOverrides().
void unpackKeyProdData | ( | const string & | key, |
string & | parName, | ||
int & | regId, | ||
string & | prod, | ||
string & | freeDim | ||
) | const |
Definition at line 1903 of file ModelData.cpp.
Referenced by applyOverrides().
|
friend |
|
friend |
|
private |
Definition at line 237 of file ModelData.h.
Referenced by cacheSettings(), getProdData(), and setProdData().
|
private |
Definition at line 215 of file ModelData.h.
Referenced by getFilenameByType(), and setOutputDirectory().
|
private |
Definition at line 234 of file ModelData.h.
Referenced by cacheSettings(), getTimedData(), and setTimedData().
|
private |
Map that register the death of biomass still usable as timber by year, l2_region, forest type and diameter class [Mm^3 wood].
Definition at line 230 of file ModelData.h.
Referenced by getAvailableDeathTimber().
|
private |
Diameter classes.
Definition at line 233 of file ModelData.h.
Referenced by cacheSettings(), getAvailableAliveTimber(), getAvailableDeathTimber(), getDiameterClasses(), getForData(), and setForData().
|
private |
Definition at line 244 of file ModelData.h.
Referenced by dataMapSetValue(), getForData(), getProdData(), and ModelData().
|
private |
Forestry data.
Definition at line 217 of file ModelData.h.
Referenced by applyOverrides(), getForData(), setDefaultForData(), setForData(), and setScenarioForData().
|
private |
Vector of coefficients from forest resources to primary products.
Definition at line 219 of file ModelData.h.
Referenced by assessProdPossibility(), getMaxYearUsableDeathTimber(), setDefaultProductResourceMatrixLink(), and setScenarioProductResourceMatrixLink().
|
private |
Vector of forest types.
Definition at line 226 of file ModelData.h.
Referenced by getForType(), getForTypeChilds(), getForTypeIds(), getForTypeParentId(), getForTypeParents(), getNForTypesChilds(), and setForestTypes().
|
private |
List of all input files. Simple (struct)
Definition at line 221 of file ModelData.h.
Referenced by getFilenameByType().
|
private |
Definition at line 213 of file ModelData.h.
|
private |
Region2 ids.
Definition at line 229 of file ModelData.h.
|
private |
Vector of Low Level Data.
Definition at line 223 of file ModelData.h.
Referenced by getTable(), and loadInput().
|
private |
For each agricultural soil type (as defined in the setting "agrLandTypes") this list define the objects that can be placed on that soil type.
the main input document, loaded in memory at unzipping stage
Definition at line 243 of file ModelData.h.
Referenced by loadInput().
|
private |
Definition at line 214 of file ModelData.h.
Referenced by setOutputDirectory().
|
private |
Vector of pathogen rules.
Definition at line 228 of file ModelData.h.
Referenced by getPathMortalityRule(), setDefaultPathogenRules(), and setScenarioPathogenRules().
|
private |
Definition at line 235 of file ModelData.h.
Referenced by cacheSettings(), getAllocableProductIdsFromDeathTimber(), getProdData(), and setProdData().
|
private |
Product data.
Definition at line 218 of file ModelData.h.
Referenced by applyOverrides(), getProdData(), setDefaultProdData(), setProdData(), and setScenarioProdData().
|
private |
Setting data. Simple (struct)
Definition at line 222 of file ModelData.h.
Referenced by addSetting(), applyDebugMode(), getBaseData(), getVectorBaseData(), setDefaultSettings(), and setScenarioSettings().
|
private |
Vector of reclassification rules.
Definition at line 227 of file ModelData.h.
Referenced by applyOverrides(), and setReclassificationRules().
|
private |
Vector of modelled regions.
Definition at line 224 of file ModelData.h.
Referenced by applyDebugMode(), createRegions(), getAllRegions(), getRegion(), getRegionIds(), and regionExist().
scenarioData scenario |
Definition at line 202 of file ModelData.h.
Referenced by setScenarioData(), setScenarioForData(), setScenarioPathogenRules(), setScenarioProdData(), setScenarioProductResourceMatrixLink(), and setScenarioSettings().
|
private |
Definition at line 236 of file ModelData.h.
Referenced by cacheSettings(), getProdData(), and setProdData().
|
private |
a temporary bool variable used for various functions
Definition at line 239 of file ModelData.h.
Referenced by dataMapGetValue(), getForData(), getProdData(), and ModelData().
|
private |
a bool used in getForData() and getProdData() to communicate they didn't found a variable
Definition at line 240 of file ModelData.h.
Referenced by getForData(), getProdData(), and ModelData().