Constant Time Step Observers

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

template<ObsFuncs O>
struct ConstTstepObserver

Structure ConstTstepObserver represents a type that satisfies the concept of an observer with a constant timestep interval between observations at the start of each timestep.

Struct can be used to create an observer with a constant timestep and with observation functionality as determined by the ‘do_obs’ instance of the ObsFuncs type ‘O’.

Template Parameters:

O – Type that satisfies the ObsFuncs concept.

Public Functions

inline ConstTstepObserver(const unsigned int interval, const O o)

Construct a new ConstTstepObserver object.

Parameters:
  • interval – Timestep interval.

  • oObserver.

inline void before_timestepping(const viewd_constgbx d_gbxs) const

Perform operations before timestepping.

Calls before_timestepping function of do_obs.

Parameters:

d_gbxs – The view of gridboxes in device memory.

inline void after_timestepping() const

Perform operations after timestepping.

Calls after_timestepping function of do_obs.

inline unsigned int next_obs(const unsigned int t_mdl) const

Determine the next observation time.

Calculates the next observation time based on the current model time and this observer’s constant timestep between observations, ‘interval’.

Parameters:

t_mdl – The unsigned int parameter representing the current model timestep.

Returns:

Unsigned int for the next observation timestep.

inline bool on_step(const unsigned int t_mdl) const

Check if observer is “on step”.

Checks if the current model time is on an observation timestep.

Parameters:

t_mdl – The unsigned int parameter representing the current model timestep.

Returns:

True if the current timestep is an observation timestep, false otherwise.

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

Perform operation at the start of a step if at appropriate interval.

Calls at_start_step function of do_obs if the current model time is on an observation timestep.

Parameters:
  • t_mdl – The unsigned int parameter representing the current model time.

  • d_gbxs – The view of gridboxes in device memory.

  • totsupers – View of superdrops on device.

inline SDMMonitor auto get_sdmmonitor() const

Get monitor for SDM processes from observer.

Returns:

monitor ‘mo’ of the observer

Private Members

unsigned int interval

interval between observations.

O do_obs

Observation functionality.