#include <RegData.h>
Inheritance diagram for RegData:
Public Member Functions | |
RegData (ThreadManager *MTHREAD_h) | |
~RegData () | |
void | loadInput () |
Unzip the OpenOffice input file (NEW 2008.05.13). | |
vector< string > | getScenarios () |
int | getScenarioIndex () |
bool | delDir (QString dirname) |
Recursivelly delete a directory. | |
void | setDefaultSettings () |
void | setScenarioSettings () |
void | setResources () |
void | setDefaultActivities () |
void | setScenarioActivities () |
void | setObjectsDefinitions () |
void | initializeResourcesObjectsMatch () |
Cache the vectors of object names and object values that are associated to each resource. | |
void | setSpace () |
void | initializeSpacialObjectsMatch () |
Create the vector availableObjectsBySoilType so it is faster to assign spacial objects to farmers basing on their land types. | |
void | debug () |
vector< ModelObject > | getBestMatchingInitialObjects (string resourceName_h, double resourceQ_h) |
Return a vector of objects that together provide the specified resource in the specified quantity. | |
string | getOutputDirectory () const |
string | getFilenameByType (string type_h) |
LLData | getTable (string tableName_h, int debugLevel=MSG_CRITICAL_ERROR) |
vector< IFiles > | getIFilesVector () const |
string | getBaseDirectory () const |
int | getActivitiesDefinitionVectorSize () const |
vector< string > | getResourceNames (int type_h=-1) const |
get resources, all (default) or by type; | |
int | getResourceSize (int type_h=-1) const |
get number of defined resources, all (default) or by type; | |
vector< string > | getObjectNames () const |
vector< string > | getActivityNames () const |
int | getActGisCodeByName (string actName_h) const |
int | getIntSetting (const string &name_h, int position=0) |
double | getDoubleSetting (const string &name_h, int position=0) |
string | getStringSetting (const string &name_h, int position=0) |
bool | getBoolSetting (const string &name_h, int position=0) |
vector< int > | getIntVectorSetting (const string &name_h) |
vector< double > | getDoubleVectorSetting (const string &name_h) |
vector< string > | getStringVectorSetting (const string &name_h) |
vector< bool > | getBoolVectorSetting (const string &name_h) |
RegResources | getResourceByName (string name_h) |
ModelObject | getObjectByName (string name_h) |
vector< RegActivities * > | getRegActivities () |
RegActivities * | getRegActivityByName (string name_h) |
vector< ModelObject * > | getObjectsDefinitionVector () |
vector< ModelObject > | getModelObjectsBySoilType (int soilType_h) |
Retrieve the list of objects type that can be placed on the specified soil type. | |
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 | setBasicData (const string &name_h, int value, int position=0) |
void | setBasicData (const string &name_h, double value, int position=0) |
void | setBasicData (const string &name_h, string value, int position=0) |
void | setBasicData (const string &name_h, bool value, int position=0) |
Private Member Functions | |
string | getBaseData (const string &name_h, int type_h, int position=0) |
vector< string > | getVectorBaseData (const string &name_h, int type_h) |
void | setBasicData (const string &name_h, string value, int type_h, int position) |
Private Attributes | |
string | inputFilename |
string | outputDirname |
string | baseDirectory |
vector< IFiles > | iFilesVector |
list of all input files. Simple (struct) | |
vector< BasicData > | programSettingsVector |
setting data. Simple (struct) | |
vector< RegResources > | resourcesDefinitionVector |
definition of available resources. Just the topology. (struct) | |
vector< RegActivities > | activitiesDefinitionVector |
available activities. Just the topology. | |
vector< ModelObject > | objectsDefinitionVector |
definition of available objects. Just the topology. (class) | |
vector< LLData > | LLDataVector |
vector of Low Level Data | |
vector< vector< string > > | resourcesJoinedObjects |
a vector for each resource with the list of the joined objects | |
vector< vector< double > > | resourcesProvidedQuantities |
vector< vector< ModelObject > > | availableObjectsBySoilType |
For each agricultural soil type (as defined in the setting "agrLandTypes") this list define the objects that can be placed on that soil type. | |
InputNode | mainDocument |
the main input document, loaded in memory at unzipping stage |
All regional data are within this class. It may have linked other data-classes.
On some variables RegData 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 59 of file RegData.h.
RegData | ( | ThreadManager * | MTHREAD_h | ) |
Definition at line 45 of file RegData.cpp.
~RegData | ( | ) |
Definition at line 49 of file RegData.cpp.
void loadInput | ( | ) |
Unzip the OpenOffice input file (NEW 2008.05.13).
Definition at line 883 of file RegData.cpp.
Referenced by MainProgram::MainProgram().
Here is the caller graph for this function:
vector< string > getScenarios | ( | ) |
Definition at line 54 of file RegData.cpp.
Referenced by getScenarioIndex(), ThreadManager::run(), and ThreadManager::runFromConsole().
Here is the caller graph for this function:
int getScenarioIndex | ( | ) |
Definition at line 65 of file RegData.cpp.
Referenced by Output::printDetailedData().
Here is the caller graph for this function:
bool delDir | ( | QString | dirname | ) |
Recursivelly delete a directory.
Definition at line 1024 of file RegData.cpp.
Referenced by loadInput().
Here is the caller graph for this function:
void setDefaultSettings | ( | ) |
Definition at line 79 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void setScenarioSettings | ( | ) |
Definition at line 146 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void setResources | ( | ) |
Definition at line 240 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void setDefaultActivities | ( | ) |
Definition at line 275 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void setScenarioActivities | ( | ) |
Definition at line 343 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void setObjectsDefinitions | ( | ) |
Definition at line 402 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void initializeResourcesObjectsMatch | ( | ) |
Cache the vectors of object names and object values that are associated to each resource.
Definition at line 784 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void setSpace | ( | ) |
void initializeSpacialObjectsMatch | ( | ) |
Create the vector availableObjectsBySoilType so it is faster to assign spacial objects to farmers basing on their land types.
Create the array availableObjectsBySoilType
Definition at line 827 of file RegData.cpp.
Referenced by Init::setInitLevel1().
Here is the caller graph for this function:
void debug | ( | ) |
Definition at line 857 of file RegData.cpp.
vector< ModelObject > getBestMatchingInitialObjects | ( | string | resourceName_h, | |
double | resourceQ_h | |||
) |
Return a vector of objects that together provide the specified resource in the specified quantity.
We have to ordered list of object and associated values providing the resource we want (from the caching function initializeResourcesObjectsMatch() ).
So we loop over them to see if the agent resource is higher than those provided by the object. If not, we assign the object, otherwise we try with the higher object.
If we don't perform any match because the agent resources are higher than those provided by any available object, we still assign the bigger object and then we calculate the remaining resources and we continue till there is no more remained resources.
resourceName_h | Name of the resource | |
resourceQ_h | Quantity of the resource to cover with the objects |
Definition at line 748 of file RegData.cpp.
Referenced by Manager_base::assignObjectsToAgents().
Here is the caller graph for this function:
string getOutputDirectory | ( | ) | const [inline] |
Definition at line 85 of file RegData.h.
Referenced by Opt::debug(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::initOutputLeavingAgents(), Output::initOutputMaps(), Layers::print(), Output::printAggregatedData(), Layers::printBinMap(), Output::printDetailedData(), and Output::printLeavingAgent().
Here is the caller graph for this function:
std::string getFilenameByType | ( | string | type_h | ) |
Definition at line 630 of file RegData.cpp.
LLData getTable | ( | string | tableName_h, | |
int | debugLevel = MSG_CRITICAL_ERROR | |||
) |
Definition at line 1056 of file RegData.cpp.
Referenced by getScenarios(), Manager_farmers::setAgentMoulds(), setDefaultActivities(), setDefaultSettings(), setObjectsDefinitions(), setResources(), setScenarioActivities(), and setScenarioSettings().
Here is the caller graph for this function:
string getBaseDirectory | ( | ) | const [inline] |
Definition at line 89 of file RegData.h.
Referenced by Opt::debug(), Gis::initLayers(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::initOutputLeavingAgents(), Output::initOutputMaps(), Layers::print(), Output::printAggregatedData(), Layers::printBinMap(), Output::printDetailedData(), and Output::printLeavingAgent().
Here is the caller graph for this function:
int getActivitiesDefinitionVectorSize | ( | ) | const [inline] |
Definition at line 90 of file RegData.h.
Referenced by Manager_farmers::endInit().
Here is the caller graph for this function:
vector< string > getResourceNames | ( | int | type_h = -1 |
) | const |
get resources, all (default) or by type;
Definition at line 677 of file RegData.cpp.
Referenced by Agent_farmer::collectProductionEffects(), Manager_farmers::getAverageRightsByAct(), Agent_farmer::getDecoupledPayments(), RegActivities::getMatrixCoefficients(), ModelObject::getMatrixCoefficients(), setScenarioActivities(), and Opt::updateResourceNames().
Here is the caller graph for this function:
int getResourceSize | ( | int | type_h = -1 |
) | const |
get number of defined resources, all (default) or by type;
Definition at line 688 of file RegData.cpp.
Referenced by Agent_farmer::Agent_farmer(), Manager_farmers::endInit(), Manager_farmers::removeFromModel(), setDefaultActivities(), Opt::solveGlpk(), and Opt::updateResourceValues().
Here is the caller graph for this function:
vector< string > getObjectNames | ( | ) | const |
Definition at line 699 of file RegData.cpp.
Referenced by Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::printAggregatedData(), and Output::printDetailedData().
Here is the caller graph for this function:
vector< string > getActivityNames | ( | ) | const |
Definition at line 708 of file RegData.cpp.
Referenced by Output::getSurveyActivityByName(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::printAggregatedData(), and Output::printDetailedData().
Here is the caller graph for this function:
int getActGisCodeByName | ( | string | actName_h | ) | const |
Definition at line 717 of file RegData.cpp.
int getIntSetting | ( | const string & | name_h, | |
int | position = 0 | |||
) |
Definition at line 561 of file RegData.cpp.
Referenced by Output::collectData(), Gis::filterSubRegion(), Output::getOutputFieldDelimiter(), Scheduler::getYear(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::initOutputLeavingAgents(), Output::initOutputMaps(), Manager_farmers::landAllocation(), Manager_farmers::locateMyAgents(), Manager_farmers::prepare(), Layers::print(), Output::printAggregatedData(), Output::printDebugMatrices(), Output::printDetailedData(), Output::printLeavingAgent(), Output::printMaps(), Manager_farmers::quotePlot(), Scheduler::run(), setDefaultActivities(), setDefaultSettings(), Pixel::setRandomRenting(), setScenarioActivities(), setScenarioSettings(), and Gis::setSpace().
Here is the caller graph for this function:
double getDoubleSetting | ( | const string & | name_h, | |
int | position = 0 | |||
) |
Definition at line 565 of file RegData.cpp.
Referenced by Agent_farmer::applyModulation(), Agent_farmer::filterActivity(), Gis::getAgrDistCost(), Agent_farmer::getAgrDistCost(), Agent_base::getCalculatedResourceByName(), Layers::getCategory(), Layers::getColor(), Manager_farmers::landAllocation(), Agent_farmer::leaveActivity(), Agent_farmer::offerRentalPrice(), Output::printAggregatedData(), Gis::printDebugValues(), Output::printDetailedData(), Output::printLeavingAgent(), Manager_farmers::quotePlot(), setDefaultSettings(), Init::setInitLevel1(), setScenarioSettings(), Gis::setSpace(), and Agent_base::withdraw().
Here is the caller graph for this function:
string getStringSetting | ( | const string & | name_h, | |
int | position = 0 | |||
) |
Definition at line 569 of file RegData.cpp.
Referenced by Gis::initLayers(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::initOutputLeavingAgents(), Output::printAggregatedData(), Output::printDetailedData(), Output::printLeavingAgent(), setDefaultSettings(), and setScenarioSettings().
Here is the caller graph for this function:
bool getBoolSetting | ( | const string & | name_h, | |
int | position = 0 | |||
) |
Definition at line 573 of file RegData.cpp.
Referenced by Agent_base::Agent_base(), Agent_space::Agent_space(), Agent_farmer::applyModulation(), Manager_farmers::createBehaviours(), Gis::filterSubRegion(), Agent_farmer::getDecoupledPayments(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Manager_farmers::landAllocation(), Agent_farmer::leaveActivity(), Gis::loadLayersDataFromFile(), Manager_farmers::locateMyAgents(), Output::printAggregatedData(), Output::printDetailedData(), Manager_farmers::quotePlot(), setDefaultSettings(), Init::setInitLevel1(), setScenarioSettings(), Opt::solveGlpk(), Gis::sub2realID(), Manager_farmers::update(), and Agent_base::~Agent_base().
Here is the caller graph for this function:
vector< int > getIntVectorSetting | ( | const string & | name_h | ) |
Definition at line 577 of file RegData.cpp.
Referenced by Agent_base::answerStats(), Manager_farmers::calibrateLandValues(), getModelObjectsBySoilType(), Pixel::getStartingRentalCosts(), initializeSpacialObjectsMatch(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Gis::isAgrCode(), Pixel::isAgricultural(), Manager_farmers::landAllocation(), Agent_farmer::leaveActivity(), Manager_farmers::locateMyAgents(), Output::printAggregatedData(), and Output::printDetailedData().
Here is the caller graph for this function:
vector< double > getDoubleVectorSetting | ( | const string & | name_h | ) |
Definition at line 581 of file RegData.cpp.
Referenced by Manager_farmers::calibrateLandValues(), Pixel::getStartingRentalCosts(), Agent_farmer::leaveActivity(), and Output::printAggregatedData().
Here is the caller graph for this function:
vector< string > getStringVectorSetting | ( | const string & | name_h | ) |
Definition at line 585 of file RegData.cpp.
Referenced by Output::initOutputAggregatedData(), and Manager_farmers::landAllocation().
Here is the caller graph for this function:
vector< bool > getBoolVectorSetting | ( | const string & | name_h | ) |
Definition at line 589 of file RegData.cpp.
RegResources getResourceByName | ( | string | name_h | ) |
Definition at line 728 of file RegData.cpp.
Referenced by Agent_base::getResource().
Here is the caller graph for this function:
ModelObject getObjectByName | ( | string | name_h | ) |
Definition at line 812 of file RegData.cpp.
Referenced by Agent_farmer::collectProductionEffects().
Here is the caller graph for this function:
vector< RegActivities * > getRegActivities | ( | ) |
Definition at line 646 of file RegData.cpp.
Referenced by Opt::addPixel(), Agent_farmer::Agent_farmer(), Agent_base::answerStats(), Agent_farmer::collectProductionEffects(), Manager_farmers::getAverageRightsByAct(), Agent_farmer::getDecoupledPayments(), Output::getSurveyUnusedLand(), Gis::initLayers(), Manager_farmers::removeFromModel(), and Opt::updateActivities().
Here is the caller graph for this function:
RegActivities * getRegActivityByName | ( | string | name_h | ) |
Definition at line 655 of file RegData.cpp.
Referenced by Agent_farmer::collectProductionEffects().
Here is the caller graph for this function:
vector< ModelObject * > getObjectsDefinitionVector | ( | ) |
Definition at line 668 of file RegData.cpp.
Referenced by Opt::addPixel(), Agent_base::answerStats(), and Opt::updateActivities().
Here is the caller graph for this function:
vector< ModelObject > getModelObjectsBySoilType | ( | int | soilType_h | ) |
Retrieve the list of objects type that can be placed on the specified soil type.
Definition at line 845 of file RegData.cpp.
Referenced by Pixel::initObjects().
Here is the caller graph for this function:
void setOutputDirectory | ( | const char * | output_dirname_h | ) |
Definition at line 506 of file RegData.cpp.
Referenced by setDefaultSettings(), and setScenarioSettings().
Here is the caller graph for this function:
void setBaseDiretory | ( | string | baseDirectory_h | ) | [inline] |
Definition at line 117 of file RegData.h.
Referenced by MainProgram::MainProgram().
Here is the caller graph for this function:
void addSetting | ( | string | name_h, | |
vector< string > | values_h, | |||
int | type_h, | |||
string | comment_h | |||
) |
Definition at line 216 of file RegData.cpp.
Referenced by addSetting(), and setDefaultSettings().
Here is the caller graph for this function:
void addSetting | ( | string | name_h, | |
string | value_h, | |||
int | type_h, | |||
string | comment_h | |||
) |
Definition at line 233 of file RegData.cpp.
void setBasicData | ( | const string & | name_h, | |
int | value, | |||
int | position = 0 | |||
) |
Definition at line 596 of file RegData.cpp.
Referenced by Manager_farmers::landAllocation(), setBasicData(), and setScenarioSettings().
Here is the caller graph for this function:
void setBasicData | ( | const string & | name_h, | |
double | value, | |||
int | position = 0 | |||
) |
Definition at line 600 of file RegData.cpp.
void setBasicData | ( | const string & | name_h, | |
string | value, | |||
int | position = 0 | |||
) |
Definition at line 604 of file RegData.cpp.
void setBasicData | ( | const string & | name_h, | |
bool | value, | |||
int | position = 0 | |||
) |
Definition at line 608 of file RegData.cpp.
string getBaseData | ( | const string & | name_h, | |
int | type_h, | |||
int | position = 0 | |||
) | [private] |
Definition at line 518 of file RegData.cpp.
Referenced by getBoolSetting(), getDoubleSetting(), getIntSetting(), and getStringSetting().
Here is the caller graph for this function:
vector< string > getVectorBaseData | ( | const string & | name_h, | |
int | type_h | |||
) | [private] |
Definition at line 546 of file RegData.cpp.
Referenced by getBoolVectorSetting(), getDoubleVectorSetting(), getIntVectorSetting(), and getStringVectorSetting().
Here is the caller graph for this function:
void setBasicData | ( | const string & | name_h, | |
string | value, | |||
int | type_h, | |||
int | position | |||
) | [private] |
Definition at line 613 of file RegData.cpp.
string inputFilename [private] |
string outputDirname [private] |
Definition at line 132 of file RegData.h.
Referenced by getOutputDirectory(), and setOutputDirectory().
string baseDirectory [private] |
Definition at line 133 of file RegData.h.
Referenced by getBaseDirectory(), getFilenameByType(), setBaseDiretory(), and setOutputDirectory().
vector<IFiles> iFilesVector [private] |
list of all input files. Simple (struct)
Definition at line 136 of file RegData.h.
Referenced by getFilenameByType(), and getIFilesVector().
vector<BasicData> programSettingsVector [private] |
setting data. Simple (struct)
Definition at line 137 of file RegData.h.
Referenced by addSetting(), getBaseData(), getVectorBaseData(), setBasicData(), setDefaultSettings(), and setScenarioSettings().
vector<RegResources> resourcesDefinitionVector [private] |
definition of available resources. Just the topology. (struct)
Definition at line 138 of file RegData.h.
Referenced by getBestMatchingInitialObjects(), getResourceByName(), getResourceNames(), getResourceSize(), initializeResourcesObjectsMatch(), setDefaultActivities(), setObjectsDefinitions(), and setResources().
vector<RegActivities> activitiesDefinitionVector [private] |
available activities. Just the topology.
Definition at line 139 of file RegData.h.
Referenced by getActGisCodeByName(), getActivitiesDefinitionVectorSize(), getActivityNames(), getRegActivities(), getRegActivityByName(), setDefaultActivities(), setObjectsDefinitions(), and setScenarioActivities().
vector<ModelObject> objectsDefinitionVector [private] |
definition of available objects. Just the topology. (class)
Definition at line 140 of file RegData.h.
Referenced by getObjectByName(), getObjectNames(), getObjectsDefinitionVector(), initializeResourcesObjectsMatch(), initializeSpacialObjectsMatch(), and setObjectsDefinitions().
vector<LLData> LLDataVector [private] |
vector of Low Level Data
Definition at line 141 of file RegData.h.
Referenced by getTable(), and loadInput().
vector<vector <string> > resourcesJoinedObjects [private] |
a vector for each resource with the list of the joined objects
Definition at line 143 of file RegData.h.
Referenced by getBestMatchingInitialObjects(), and initializeResourcesObjectsMatch().
vector<vector <double> > resourcesProvidedQuantities [private] |
the corresponding vectors of provided quantities
Definition at line 144 of file RegData.h.
Referenced by getBestMatchingInitialObjects(), and initializeResourcesObjectsMatch().
vector<vector <ModelObject> > availableObjectsBySoilType [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.
Definition at line 146 of file RegData.h.
Referenced by getModelObjectsBySoilType(), and initializeSpacialObjectsMatch().
InputNode mainDocument [private] |
the main input document, loaded in memory at unzipping stage
Definition at line 147 of file RegData.h.
Referenced by loadInput().