43typedef map<string, vector <double> >
DataMap;
44typedef pair<string, vector <double> >
DataPair;
93 bool delDir(QString dirname);
114 int getFilenamesByDir (
const string & dir, vector<string> &files,
const string &filter =
"");
121 vector <ModelRegion*>
getAllRegions(
bool excludeResidual=
true);
122 vector<int>
getRegionIds(
int level_h,
bool excludeResidual=
true);
123 vector < vector <int> >
getRegionIds(
bool excludeResidual=
true);
140 const bool assessProdPossibility(
const string &prod_h,
const string &forType_h,
const string &dClass_h);
152 double getTimedData(
const vector <double> &dated_vector,
const int& year_h)
const;
153 void setTimedData(
const double& value_h, vector<double> &dated_vector,
const int& year_h,
const int& MSG_LEVEL=
MSG_WARNING);
165 const double getProdData(
const string &type_h,
const int& regId_h,
const string &prodId_h,
const int &year=
DATA_NOW,
const string &freeDim_h=
"");
166 const double getForData(
const string &type_h,
const int& regId_h,
const string &forType_h,
const string &freeDim_h,
const int& year=
DATA_NOW);
169 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=
"");
170 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);
172 string makeKeyProdData(
const string& parName,
const string& regId,
const string& prod,
const string& freeDim=
"")
const {
return parName+
"#"+regId+
"#"+prod+
"#"+freeDim+
"#";}
173 string makeKeyForData(
const string& parName,
const string& regId,
const string&
forType,
const string& diamClass)
const {
return parName+
"#"+regId+
"#"+
forType+
"#"+diamClass+
"#";}
174 void unpackKeyProdData(
const string& key,
string& parName,
int ®Id,
string& prod,
string& freeDim)
const;
175 void unpackKeyForData(
const string& key,
string& parName,
int ®Id,
string&
forType,
string& diamClass)
const;
184 void addSetting(
string name_h, vector <string> values_h,
int type_h,
string comment_h);
185 void addSetting(
string name_h,
string value_h,
int type_h,
string comment_h);
205 string getBaseData (
const string &name_h,
int type_h,
int position=0,
int regId_h=
WORLD);
210 double dataMapGetValue(
const DataMap& map,
const string& search_for,
const int& year_h,
const bool& exactMatch=
true);
211 int dataMapSetValue(
DataMap& map,
const string& search_for,
const double& value_h,
const int& year_h,
const bool& exactMatch=
true);
229 vector < vector <int> >
l2r;
This file is the header of BaseClass and it is included by ALL compiled code.
@ WORLD
Request something that is not region-specific.
@ DATA_NOW
The required data is for the current year.
@ MSG_CRITICAL_ERROR
Print an error message and stop the model.
@ MSG_WARNING
Print a WARNING message.
map< string, vector< double > > DataMap
pair< string, vector< double > > DataPair
Base class for the regmas application.
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.
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.
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.
Low level data. XML input is reversed here after unzipping oocalc file and parsing content....
string getData(const int &pos_h, const string &header_h, const int &debugLevel=MSG_CRITICAL_ERROR) const
vector< vector< string > > records
Define layer objects at the regional level.
Regional data, including macros and settings.
bool regionExist(const int ®Id_h) const
vector< string > getForTypeParents()
forType * getForType(int position)
vector< pathRule > pathRules
Vector of pathogen rules.
string getOutputDirectory() const
Return a vector of objects that together provide the specified resource in the specified quantity.
vector< string > allProducts
vector< int > getIntVectorSetting(const string &name_h, int reg=WORLD) const
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...
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.
void cacheSettings()
Called after input reading, it fix frequently used data;.
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="")
int getForTypeCounter(string &forTypeId_h, bool all=false)
By default it doesn't return forTypes used only as input.
double dataMapGetValue(const DataMap &map, const string &search_for, const int &year_h, const bool &exactMatch=true)
void setTimedData(const double &value_h, vector< double > &dated_vector, const int &year_h, const int &MSG_LEVEL=MSG_WARNING)
vector< string > getScenarios()
void setValueFoundBool(bool valueFoundBool_h)
vector< IFiles > iFilesVector
List of all input files. Simple (struct)
void setScenarioData()
Set the infos about this scenario (long description and overriding tables)
bool getBoolSetting(const string &name_h, int position=0, int reg=WORLD) const
vector< ModelRegion > regionsVector
Vector of modelled regions.
vector< bool > getBoolVectorSetting(const string &name_h, int reg=WORLD) 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...
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
vector< vector< int > > l2r
Region2 ids.
void setDefaultSettings()
void setScenarioProdData()
void applyDebugMode()
Works only a specified subset of regions and products.
string getBaseDirectory() const
vector< forType > forTypes
Vector of forest types.
void setDefaultPathogenRules()
map< iisskey, double > deathTimberInventory
Map that register the death of biomass still usable as timber by year, l2_region, forest type and dia...
double getDoubleSetting(const string &name_h, int position=0, int reg=WORLD) const
void setScenarioPathogenRules()
vector< string > getForTypeIds(bool all=false)
By default it doesn't return forTypes used only as input.
vector< vector< int > > createCombinationsVector(const int &nItems)
Return a vector containing any possible combination of nItems items (including any possible subset)....
string getBaseData(const string &name_h, int type_h, int position=0, int regId_h=WORLD)
InputNode mainDocument
For each agricultural soil type (as defined in the setting "agrLandTypes") this list define the objec...
vector< int > getForTypeChilds_pos(const string &forTypeId_h, bool all=false)
void setDefaultProdData()
string getForTypeParentId(const string &forTypeId_h)
vector< string > getStringVectorSetting(const string &name_h, int reg=WORLD) const
bool delDir(QString dirname)
Recursivelly delete a directory.
vector< double > getDoubleVectorSetting(const string &name_h, int reg=WORLD) const
vector< string > getForTypeChilds(const string &forTypeId_h)
double deathTimberInventory_get(const iisskey &thekey)
vector< string > priProducts
void setScenarioProductResourceMatrixLink()
void deathTimberInventory_incr(const iisskey &thekey, double value_h)
void setReclassificationRules()
const int getMaxYearUsableDeathTimber()
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 setScenarioSettings()
vector< LLData > LLDataVector
Vector of Low Level Data.
LLData getTableFromFile(string tablename, string filename_h)
Load and return a data table from a file (instead that from a spreadsheet sheet)
void setOutputDirectory(const char *output_dirname_h)
vector< IFiles > getIFilesVector() const
vector< int > getRegionIds(int level_h, bool excludeResidual=true)
ModelRegion * getRegion(int regId_h)
int getNForTypesChilds(const string &forTypeId_h)
vector< ModelRegion * > getAllRegions(bool excludeResidual=true)
void unpackKeyForData(const string &key, string &parName, int ®Id, string &forType, string &diamClass) const
string getFilenameByType(string type_h)
void setErrorLevel(int errorLevel_h)
bool tempBool
a temporary bool variable used for various functions
int getIntSetting(const string &name_h, int position=0, int reg=WORLD) const
vector< string > getDiameterClasses(bool productionOnly=false)
void setTempBool(bool tempBool_h)
void setDefaultProductResourceMatrixLink()
void applyOverrides()
Cancel all reg1 level data and trasform them in reg2 level if not already existing.
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)
vector< string > secProducts
void unpackKeyProdData(const string &key, string &parName, int ®Id, string &prod, string &freeDim) const
void addSetting(string name_h, vector< string > values_h, int type_h, string comment_h)
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...
string getStringSetting(const string &name_h, int position=0, int reg=WORLD) const
reclRule * getReclRule(int position)
bool valueFoundBool
a bool used in getForData() and getProdData() to communicate they didn't found a variable
string regId2RegSName(const int ®Id_h) const
int getCachedInitialYear()
int regSName2RegId(const string ®SName_h) const
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 ...
void loadInput()
Unzip the OpenOffice input file (NEW 2008.05.13)
vector< reclRule > reclRules
Vector of reclassification rules.
vector< string > getVectorBaseData(const string &name_h, int type_h, int regId_h=WORLD)
map< string, vector< double > > prodDataMap
Product data.
const double getProdData(const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const string &freeDim_h="")
map< string, vector< double > > forDataMap
Forestry data.
void setBaseDiretory(string baseDirectory_h)
void deathTimberInventory_incrOrAdd(const iisskey &thekey, double value_h)
LLData getTable(string tableName_h, int debugLevel=MSG_CRITICAL_ERROR)
bool dataMapCheckExist(const DataMap &map, const string &search_for, const bool &exactMatch=true) const
int getFilenamesByDir(const string &dir, vector< string > &files, const string &filter="")
Return a list of files in a directory.
void setScenarioForData()
map< iisskey, double > * getDeathTimberInventory()
double calculateAnnualisedEquivalent(const double &amount_h, const int &years_h, const double &ir) const
Calculate the annual equivalent flow.
int dataMapSetValue(DataMap &map, const string &search_for, const double &value_h, const int &year_h, const bool &exactMatch=true)
vector< string > diamClasses
Diameter classes.
vector< forToProd > forToProdVector
Vector of coefficients from forest resources to primary products.
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 deathTimberInventor...
vector< BasicData > programSettingsVector
Setting data. Simple (struct)
void printForestData(bool finalFlush)
void printProductData(bool finalFlush)
Thread manager. Responsable to manage the main thread and "speak" with the GUI.
Class to provide a simple integer-integer-string-string key in std maps.
Basic data units (struct)
vector< string > values
Values are stored as "string" because we don't yet know at this point if they are string,...
IO production matrix between the forest resources and the primary products (struct)
int maxYears
The maximum year for a tree collapse that this product can be harvested from. E.g....
Pathogen rule (how pathogen presense influence mortality) for a given forest type and diameter class ...
vector< double > mortCoefficents
Mortality coefficients ordered by number of presence of the pathogen, e.g. first value is the mortali...
double pres_min
Minimum level of presence of the pathogen to be counted as present (tolerance threshold)
string pathId
Pathogen id (name)
IO production matrix between the forest resources and the primary products (struct)