Gbxindex Observer

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

struct GbxIndexFunctor

Functor for copying gridbox indexes to a view in device memory.

Public Functions

inline GbxIndexFunctor(const viewd_constgbx d_gbxs, Buffer<uint32_t>::mirrorviewd_buffer d_data)

Constructor for GbxIndexFunctor.

Parameters:
  • d_gbxs – View of gridboxes on device.

  • d_data – Mirror view on device of memory to copy gridbox indexes into.

inline void operator()(const size_t ii) const

Operator is functor for within a Kokkos::parallel_for loop.

Copies a gridbox’s gbxindex to d_data view (for each gridbox in parallel).

Parameters:

ii – index for the gridbox in the d_gbxs and d_data views.

Public Members

viewd_constgbx d_gbxs

View of gridboxes.

Buffer<uint32_t>::mirrorviewd_buffer d_data

Mirror view on device for gridbox indexes.

template<typename Store>
class GbxindexObserver

Public Functions

inline GbxindexObserver(Dataset<Store> &dataset, const size_t maxchunk, const size_t ngbxs)

Constructor for GbxindexObserver.

Parameters:
  • datasetDataset to write gridbox index data to.

  • maxchunk – Maximum number of elements in a chunk (1-D vector size).

  • ngbxs – Number of gridboxes in final array.

inline ~GbxindexObserver()
inline void before_timestepping(const viewd_constgbx d_gbxs) const

Obsevers the gridboxes’ gbxindexes before timestepping.

Write the gbxindex of every gridbox in d_gbxs to the gbxindex array in the dataset and assert the size of the gbxindex dimension in the dataset is correct.

Parameters:

d_gbxs – View of gridboxes on device.

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

Placeholder for functionality at the start of each timestep and to make class satisfy observer concept.

Parameters:
  • t_mdl – Current model timestep.

  • d_gbxs – View of gridboxes on device.

  • totsupers – View of superdrops on device.

inline unsigned int next_obs(const unsigned int t_mdl) const

Returns the timestep of the next observation.

No observation during timestepping so function returns the largest possible timestep (largest unsigned integer).

Parameters:

t_mdl – Current model timestep.

Returns:

Next observation timestep.

inline bool on_step(const unsigned int t_mdl) const

Checks if the current timestep is an observation timestep.

No observation during timestepping so function always returns false.

Parameters:

t_mdl – Current model timestep.

Returns:

boolean, false.

Private Functions

inline Buffer<uint32_t>::viewh_buffer collect_gbxindexes(const viewd_constgbx d_gbxs) const

Collects gridbox indexes from g_gbxs into a host memory view.

Parameters:

d_gbxs – View of the gridboxes in device memory.

Returns:

View in host memory of gridbox index of every gridbox in d_gbxs.

Private Members

Dataset<Store> &dataset

Dataset to write gridbox index data to.

std::shared_ptr<XarrayZarrArray<Store, uint32_t>> xzarr_ptr

Pointer to gridbox index array in dataset.