Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | List of all members
shamrock::ReattributeDataUtility Class Reference

Utility class used to move the objects between patches. More...

#include <shamrock/include/shamrock/scheduler/ReattributeDataUtility.hpp>

Public Member Functions

 ReattributeDataUtility (PatchScheduler &sched)
 Constructor.
 
template<class T >
shambase::DistributedData< sycl::buffer< u64 > > compute_new_pid (SerialPatchTree< T > &sptree, u32 ipos)
 Computes the new patch owner IDs for the objects in the patches based on their position in space.
 
shambase::DistributedDataShared< shamrock::patch::PatchDataLayerextract_elements (shambase::DistributedData< sycl::buffer< u64 > > new_pid)
 Extracts elements that do not belong to a patch from the patch data based on the new patch IDs.
 
template<class T >
void reatribute_patch_objects (SerialPatchTree< T > &sptree, std::string position_field)
 Reattribute objects based on a given position field.
 

Detailed Description

Utility class used to move the objects between patches.

The class is used to recompute the ownership of the objects in the patches based on their position in space.

Definition at line 38 of file ReattributeDataUtility.hpp.

Constructor & Destructor Documentation

◆ ReattributeDataUtility()

shamrock::ReattributeDataUtility::ReattributeDataUtility ( PatchScheduler sched)
inline

Constructor.

Parameters
schedThe PatchScheduler to work on.

Definition at line 47 of file ReattributeDataUtility.hpp.

Member Function Documentation

◆ compute_new_pid()

template<class T >
shambase::DistributedData< sycl::buffer< u64 > > shamrock::ReattributeDataUtility::compute_new_pid ( SerialPatchTree< T > &  sptree,
u32  ipos 
)
inline

Computes the new patch owner IDs for the objects in the patches based on their position in space.

Parameters
sptreeThe SerialPatchTree used to compute the patch owners.
iposThe index of the position field in the PatchData.
Returns
A DistributedData containing the new patch IDs for each patch.
Exceptions
std::runtime_errorIf a new ID could not be computed for an object (out of bound).

Definition at line 62 of file ReattributeDataUtility.hpp.

+ Here is the call graph for this function:

◆ extract_elements()

shambase::DistributedDataShared< shamrock::patch::PatchDataLayer > shamrock::ReattributeDataUtility::extract_elements ( shambase::DistributedData< sycl::buffer< u64 > >  new_pid)
inline

Extracts elements that do not belong to a patch from the patch data based on the new patch IDs.

This function iterates over the patch data and extracts elements that need to be moved to a different patch. It uses the new patch IDs to determine which elements to extract and where to move them.

Parameters
new_pidA distributed data object containing the new patch IDs.
Returns
A shared distributed data object containing the extracted patch data.

Definition at line 116 of file ReattributeDataUtility.hpp.

+ Here is the call graph for this function:

◆ reatribute_patch_objects()

template<class T >
void shamrock::ReattributeDataUtility::reatribute_patch_objects ( SerialPatchTree< T > &  sptree,
std::string  position_field 
)
inline

Reattribute objects based on a given position field.

This function computes new patch IDs for each object in the PatchData, extracts elements to be exchanged between patches, and then updates the patch data with the received elements.

Parameters
sptreethe SerialPatchTree
position_fieldthe name of the main field used to determine the new patch IDs

Definition at line 216 of file ReattributeDataUtility.hpp.

+ Here is the call graph for this function:

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