Nemo  2.3.46
TTWolbachiaFH Class Reference

FileHandler of the Wolbachia trait. More...

#include <ttwolbachia.h>

+ Inheritance diagram for TTWolbachiaFH:
+ Collaboration diagram for TTWolbachiaFH:

Public Member Functions

 TTWolbachiaFH (LCE_Breed_Wolbachia *TP)
 
virtual ~TTWolbachiaFH ()
 
void record (unsigned int repl, unsigned int gen, double infection)
 
virtual void FHwrite ()
 
virtual void FHread (string &filename)
 
- Public Member Functions inherited from EventFileHandler< LCE_Breed_Wolbachia >
 EventFileHandler (LCE_Breed_Wolbachia *event, const char *ext)
 
virtual ~EventFileHandler ()
 
virtual void set (bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, LCE_Breed_Wolbachia *event)
 
- Public Member Functions inherited from FileHandler
 FileHandler (const char *ext)
 
virtual ~FileHandler ()
 
virtual void init ()
 Called by notifier during simulation setup, performs file checking. More...
 
virtual bool 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 update ()
 Updates the inner replicate and generation counters and calls FHwrite if needed by the the periodicity of the file. More...
 
Metapopget_pop_ptr ()
 Returns the pointer to the current metapop through the FileServices interface. More...
 
void set_pop_ptr (Metapop *pop_ptr)
 
FileServicesget_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)
 
TMatrixget_OccMatrix ()
 
void set_OccMatrix (TMatrix *occ)
 
bool get_isMasterExec ()
 
void set_isMasterExec (bool is)
 
- Public Member Functions inherited from Handler
virtual ~Handler ()
 

Private Attributes

map< unsigned int, unsigned int_times
 
vector< double > _rate
 

Additional Inherited Members

- Protected Attributes inherited from EventFileHandler< LCE_Breed_Wolbachia >
LCE_Breed_Wolbachia_FHLinkedEvent
 
- Protected Attributes inherited from FileHandler
Metapop_pop
 Pointer to the current metapop, set during initialization within the init function. More...
 

Detailed Description

FileHandler of the Wolbachia trait.

Records the last generation of each replicate; i.e. the generation at which infection is either lost, fixed, or incomplete due to generation time limit.

Constructor & Destructor Documentation

TTWolbachiaFH::TTWolbachiaFH ( LCE_Breed_Wolbachia TP)
inline
virtual TTWolbachiaFH::~TTWolbachiaFH ( )
inlinevirtual
250 { }

Member Function Documentation

virtual void TTWolbachiaFH::FHread ( string &  filename)
inlinevirtual
void TTWolbachiaFH::FHwrite ( )
virtual

Implements EventFileHandler< LCE_Breed_Wolbachia >.

References _rate, _times, fatal(), and FileHandler::get_filename().

436 {
437  string filename = get_filename();
438 
439  ofstream FILE (filename.c_str(), ios::out);
440 
441  if(!FILE) fatal("could not open wolbachia output file \"%s\"\n", filename.c_str());
442 
443  FILE << "replicate\t" << "generation\t" << "infection_rate\n";
444 
445  unsigned int i = 0;
446 
447  map<unsigned int, unsigned int>::iterator IT = _times.begin();
448 
449  while (IT != _times.end() && i < _rate.size() ) {
450  FILE << IT->first <<"\t"<< IT->second << "\t" << _rate[i] << endl;
451  i++;
452  IT++;
453  }
454 
455  FILE.close();
456 
457 }
std::string & get_filename()
Builds and returns the current file name depending on the periodicity of the file.
Definition: filehandler.cc:148
void fatal(const char *str,...)
Definition: output.cc:90
vector< double > _rate
Definition: ttwolbachia.h:241
map< unsigned int, unsigned int > _times
Definition: ttwolbachia.h:240
void TTWolbachiaFH::record ( unsigned int  repl,
unsigned int  gen,
double  infection 
)

References _rate, and _times.

Referenced by LCE_Breed_Wolbachia::execute().

428 {
429  _times[repl] = gen;
430  _rate.push_back(infection);
431 }
vector< double > _rate
Definition: ttwolbachia.h:241
map< unsigned int, unsigned int > _times
Definition: ttwolbachia.h:240

Member Data Documentation

vector< double > TTWolbachiaFH::_rate
private

Referenced by FHwrite(), and record().

map< unsigned int, unsigned int > TTWolbachiaFH::_times
private

Referenced by FHwrite(), and record().


The documentation for this class was generated from the following files:

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR