chombo-discharge
Loading...
Searching...
No Matches
Namespaces | Functions
CD_KDParticleMergeImplem.H File Reference

Implementation of CD_KDParticleMerge.H. More...

#include <algorithm>
#include <cmath>
#include <functional>
#include <utility>
#include <vector>
#include <BaseFab.H>
#include <Box.H>
#include <CH_Timer.H>
#include <MayDay.H>
#include <SPMD.H>
#include <DataIterator.H>
#include <CD_LevelTiles.H>
#include <CD_KDParticleMerge.H>
#include <CD_NamespaceHeader.H>
#include <CD_NamespaceFooter.H>
Include dependency graph for CD_KDParticleMergeImplem.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ParticleManagement
 Namespace for various particle management tools.
 
namespace  ParticleManagement::detail
 Internal-only implementation details of the ParticleManagement API.
 

Functions

template<typename T >
std::vector< T > ParticleManagement::detail::kdExchangeByRank (const std::vector< std::vector< T > > &a_sendByRank)
 Generic Alltoallv-style exchange for a trivially-copyable record type: send a per-destination-rank bucket, return the flat concatenation of everything received.
 
template<typename Packed >
void ParticleManagement::detail::kdBBox (RealVect &a_boxLo, RealVect &a_boxHi, const std::vector< MergeParticle< Packed > > &a_particles, const std::size_t a_lo, const std::size_t a_hi) noexcept
 Axis-aligned bounding box of particles[a_lo, a_hi).
 
Real ParticleManagement::detail::kdMaxAxisSpan (const RealVect &a_boxLo, const RealVect &a_boxHi, const RealVect &a_dx) noexcept
 Largest per-axis extent of [a_boxLo,a_boxHi], expressed as a fraction of that axis's own cell width.
 
IntVect ParticleManagement::detail::kdCellKeyOf (const RealVect &a_position, const RealVect &a_probLo, const RealVect &a_dx) noexcept
 The unclamped, position-derived cell index a physical position falls in.
 
bool ParticleManagement::detail::kdIntVectLess (const IntVect &a_lhs, const IntVect &a_rhs) noexcept
 Strict weak ordering over IntVect, lexicographic component-wise.
 
template<typename Packed >
void ParticleManagement::detail::kdFillCellHistogram (FArrayBox &a_counts, const std::vector< MergeParticle< Packed > > &a_particles, const RealVect &a_probLo, const RealVect &a_dx) noexcept
 Tally a per-cell particle-count histogram over one patch's gathered particles.
 
template<typename Packed >
std::size_t ParticleManagement::detail::kdSplitCountMedian (std::vector< MergeParticle< Packed > > &a_particles, const std::size_t a_lo, const std::size_t a_hi, const int a_axis) noexcept
 Split particles[a_lo,a_hi) in place by the longest axis at the count-median – the sole split rule used by buildKDQuotaLeaves().
 
template<typename Packed >
std::size_t ParticleManagement::detail::kdSplitWeightMedian (std::vector< MergeParticle< Packed > > &a_particles, const std::size_t a_lo, const std::size_t a_hi, const int a_axis) noexcept
 Split particles[a_lo,a_hi) in place by the longest axis at the WEIGHT median – the plane with half this node's total particle weight on either side.
 
template<typename Packed >
void ParticleManagement::detail::buildKDQuotaLeaves (std::vector< MergeParticle< Packed > > &a_particles, FArrayBox &a_used, std::vector< KDLeaf > &a_leaves, const int a_ppc, const Real a_splitWeightLeafDx, const RealVect &a_dx, const RealVect &a_probLo, const FArrayBox &a_cellCounts) noexcept
 Build one whole-patch kd tree: partition a_particles by position into leaves, each of which becomes exactly one super-particle, subject to a live per-cell leaf quota of a_ppc.
 
void ParticleManagement::detail::kdBoxRealBounds (RealVect &a_boxLo, RealVect &a_boxHi, const Box &a_box, const RealVect &a_dx, const RealVect &a_probLo) noexcept
 Real-space bounds of a box: the half-open region [lo, hi) that its cells cover.
 
void ParticleManagement::detail::kdCheckCentroid (const RealVect &a_centroid, const Real a_totalWeight, const RealVect &a_boxLo, const RealVect &a_boxHi) noexcept
 Debug-only sanity check on a merged particle's position: a weighted centroid of positions that all lie within [a_boxLo,a_boxHi], using strictly positive weights, is mathematically guaranteed to itself lie within that same box.
 
template<typename P , typename Packed , typename Traits = ParticleTraits<P>, typename Gather , typename Combine , typename Scatter , typename Allocator , typename PosValid >
void ParticleManagement::mergeKDCarve (ParticleContainer< P, Traits > &a_particles, EBAMRFAB &a_cellHistogram, EBAMRFAB &a_leafQuota, const AmrMesh &a_amr, const int a_ppc, const Real a_splitWeightLeafDx, const Gather &a_gather, const Combine &a_combine, const Scatter &a_scatter, const Allocator &a_allocateID, const PosValid &a_isPositionValid)
 Run one non-iterative pass of the kd-tree carve merge over every patch this rank owns.
 
template<typename P , typename Packed , typename Traits = ParticleTraits<P>, typename Gather , typename Combine , typename Scatter , typename Allocator , typename PosValid >
void ParticleManagement::mergeKDPatch (ParticleContainer< P, Traits > &a_particles, EBAMRFAB &a_cellHistogram, EBAMRFAB &a_leafQuota, const AmrMesh &a_amr, const int a_ppc, const Real a_splitWeightLeafDx, const Gather &a_gather, const Combine &a_combine, const Scatter &a_scatter, const Allocator &a_allocateID, const PosValid &a_isPositionValid)
 Run one patch-local kd-tree merge over every patch this rank owns.
 
template<typename P , typename Packed , typename Traits = ParticleTraits<P>, typename Gather , typename Combine , typename Scatter , typename Allocator , typename PosValid >
void ParticleManagement::mergeKDInterior (ParticleContainer< P, Traits > &a_particles, ParticleContainer< P, Traits > &a_interior, EBAMRFAB &a_cellHistogram, EBAMRFAB &a_leafQuota, const AmrMesh &a_amr, const int a_ppc, const Real a_splitWeightLeafDx, const Gather &a_gather, const Combine &a_combine, const Scatter &a_scatter, const Allocator &a_allocateID, const PosValid &a_isPositionValid)
 Run the uncontested tier of the kd merge, splitting the input into merged and leftover.
 

Detailed Description

Implementation of CD_KDParticleMerge.H.

Author
Robert Marskar