125 virtual void init ( );
129 virtual vector< string >
ifExist( );
195 virtual void set (
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path) {
199 virtual void set_multi (
bool rpl_per,
bool gen_per,
int rpl_occ,
TMatrix* Occ,
string path) {
207 virtual void FHread (
string& filename) = 0;
229 virtual void FHread (
string& filename) = 0;
231 virtual void set (
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path, TP* trait_proto);
232 virtual void set_multi (
bool rpl_per,
bool gen_per,
int rpl_occ,
TMatrix* Occ,
string path, TP* trait_proto);
236 FileHandler(ext), _FHLinkedTrait(trait_proto), _FHLinkedTraitIndex(trait_proto->get_index())
239 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)
242 _FHLinkedTrait = trait_proto;
243 _FHLinkedTraitIndex = trait_proto->get_index();
249 _FHLinkedTrait = trait_proto;
250 _FHLinkedTraitIndex = trait_proto->get_index();
265 virtual void FHread (
string& filename) = 0;
267 virtual void set (
bool rpl_per,
bool gen_per,
int rpl_occ,
int gen_occ,
int rank,
string path, LCE* event);
274 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)
277 _FHLinkedEvent = event;
287 virtual void FHread (
string& filename) {}
Template class for the LCEs StatHandler classes.
Definition: filehandler.h:256
LCE * _FHLinkedEvent
Definition: filehandler.h:258
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, LCE *event)
Definition: filehandler.h:274
EventFileHandler(LCE *event, const char *ext)
Definition: filehandler.h:270
virtual ~EventFileHandler()
Definition: filehandler.h:261
virtual void FHread(string &filename)=0
File Handler used to save the simulation parameters to a log file.
Definition: filehandler.h:281
void save_simparams(list< ParamSet * > ¶ms)
Definition: filehandler.cc:199
virtual void FHread(string &filename)
Definition: filehandler.h:287
virtual void FHwrite()
Definition: filehandler.h:286
void log_message(string &logstr)
Definition: filehandler.cc:264
FHLogWriter()
Definition: filehandler.h:283
virtual ~FHLogWriter()
Definition: filehandler.h:284
void createInitFile(list< ParamSet * > ¶ms)
Definition: filehandler.cc:228
void open_logfile4writing(ofstream &FH, ios_base::openmode flag=ios_base::out)
Definition: filehandler.cc:278
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:51
void set_extension(const char *ext)
Definition: filehandler.h:147
void set_OccMatrix(TMatrix *occ)
Definition: filehandler.h:172
std::string & get_path()
Definition: filehandler.h:141
FileServices * _service
Link to the files manager.
Definition: filehandler.h:55
void set_isMasterExec(bool is)
Definition: filehandler.h:184
bool _isGenerationPeriodic
Flag setting the per generation periodicity behaviour of the file.
Definition: filehandler.h:69
bool get_isMasterExec()
Definition: filehandler.h:180
list< int > _generations
Definition: filehandler.h:83
bool _isInputHandler
Writing mode flag.
Definition: filehandler.h:65
unsigned int _ExecRank
unused...
Definition: filehandler.h:86
std::string _path
File path as set during initialization.
Definition: filehandler.h:88
void set_ExecRank(int val)
Definition: filehandler.h:168
std::string _extension
File extension, should be specific to the implementation.
Definition: filehandler.h:91
virtual void init()
Called by notifier during simulation setup, performs file checking.
Definition: filehandler.cc:49
list< int >::const_iterator _genITER
Definition: filehandler.h:82
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path)
Definition: filehandler.h:199
std::string & get_filename()
Builds and returns the current file name depending on the periodicity of the file.
Definition: filehandler.cc:149
void set_pop_ptr(Metapop *pop_ptr)
Definition: filehandler.h:135
void set_ReplicateOccurrence(unsigned int val)
Definition: filehandler.h:159
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:165
virtual ~FileHandler()
Definition: filehandler.h:123
void set_service(FileServices *srv)
Definition: filehandler.h:139
unsigned int _GenerationOccurrence
Tells every what generation the file should be written.
Definition: filehandler.h:73
bool get_isGenerationPeriodic()
Definition: filehandler.h:161
bool get_isInputHandler()
Definition: filehandler.h:152
void set_path()
Definition: filehandler.cc:110
bool _isMasterExec
Flag telling if the file must be written by the master or the worker node.
Definition: filehandler.h:63
TMatrix * get_OccMatrix()
Definition: filehandler.h:170
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:195
std::string _current_filename
The current filename as set by FileHandler::get_filename().
Definition: filehandler.h:97
TMatrix _multipleOccurences
Multiple occurences.
Definition: filehandler.h:80
Metapop * _pop
Pointer to the current metapop, set during initialization within the init function.
Definition: filehandler.h:101
unsigned int get_ReplicateOccurrence()
Definition: filehandler.h:158
FileHandler(const char *ext)
Definition: filehandler.h:105
bool get_isReplicatePeriodic()
Definition: filehandler.h:155
Metapop * get_pop_ptr()
Returns the pointer to the current metapop through the FileServices interface.
Definition: filehandler.h:133
FileServices * get_service()
Returns pointer to the FileServices.
Definition: filehandler.h:137
unsigned int get_GenerationOccurrence()
Definition: filehandler.h:164
unsigned int _ReplicateOccurrence
Tells every what replicate the file should be written.
Definition: filehandler.h:71
unsigned int _current_generation
The current generation number of the simulation.
Definition: filehandler.h:77
unsigned int _current_replicate
The current replicate number of the simulation.
Definition: filehandler.h:75
unsigned int get_ExecRank()
unused yet...
Definition: filehandler.h:167
virtual void update()
Updates the inner replicate and generation counters and calls FHwrite if needed by the the periodicit...
Definition: filehandler.cc:164
void set_isGenerationPeriodic(bool val)
Definition: filehandler.h:162
std::string & get_extension()
Definition: filehandler.h:145
void set_isInputHandler(bool val)
Definition: filehandler.h:153
bool _isReplicatePeriodic
Flag telling if the file should be written each replicate.
Definition: filehandler.h:67
void set_isReplicatePeriodic(bool val)
Definition: filehandler.h:156
virtual vector< string > ifExist()
Checks if any file associated with the current file name already exists on disk.
Definition: filehandler.cc:68
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:50
Service handler (an observer).
Definition: handler.h:34
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:48
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:159
double * getValArray() const
Definition: tmatrix.h:200
unsigned int ncols() const
Definition: tmatrix.h:214
double get(unsigned int i, unsigned int j) const
Accessor to element at row i and column j.
Definition: tmatrix.h:191
unsigned int nrows() const
Definition: tmatrix.h:211
Template class for the trait's FileHandler.
Definition: filehandler.h:219
virtual ~TraitFileHandler()
Definition: filehandler.h:225
int _FHLinkedTraitIndex
Definition: filehandler.h:222
TraitFileHandler(TP *trait_proto, const char *ext)
Definition: filehandler.h:235
virtual void FHread(string &filename)=0
TP * _FHLinkedTrait
Definition: filehandler.h:221
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path, TP *trait_proto)
Definition: filehandler.h:246
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:239