155 bool run (
int ARGC,
char **ARGV );
163 void step (
unsigned int nb_gen);
186 void Cycle(
char* startTime);
list< SimComponent * > _components
List of all the simulation components.
Definition: basicsimulation.h:71
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:52
Definition: MPImanager.h:48
Provides methods to build the user's selected set of life cycle events and traits from the parameters...
Definition: basicsimulation.h:168
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:45
Performs the setup of the Metapop and SimComponents and runs the simulation.
Definition: simulation.h:53
std::string _postexec_args
Arguments to pass to the post-exec script.
Definition: simulation.h:92
UpdaterServices _ParamUpdaterManager
Definition: simulation.h:104
unsigned int _replicates
Number of replicates to iterate.
Definition: simulation.h:74
void reset_services()
Resets the FileServices and StatServices.
Definition: simulation.cc:208
void setForFirstGeneration()
Sets the population and the services ready for the first generation of a new replicate.
Definition: simulation.cc:609
unsigned int getReplicates()
Definition: simulation.h:196
clock_t _meanReplElapsedTime
Clock counter, for logging.
Definition: simulation.h:66
char _startTime[20]
Definition: simulation.h:62
unsigned int getGenerations()
Definition: simulation.h:192
bool run()
First loop of the simulation, performs the simulations stored in the ParamManager base class.
Definition: simulation.cc:390
bool init()
Checks simulation parameters and init the FileServices with the base filename.
Definition: simulation.cc:68
unsigned int getCurrentGeneration()
Definition: simulation.h:190
std::string setElapsedTime(clock_t time)
Compute and print the simulation's elapsed time to stdout.
Definition: simulation.cc:709
void step(unsigned int nb_gen)
Iterates the life cycle.
Definition: simulation.cc:695
unsigned int _generations
Number of generations to iterate.
Definition: simulation.h:72
void setGenerations(unsigned int gen)
Definition: simulation.h:191
Metapop * get_pop()
Accessor to the pop ptr.
Definition: simulation.h:172
list< StatRecBase * > get_allRegisteredStats()
Returns the complete list of the stat recorders loaded after parameters initialization.
Definition: simulation.h:152
unsigned int _meanGenLength
Generation counter, for logging.
Definition: simulation.h:68
SimRunner(Metapop *pop)
Definition: simulation.h:108
void Cycle(char *startTime)
Life cycle loop, executes the list of LCEs _generations times.
Definition: simulation.cc:625
void runPostExecReplicateWise()
Run the post-exec script after each replicate, adds filename and replicate number as args.
Definition: simulation.cc:842
void setLifeCycle()
Sets the list of LifeCyckeEvent's currently active.
Definition: simulation.cc:242
unsigned long _random_seed
The startup random seed of the random generator.
Definition: simulation.h:82
void attach_pop(Metapop *pop)
Attach a pop to the simulation.
Definition: simulation.h:168
char _endTime[20]
Definition: simulation.h:62
bool build_pop()
Calls the Metapop init procedure with current traits and LCEs.
unsigned int _mode
The run mode code (0 = run, 1 = overwrite, 2 = skip, 3 = dryrun, 4 = create_init)
Definition: simulation.h:86
std::string _logfile
Definition: simulation.h:60
MPImanager * _my_mpi_manager
Definition: simulation.h:56
void setCurrentGeneration(unsigned int gen)
Definition: simulation.h:189
bool _doRun
Boolean set when not in dryrun mode.
Definition: simulation.h:88
~SimRunner()
Dstror.
Definition: simulation.cc:179
FileServices _FileServices
Definition: simulation.h:100
void runPostExec()
Run the post-exec script after all simulations have finished.
Definition: simulation.cc:817
void reset()
Resets all the parameters to the unset state, resets the services.
Definition: simulation.cc:191
int _currentRankInLifeCycle
The current rank in the life cycle, corresponds to the rank of the current LCE, before it executes.
Definition: simulation.h:80
std::string _postexec_script
The path to the script to be executed after last simulation.
Definition: simulation.h:90
unsigned int _currentReplicate
The current replicate in the replicate loop, starts at 1.
Definition: simulation.h:76
int getCurrentRankInLifeCycle()
Definition: simulation.h:197
bool init_components(map< string, string > &simparams)
Performs the initialization of the different components of the simulation.
Definition: simulation.cc:252
bool _do_postexec_replicatewise
Boolean to trigger replicate-wise execution of post script.
Definition: simulation.h:94
FileServices * get_FileServices()
Returns the FileServices.
Definition: simulation.h:148
Metapop * _thePop
Definition: simulation.h:58
StatServices * get_StatServices()
Returns the StatServices.
Definition: simulation.h:150
void init_random_seed()
Initialize the seed of the random generator.
Definition: simulation.cc:315
unsigned int _currentGeneration
The current generation in the generation loop, starts at 1.
Definition: simulation.h:78
void printLog()
Definition: simulation.cc:762
void register_component(SimComponent *cmpt)
Register the different Handler's attached to a SimComponent.
Definition: simulation.cc:220
void Replicate_LOOP()
Replicate loop, iterates the life cycle _replicates times.
Definition: simulation.cc:506
void register_component_handlers()
Register all the Handlers of the currently active simulation components.
Definition: simulation.cc:229
void setCurrentReplicate(unsigned int repl)
Definition: simulation.h:193
StatServices _StatServices
Definition: simulation.h:102
void setReplicates(unsigned int repl)
Definition: simulation.h:195
std::string _modeArg
The run mode ('overwrite', 'run', 'skip', 'dryrun', 'create_init').
Definition: simulation.h:84
std::string _simElapsedTime
Definition: simulation.h:64
bool _do_postexec
Boolean set when a post-exec script must be executed.
Definition: simulation.h:96
void printLogHeader()
Definition: simulation.cc:734
bool run_event(string &name)
Execute one specific life cycle event, if present in the list of current events.
Definition: simulation.cc:675
unsigned int getCurrentReplicate()
Definition: simulation.h:194
The Service class used to manage the StatHandler objects.
Definition: statservices.h:50
list< StatRecBase * > getAllStats()
Definition: statservices.cc:389
Class to update the simulation components' state during a simulation.
Definition: updaterservices.h:64