Simpact Cyan
Population based event driven simulation using mNRM
|
This class allows you to pick random ages according to the data loaded from a CSV file. More...
#include <populationdistributioncsv.h>
Public Member Functions | |
PopulationDistributionCSV (GslRandomNumberGenerator *pRndGen) | |
Constructor of the class, which needs the random number generator to use. More... | |
bool | load (const std::string &csvFile) |
Load the age distribution from the specified file. More... | |
void | clear () |
Clears the previously loaded data. More... | |
double | pickAge (bool male) const |
This function generates the random age, for either a man or a woman. More... | |
Public Member Functions inherited from PopulationDistribution | |
PopulationDistribution (GslRandomNumberGenerator *pRndGen) | |
Constructor of the class, in which you need to specify a random number generator which can then be used internally. More... | |
Public Member Functions inherited from errut::ErrorBase | |
ErrorBase () | |
Creates an instance without an explicit object name. More... | |
ErrorBase (const std::string &objName) | |
Creates an instance with the object name set to objName . More... | |
std::string | getObjectName () const |
Returns the stored object name. More... | |
std::string | getErrorString () const |
Returns the currently stored error message. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from PopulationDistribution | |
GslRandomNumberGenerator * | getRandomNumberGenerator () |
This function can be used to obtain the random number generator specified in the constructor. More... | |
Protected Member Functions inherited from errut::ErrorBase | |
void | setErrorString (const std::string &str) const |
Derived classes can use this member function to store an error message. More... | |
This class allows you to pick random ages according to the data loaded from a CSV file.
PopulationDistributionCSV::PopulationDistributionCSV | ( | GslRandomNumberGenerator * | pRndGen | ) |
Constructor of the class, which needs the random number generator to use.
void PopulationDistributionCSV::clear | ( | ) |
Clears the previously loaded data.
bool PopulationDistributionCSV::load | ( | const std::string & | csvFile | ) |
Load the age distribution from the specified file.
The file should look something like this:
"Start of age bin", "Number of men in bin", "Number of women in bin" ..., ..., ...
|
virtual |
This function generates the random age, for either a man or a woman.
Implements PopulationDistribution.