Template for Observer to Write To Dataset

Header file: <libs/observers/write_to_dataset_observer.hpp> [source]

template<typename ParallelWriteData>
class DoWriteToDataset

Templated class for writing data from gridboxes and/or superdroplets to a dataset at the constant time intervals by calling the operator of the ParallelWriteData type at the start of each step.

Template Parameters:

ParallelWriteData – Type of function-like object to call during at_start_step.

Public Functions

inline explicit DoWriteToDataset(ParallelWriteData parallel_write)

Constructor for DoWriteToDataset.

Parameters:

parallel_write – Function-like object to call during at_start_step.

inline void before_timestepping(const viewd_constgbx d_gbxs) const

Placeholder for before timestepping functionality and to make class satisfy observer concept.

inline void after_timestepping() const

Placeholder for after timestepping functionality and to make class satisfy observer concept.

inline void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const

Calls the parallel_write function during at_start_step.

Parameters:
  • t_mdl – Current model time.

  • d_gbxs – View of gridboxes.

  • totsupers – View of superdroplets.

Private Members

ParallelWriteData parallel_write

Function-like object to call during at_start_step.

template<typename ParallelWriteData>
inline Observer auto WriteToDatasetObserver(const unsigned int interval, ParallelWriteData parallel_write)

Constructs an observer to write data from gridboxes and/or superdroplets to a dataset at a constant time interval according to the ParallelWriteData struct.

Template Parameters:

ParallelWriteData – Type of function-like object to call during at_start_step.

Parameters:
  • interval – Constant timestep interval.

  • parallel_write – Function-like object to call during at_start_step.

Returns:

Constructed observer.

template<typename Store, CollectDataForDataset<Store> CollectData>
inline Observer auto WriteToDatasetObserver(const unsigned int interval, const Dataset<Store> &dataset, CollectData collect_data)

Constructs an observer to write data from gridboxes to arrays in a dataset at a constant time interval using a range policy parallelism over the gridboxes.

Template Parameters:
  • Store – Type of store for dataset.

  • CollectData – Type of collect data function.

Parameters:
  • interval – Constant timestep interval.

  • datasetDataset to write data to.

  • collect_data – Function to collect data from gridboxes.

Returns:

Constructed observer.

template<typename Store, CollectDataForDataset<Store> CollectData, CollectRaggedCount<Store> RaggedCount>
inline Observer auto WriteToDatasetObserver(const unsigned int interval, const Dataset<Store> &dataset, CollectData collect_data, RaggedCount ragged_count)

Constructs an observer to write data from superdroplets to ragged arrays in a dataset at a constant time interval.

Template Parameters:
  • Store – Type of store for dataset.

  • CollectData – Type of collect data function.

  • RaggedCount – Type of collect ragged count function.

Parameters:
  • interval – Constant timestep interval.

  • datasetDataset to write data to.

  • collect_data – Function to collect data from superdroplets.

  • ragged_count – Function to collect ragged count for superdroplet data arrays(s).

Returns:

Constructed observer.