Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
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 FHwrite ()=0
 
virtual void FHread (string &filename)=0
 
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 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...
 
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 void init ()=0
 Inits state. More...
 
virtual void update ()=0
 Updates the handler state. More...
 
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::TTWolbachiaFH ( LCE_Breed_Wolbachia TP)
inline
250 { }
Template class for the LCEs StatHandler classes.
Definition: filehandler.h:247

◆ ~TTWolbachiaFH()

virtual TTWolbachiaFH::~TTWolbachiaFH ( )
inlinevirtual
253{ }

Member Function Documentation

◆ FHread()

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

Implements FileHandler.

259{}

◆ FHwrite()

void TTWolbachiaFH::FHwrite ( )
virtual

Implements EventFileHandler< LCE_Breed_Wolbachia >.

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:151
map< unsigned int, unsigned int > _times
Definition: ttwolbachia.h:243
vector< double > _rate
Definition: ttwolbachia.h:244
void fatal(const char *str,...)
Definition: output.cc:96

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

◆ record()

void TTWolbachiaFH::record ( unsigned int  repl,
unsigned int  gen,
double  infection 
)
428{
429 _times[repl] = gen;
430 _rate.push_back(infection);
431}

References _rate, and _times.

Referenced by LCE_Breed_Wolbachia::execute().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _rate

vector< double > TTWolbachiaFH::_rate
private

Referenced by FHwrite(), and record().

◆ _times

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.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR