BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
14 #ifndef CORE_SIMULATION_H_
15 #define CORE_SIMULATION_H_
30 class ResourceManager;
35 class ExecutionContext;
36 class CommandLineOptions;
37 class AgentUidGenerator;
40 class ParaviewAdaptorTest;
42 namespace experimental {
60 const std::vector<std::string>& config_files = {});
63 const std::vector<std::string>& config_files = {});
71 explicit Simulation(
const std::string& simulation_name,
72 const std::vector<std::string>& config_files = {});
75 const std::function<
void(
Param*)>& set_param,
76 const std::vector<std::string>& config_files = {});
79 const std::function<
void(
Param*)>& set_param,
80 const std::vector<std::string>& config_files = {});
83 const std::function<
void(
Param*)>& set_param,
84 const std::vector<std::string>& config_files = {});
125 void SetAllExecCtxts(
const std::vector<ExecutionContext*>& exec_ctxts);
189 const std::function<
void(
Param*)>& set_param,
190 const std::vector<std::string>& config_files);
197 const std::function<
void(
Param*)>& set_param,
198 const std::vector<std::string>& ctor_config);
201 const std::vector<std::string>& cli_configs);
219 #endif // CORE_SIMULATION_H_
void InitializeUniqueName(const std::string &simulation_name)
This function initializes unique_name_
void InitializeRuntimeParams(CommandLineOptions *clo, const std::function< void(Param *)> &set_param, const std::vector< std::string > &ctor_config)
This function parses command line parameters and the configuration file.
Environment * environment_
void Initialize(CommandLineOptions *clo, const std::function< void(Param *)> &set_param, const std::vector< std::string > &config_files)
Initialize Simulation.
experimental::TimeSeries * GetTimeSeries()
void Simulate(uint64_t steps)
std::string output_dir_
cached value where unique_name_ is appended to Param::output_dir
MemoryManager * mem_mgr_
BioDynaMo memory manager. If nullptr, default allocator will be used.
void InitializeMembers()
Initialize data members that have a dependency on Simulation.
const std::string & GetUniqueName() const
Returns the name of the simulation.
void Activate()
Activates this simulation.
Random * GetRandom()
Returns a thread local random number generator.
BDM_CLASS_DEF_NV(Simulation, 1)
std::vector< ExecutionContext * > exec_ctxt_
Execution Context for each thread.
bool is_gpu_environment_initialized_
void SetEnvironment(Environment *env)
std::vector< Random * > random_
random number generator for each thread
Scheduler * GetScheduler()
uint64_t id_
This id is unique for each simulation within the same process.
std::vector< Random * > & GetAllRandom()
Returns all thread local random number generator.
experimental::TimeSeries * time_series_
Collects time series information during the simulation.
MemoryManager * GetMemoryManager()
ResourceManager * GetResourceManager()
Returns the ResourceManager instance.
void InitializeOutputDir()
Initializes output_dir_ and creates dir if it does not exist.
static std::atomic< uint64_t > counter_
Number of simulations in this process.
int64_t dtor_ts_
Timestep when destructor was called.
void SetAllExecCtxts(const std::vector< ExecutionContext * > &exec_ctxts)
void Restore(Simulation &&restored)
OpenCLState * GetOpenCLState()
Return helper class for OpenCL environment.
std::string command_line_parameter_str_
AgentUidGenerator * GetAgentUidGenerator()
This class generates unique ids for agents.
Simulation(TRootIOCtor *p)
friend std::ostream & operator<<(std::ostream &os, Simulation &sim)
static Simulation * active_
Currently active simulation.
int64_t ctor_ts_
Timestep when constructor was called.
friend class DiffusionTest_CopyOldData_Test
ExecutionContext * GetExecutionContext()
Returns a thread local execution context.
Environment * GetEnvironment()
void ReplaceScheduler(Scheduler *scheduler)
friend ParaviewAdaptorTest
const Param * GetParam() const
Returns the simulation parameters.
void SetResourceManager(ResourceManager *rm)
std::vector< ExecutionContext * > & GetAllExecCtxts()
Returns all thread local execution contexts.
void LoadConfigFiles(const std::vector< std::string > &ctor_configs, const std::vector< std::string > &cli_configs)
static Simulation * GetActive()
This function returns the currently active Simulation simulation.
Class to contain and parse command line options.
const std::string & GetOutputDir() const
Returns the output directory for this specific simulation.
AgentUidGenerator * agent_uid_generator_