Superdrops Observer¶
Header file: <libs/observers/superdrops_observer.hpp>
[source]
-
template<typename Store, typename T, typename FunctorFunc>
CollectDataForDataset<Store> auto CollectSuperdropVariable(const Dataset<Store> &dataset, const FunctorFunc ffunc, const std::string_view name, const std::string_view units, const double scale_factor, const size_t maxchunk)¶ Constructs type sastifying the CollectDataForDataset concept for a given Store (using an instance of the GenericCollectData class) which writes a superdroplet variable to a ragged Xarray in a dataset.
Function return type writes a superdroplet varaible “name” to a ragged Xarray for a data type by collecting data according to the given FunctorFunc from within a Kokkos::parallel_for loop over superdroplets with a range policy.
- Template Parameters:
Store – The type of the dataset store.
T – The type of the superdroplet variable data.
FunctorFunc – The type of the functor function.
- Parameters:
dataset – The dataset to collect data from.
ffunc – The functor function to apply to collect data.
name – The name of the variable.
units – The units of the variable.
scale_factor – The scale factor of the variable.
maxchunk – The maximum chunk size.
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting superdroplet variable data.
-
struct SdgbxindexFunc¶
Functor operator to perform a copy of the sdgbxindex of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of sdgbxindex from unsigned long int (8 bytes) to unsigned int (uint32_t = 4 bytes)
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ sdgbxindex.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<uint32_t>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectSdgbxindex(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept for each superdroplets’ gridbox index data.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s gridbox index “sdgbxindex” as a 4 byte unsigned integer and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting sdgbxindex data.
-
struct SdIdFunc¶
Functor operator to perform a copy of the identity of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of sdid from unsigned long int (8 bytes) to unsigned int (uint32_t = 4 bytes)
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ identity.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<uint32_t>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectSdId(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset conceptfor each superdroplets’ identity.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s identity “sdId” as a 4 byte unsigned integer and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting sdId data.
-
struct XiFunc¶
Functor operator to perform a copy of the multiplicity of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of xi from size_t (architecture dependent usually 8 bytes) to 8 byte, long unsigned int (unit64_t).
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ multiplicity.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<uint64_t>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectXi(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept for each superdroplets’ multiplicity.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s multiplicity “xi” as a 8 byte unsigned integer and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting xi data.
-
struct RadiusFunc¶
Functor operator to perform a copy of the radius of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of radius from double (8 bytes) to float (4 bytes).
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ radius.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectRadius(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets’ radius.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s radius as a 4 byte floating point value and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting radius.
-
struct MsolFunc¶
Functor operator to perform a copy of the solute mass of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of msol from double (8 bytes) to float (4 bytes).
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ msol.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectMsol(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets’ solute mass.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s solute mass “msol” as a 4 byte floating point value and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting msol.
-
struct Coord3Func¶
Functor operator to perform a copy of the coord3 of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of coord3 from double (8 bytes) to float (4 bytes).
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ coord3.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectCoord3(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets’ coord3.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s coord3 as a 4 byte floating point value and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting coord3.
-
struct Coord1Func¶
Functor operator to perform a copy of the coord1 of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of coord1 from double (8 bytes) to float (4 bytes).
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ coord1.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectCoord1(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets’ coord1.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s coord1 as a 4 byte floating point value and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting coord1.
-
struct Coord2Func¶
Functor operator to perform a copy of the coord2 of each superdroplet to d_data within Kokkos::parallel_for loop over superdroplets with a range policy.
Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.
Note: Conversion of coord2 from double (8 bytes) to float (4 bytes).
- Param kk:
The index of the superdrop.
- Param d_gbxs:
The view of gridboxes on device.
- Param totsupers:
The view of superdroplets on device.
- Param d_data:
The mirror view buffer for the superdroplets’ coord2.
Public Functions
-
inline void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const¶
-
template<typename Store>
CollectDataForDataset<Store> auto CollectCoord2(const Dataset<Store> &dataset, const size_t maxchunk)¶ Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets’ coord2.
This function constructs a type satisfying the CollectDataForDataset to collect each superdroplet’s coord2 as a 4 byte floating point value and write it to a ragged array in a dataset.
- Template Parameters:
Store – The type of the dataset store.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
- Returns:
CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting coord2.
-
template<typename Store>
struct RaggedCount¶ A struct for collecting ragged count data.
This struct is responsible for collecting ragged count data, which represents the count of the number of super-droplets written during a write of a ragged array of superdroplet data.
- Template Parameters:
Store – The type of the dataset store.
Public Functions
-
inline RaggedCount(const Dataset<Store> &dataset, const size_t maxchunk)¶
Constructs a RaggedCount object.
Constructs a RaggedCount object with the specified dataset and maximum chunk size.
- Parameters:
dataset – The dataset to collect data from.
maxchunk – The maximum chunk size (number of elements).
-
inline void write_to_array(const Dataset<Store> &dataset, const viewd_constsupers totsupers) const¶
Writes the total number of super-droplets to the ragged count array in the dataset.
Note: static conversion from architecture dependent, usually 16 byte unsigned integer (size_t = uint64_t), to 8 byte unsigned integer (uint32_t).
- Parameters:
dataset – The dataset to write data to.
totsupers – The view of total super-droplets.
Private Members
-
std::shared_ptr<XarrayZarrArray<Store, uint32_t>> xzarr_ptr¶
pointer to raggedcount Xarray
-
template<typename Store>
inline Observer auto SuperdropsObserver(const unsigned int interval, const Dataset<Store> &dataset, const size_t maxchunk, CollectDataForDataset<Store> auto collect_data)¶ Constructs an observer which writes superdroplet variables (e.g. their attributes) from each superdroplet at start of each observation timestep to a ragged arrays with a constant observation timestep “interval”.
- Template Parameters:
Store – Type of store for dataset.
- Parameters:
interval – Observation timestep.
dataset – Dataset to write time data to.
maxchunk – Maximum number of elements in a chunk (1-D vector size).
collect_data – Object satisfying CollectDataForDataset for given Store to write superdroplet data, such as their attributes, to ragged arrays.
- Returns:
Observer An observer instance for writing thermodynamic variables from each gridbox.