Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
A class to handle simulation data saving in binary format. More...
#include <binarydatasaver.h>
Public Member Functions | |
BinaryDataSaver () | |
~BinaryDataSaver () | |
void | printData () |
virtual bool | setParameters () |
virtual void | execute () |
virtual BinaryDataSaver * | clone () |
virtual vector< string > | ifExist () |
virtual void | FHwrite () |
virtual void | FHread (string &filename) |
virtual void | loadFileServices (FileServices *loader) |
virtual void | loadStatServices (StatServices *loader) |
virtual bool | resetParameterFromSource (std::string param, SimComponent *cmpt) |
virtual age_t | removeAgeClass () |
virtual age_t | addAgeClass () |
virtual age_t | requiredAgeClass () |
![]() | |
LifeCycleEvent (const char *name, const char *trait_link) | |
Cstor. More... | |
virtual | ~LifeCycleEvent () |
virtual void | init (Metapop *popPtr) |
Sets the pointer to the current Metapop and the trait link if applicable. More... | |
virtual bool | attach_trait (string trait) |
virtual void | set_paramset (std::string name, bool required, SimComponent *owner) |
virtual void | set_event_name (std::string &name) |
Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set. More... | |
virtual void | set_event_name (const char *name) |
virtual string & | get_event_name () |
Accessor to the LCE's name. More... | |
virtual int | get_rank () |
Accessor to the LCE rank in the life cycle. More... | |
virtual void | set_pop_ptr (Metapop *popPtr) |
Accessors for the population pointer. More... | |
virtual Metapop * | get_pop_ptr () |
![]() | |
SimComponent () | |
virtual | ~SimComponent () |
virtual void | loadUpdaters (UpdaterServices *loader) |
Loads the parameters and component updater onto the updater manager. More... | |
virtual void | set_paramset (ParamSet *paramset) |
Sets the ParamSet member. More... | |
virtual void | set_paramsetFromCopy (const ParamSet &PSet) |
Reset the set of parameters from a another set. More... | |
virtual ParamSet * | get_paramset () |
ParamSet accessor. More... | |
virtual void | add_parameter (Param *param) |
Interface to add a parameter to the set. More... | |
virtual void | add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd) |
Interface to add a parameter to the set. More... | |
virtual void | add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater) |
Interface to add a parameter and its updater to the set. More... | |
virtual Param * | get_parameter (std::string name) |
Param getter. More... | |
virtual double | get_parameter_value (std::string name) |
Param value getter. More... | |
virtual string | get_name () |
Returnd the name of the ParamSet, i.e. More... | |
virtual bool | has_parameter (std::string name) |
Param getter. More... | |
![]() | |
FileHandler (const char *ext) | |
virtual | ~FileHandler () |
virtual void | init () |
Called by notifier during simulation setup, performs file checking. More... | |
virtual vector< string > | ifExist () |
Checks if any file associated with the current file name already exists on disk. More... | |
virtual void | set (bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path) |
Sets the hanlder parameters. More... | |
virtual void | set_multi (bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path) |
virtual void | FHwrite ()=0 |
Default behavior of the class, called by Handler::update(). More... | |
virtual void | FHread (string &filename)=0 |
Default input function. More... | |
virtual void | update () |
Updates the inner replicate and generation counters and calls FHwrite if needed by the the periodicity of the file. More... | |
Metapop * | get_pop_ptr () |
Returns the pointer to the current metapop through the FileServices interface. More... | |
void | set_pop_ptr (Metapop *pop_ptr) |
FileServices * | get_service () |
Returns pointer to the FileServices. More... | |
void | set_service (FileServices *srv) |
std::string & | get_path () |
void | set_path () |
std::string & | get_extension () |
void | set_extension (const char *ext) |
std::string & | get_filename () |
Builds and returns the current file name depending on the periodicity of the file. More... | |
bool | get_isInputHandler () |
void | set_isInputHandler (bool val) |
bool | get_isReplicatePeriodic () |
void | set_isReplicatePeriodic (bool val) |
unsigned int | get_ReplicateOccurrence () |
void | set_ReplicateOccurrence (unsigned int val) |
bool | get_isGenerationPeriodic () |
void | set_isGenerationPeriodic (bool val) |
unsigned int | get_GenerationOccurrence () |
void | set_GenerationOccurrence (unsigned int val) |
unsigned int | get_ExecRank () |
unused yet... More... | |
void | set_ExecRank (int val) |
TMatrix * | get_OccMatrix () |
void | set_OccMatrix (TMatrix *occ) |
bool | get_isMasterExec () |
void | set_isMasterExec (bool is) |
![]() | |
virtual void | init ()=0 |
Inits state. More... | |
virtual void | update ()=0 |
Updates the handler state. More... | |
virtual | ~Handler () |
Static Public Attributes | |
static pid_t | PID = 0 |
Private Member Functions | |
void | setFileDescriptor () |
int | getFileDescriptor () |
void | printHeader () |
void | storeData () |
void | printOffsetTable () |
void | finish () |
Private Attributes | |
BinaryStorageBuffer | _buff |
std::string | _comp_cmd |
std::string | _comp_ext |
std::string | _uncomp_cmd |
std::string | _tar_cmd |
std::string | _tar_ext |
std::string | _dir |
bool | _isPeriodic |
unsigned int | _generation |
off_t | _offsetDataStart |
vector< unsigned int > | _occurrences |
vector< unsignedint >::const_iterator | _current_occurrence |
int | _fdesc |
Additional Inherited Members | |
![]() | |
std::string | _event_name |
The param name to be read in the init file. More... | |
Metapop * | _popPtr |
The ptr to the current Metapop. More... | |
std::string | _LCELinkedTraitType |
The name of the linked trait. More... | |
int | _LCELinkedTraitIndex |
The index in the individual's trait table of the linked trait. More... | |
![]() | |
ParamSet * | _paramSet |
The parameters container. More... | |
![]() | |
Metapop * | _pop |
Pointer to the current metapop, set during initialization within the init function. More... | |
A class to handle simulation data saving in binary format.
It is both an LCE and a FileHandler but the writing is executed through the LCE interface (i.e. LifeCycleEvent::execute()). Its inheritance from the FileHandler class is used to access the basic file services (i.e. basename and current replicate filename, etc.).
BinaryDataSaver::BinaryDataSaver | ( | ) |
References SimComponent::add_parameter(), BOOL, INT, setParameters(), and STR.
Referenced by clone().
|
inline |
|
inlinevirtual |
Implements LifeCycleEvent.
|
inlinevirtual |
|
virtual |
Implements LifeCycleEvent.
References _buff, _current_occurrence, _occurrences, LifeCycleEvent::_popPtr, finish(), Metapop::getCurrentGeneration(), printHeader(), printOffsetTable(), BinaryStorageBuffer::set_buff(), and storeData().
|
inlinevirtual |
Implements FileHandler.
|
virtual |
Implements FileHandler.
References _buff, finish(), LifeCycleEvent::get_rank(), BinaryStorageBuffer::getBuffLength(), SIMenv::getCurrentRankInLifeCycle(), printHeader(), and printOffsetTable().
|
private |
References _comp_cmd, _comp_ext, _myenv, LifeCycleEvent::_popPtr, _tar_cmd, _tar_ext, error(), FileHandler::get_filename(), FileHandler::get_path(), FileHandler::get_service(), FileServices::getBaseFileName(), Metapop::getCurrentReplicate(), FileServices::getMode(), MPIenv::isMaster(), and MPIenv::workerRank().
Referenced by execute(), and FHwrite().
|
virtual |
Reimplemented from FileHandler.
References _comp_cmd, _comp_ext, _isPeriodic, FileHandler::_pop, _tar_cmd, _tar_ext, FileHandler::get_extension(), FileHandler::get_GenerationOccurrence(), FileHandler::get_path(), FileHandler::get_ReplicateOccurrence(), FileHandler::get_service(), FileServices::getBaseFileName(), Metapop::getGenerations(), Metapop::getReplicates(), and ifExist().
Referenced by ifExist().
|
inlinevirtual |
Implements SimComponent.
References FileServices::attach().
|
inlinevirtual |
Implements SimComponent.
void BinaryDataSaver::printData | ( | ) |
References _buff, _fdesc, BinaryStorageBuffer::emptyBuffer(), fatal(), BinaryStorageBuffer::getBuffer(), and BinaryStorageBuffer::getBuffLength().
Referenced by BinaryStorageBuffer::store().
|
private |
References fatal(), FileHandler::get_filename(), FileServices::get_params(), FileHandler::get_service(), MAIN_VERSION, message(), MINOR_VERSION, RELEASE, REVISION, and VERSION_DATE.
Referenced by execute(), and FHwrite().
|
private |
References _buff, _fdesc, _offsetDataStart, LifeCycleEvent::_popPtr, BinaryStorageBuffer::clear(), error(), fatal(), BinaryStorageBuffer::getBuffer(), BinaryStorageBuffer::getBuffLength(), Metapop::getCurrentGeneration(), message(), and BinaryStorageBuffer::store().
Referenced by execute(), and FHwrite().
|
inlinevirtual |
Implements LifeCycleEvent.
|
inlinevirtual |
Implements LifeCycleEvent.
|
inlinevirtual |
Implements SimComponent.
|
private |
References _fdesc, fatal(), and FileHandler::get_filename().
Referenced by storeData().
|
virtual |
Implements SimComponent.
References _comp_cmd, _comp_ext, _current_occurrence, _dir, _generation, _isPeriodic, _occurrences, _offsetDataStart, LifeCycleEvent::_popPtr, _tar_cmd, _tar_ext, _uncomp_cmd, SimComponent::get_parameter(), SimComponent::get_parameter_value(), LifeCycleEvent::get_rank(), Param::getArg(), Metapop::getGenerations(), Param::isSet(), and FileHandler::set().
Referenced by BinaryDataSaver().
|
private |
References _buff, _fdesc, _offsetDataStart, LifeCycleEvent::_popPtr, BinaryStorageBuffer::getBuffLength(), Metapop::getCurrentGeneration(), message(), setFileDescriptor(), BinaryStorageBuffer::store(), and Metapop::store_data().
Referenced by execute().
|
private |
Referenced by execute(), FHwrite(), printData(), printOffsetTable(), and storeData().
|
private |
Referenced by finish(), ifExist(), and setParameters().
|
private |
Referenced by finish(), ifExist(), and setParameters().
|
private |
Referenced by execute(), and setParameters().
|
private |
Referenced by setParameters().
|
private |
Referenced by getFileDescriptor(), printData(), printOffsetTable(), setFileDescriptor(), and storeData().
|
private |
Referenced by setParameters().
|
private |
Referenced by ifExist(), and setParameters().
|
private |
Referenced by execute(), and setParameters().
|
private |
Referenced by printOffsetTable(), setParameters(), and storeData().
|
private |
Referenced by finish(), ifExist(), and setParameters().
|
private |
Referenced by finish(), ifExist(), and setParameters().
|
private |
Referenced by setParameters().
|
static |