1#ifndef UTOPIA_MODELS_DUMMY_HH
2#define UTOPIA_MODELS_DUMMY_HH
25 using Data = std::vector<double>;
49 template <
class ParentModel>
51 const std::string& name,
76 auto gen = std::bind(std::uniform_real_distribution<>(), *this->
_rng);
77 std::generate(
_bc.begin(),
_bc.end(),
gen);
80 [](
const auto a,
const auto b) { return a + b; });
91 _monitor.set_by_func(
"state_mean", [
this](){
92 const double sum = std::accumulate(this->_state.begin(),
95 return sum / this->_state.size();
104 [](
auto& value) { return value; });
Base class interface for Models using the CRT Pattern.
Definition model.hh:112
Monitor _monitor
The monitor.
Definition model.hh:188
typename ModelTypes::DataSet DataSet
Data type that is used for storing data.
Definition model.hh:125
const std::shared_ptr< RNG > _rng
The RNG shared between models.
Definition model.hh:161
std::shared_ptr< DataSet > create_dset(const std::string name, const std::shared_ptr< DataGroup > &hdfgrp, std::vector< hsize_t > add_write_shape, const std::size_t compression_level=1, const std::vector< hsize_t > chunksize={})
Create a new dataset within the given group.
Definition model.hh:752
Dummy model with simple update rule.
Definition dummy.hh:19
std::vector< double > Data
The data type to use for _state and _bc members.
Definition dummy.hh:25
Data _state
The current state of the model.
Definition dummy.hh:32
std::shared_ptr< DataSet > _dset_state
Dataset to write the state to.
Definition dummy.hh:38
void perform_step()
Iterate by one time step.
Definition dummy.hh:73
void monitor()
Monitor model information.
Definition dummy.hh:88
Base::DataSet DataSet
Definition dummy.hh:28
Data _bc
The boundary conditions of the model.
Definition dummy.hh:35
void write_data()
Write data into a dataset that corresponds to the current step.
Definition dummy.hh:101
Model< Dummy, DummyTypes > Base
The base model class.
Definition dummy.hh:22
Dummy(const std::string &name, const ParentModel &parent_model, const Data &initial_state, const DataIO::Config &custom_cfg={})
Construct the dummy model with an initial state.
Definition dummy.hh:50
OutputIt transform(const Utopia::ExecPolicy policy, InputIt first1, InputIt last1, OutputIt d_first, UnaryOperation unary_op)
Apply a unary operator to a range and store the result in a new range.
Definition parallel.hh:368
YAML::Node Config
Type of a variadic dictionary-like data structure used throughout Utopia.
Definition types.hh:71
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
Wrapper struct for defining model class data types.
Definition model.hh:92