126 virtual void init ( );
130 virtual vector< string >
ifExist( );
196 virtual void set (
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path) {
200 virtual void set_multi (
bool rpl_per,
bool gen_per,
int rpl_occ,
TMatrix* Occ,
string path) {
208 virtual void FHread (
string& filename) = 0;
230 virtual void FHread (
string& filename) = 0;
232 virtual void set (
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path, TP* trait_proto);
233 virtual void set_multi (
bool rpl_per,
bool gen_per,
int rpl_occ,
TMatrix* Occ,
string path, TP* trait_proto);
237 FileHandler(ext), _FHLinkedTrait(trait_proto), _FHLinkedTraitIndex(trait_proto->get_index())
240 template <
class TP>
void TraitFileHandler<TP>::set(
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path, TP* trait_proto)
243 _FHLinkedTrait = trait_proto;
244 _FHLinkedTraitIndex = trait_proto->get_index();
250 _FHLinkedTrait = trait_proto;
251 _FHLinkedTraitIndex = trait_proto->get_index();
266 virtual void FHread (
string& filename) = 0;
268 virtual void set (
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path, LCE* event);
275 template <
class LCE>
void EventFileHandler<LCE>::set(
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path, LCE* event)
278 _FHLinkedEvent = event;
288 virtual void FHread (
string& filename) {}
Template class for the LCEs StatHandler classes.
Definition: filehandler.h:257
LCE * _FHLinkedEvent
Definition: filehandler.h:259
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, LCE *event)
Definition: filehandler.h:275
EventFileHandler(LCE *event, const char *ext)
Definition: filehandler.h:271
virtual ~EventFileHandler()
Definition: filehandler.h:262
virtual void FHread(string &filename)=0
File Handler used to save the simulation parameters to a log file.
Definition: filehandler.h:282
void save_simparams(list< ParamSet * > ¶ms)
Definition: filehandler.cc:200
virtual void FHread(string &filename)
Definition: filehandler.h:288
virtual void FHwrite()
Definition: filehandler.h:287
void log_message(string &logstr)
Definition: filehandler.cc:265
FHLogWriter()
Definition: filehandler.h:284
virtual ~FHLogWriter()
Definition: filehandler.h:285
void createInitFile(list< ParamSet * > ¶ms)
Definition: filehandler.cc:229
void open_logfile4writing(ofstream &FH, ios_base::openmode flag=ios_base::out)
Definition: filehandler.cc:279
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:52
void set_extension(const char *ext)
Definition: filehandler.h:148
void set_OccMatrix(TMatrix *occ)
Definition: filehandler.h:173
std::string & get_path()
Definition: filehandler.h:142
FileServices * _service
Link to the files manager.
Definition: filehandler.h:56
void set_isMasterExec(bool is)
Definition: filehandler.h:185
bool _isGenerationPeriodic
Flag setting the per generation periodicity behaviour of the file.
Definition: filehandler.h:70
bool get_isMasterExec()
Definition: filehandler.h:181
list< int > _generations
Definition: filehandler.h:84
bool _isInputHandler
Writing mode flag.
Definition: filehandler.h:66
unsigned int _ExecRank
unused...
Definition: filehandler.h:87
std::string _path
File path as set during initialization.
Definition: filehandler.h:89
void set_ExecRank(int val)
Definition: filehandler.h:169
std::string _extension
File extension, should be specific to the implementation.
Definition: filehandler.h:92
virtual void init()
Called by notifier during simulation setup, performs file checking.
Definition: filehandler.cc:50
list< int >::const_iterator _genITER
Definition: filehandler.h:83
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path)
Definition: filehandler.h:200
std::string & get_filename()
Builds and returns the current file name depending on the periodicity of the file.
Definition: filehandler.cc:150
void set_pop_ptr(Metapop *pop_ptr)
Definition: filehandler.h:136
void set_ReplicateOccurrence(unsigned int val)
Definition: filehandler.h:160
virtual void FHread(string &filename)=0
Default input function.
virtual void FHwrite()=0
Default behavior of the class, called by Handler::update().
void set_GenerationOccurrence(unsigned int val)
Definition: filehandler.h:166
virtual ~FileHandler()
Definition: filehandler.h:124
void set_service(FileServices *srv)
Definition: filehandler.h:140
unsigned int _GenerationOccurrence
Tells every what generation the file should be written.
Definition: filehandler.h:74
bool get_isGenerationPeriodic()
Definition: filehandler.h:162
bool get_isInputHandler()
Definition: filehandler.h:153
void set_path()
Definition: filehandler.cc:111
bool _isMasterExec
Flag telling if the file must be written by the master or the worker node.
Definition: filehandler.h:64
TMatrix * get_OccMatrix()
Definition: filehandler.h:171
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path)
Sets the hanlder parameters.
Definition: filehandler.h:196
std::string _current_filename
The current filename as set by FileHandler::get_filename().
Definition: filehandler.h:98
TMatrix _multipleOccurences
Multiple occurences.
Definition: filehandler.h:81
Metapop * _pop
Pointer to the current metapop, set during initialization within the init function.
Definition: filehandler.h:102
unsigned int get_ReplicateOccurrence()
Definition: filehandler.h:159
FileHandler(const char *ext)
Definition: filehandler.h:106
bool get_isReplicatePeriodic()
Definition: filehandler.h:156
Metapop * get_pop_ptr()
Returns the pointer to the current metapop through the FileServices interface.
Definition: filehandler.h:134
FileServices * get_service()
Returns pointer to the FileServices.
Definition: filehandler.h:138
unsigned int get_GenerationOccurrence()
Definition: filehandler.h:165
unsigned int _ReplicateOccurrence
Tells every what replicate the file should be written.
Definition: filehandler.h:72
unsigned int _current_generation
The current generation number of the simulation.
Definition: filehandler.h:78
unsigned int _current_replicate
The current replicate number of the simulation.
Definition: filehandler.h:76
unsigned int get_ExecRank()
unused yet...
Definition: filehandler.h:168
virtual void update()
Updates the inner replicate and generation counters and calls FHwrite if needed by the the periodicit...
Definition: filehandler.cc:165
void set_isGenerationPeriodic(bool val)
Definition: filehandler.h:163
std::string & get_extension()
Definition: filehandler.h:146
void set_isInputHandler(bool val)
Definition: filehandler.h:154
bool _isReplicatePeriodic
Flag telling if the file should be written each replicate.
Definition: filehandler.h:68
void set_isReplicatePeriodic(bool val)
Definition: filehandler.h:157
virtual vector< string > ifExist()
Checks if any file associated with the current file name already exists on disk.
Definition: filehandler.cc:69
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:51
Service handler (an observer).
Definition: handler.h:35
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
void reset(unsigned int rows, unsigned int cols)
Re-allocate the existing matrix with assigned rows and cols dimensions and all elements to 0.
Definition: tmatrix.h:160
double * getValArray() const
Definition: tmatrix.h:201
unsigned int ncols() const
Definition: tmatrix.h:215
double get(unsigned int i, unsigned int j) const
Accessor to element at row i and column j.
Definition: tmatrix.h:192
unsigned int nrows() const
Definition: tmatrix.h:212
Template class for the trait's FileHandler.
Definition: filehandler.h:220
virtual ~TraitFileHandler()
Definition: filehandler.h:226
int _FHLinkedTraitIndex
Definition: filehandler.h:223
TraitFileHandler(TP *trait_proto, const char *ext)
Definition: filehandler.h:236
virtual void FHread(string &filename)=0
TP * _FHLinkedTrait
Definition: filehandler.h:222
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path, TP *trait_proto)
Definition: filehandler.h:247
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, TP *trait_proto)
Definition: filehandler.h:240