Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Utopia::DataIO::Default::DefaultExecutionProcess Struct Reference

Functor representing what is considered the most widely used execution process for writing data. More...

#include <defaults.hh>

Public Member Functions

template<class Datamanager , class Model >
void operator() (Datamanager &dm, Model &m)
 Call operator for executing the execution process.
 

Detailed Description

Functor representing what is considered the most widely used execution process for writing data.

First runs over all triggers, and checks whether new datasets need to be built. If yes, the builder in the respective dataset is called.

Member Function Documentation

◆ operator()()

template<class Datamanager , class Model >
void Utopia::DataIO::Default::DefaultExecutionProcess::operator() ( Datamanager &  dm,
Model m 
)
inline

Call operator for executing the execution process.

Template Parameters
DatamanagerThe DataManager; automatically determined
ModelThe Model; automatically determined
Parameters
dmReference to a DataManager instance
mReference to a model instance
97 {
98 auto& tasks = dm.get_tasks();
99 for (auto& taskpair : tasks)
100 {
101 // TODO Instead of nullptr-check, check boolean?!
102 if (taskpair.second->base_group == nullptr)
103 {
104 taskpair.second->base_group =
105 taskpair.second->build_basegroup(m.get_hdfgrp());
106 }
107 }
108 for (auto& [name, trigger] : dm.get_triggers())
109 {
110 if ((*trigger)(m))
111 {
112 for (auto& taskname : dm.get_trigger_task_map()[name])
113 {
114 // using this ref variable avoids recomputing
115 // 'taskname''s hash all the time, should give minor
116 // performance improvement
117 auto& task = tasks[taskname];
118
119 task->active_dataset =
120 task->build_dataset(
121 task->base_group, m);
122
123 if (task->write_attribute_basegroup)
124 {
125 task->write_attribute_basegroup(
126 task->base_group, m);
127 }
128 }
129 }
130 }
131
132 for (auto& [name, decider] : dm.get_deciders())
133 {
134 if ((*decider)(m))
135 {
136 for (auto& taskname : dm.get_decider_task_map()[name])
137 {
138 auto& task = tasks[taskname];
139
140 task->write_data(task->active_dataset,
141 m);
142 if (task->write_attribute_active_dataset)
143 {
144 task->write_attribute_active_dataset(
145 task->active_dataset, m);
146 }
147 }
148 }
149 }
150 }
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213

The documentation for this struct was generated from the following file: