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

#include <leaf_halo.hpp>

Public Types

using DO = DistributedOctree< Dim, Bits >
 
using M = typename DO::M
 
using Coord = typename DO::Coord
 
using CoordArr = std::array< Coord, Dim >
 

Public Member Functions

void init (DO &d)
 
Index numLocal () const
 
Index numGhosts () const
 
Index extendedSize () const
 
MPI_Comm comm () const
 
bool wrap (std::array< long, Dim > &g) const
 Wrap an unbounded global fine probe into the domain (in place); false = the probe exits a non-periodic axis (no neighbour there).
 
Index resolve (const CoordArr &gc)
 Resolve a wrapped global fine coordinate to an extended slot: [0, nLocal) = the covering LOCAL leaf; [nLocal, nLocal+nGhost) = ghost slot; kPending = unknown remote (queued as a miss — run the collective resolveMisses() and repeat the build pass).
 
Index resolveGlobal (std::array< long, Dim > g)
 Wrap + resolve from unbounded long coords; kNone on a non-periodic exit.
 
Index lookup (const CoordArr &gc) const
 Const lookup against the FINALIZED registry (no miss registration): wrapped probe → local leaf or cached ghost slot; throws on an unknown remote coord — the caller's probe set must be a subset of what the registry was built with (e.g.
 
Index lookupGlobal (std::array< long, Dim > g) const
 
long resolveMisses ()
 COLLECTIVE (all ranks together, misses or not): one owner coverLevels round resolving every queued miss to a canonical ghost slot (or a newly-discovered one).
 
int level (Index slot) const
 Covering-leaf level of an extended slot (local octree level convention: 0 = finest cell).
 
const CoordArrghostCoord (Index g) const
 Global fine anchor (lo corner) of ghost g in [0, nGhosts) — for SDF sampling / multi-hop probe construction by the builders.
 
void finalize ()
 Freeze the ghost set and establish the owner↔ghost value topology (one NBX round; the owner-side locateGlobal happens here, once — never per exchange).
 
const DO::GatherHaloTopology & topology () const
 
void exchangeHost (std::vector< double > &x, int tag=45) const
 Host exchange: refresh x[nLocal, nLocal+nGhost) from the owners (x sized extendedSize()).
 

Static Public Attributes

static constexpr Index kPending = -2
 resolve(): queued as a miss (call resolveMisses)
 
static constexpr Index kNone = -1
 resolveGlobal(): exits a non-periodic axis
 

Detailed Description

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
class peclet::core::amr::LeafHalo< Dim, Bits >

Definition at line 62 of file leaf_halo.hpp.

Member Typedef Documentation

◆ DO

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::amr::LeafHalo< Dim, Bits >::DO = DistributedOctree<Dim, Bits>

Definition at line 64 of file leaf_halo.hpp.

◆ M

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::amr::LeafHalo< Dim, Bits >::M = typename DO::M

Definition at line 65 of file leaf_halo.hpp.

◆ Coord

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::amr::LeafHalo< Dim, Bits >::Coord = typename DO::Coord

Definition at line 66 of file leaf_halo.hpp.

◆ CoordArr

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::amr::LeafHalo< Dim, Bits >::CoordArr = std::array<Coord, Dim>

Definition at line 67 of file leaf_halo.hpp.

Member Function Documentation

◆ init()

◆ numLocal()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::numLocal ( ) const
inline

Definition at line 89 of file leaf_halo.hpp.

◆ numGhosts()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::numGhosts ( ) const
inline

◆ extendedSize()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::extendedSize ( ) const
inline

◆ comm()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
MPI_Comm peclet::core::amr::LeafHalo< Dim, Bits >::comm ( ) const
inline

◆ wrap()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
bool peclet::core::amr::LeafHalo< Dim, Bits >::wrap ( std::array< long, Dim > &  g) const
inline

Wrap an unbounded global fine probe into the domain (in place); false = the probe exits a non-periodic axis (no neighbour there).

Definition at line 96 of file leaf_halo.hpp.

References peclet::core::amr::transferFieldGradients().

Referenced by peclet::core::amr::LeafHalo< Dim, Bits >::lookupGlobal(), and peclet::core::amr::LeafHalo< Dim, Bits >::resolveGlobal().

◆ resolve()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::resolve ( const CoordArr gc)
inline

Resolve a wrapped global fine coordinate to an extended slot: [0, nLocal) = the covering LOCAL leaf; [nLocal, nLocal+nGhost) = ghost slot; kPending = unknown remote (queued as a miss — run the collective resolveMisses() and repeat the build pass).

Definition at line 111 of file leaf_halo.hpp.

References peclet::core::amr::BlockOctree< Dim, Bits >::find(), peclet::core::amr::LeafHalo< Dim, Bits >::kPending, peclet::core::amr::DistributedOctree< Dim, Bits >::local(), and peclet::core::amr::transferFieldGradients().

Referenced by peclet::core::amr::LeafHalo< Dim, Bits >::resolveGlobal().

◆ resolveGlobal()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::resolveGlobal ( std::array< long, Dim >  g)
inline

◆ lookup()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::lookup ( const CoordArr gc) const
inline

Const lookup against the FINALIZED registry (no miss registration): wrapped probe → local leaf or cached ghost slot; throws on an unknown remote coord — the caller's probe set must be a subset of what the registry was built with (e.g.

the pressure MG's level-0 ±1 face probes against the flow's ±2 registry).

Definition at line 149 of file leaf_halo.hpp.

References peclet::core::amr::BlockOctree< Dim, Bits >::find(), peclet::core::amr::DistributedOctree< Dim, Bits >::local(), and peclet::core::amr::transferFieldGradients().

Referenced by peclet::core::amr::LeafHalo< Dim, Bits >::lookupGlobal().

◆ lookupGlobal()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
Index peclet::core::amr::LeafHalo< Dim, Bits >::lookupGlobal ( std::array< long, Dim >  g) const
inline

◆ resolveMisses()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
long peclet::core::amr::LeafHalo< Dim, Bits >::resolveMisses ( )
inline

COLLECTIVE (all ranks together, misses or not): one owner coverLevels round resolving every queued miss to a canonical ghost slot (or a newly-discovered one).

Returns the GLOBAL number of coords that were pending — drive the builders' fixpoint: for (;;) { attempt build; if (halo.resolveMisses() == 0) break; }

Definition at line 182 of file leaf_halo.hpp.

References peclet::core::amr::DistributedOctree< Dim, Bits >::comm(), peclet::core::amr::DistributedOctree< Dim, Bits >::coverLevels(), MPI_Allreduce(), MPI_LONG, MPI_SUM, and peclet::core::amr::transferFieldGradients().

◆ level()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
int peclet::core::amr::LeafHalo< Dim, Bits >::level ( Index  slot) const
inline

Covering-leaf level of an extended slot (local octree level convention: 0 = finest cell).

Definition at line 221 of file leaf_halo.hpp.

References peclet::core::amr::BlockOctree< Dim, Bits >::level(), and peclet::core::amr::DistributedOctree< Dim, Bits >::local().

◆ ghostCoord()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
const CoordArr & peclet::core::amr::LeafHalo< Dim, Bits >::ghostCoord ( Index  g) const
inline

Global fine anchor (lo corner) of ghost g in [0, nGhosts) — for SDF sampling / multi-hop probe construction by the builders.

Definition at line 228 of file leaf_halo.hpp.

◆ finalize()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::core::amr::LeafHalo< Dim, Bits >::finalize ( )
inline

Freeze the ghost set and establish the owner↔ghost value topology (one NBX round; the owner-side locateGlobal happens here, once — never per exchange).

Definition at line 234 of file leaf_halo.hpp.

References peclet::core::amr::DistributedOctree< Dim, Bits >::buildGatherHaloTopology(), peclet::core::amr::LeafHalo< Dim, Bits >::extendedSize(), and peclet::core::amr::transferFieldGradients().

◆ topology()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
const DO::GatherHaloTopology & peclet::core::amr::LeafHalo< Dim, Bits >::topology ( ) const
inline

Definition at line 253 of file leaf_halo.hpp.

◆ exchangeHost()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::core::amr::LeafHalo< Dim, Bits >::exchangeHost ( std::vector< double > &  x,
int  tag = 45 
) const
inline

Host exchange: refresh x[nLocal, nLocal+nGhost) from the owners (x sized extendedSize()).

Values are unmodified copies of the owner's doubles (bit-exact by construction).

Definition at line 257 of file leaf_halo.hpp.

References peclet::core::amr::DistributedOctree< Dim, Bits >::comm(), MPI_BYTE, MPI_Irecv(), MPI_Isend(), MPI_STATUSES_IGNORE, MPI_Waitall(), and peclet::core::amr::transferFieldGradients().

Member Data Documentation

◆ kPending

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
constexpr Index peclet::core::amr::LeafHalo< Dim, Bits >::kPending = -2
staticconstexpr

resolve(): queued as a miss (call resolveMisses)

Definition at line 69 of file leaf_halo.hpp.

Referenced by peclet::core::amr::LeafHalo< Dim, Bits >::resolve().

◆ kNone

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
constexpr Index peclet::core::amr::LeafHalo< Dim, Bits >::kNone = -1
staticconstexpr

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