Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
StatServices Class Reference

The Service class used to manage the StatHandler objects. More...

#include <statservices.h>

+ Inheritance diagram for StatServices:
+ Collaboration diagram for StatServices:

Public Types

typedef list< StatHandlerBase * >::const_iterator stat_it
 
typedef list< StatRecBase * >::const_iterator rec_it
 

Public Member Functions

 StatServices ()
 
virtual ~StatServices ()
 
virtual bool init ()
 
Metapopget_pop_ptr ()
 
void set_pop_ptr (Metapop *pop)
 
void set (string &str, unsigned int occ)
 
void setStatOptions (string &str)
 
string & getStatArg ()
 
unsigned int getOccurrence ()
 
void setOcccurrence (unsigned int value)
 
void setOccurrences (map< unsigned int, unsigned int > timeTable)
 Sets the list of generation for which statistics must be recorded during a run. More...
 
unsigned int getNumOccurrences ()
 Returns the maximum number of generation records per replicate. More...
 
unsigned int getNumOccurrences (unsigned int replicate)
 Returns the number of generation records present in the stat table for a replicate. More...
 
unsigned int getCurrentOccurrence ()
 Returns the last generation recorded for current replicate. More...
 
void resetCurrentOccurrence ()
 Resets the occurrence iterator to the beginning of the list of generation occurrences. More...
 
void printStatHeaders (ofstream &FH)
 
void doPrintAverages ()
 
void cancelPrintAverages ()
 
bool getPrintAveragesOpt ()
 
void printStatValue (ofstream &FH, unsigned int repl_idx)
 Prints the stat values to the '.txt' output file. More...
 
void printStatAverage (ofstream &FH)
 
void setCompactOutputFormat ()
 
void setFieldWidth (unsigned int val)
 
void setFieldPrecision (unsigned int val)
 
void setFieldSeparator (unsigned char c)
 
void setDefaultOutputFormat ()
 
list< StatRecBase * > getAllStats ()
 
unsigned int getNumStats ()
 
stat_it getFirst ()
 
stat_it getLast ()
 
vector< double * > * getReplicateStatRecords (unsigned int replicate)
 
double * getGenerationStatValues (unsigned int replicate, unsigned int occurence) const
 
void copyGenerationStatValues (unsigned int replicate, unsigned int occurence, double *values, unsigned int size)
 
void recordStats (unsigned int gen)
 record stat values in stat table by calling all stat recorders. More...
 
virtual void notify ()
 
virtual void load (SimComponent *sc)
 tell the SimComponent to load its stat handlers More...
 
virtual void attach (Handler *H)
 attach the StatHandler to the current list (_statHandlers) of the StatServices More...
 
virtual void reset ()
 clear the list of StatHandler More...
 
void reset_stat_table ()
 Deletes the stat tables. More...
 
- Public Member Functions inherited from Service
 Service ()
 
virtual ~Service ()
 
virtual bool init ()=0
 Inits internals. More...
 
virtual void notify ()=0
 Notifies all observers to update their state. More...
 
virtual void load (SimComponent *sc)=0
 Interface used by a simulation component to load its obervers onto a service provider. More...
 
virtual void attach (Handler *h)=0
 Adds an observer to the list. More...
 
virtual void reset ()=0
 Clears the observers list. More...
 

Private Attributes

Metapop_popPtr
 
list< StatHandlerBase * > _statHandlers
 List of stat handlers declared by currently active simulation components. More...
 
list< StatRecBase * > _statRecorders
 List of stat recorders. More...
 
unsigned int _numRecorders
 Number of stats to record. More...
 
vector< vector< double * > > _statValues
 Table containing all recorded stats, replicate x generation x (num recorders + 2) . More...
 
double * _currentStatValues
 Pointer to the last recorded stats. More...
 
string _statArg
 The string argument of the 'stat' input option. More...
 
unsigned int _occurrence
 Deprecated. More...
 
list< unsigned int_occurrences
 List of all generations to record. More...
 
list< unsignedint >::const_iterator _current_occurrence
 Iterator pointing to the current generation to record. More...
 
unsigned int _width
 
unsigned int _precision
 
unsigned char _separator
 
bool _printAverages
 

Detailed Description

The Service class used to manage the StatHandler objects.

Member Typedef Documentation

◆ rec_it

typedef list<StatRecBase*>::const_iterator StatServices::rec_it

◆ stat_it

typedef list<StatHandlerBase*>::const_iterator StatServices::stat_it

Constructor & Destructor Documentation

◆ StatServices()

StatServices::StatServices ( )
inline
100 { }
Metapop * _popPtr
Definition: statservices.h:54
unsigned char _separator
Definition: statservices.h:88
unsigned int _occurrence
Deprecated.
Definition: statservices.h:75
unsigned int _width
Definition: statservices.h:86
unsigned int _precision
Definition: statservices.h:86
unsigned int _numRecorders
Number of stats to record.
Definition: statservices.h:63
bool _printAverages
Definition: statservices.h:90
double * _currentStatValues
Pointer to the last recorded stats.
Definition: statservices.h:69

◆ ~StatServices()

virtual StatServices::~StatServices ( )
inlinevirtual
102{ reset_stat_table(); }
void reset_stat_table()
Deletes the stat tables.
Definition: statservices.cc:231

References reset_stat_table().

Member Function Documentation

◆ attach()

void StatServices::attach ( Handler H)
virtual

attach the StatHandler to the current list (_statHandlers) of the StatServices

Parameters
Hthe StatHandler

Implements Service.

178{
179 StatHandlerBase* SH = dynamic_cast<StatHandlerBase*> (H);
180
181 _statHandlers.push_back(SH);
182
183 SH->set_service(this);
184}
Base class of the StatHandler class, implements the Handler interface.
Definition: stathandler.h:48
void set_service(StatServices *srv)
Definition: stathandler.h:73
list< StatHandlerBase * > _statHandlers
List of stat handlers declared by currently active simulation components.
Definition: statservices.h:57

References _statHandlers, and StatHandlerBase::set_service().

Referenced by LCE_Selection_base::loadStatServices(), Metapop::loadStatServices(), TProtoBDMI::loadStatServices(), TProtoDeletMutations_bitstring::loadStatServices(), TProtoDispersal::loadStatServices(), TProtoNeutralGenes::loadStatServices(), TProtoQuanti::loadStatServices(), and TProtoWolbachia::loadStatServices().

+ Here is the caller graph for this function:

◆ cancelPrintAverages()

void StatServices::cancelPrintAverages ( )
inline
143{_printAverages = 0;}

References _printAverages.

Referenced by LCE_StatServiceNotifier::loadStatServices().

+ Here is the caller graph for this function:

◆ copyGenerationStatValues()

void StatServices::copyGenerationStatValues ( unsigned int  replicate,
unsigned int  occurence,
double *  values,
unsigned int  size 
)
inline
184 {
185 assert( _statValues[ replicate-1 ].size() < _occurrences.size() );
186
187 assert( size == _numRecorders+2);
188
189 double* new_record = new double[size];
190
191 memcpy(new_record, values, size*sizeof(double));
192
193 _statValues[ replicate-1 ].push_back(new_record);
194 }
list< unsigned int > _occurrences
List of all generations to record.
Definition: statservices.h:78
vector< vector< double * > > _statValues
Table containing all recorded stats, replicate x generation x (num recorders + 2) .
Definition: statservices.h:66

References _numRecorders, _occurrences, and _statValues.

◆ doPrintAverages()

void StatServices::doPrintAverages ( )
inline
142{_printAverages = 1;}

References _printAverages.

Referenced by LCE_StatServiceNotifier::loadStatServices().

+ Here is the caller graph for this function:

◆ get_pop_ptr()

Metapop * StatServices::get_pop_ptr ( )
inline
106{return _popPtr;}

References _popPtr.

Referenced by StatHandlerBase::get_pop_ptr().

+ Here is the caller graph for this function:

◆ getAllStats()

list< StatRecBase * > StatServices::getAllStats ( )
390{
391 list< StatHandlerBase* >::iterator HIT = _statHandlers.begin();
392
393 list<StatRecBase*> allStats, stats;
394
395 while(HIT != _statHandlers.end()) {
396 stats = (*HIT)->getStats();
397 allStats.insert(allStats.end(), stats.begin(), stats.end());
398 HIT++;
399 }
400
401 return allStats;
402}

References _statHandlers.

Referenced by SimRunner::get_allRegisteredStats().

+ Here is the caller graph for this function:

◆ getCurrentOccurrence()

unsigned int StatServices::getCurrentOccurrence ( )
inline

Returns the last generation recorded for current replicate.

136{return *_current_occurrence;}
list< unsignedint >::const_iterator _current_occurrence
Iterator pointing to the current generation to record.
Definition: statservices.h:83

References _current_occurrence.

Referenced by StatHandlerBase::getCurrentOccurrence().

+ Here is the caller graph for this function:

◆ getFirst()

stat_it StatServices::getFirst ( )
inline
168{return _statHandlers.begin();}

References _statHandlers.

◆ getGenerationStatValues()

double * StatServices::getGenerationStatValues ( unsigned int  replicate,
unsigned int  occurence 
) const
inline
178 {
179 assert(occurence < _occurrences.size());
180 return _statValues[ replicate-1 ][ occurence ];
181 }

References _occurrences, and _statValues.

◆ getLast()

stat_it StatServices::getLast ( )
inline
170{return _statHandlers.end();}

References _statHandlers.

◆ getNumOccurrences() [1/2]

unsigned int StatServices::getNumOccurrences ( )
inline

Returns the maximum number of generation records per replicate.

126{return _occurrences.size();}

References _occurrences.

Referenced by StatHandlerBase::getNumOccurrences(), printStatAverage(), and recordStats().

+ Here is the caller graph for this function:

◆ getNumOccurrences() [2/2]

unsigned int StatServices::getNumOccurrences ( unsigned int  replicate)
inline

Returns the number of generation records present in the stat table for a replicate.

Parameters
replicatethe replicate number (not the index in the stat table).
132 {
133 return _statValues[replicate-1].size();
134 }

References _statValues.

◆ getNumStats()

unsigned int StatServices::getNumStats ( )
inline
166{return _statRecorders.size();}
list< StatRecBase * > _statRecorders
List of stat recorders.
Definition: statservices.h:60

References _statRecorders.

◆ getOccurrence()

unsigned int StatServices::getOccurrence ( )
inline
118{return _occurrence;}

References _occurrence.

Referenced by LCE_StatServiceNotifier::execute(), and StatHandlerBase::getOccurrence().

+ Here is the caller graph for this function:

◆ getPrintAveragesOpt()

bool StatServices::getPrintAveragesOpt ( )
inline
144{return _printAverages;}

References _printAverages.

Referenced by LCE_StatFH::FHwrite().

+ Here is the caller graph for this function:

◆ getReplicateStatRecords()

vector< double * > * StatServices::getReplicateStatRecords ( unsigned int  replicate)
inline
173 {
174 return &_statValues[ replicate-1 ];
175 }

References _statValues.

◆ getStatArg()

string & StatServices::getStatArg ( )
inline
115{return _statArg;}
string _statArg
The string argument of the 'stat' input option.
Definition: statservices.h:72

References _statArg.

◆ init()

bool StatServices::init ( )
virtual

Implements Service.

48{
49 stat_it HIT;
50
51 HIT = _statHandlers.begin();
52
53 //first init the stat handlers -> will define the dims of the stat tables
54 while(HIT != _statHandlers.end()) {
55 (*HIT)->init();
56 HIT++;
57 }
58
59 istringstream stats(_statArg);
60 string arg;
61 list<string> args;
62
63 //extract the stat options from the string read in the init file
64 while(stats>>arg) args.push_back(arg);
65
66 list<string>::iterator token = args.begin();
67
68 bool is_set = false;
69
70 while(token != args.end()) {
71
72 HIT = _statHandlers.begin();
73
74 is_set = false;
75
76 while(HIT != _statHandlers.end() && !is_set) {
77 is_set |= (*HIT)->setStatRecorders( (*token) );
78 HIT++;
79 }
80
81 if(!is_set) {
82 error("the string \"%s\" is not a valid stat option\n",(*token).c_str());
83 return false;
84 }
85
86 token++;
87 }
88
89 //---- set the list of stat recorders:
90 _statRecorders.clear();
91
92 for (HIT = _statHandlers.begin(); HIT != _statHandlers.end(); ++HIT) {
93
94 _statRecorders.splice(_statRecorders.end(), (*HIT)->getStats());
95 //this removes the recorders from the handler's list (in principle)
96 //this means we need to delete the recorders within the StatServices!!
97 }
98
100
101
102 //---- set iterator to first generation occurrence to record
104 //this is safe as the occurrence list is set before init() is called.
105
106// //reset output option for per-gen mean stats
107// _printAverages = 1; //this resets user-defined option!!
108
109 //---- set the stat table:
111
112 for (unsigned int i = 0; i < SIMenv::getReplicates(); ++i) {
113 _statValues.push_back(vector<double*>());
114 }
115
116 return true;
117}
static unsigned int getReplicates()
Definition: simenv.h:63
list< StatHandlerBase * >::const_iterator stat_it
Definition: statservices.h:94
int error(const char *str,...)
Definition: output.cc:77

References _current_occurrence, _numRecorders, _occurrences, _statArg, _statHandlers, _statRecorders, _statValues, error(), SIMenv::getReplicates(), and reset_stat_table().

Referenced by SimRunner::init_components().

+ Here is the caller graph for this function:

◆ load()

void StatServices::load ( SimComponent sc)
virtual

tell the SimComponent to load its stat handlers

Parameters
scthe SimComponent

Implements Service.

171{
172 sc->loadStatServices(this);
173}
virtual void loadStatServices(StatServices *loader)=0
Loads the component's StatHandler onto the StatServices.

References SimComponent::loadStatServices().

Referenced by SimRunner::register_component().

+ Here is the caller graph for this function:

◆ notify()

void StatServices::notify ( )
virtual

Implements Service.

189{
190#ifdef _DEBUG_
191 message("StatServices::notify (%i/%i): ", SIMenv::getCurrentGeneration(),
193 fflush(stdout);
194#endif
195
199 }
200
201#ifdef _DEBUG_
202 message("\n");
203#endif
204}
static unsigned int getCurrentGeneration()
Definition: simenv.h:60
void recordStats(unsigned int gen)
record stat values in stat table by calling all stat recorders.
Definition: statservices.cc:246
void message(const char *message,...)
Definition: output.cc:40

References _current_occurrence, SIMenv::getCurrentGeneration(), message(), and recordStats().

Referenced by LCE_StatServiceNotifier::execute().

+ Here is the caller graph for this function:

◆ printStatAverage()

void StatServices::printStatAverage ( ofstream &  FH)
329{
330 vector< double > means;
331 unsigned int num_repl = SIMenv::getReplicates(), rep_cntr;
332 unsigned int num_gen = getNumOccurrences();
333 unsigned int current_gen = 0;
334
335 //print the first row with stats headers:
336// FH.setf(ios::left,ios::adjustfield);
337 FH << setw(_width) << left <<"generation";
338
339 //print the stat names:
341
342 FH<< _separator << setw(_width) << "alive.rpl" << endl;
343
344// FH << setprecision(_precision);
345
346 for (unsigned int gen = 0; gen < num_gen; ++gen) {
347
348 rep_cntr = 0;
349
350 means.assign(_numRecorders,0);
351
352 for (unsigned int rep = 0; rep < num_repl; ++rep) {
353
354 //verify if this replicate was not extinct at this generation
355 if ( _statValues[ rep ].size() > gen ) rep_cntr++;
356 else continue; //skip this replicate
357
358 for (unsigned int j = 0; j < _numRecorders; ++j) {
359 means[j] += _statValues[rep][gen][j+2]; //two first are replicate and generation
360 }
361 current_gen = _statValues[rep][gen][1];
362 }
363
364 if(rep_cntr != 0) {
365
366// FH.width(_width);
367// FH.setf(ios::left,ios::adjustfield);
368 //FH<<_statValues[0][gen][1];
369 FH << setw(_width) << left << current_gen;
370
371 FH << setprecision(_precision);
372
373 for (unsigned int j = 0; j < _numRecorders; ++j) {
374 FH << _separator << setw(_width) << means[j] / rep_cntr;
375 }
376 //print number of alive replicates 'til this generation
377 FH << _separator << setw(_width) << rep_cntr;
378
379 FH << endl;
380 }
381
382 }
383
384
385}
unsigned int getNumOccurrences()
Returns the maximum number of generation records per replicate.
Definition: statservices.h:126
void printStatHeaders(ofstream &FH)
Definition: statservices.cc:271

References _numRecorders, _precision, _separator, _statValues, _width, getNumOccurrences(), SIMenv::getReplicates(), and printStatHeaders().

Referenced by LCE_StatFH::PrintStat_byGen().

+ Here is the caller graph for this function:

◆ printStatHeaders()

void StatServices::printStatHeaders ( ofstream &  FH)
272{
273 for (rec_it IT = _statRecorders.begin(); IT != _statRecorders.end(); ++IT) {
274 FH << _separator << setw(_width) << (*IT)->getName();
275 }
276}
list< StatRecBase * >::const_iterator rec_it
Definition: statservices.h:96

References _separator, _statRecorders, and _width.

Referenced by printStatAverage(), and printStatValue().

+ Here is the caller graph for this function:

◆ printStatValue()

void StatServices::printStatValue ( ofstream &  FH,
unsigned int  repl_idx 
)

Prints the stat values to the '.txt' output file.

Parameters
FHthe file output stream
repl_idxthe replicate index in the stat tables
281{
282
283// FH.width(_width);
284// FH.setf(ios::left,ios::adjustfield);
285
286 if(SIMenv::getCurrentReplicate() == 1) {
287
288 //print the first row with stat headers:
289 FH << setw(_width) << left <<"replicate"<< _separator << setw(_width) <<"generation";
290
291 //print the stat names:
293
294 FH << endl;
295 }
296
297 for (unsigned int gen = 0, i = 2; gen < _statValues[repl_idx].size(); ++gen) {
298 //for all generations recorded, print stuff:
299
300 assert( repl_idx + 1 == _statValues[repl_idx][gen][0]); //check if replicate is ok
301
302// FH.width(_width);
303 FH << setw(_width) << left << _statValues[repl_idx][gen][0]; //replicate number
304 FH << _separator;
305 FH << setprecision(16); //to avoid scientific notation for generation number
306 FH << setw(_width) << _statValues[repl_idx][gen][1]; //generation recorded
307 FH << setprecision(_precision); //this precision is needed only for stat values
308
309 i = 2;
310 //print all stats on one line
311 for (rec_it IT = _statRecorders.begin(); IT != _statRecorders.end(); ++IT) {
312
313 FH << _separator << setw(_width) << _statValues[repl_idx][gen][i];
314
315 i++;
316
317 }
318
319 FH<<endl;
320
321 assert( i == _numRecorders + 2 );
322 }
323
324}
static unsigned int getCurrentReplicate()
Definition: simenv.h:62

References _numRecorders, _precision, _separator, _statRecorders, _statValues, _width, SIMenv::getCurrentReplicate(), and printStatHeaders().

Referenced by LCE_StatFH::FHwrite().

+ Here is the caller graph for this function:

◆ recordStats()

void StatServices::recordStats ( unsigned int  gen)

record stat values in stat table by calling all stat recorders.

247{
248 _currentStatValues = new double [ _numRecorders + 2]; //+ replicate + generation
249
251 _currentStatValues[1] = gen;
252
253 unsigned int i = 2, tab_idx = SIMenv::getCurrentReplicate() - 1;
254
255 for (rec_it REC = _statRecorders.begin(); REC != _statRecorders.end(); ++REC)
256 {
257
258 assert(i < _numRecorders+2 );
259
260 _currentStatValues[i++] = (*REC)->setVal( _popPtr->getCurrentAge() );
261
262 }
263
264 _statValues[ tab_idx ].push_back(_currentStatValues);
265
266 assert( _statValues[ tab_idx ].size() <= getNumOccurrences() );
267}
age_t getCurrentAge()
Definition: metapop.h:297

References _currentStatValues, _numRecorders, _popPtr, _statRecorders, _statValues, Metapop::getCurrentAge(), SIMenv::getCurrentReplicate(), and getNumOccurrences().

Referenced by notify().

+ Here is the caller graph for this function:

◆ reset()

void StatServices::reset ( )
virtual

clear the list of StatHandler

Implements Service.

209{
210 stat_it HIT = _statHandlers.begin();
211
212 while(HIT != _statHandlers.end()) {
213 (*HIT)->reset();
214 HIT++;
215 }
216
217 _statHandlers.clear();
218
219 //the stat recorders must be freed here, they have been removed from the StatHandlers
220 rec_it REC = _statRecorders.begin();
221
222 for(; REC != _statRecorders.end(); ++REC) delete (*REC);
223
224 _statRecorders.clear();
225
227}

References _statHandlers, _statRecorders, and reset_stat_table().

Referenced by SimRunner::reset_services().

+ Here is the caller graph for this function:

◆ reset_stat_table()

void StatServices::reset_stat_table ( )

Deletes the stat tables.

232{
233 for (unsigned int i = 0; i < _statValues.size(); ++i) {
234 for (unsigned int j = 0; j < _statValues[i].size(); ++j) {
235 delete [] _statValues[i][j];
236 }
237 _statValues[i].clear();
238 }
239 _statValues.clear();
240
242}

References _currentStatValues, and _statValues.

Referenced by init(), reset(), and ~StatServices().

+ Here is the caller graph for this function:

◆ resetCurrentOccurrence()

void StatServices::resetCurrentOccurrence ( )
inline

Resets the occurrence iterator to the beginning of the list of generation occurrences.

References _current_occurrence, and _occurrences.

Referenced by SimRunner::setForFirstGeneration().

+ Here is the caller graph for this function:

◆ set()

void StatServices::set ( string &  str,
unsigned int  occ 
)
inline
111 {_statArg = str; _occurrence = occ;}

References _occurrence, and _statArg.

◆ set_pop_ptr()

void StatServices::set_pop_ptr ( Metapop pop)
inline
108{_popPtr=pop;}

References _popPtr.

Referenced by SimRunner::init_components().

+ Here is the caller graph for this function:

◆ setCompactOutputFormat()

void StatServices::setCompactOutputFormat ( )
inline
153{_width = 0; _separator = ' ';}

References _separator, and _width.

Referenced by LCE_StatServiceNotifier::setParameters().

+ Here is the caller graph for this function:

◆ setDefaultOutputFormat()

void StatServices::setDefaultOutputFormat ( )
inline
161{_width = 12; _precision = 6; _separator = '\t';}

References _precision, _separator, and _width.

Referenced by LCE_StatServiceNotifier::setParameters().

+ Here is the caller graph for this function:

◆ setFieldPrecision()

void StatServices::setFieldPrecision ( unsigned int  val)
inline
157{_precision = val;}

References _precision.

Referenced by LCE_StatServiceNotifier::setParameters().

+ Here is the caller graph for this function:

◆ setFieldSeparator()

void StatServices::setFieldSeparator ( unsigned char  c)
inline
159{_separator = c;}

References _separator.

Referenced by LCE_StatServiceNotifier::setParameters().

+ Here is the caller graph for this function:

◆ setFieldWidth()

void StatServices::setFieldWidth ( unsigned int  val)
inline
155{_width = val;}

References _width.

Referenced by LCE_StatServiceNotifier::setParameters().

+ Here is the caller graph for this function:

◆ setOcccurrence()

void StatServices::setOcccurrence ( unsigned int  value)
inline
120{_occurrence = value;}

References _occurrence.

◆ setOccurrences()

void StatServices::setOccurrences ( map< unsigned int, unsigned int timeTable)

Sets the list of generation for which statistics must be recorded during a run.

Parameters
timeTablea map containing the generations at which stats must be recorded
122{
123 map<unsigned int, unsigned int>::const_iterator time = timeTable.begin(), next;
124
125 _occurrences.clear();
126 _occurrences.push_front(0);
127
128 if (time->first == 0 && time->second != 0) { //this is a recursive logtime
129
130 unsigned int next_term;
131
132 for (;time != timeTable.end(); ++time) {
133
134 next = time;
135 next++;
136 next_term = ( next != timeTable.end() ?
137 next->first : SIMenv::getGenerations() );
138
139 while( _occurrences.back() + time->second < next_term)
140 {
141 _occurrences.push_back( _occurrences.back() + time->second );
142 }
143 _occurrences.push_back(next_term);
144 }
145
146
147 } else if (time->second == 0) { //non-recursive logtime, only records specific times
148
149 for (;time != timeTable.end(); ++time) _occurrences.push_back(time->first);
150
151 } else {
152
153 fatal("something went wrong while setting stat recording times (first=%i, second=%i)\n",
154 time->first, time->second);
155 }
156
157 //clean up:
158 while (_occurrences.back() > SIMenv::getGenerations()) _occurrences.pop_back();
159
160 if(_occurrences.back() != SIMenv::getGenerations()) //automatically record last gen
162
163 if (_occurrences.front() == 0) _occurrences.pop_front();
164 if (_occurrences.front() != 1) _occurrences.push_front(1); //automatically record first gen
165}
static unsigned int getGenerations()
Definition: simenv.h:61
void fatal(const char *str,...)
Definition: output.cc:96

References _occurrences, fatal(), and SIMenv::getGenerations().

Referenced by LCE_StatServiceNotifier::setOccurence().

+ Here is the caller graph for this function:

◆ setStatOptions()

void StatServices::setStatOptions ( string &  str)
inline
113{_statArg = str;}

References _statArg.

Referenced by LCE_StatServiceNotifier::loadStatServices().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _current_occurrence

list<unsignedint>::const_iterator StatServices::_current_occurrence
private

Iterator pointing to the current generation to record.

Is incremented once all stats have been recorded for the current generation.

Referenced by getCurrentOccurrence(), init(), notify(), and resetCurrentOccurrence().

◆ _currentStatValues

double* StatServices::_currentStatValues
private

Pointer to the last recorded stats.

Referenced by recordStats(), and reset_stat_table().

◆ _numRecorders

unsigned int StatServices::_numRecorders
private

Number of stats to record.

Referenced by copyGenerationStatValues(), init(), printStatAverage(), printStatValue(), and recordStats().

◆ _occurrence

unsigned int StatServices::_occurrence
private

Deprecated.

Referenced by getOccurrence(), set(), and setOcccurrence().

◆ _occurrences

list< unsigned int > StatServices::_occurrences
private

◆ _popPtr

Metapop* StatServices::_popPtr
private

◆ _precision

unsigned int StatServices::_precision
private

◆ _printAverages

bool StatServices::_printAverages
private

◆ _separator

◆ _statArg

string StatServices::_statArg
private

The string argument of the 'stat' input option.

Referenced by getStatArg(), init(), set(), and setStatOptions().

◆ _statHandlers

list< StatHandlerBase* > StatServices::_statHandlers
private

List of stat handlers declared by currently active simulation components.

Referenced by attach(), getAllStats(), getFirst(), getLast(), init(), and reset().

◆ _statRecorders

list< StatRecBase *> StatServices::_statRecorders
private

List of stat recorders.

Referenced by getNumStats(), init(), printStatHeaders(), printStatValue(), recordStats(), and reset().

◆ _statValues

vector< vector< double*> > StatServices::_statValues
private

Table containing all recorded stats, replicate x generation x (num recorders + 2) .

Referenced by copyGenerationStatValues(), getGenerationStatValues(), getNumOccurrences(), getReplicateStatRecords(), init(), printStatAverage(), printStatValue(), recordStats(), and reset_stat_table().

◆ _width


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