![]() |
Shamrock 2025.10.0
Astrophysical Code
|
PatchDataLayer container class, the layout is described in patchdata_layout. More...
#include <shamrock/include/shamrock/patch/PatchDataLayer.hpp>
Public Types | |
| using | field_variant_t = var_t |
Public Member Functions | |
| PatchDataLayerLayout & | pdl () |
| const PatchDataLayerLayout & | pdl () const |
| std::shared_ptr< PatchDataLayerLayout > | get_layout_ptr () const |
| PatchDataLayer (const std::shared_ptr< PatchDataLayerLayout > &pdl) | |
| PatchDataLayer (const PatchDataLayer &other) | |
| PatchDataLayer copy constructor. | |
| PatchDataLayer (PatchDataLayer &&other) noexcept | |
| PatchDataLayer move constructor. | |
| PatchDataLayer & | operator= (PatchDataLayer &&other) noexcept |
| PatchDataLayer move assignment. | |
| PatchDataLayer & | operator= (const PatchDataLayer &other)=delete |
| template<class Functor> | |
| void | for_each_field_any (Functor &&func) |
| template<class Functor> | |
| void | for_each_field_any (Functor &&func) const |
| template<class Func> | |
| PatchDataLayer (const std::shared_ptr< PatchDataLayerLayout > &pdl, Func &&fct_init) | |
| PatchDataLayer | duplicate () |
| std::unique_ptr< PatchDataLayer > | duplicate_to_ptr () |
| void | extract_element (u32 pidx, PatchDataLayer &out_pdat) |
| extract particle at index pidx and insert it in the provided vectors | |
| void | extract_elements (const sham::DeviceBuffer< u32 > &idxs, PatchDataLayer &out_pdat) |
| void | keep_ids (sycl::buffer< u32 > &index_map, u32 len) |
| void | insert_elements (const PatchDataLayer &pdat) |
| template<class T> | |
| void | insert_elements_in_range (PatchDataLayer &pdat, T bmin, T bmax) |
| insert elements of pdat only if they are within the range | |
| void | resize (u32 new_obj_cnt) |
| void | reserve (u32 new_obj_cnt) |
| void | expand (u32 obj_cnt) |
| void | index_remap (sycl::buffer< u32 > &index_map, u32 len) |
| this function remaps the patchdatafield like so val[id] = val[index_map[id]] This function can be used to apply the result of a sort to the field | |
| void | index_remap_resize (sycl::buffer< u32 > &index_map, u32 len) |
| this function remaps the patchdatafield like so val[id] = val[index_map[id]] This function can be used to apply the result of a sort to the field | |
| void | index_remap_resize (sham::DeviceBuffer< u32 > &index_map, u32 len) |
| Same as index_remap_resize with a shamrock device buffer instead. | |
| void | keep_ids (sham::DeviceBuffer< u32 > &index_map, u32 len) |
| Same as keep_ids with a shamrock device buffer instead. | |
| void | remove_ids (const sham::DeviceBuffer< u32 > &indexes, u32 len) |
| remove some particles ids | |
| template<class Tvecbox> | |
| void | split_patchdata (std::array< std::reference_wrapper< PatchDataLayer >, 8 > pdats, std::array< Tvecbox, 8 > min_box, std::array< Tvecbox, 8 > max_box) |
| void | append_subset_to (const std::vector< u32 > &idxs, PatchDataLayer &pdat) |
| void | append_subset_to (sycl::buffer< u32 > &idxs_buf, u32 sz, PatchDataLayer &pdat) |
| void | append_subset_to (const sham::DeviceBuffer< u32 > &idxs_buf, u32 sz, PatchDataLayer &pdat) const |
| u32 | get_obj_cnt () const |
| get the number of objects (particles) stored in this layer | |
| u64 | memsize () |
| get the memory size in bytes used by all fields | |
| bool | is_empty () |
| void | synchronize_buf () |
| synchronize the host/device buffers of all fields | |
| void | overwrite (PatchDataLayer &pdat, u32 obj_cnt) |
| template<class T> | |
| bool | check_field_type (u32 idx) |
| template<class T> | |
| PatchDataField< T > & | get_field (u32 idx) |
| template<class T> | |
| const PatchDataField< T > & | get_field (u32 idx) const |
| template<class T> | |
| PatchDataField< T > & | get_field (const std::string &field_name) |
| template<class T> | |
| const PatchDataField< T > & | get_field (const std::string &field_name) const |
| template<class T> | |
| sham::DeviceBuffer< T > & | get_field_buf_ref (u32 idx) |
| template<class T, u32 nvar> | |
| PatchDataFieldSpan< T, nvar > | get_field_span (u32 idx) |
| returns a PatchDataFieldSpan of the field at index idx, with the given nvar value | |
| template<class T> | |
| PatchDataFieldSpan< T, shamrock::dynamic_nvar > | get_field_span_nvar_dynamic (u32 idx) |
| returns a PatchDataFieldSpan of the field at index idx, with a dynamic number of variables | |
| template<class T> | |
| PatchDataFieldSpan< T, shamrock::dynamic_nvar, shamrock::access_t_pointer > | get_field_pointer_span (u32 idx) |
| void | check_field_obj_cnt_match () |
| check that all contained field have the same obj cnt | |
| template<class T, class Functor> | |
| void | for_each_field (Functor &&func) |
| void | serialize_buf (shamalgs::SerializeHelper &serializer) |
| shamalgs::SerializeSize | serialize_buf_byte_size () |
| void | fields_raz () |
| bool | has_nan () |
| check whether any field contains a NaN value | |
| bool | has_inf () |
| check whether any field contains an infinite value | |
| bool | has_nan_or_inf () |
| check whether any field contains a NaN or infinite value | |
| template<class T> | |
| void | override_patch_field (std::string field_name, std::vector< T > &vec) |
| template<class T> | |
| std::vector< T > | fetch_data (std::string key) |
| Fetch data of a patchdata field into a std::vector. | |
| template<class T> | |
| void | split_patchdata (std::array< std::reference_wrapper< PatchDataLayer >, 8 > pdats, std::array< T, 8 > min_box, std::array< T, 8 > max_box) |
Static Public Member Functions | |
| static PatchDataLayer | mock_patchdata (u64 seed, u32 obj_cnt, const std::shared_ptr< PatchDataLayerLayout > &pdl) |
| static PatchDataLayer | deserialize_buf (shamalgs::SerializeHelper &serializer, const std::shared_ptr< PatchDataLayerLayout > &pdl) |
Friends | |
| bool | operator== (PatchDataLayer &p1, PatchDataLayer &p2) |
| Compare two layers field by field (defined in PatchDataLayer.cpp). | |
PatchDataLayer container class, the layout is described in patchdata_layout.
Definition at line 35 of file PatchDataLayer.hpp.
| using shamrock::patch::PatchDataLayer::field_variant_t = var_t |
Definition at line 71 of file PatchDataLayer.hpp.
|
inline |
Definition at line 78 of file PatchDataLayer.hpp.
| shamrock::patch::PatchDataLayer::PatchDataLayer | ( | const PatchDataLayer & | other | ) |
PatchDataLayer copy constructor.
Defined out of line: visiting every FieldVariant alternative instantiates the copy of all PatchDataField types, which is costly to compile in every includer.
| other |
Definition at line 50 of file PatchDataLayer.cpp.
|
inlinenoexcept |
|
inline |
Definition at line 135 of file PatchDataLayer.hpp.
| void shamrock::patch::PatchDataLayer::append_subset_to | ( | const sham::DeviceBuffer< u32 > & | idxs_buf, |
| u32 | sz, | ||
| PatchDataLayer & | pdat ) const |
Definition at line 282 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::append_subset_to | ( | const std::vector< u32 > & | idxs, |
| PatchDataLayer & | pdat ) |
Definition at line 260 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::append_subset_to | ( | sycl::buffer< u32 > & | idxs_buf, |
| u32 | sz, | ||
| PatchDataLayer & | pdat ) |
Definition at line 237 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::check_field_obj_cnt_match | ( | ) |
check that all contained field have the same obj cnt
Definition at line 381 of file PatchDataLayer.cpp.
|
inline |
Definition at line 255 of file PatchDataLayer.hpp.
|
static |
Definition at line 323 of file PatchDataLayer.cpp.
|
inline |
Definition at line 143 of file PatchDataLayer.hpp.
|
inline |
Definition at line 148 of file PatchDataLayer.hpp.
| void shamrock::patch::PatchDataLayer::expand | ( | u32 | obj_cnt | ) |
Definition at line 181 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::extract_element | ( | u32 | pidx, |
| PatchDataLayer & | out_pdat ) |
extract particle at index pidx and insert it in the provided vectors
| pidx | |
| out_pdat |
Definition at line 73 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::extract_elements | ( | const sham::DeviceBuffer< u32 > & | idxs, |
| PatchDataLayer & | out_pdat ) |
Definition at line 95 of file PatchDataLayer.cpp.
|
inline |
Fetch data of a patchdata field into a std::vector.
| T |
| key | |
| pdat |
Definition at line 450 of file PatchDataLayer.hpp.
| void shamrock::patch::PatchDataLayer::fields_raz | ( | ) |
Definition at line 340 of file PatchDataLayer.cpp.
|
inline |
Definition at line 379 of file PatchDataLayer.hpp.
|
inline |
Definition at line 117 of file PatchDataLayer.hpp.
|
inline |
Definition at line 126 of file PatchDataLayer.hpp.
|
inline |
Definition at line 308 of file PatchDataLayer.hpp.
|
inline |
Definition at line 313 of file PatchDataLayer.hpp.
|
inline |
Definition at line 268 of file PatchDataLayer.hpp.
|
inline |
Definition at line 288 of file PatchDataLayer.hpp.
|
inline |
Definition at line 318 of file PatchDataLayer.hpp.
|
inline |
Definition at line 362 of file PatchDataLayer.hpp.
|
inline |
returns a PatchDataFieldSpan of the field at index idx, with the given nvar value
| idx | the index of the field |
Definition at line 344 of file PatchDataLayer.hpp.
|
inline |
returns a PatchDataFieldSpan of the field at index idx, with a dynamic number of variables
| idx | the index of the field |
Definition at line 356 of file PatchDataLayer.hpp.
|
inline |
Definition at line 76 of file PatchDataLayer.hpp.
| u32 shamrock::patch::PatchDataLayer::get_obj_cnt | ( | ) | const |
get the number of objects (particles) stored in this layer
Definition at line 346 of file PatchDataLayer.cpp.
| bool shamrock::patch::PatchDataLayer::has_inf | ( | ) |
check whether any field contains an infinite value
Definition at line 407 of file PatchDataLayer.cpp.
| bool shamrock::patch::PatchDataLayer::has_nan | ( | ) |
check whether any field contains a NaN value
Definition at line 392 of file PatchDataLayer.cpp.
| bool shamrock::patch::PatchDataLayer::has_nan_or_inf | ( | ) |
check whether any field contains a NaN or infinite value
Definition at line 422 of file PatchDataLayer.cpp.
this function remaps the patchdatafield like so val[id] = val[index_map[id]] This function can be used to apply the result of a sort to the field
| index_map | |
| len | the length of the map (must match with the current count) |
Definition at line 190 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::index_remap_resize | ( | sham::DeviceBuffer< u32 > & | index_map, |
| u32 | len ) |
Same as index_remap_resize with a shamrock device buffer instead.
Definition at line 213 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::index_remap_resize | ( | sycl::buffer< u32 > & | index_map, |
| u32 | len ) |
this function remaps the patchdatafield like so val[id] = val[index_map[id]] This function can be used to apply the result of a sort to the field
| index_map | |
| len | the length of the map |
Definition at line 202 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::insert_elements | ( | const PatchDataLayer & | pdat | ) |
Definition at line 118 of file PatchDataLayer.cpp.
|
inline |
insert elements of pdat only if they are within the range
| T |
| pdat | |
| bmin | |
| bmax |
Definition at line 484 of file PatchDataLayer.hpp.
|
inline |
Definition at line 247 of file PatchDataLayer.hpp.
| void shamrock::patch::PatchDataLayer::keep_ids | ( | sham::DeviceBuffer< u32 > & | index_map, |
| u32 | len ) |
Same as keep_ids with a shamrock device buffer instead.
Definition at line 225 of file PatchDataLayer.cpp.
Definition at line 221 of file PatchDataLayer.cpp.
| u64 shamrock::patch::PatchDataLayer::memsize | ( | ) |
get the memory size in bytes used by all fields
Definition at line 360 of file PatchDataLayer.cpp.
|
static |
Definition at line 33 of file PatchDataLayer.cpp.
|
inlinenoexcept |
|
inline |
| T |
| field_name | |
| vec |
Definition at line 432 of file PatchDataLayer.hpp.
| void shamrock::patch::PatchDataLayer::overwrite | ( | PatchDataLayer & | pdat, |
| u32 | obj_cnt ) |
Definition at line 141 of file PatchDataLayer.cpp.
|
inline |
Definition at line 73 of file PatchDataLayer.hpp.
|
inline |
Definition at line 74 of file PatchDataLayer.hpp.
| void shamrock::patch::PatchDataLayer::remove_ids | ( | const sham::DeviceBuffer< u32 > & | indexes, |
| u32 | len ) |
remove some particles ids
Definition at line 229 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::reserve | ( | u32 | new_obj_cnt | ) |
Definition at line 172 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::resize | ( | u32 | new_obj_cnt | ) |
Definition at line 163 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::serialize_buf | ( | shamalgs::SerializeHelper & | serializer | ) |
Definition at line 308 of file PatchDataLayer.cpp.
| shamalgs::SerializeSize shamrock::patch::PatchDataLayer::serialize_buf_byte_size | ( | ) |
Definition at line 315 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::split_patchdata | ( | std::array< std::reference_wrapper< PatchDataLayer >, 8 > | pdats, |
| std::array< T, 8 > | min_box, | ||
| std::array< T, 8 > | max_box ) |
Definition at line 438 of file PatchDataLayer.cpp.
| void shamrock::patch::PatchDataLayer::synchronize_buf | ( | ) |
synchronize the host/device buffers of all fields
Definition at line 373 of file PatchDataLayer.cpp.
|
friend |
Compare two layers field by field (defined in PatchDataLayer.cpp).
Definition at line 552 of file PatchDataLayer.cpp.