core
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::decomp::BlockDecomposer< Dim > Class Template Reference

#include <block_decomposer.hpp>

Public Member Functions

 BlockDecomposer ()=default
 
 BlockDecomposer (std::size_t numBlocks, IVec< Dim > globalSize)
 
 BlockDecomposer (std::size_t numBlocks, IVec< Dim > globalSize, const std::vector< Real > &weights)
 
void init (std::size_t numBlocks, IVec< Dim > globalSize)
 Build the decomposition of a globalSize cell grid into numBlocks blocks (equal cell count).
 
void init (std::size_t numBlocks, IVec< Dim > globalSize, const std::vector< Real > &weights)
 Weighted ORB: balance the total weight per block instead of the cell count.
 
std::size_t numBlocks () const
 
const IVec< Dim > & globalSize () const
 
const std::vector< IVec< Dim > > & origins () const
 
const std::vector< IVec< Dim > > & sizes () const
 
Block< Dim > block (std::size_t b) const
 
int ownerOf (const IVec< Dim > &g) const
 Owning block index of a global cell coordinate. Caller must wrap into [0, globalSize) first.
 
void flattenTree (std::vector< int > &splitDim, std::vector< Index > &splitVal) const
 Flatten the implicit ORB tree into two parallel arrays for a device-callable ownerOf: for node i, splitDim[i] is the split axis (−1 ⇒ leaf), splitVal[i] the split coordinate (internal) or the block index (leaf); children sit at 2i+1 / 2i+2.
 
Index linearGlobal (const IVec< Dim > &g) const
 Global multi-index -> global linear index (x-fastest: I = x + y*nx + z*nx*ny).
 
IVec< Dim > multiGlobal (Index lin) const
 Global linear index -> global multi-index (inverse of linearGlobal).
 

Detailed Description

template<int Dim>
class peclet::core::decomp::BlockDecomposer< Dim >

Definition at line 28 of file block_decomposer.hpp.

Constructor & Destructor Documentation

◆ BlockDecomposer() [1/3]

template<int Dim>
peclet::core::decomp::BlockDecomposer< Dim >::BlockDecomposer ( )
default

◆ BlockDecomposer() [2/3]

◆ BlockDecomposer() [3/3]

template<int Dim>
peclet::core::decomp::BlockDecomposer< Dim >::BlockDecomposer ( std::size_t  numBlocks,
IVec< Dim >  globalSize,
const std::vector< Real > &  weights 
)
inline

Member Function Documentation

◆ init() [1/2]

template<int Dim>
void peclet::core::decomp::BlockDecomposer< Dim >::init ( std::size_t  numBlocks,
IVec< Dim >  globalSize 
)
inline

◆ init() [2/2]

template<int Dim>
void peclet::core::decomp::BlockDecomposer< Dim >::init ( std::size_t  numBlocks,
IVec< Dim >  globalSize,
const std::vector< Real > &  weights 
)
inline

Weighted ORB: balance the total weight per block instead of the cell count.

weights is a per-cell weight array over the global grid (size == product(globalSize), x-fastest). Each split is placed on the integer cell boundary whose cumulative weight is closest to the sub-block's target fraction. Reduces bit-exactly to the unweighted init() when all weights are equal.

Definition at line 47 of file block_decomposer.hpp.

References peclet::core::decomp::BlockDecomposer< Dim >::globalSize(), and peclet::core::decomp::BlockDecomposer< Dim >::numBlocks().

◆ numBlocks()

◆ globalSize()

◆ origins()

template<int Dim>
const std::vector< IVec< Dim > > & peclet::core::decomp::BlockDecomposer< Dim >::origins ( ) const
inline

Definition at line 60 of file block_decomposer.hpp.

◆ sizes()

template<int Dim>
const std::vector< IVec< Dim > > & peclet::core::decomp::BlockDecomposer< Dim >::sizes ( ) const
inline

Definition at line 61 of file block_decomposer.hpp.

◆ block()

template<int Dim>
Block< Dim > peclet::core::decomp::BlockDecomposer< Dim >::block ( std::size_t  b) const
inline

Definition at line 63 of file block_decomposer.hpp.

◆ ownerOf()

template<int Dim>
int peclet::core::decomp::BlockDecomposer< Dim >::ownerOf ( const IVec< Dim > &  g) const
inline

Owning block index of a global cell coordinate. Caller must wrap into [0, globalSize) first.

Definition at line 66 of file block_decomposer.hpp.

◆ flattenTree()

template<int Dim>
void peclet::core::decomp::BlockDecomposer< Dim >::flattenTree ( std::vector< int > &  splitDim,
std::vector< Index > &  splitVal 
) const
inline

Flatten the implicit ORB tree into two parallel arrays for a device-callable ownerOf: for node i, splitDim[i] is the split axis (−1 ⇒ leaf), splitVal[i] the split coordinate (internal) or the block index (leaf); children sit at 2i+1 / 2i+2.

Uploaded once by ParticleMigratorView so the per-particle owner lookup runs on the device (D1). Mirrors ownerOf exactly.

Definition at line 79 of file block_decomposer.hpp.

◆ linearGlobal()

template<int Dim>
Index peclet::core::decomp::BlockDecomposer< Dim >::linearGlobal ( const IVec< Dim > &  g) const
inline

Global multi-index -> global linear index (x-fastest: I = x + y*nx + z*nx*ny).

Definition at line 89 of file block_decomposer.hpp.

◆ multiGlobal()

template<int Dim>
IVec< Dim > peclet::core::decomp::BlockDecomposer< Dim >::multiGlobal ( Index  lin) const
inline

Global linear index -> global multi-index (inverse of linearGlobal).

Definition at line 99 of file block_decomposer.hpp.


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