Observers

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

template<typename Obs>
concept Observer
#include <observers.hpp>

Concept Observer is all types that have functions for timestepping and observations functions as constrained here.

tparam Obs:

The type that satisfies the Observer concept.

template<Observer Obs1, Observer Obs2, SDMMonitor SDMMo>
struct CombinedObserver

Structure CombinedObserver represents a new observer formed from combination of two Observers ‘a’ and ‘b’.

Template Parameters:
  • Obs1 – Type satisfying the Observer concept.

  • Obs2 – Type satisfying the Observer concept.

Public Functions

inline CombinedObserver(const Obs1 obs1, const Obs2 obs2, const SDMMo mo12)

Construct a new CombinedObserver object.

Parameters:
  • obs1 – First Observer.

  • obs2 – Second Observer.

  • mo12 – Combined Monitor from first and second observers.

inline void before_timestepping(const viewd_constgbx d_gbxs) const

Run before timestepping for combination of 2 observers.

Each observer is run sequentially.

Parameters:

d_gbxs – The view of gridboxes in device memory.

inline void after_timestepping() const

Run after timestepping for combination of 2 observers.

Each observer is run sequentially.

inline unsigned int next_obs(const unsigned int t_mdl) const

Determine the next observation time for combination of 2 observers.

For combination of 2 observers, the next observation time is the smaller out of the two possible.

Parameters:

t_mdl – The unsigned int parameter.

Returns:

unsigned int The next observation time.

inline bool on_step(const unsigned int t_mdl) const

Check if on_step = true for combination of 2 observers.

For combination of 2 observers, return on_step = true if either observer is on_step. Else return false.

Parameters:

t_mdl – The unsigned int parameter.

Returns:

bool True if on step, false otherwise.

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

Run at the start of a step for combination of 2 observers.

Each observer is run sequentially.

Parameters:
  • t_mdl – The unsigned int parameter.

  • 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

Obs1 a

First Observer.

Obs2 b

Second Observer.

SDMMo mo

Combination of First and Second Observers’ SDMMonitors

auto operator>>(const Observer auto obs1, const Observer auto obs2)

Overloaded operator >> to combine two Observers.

Parameters:
Returns:

CombinedObserver<Obs1, Obs2> Combined Observer.

struct NullObserver

Structure NullObserver does nothing at all.

NullObserver defined for completion of Observer’s Monoid Set.

Public Functions

inline void before_timestepping(const viewd_constgbx d_gbxs) const

No operations before timestepping.

Parameters:

d_gbxs – The view of gridboxes in device memory.

inline void after_timestepping() const

No perations after timestepping.

inline unsigned int next_obs(const unsigned int t_mdl) const

Next observation time is largest possible value.

Parameters:

t_mdl – Unsigned int for current timestep.

Returns:

The next observation time (maximum unsigned int).

inline bool on_step(const unsigned int t_mdl) const

Check if on step always returns false.

Null observer is never on_step.

Parameters:

t_mdl – The unsigned int parameter.

Returns:

bool, always false.

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

No operations at the start of a step.

Parameters:
  • t_mdl – The unsigned int for the current timestep.

  • d_gbxs – The view of gridboxes in device memory.

  • totsupers – View of superdrops on device.

inline SDMMonitor auto get_sdmmonitor() const

Get null monitor for SDM processes from observer.

Returns:

monitor ‘mo’ of the observer that does nothing

template<typename OFs>
concept ObsFuncs
#include <consttstep_observer.hpp>

Concept ObsFuncs for all types that can be called used by ConsttepObserver for observation functions.

Type in ConstTstepObserver obeying ObsFuncs makes it possible for ConstTstepObserver to obey Observer concept.

tparam O:

Type that satisfies the ObsFuncs concept.