BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
15 #ifndef CORE_SCHEDULER_H_
16 #define CORE_SCHEDULER_H_
22 #include <unordered_map>
36 class SimulationBackup;
37 class VisualizationAdaptor;
40 class MechanicalForcesOp;
47 using Clock = std::chrono::high_resolution_clock;
67 void SimulateUntil(
const std::function<
bool()>& exit_condition);
93 std::vector<Operation*>
GetOps(
const std::string& name);
177 template <
typename Lambda>
179 Lambda lambda)
const {
180 for (
auto* op : operations) {
186 template <
typename Lambda>
193 template <
typename Lambda>
227 #endif // CORE_SCHEDULER_H_
void Backup()
Backup the simulation. Backup interval based on Param::backup_interval
void Initialize(uint64_t steps=0)
ProgressBar * progress_bar_
void FinalizeInitialization() const
void ForEachOperation(Lambda lambda)
Runs a lambda for each operation that is executed in the Execute() call.
bool Restore(uint64_t *steps)
std::vector< Operation * > post_scheduled_ops_
TimingAggregator op_times_
Tracks operations' execution times.
std::vector< std::string > protected_op_names_
List of operations that cannot be affected by the user.
TimingAggregator * GetOpTimes()
std::chrono::time_point< Clock > last_backup_
std::vector< Operation * > scheduled_agent_ops_
List of operations will be executed on all agents.
void SimulateUntil(const std::function< bool()> &exit_condition)
std::vector< Operation * > unschedule_ops_
List of operations that are to be removed in the upcoming timestep.
SimulationBackup * backup_
void RunPostScheduledOps() const
std::vector< std::string > GetListOfScheduledStandaloneOps() const
Return a list of StandAloneOperations that are scheduled.
void PrintInfo(std::ostream &out) const
void RunPreScheduledOps() const
The class that bridges the simulation code with ROOT Visualization.
void RunAgentOps(Functor< bool, Agent * > *filter) const
std::vector< Operation * > scheduled_standalone_ops_
List of operations will be executed as a stand-alone operation.
void ForEachScheduledOperation(Lambda lambda)
Runs a lambda for each scheduled operation.
friend void RunAgentsTest(Param::MappedDataArrayMode, uint64_t, bool, bool)
void Simulate(uint64_t steps)
Simulate steps number of iterations.
real_t GetSimulatedTime() const
void ForEachOperationInList(const std::vector< Operation * > &operations, Lambda lambda) const
Runs a lambda for each operation in the specified list of operations.
const std::vector< Functor< bool, Agent * > * > & GetAgentFilters() const
void SetAgentFilters(const std::vector< Functor< bool, Agent * > * > &filters)
std::vector< Operation * > all_ops_
void UpdateSimulatedTime()
std::chrono::high_resolution_clock Clock
std::vector< std::string > GetListOfScheduledAgentOps() const
Return a list of AgentOperations that are scheduled.
RootAdaptor * GetRootVisualization()
std::vector< Functor< bool, Agent * > * > agent_filters_
std::vector< Operation * > pre_scheduled_ops_
std::vector< Operation * > GetOps(const std::string &name)
This class implements a progress bar that can be used to track the progress of a simulation.
std::vector< std::pair< OpType, Operation * > > schedule_ops_
List of operations that are to be added in the upcoming timestep.
RootAdaptor * root_visualization_
void ScheduleOp(Operation *op, OpType op_type=OpType::kSchedule)
void UnscheduleOp(Operation *op)
uint64_t GetSimulatedSteps() const
This function returns the number of simulated steps (=iterations).