Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
shamrock::patch::Patch Struct Reference

Patch object that contain generic patch information. More...

#include <shamrock/include/shamrock/patch/Patch.hpp>

+ Collaboration diagram for shamrock::patch::Patch:

Public Member Functions

bool operator== (const Patch &rhs) const
 check if patch equals
 
void set_err_mode ()
 Make the patch in error mode (patch struct that will be flushed on sync)
 
bool is_err_mode () const
 check if a patch is in error mode
 
std::array< u64, dimget_split_coord () const
 
std::array< Patch, splts_countget_split () const
 
template<class T >
std::tuple< sycl::vec< T, 3 >, sycl::vec< T, 3 > > convert_coord (sycl::vec< u64, 3 > src_offset, sycl::vec< T, 3 > divfact, sycl::vec< T, 3 > offset) const
 return an open interval of the corresponding patch coordinates given the div & offset
 
void override_from_coord (PatchCoord< dim > pc)
 
PatchCoord< dimget_coords () const
 
shammath::CoordRange< u64_3 > get_patch_range ()
 

Static Public Member Functions

static Patch merge_patch (std::array< Patch, splts_count > patches)
 
template<class T >
static bool is_in_patch_converted (sycl::vec< T, 3 > val, sycl::vec< T, 3 > min_val, sycl::vec< T, 3 > max_val)
 check if particle is in the asked range, given the output of @convert_coord
 

Public Attributes

u64 id_patch
 unique key that identify the patch
 
u64 pack_node_index
 this value mean "to pack with index xxx in the global patch table" and not "to pack with id_pach == xxx"
 
u64 load_value
 if synchronized contain the load value of the patch
 
std::array< u64, dimcoord_min
 
std::array< u64, dimcoord_max
 
u32 node_owner_id
 node rank owner of this patch
 

Static Public Attributes

static constexpr u32 dim = 3U
 dimension of the patch (only 3 so far)
 
static constexpr u32 splts_count = 1U << dim
 if a patch splits, this gives the number of childs
 
static constexpr u32 err_node_flag = u32_max
 value of node_owner_id if the patch is invalid
 

Detailed Description

Patch object that contain generic patch information.

Definition at line 33 of file Patch.hpp.

Member Function Documentation

◆ convert_coord()

template<class T >
std::tuple< sycl::vec< T, 3 >, sycl::vec< T, 3 > > shamrock::patch::Patch::convert_coord ( sycl::vec< u64, 3 >  src_offset,
sycl::vec< T, 3 >  divfact,
sycl::vec< T, 3 >  offset 
) const
inline

return an open interval of the corresponding patch coordinates given the div & offset

Template Parameters
Ttype to convert coordinates to
Parameters
divfact
offset
Returns
std::tuple<sycl::vec<T,3>,sycl::vec<T,3>>

Definition at line 199 of file Patch.hpp.

◆ get_coords()

PatchCoord< dim > shamrock::patch::Patch::get_coords ( ) const
inline

Definition at line 163 of file Patch.hpp.

◆ get_patch_range()

shammath::CoordRange< u64_3 > shamrock::patch::Patch::get_patch_range ( )
inline

Definition at line 165 of file Patch.hpp.

◆ get_split()

auto shamrock::patch::Patch::get_split ( ) const
inline

Definition at line 221 of file Patch.hpp.

◆ get_split_coord()

auto shamrock::patch::Patch::get_split_coord ( ) const
inline

Definition at line 217 of file Patch.hpp.

◆ is_err_mode()

bool shamrock::patch::Patch::is_err_mode ( ) const
inline

check if a patch is in error mode

Returns
true this patch is in error mode it should be flushed out
false this patch is not in error mode it is a valid one

Definition at line 119 of file Patch.hpp.

◆ is_in_patch_converted()

template<class T >
bool shamrock::patch::Patch::is_in_patch_converted ( sycl::vec< T, 3 >  val,
sycl::vec< T, 3 >  min_val,
sycl::vec< T, 3 >  max_val 
)
inlinestatic

check if particle is in the asked range, given the output of @convert_coord

Template Parameters
Tthe type of coordinate
Parameters
valthe value to check against
min_valthe min range given by convert_coord
max_valthe max range given by convert_coord
Returns
true is in the patch
false is not in the patch

Definition at line 210 of file Patch.hpp.

◆ merge_patch()

Patch shamrock::patch::Patch::merge_patch ( std::array< Patch, splts_count patches)
inlinestatic

Definition at line 253 of file Patch.hpp.

◆ operator==()

bool shamrock::patch::Patch::operator== ( const Patch rhs) const
inline

check if patch equals

Parameters
rhs
Returns
true
false

Definition at line 174 of file Patch.hpp.

◆ override_from_coord()

void shamrock::patch::Patch::override_from_coord ( PatchCoord< dim pc)
inline

Definition at line 154 of file Patch.hpp.

◆ set_err_mode()

void shamrock::patch::Patch::set_err_mode ( )
inline

Make the patch in error mode (patch struct that will be flushed on sync)

Definition at line 111 of file Patch.hpp.

Member Data Documentation

◆ coord_max

shamrock::patch::Patch::coord_max

Definition at line 91 of file Patch.hpp.

◆ coord_min

shamrock::patch::Patch::coord_min

Definition at line 90 of file Patch.hpp.

◆ dim

shamrock::patch::Patch::dim = 3U
staticconstexpr

dimension of the patch (only 3 so far)

Definition at line 50 of file Patch.hpp.

◆ err_node_flag

shamrock::patch::Patch::err_node_flag = u32_max
staticconstexpr

value of node_owner_id if the patch is invalid

Definition at line 56 of file Patch.hpp.

◆ id_patch

shamrock::patch::Patch::id_patch

unique key that identify the patch

Definition at line 86 of file Patch.hpp.

◆ load_value

shamrock::patch::Patch::load_value

if synchronized contain the load value of the patch

Definition at line 88 of file Patch.hpp.

◆ node_owner_id

shamrock::patch::Patch::node_owner_id

node rank owner of this patch

Definition at line 93 of file Patch.hpp.

◆ pack_node_index

shamrock::patch::Patch::pack_node_index

this value mean "to pack with index xxx in the global patch table" and not "to pack with id_pach == xxx"

Definition at line 87 of file Patch.hpp.

◆ splts_count

shamrock::patch::Patch::splts_count = 1U << dim
staticconstexpr

if a patch splits, this gives the number of childs

Definition at line 54 of file Patch.hpp.


The documentation for this struct was generated from the following file: