|
chombo-discharge
|
Declaration of a distributed, MPI-safe nearest-neighbor particle-merge algorithm. More...
#include <algorithm>#include <functional>#include <limits>#include <map>#include <optional>#include <unordered_set>#include <unordered_map>#include <utility>#include <vector>#include <RealVect.H>#include <IntVect.H>#include <EBGeometry.hpp>#include <CD_ParticleSoA.H>#include <CD_ParticleContainer.H>#include <CD_ParticleManagement.H>#include <CD_NamespaceHeader.H>#include <CD_NamespaceFooter.H>#include <CD_NearestNeighborParticleMergeImplem.H>

Go to the source code of this file.
Classes | |
| struct | ParticleManagement::detail::NNPooledParticle< Packed > |
| Pooled per-round record for one particle: the particle plus its cached boundary-exposure flag. More... | |
| struct | ParticleManagement::detail::NNFallbackCandidate |
| One additional ranked candidate beyond a query's primary nearest neighbor. More... | |
| struct | ParticleManagement::detail::NNMergeEdge< Packed > |
| One candidate merge edge: a single particle's own nearest-neighbor query result. More... | |
| struct | ParticleManagement::detail::NNMergeProposal< Packed > |
| A cross-patch merge proposal: one particle's own nearest-neighbor query result, bundled as a self-contained, atomic pair for shipment to whichever rank owns the candidate. More... | |
| struct | ParticleManagement::detail::NNMergeVerdict |
| The judge's reply to one proposal. More... | |
| struct | ParticleManagement::detail::NNMergeResult< Packed > |
| One resolved merge: the two consumed particles' ids and the newly created merged particle (not yet placed into any patch – see placeMergedParticles()). More... | |
| struct | ParticleManagement::detail::NNCellKeyHasher |
| Hash functor for NNCellKey – REQUIRED whenever NNCellKey is used as a hash-map key; NNCellKey must never be used as an ordered (std::map or std::set) key. More... | |
| class | ParticleManagement::NNCellBudget |
| The per-cell particle count this merge drains each cell down to. More... | |
Namespaces | |
| namespace | ParticleManagement |
| Namespace for various particle management tools. | |
| namespace | ParticleManagement::detail |
| Internal-only implementation details of the ParticleManagement API. | |
Typedefs | |
| template<typename Packed > | |
| using | ParticleManagement::PayloadCombine = std::function< Packed(const Packed &a_first, const Real a_firstWeight, const Packed &a_second, const Real a_secondWeight)> |
| Illustrative signature of the combine callback: produce a merged particle's opaque payload from its two parents' payloads and weights. | |
| using | ParticleManagement::PositionValid = std::function< bool(const RealVect &a_mergedPosition)> |
| Illustrative signature of the position-validity predicate for a would-be merged particle. | |
| using | ParticleManagement::IDAllocator = std::function< ParticleID()> |
| Illustrative signature of the fresh-id allocator: produce one globally-unique id for a newly created merged particle. | |
| template<typename Packed > | |
| using | ParticleManagement::MergeCommittedCallback = std::function< void(const MergeParticle< Packed > &a_first, const MergeParticle< Packed > &a_second, const MergeParticle< Packed > &a_merged)> |
| Optional per-merge diagnostic callback: observe every individual merge as it commits. | |
| using | ParticleManagement::detail::NNCellKey = std::pair< int, IntVect > |
| A cell key together with the AMR level it was computed on – see cellKeyOf()'s warning. | |
Functions | |
| IntVect | ParticleManagement::detail::cellKeyOf (const RealVect &a_position, const RealVect &a_probLo, const RealVect &a_dx) noexcept |
| The unclamped, position-derived cell index a given physical position falls in. | |
| template<typename P , typename Packed , typename Traits = ParticleTraits<P>, typename Gather , typename Combine , typename Scatter , typename Allocator , typename PosValid = std::function<bool(const RealVect&)>, typename OnMerge = std::function< void(const MergeParticle<Packed>&, const MergeParticle<Packed>&, const MergeParticle<Packed>&)>> | |
| void | ParticleManagement::mergeNearestNeighborsTree (ParticleContainer< P, Traits > &a_particles, const AmrMesh &a_amr, const NNCellBudget &a_cellBudget, const Gather &a_gather, const Combine &a_combine, const Scatter &a_scatter, const Allocator &a_allocateID, const bool a_iterateLocalTierToConvergence=false, const int a_maxFallbackCandidates=0, const std::optional< int > a_maxCellDistance=std::nullopt, const int a_ghostWidth=1, const PosValid &a_isPositionValid=[](const RealVect &) { return true;}, unsigned long long *a_crossLevelMergeCount=nullptr, const OnMerge &a_onMergeCommitted=[](const MergeParticle< Packed > &, const MergeParticle< Packed > &, const MergeParticle< Packed > &) { }) |
| Run one full round (one timestep's worth) of the nearest-neighbor merge algorithm. | |
| template<typename P , typename Packed , typename Traits = ParticleTraits<P>, typename Gather , typename Combine , typename Scatter , typename Allocator , typename PosValid = std::function<bool(const RealVect&)>, typename OnMerge = std::function< void(const MergeParticle<Packed>&, const MergeParticle<Packed>&, const MergeParticle<Packed>&)>> | |
| void | ParticleManagement::mergeNearestNeighborsHash (ParticleContainer< P, Traits > &a_particles, const AmrMesh &a_amr, const NNCellBudget &a_cellBudget, const Gather &a_gather, const Combine &a_combine, const Scatter &a_scatter, const Allocator &a_allocateID, const bool a_iterateLocalTierToConvergence=false, const int a_maxFallbackCandidates=0, const std::optional< int > a_maxCellDistance=std::nullopt, const int a_ghostWidth=1, const PosValid &a_isPositionValid=[](const RealVect &) { return true;}, unsigned long long *a_crossLevelMergeCount=nullptr, const OnMerge &a_onMergeCommitted=[](const MergeParticle< Packed > &, const MergeParticle< Packed > &, const MergeParticle< Packed > &) { }) |
| Run one full round of the nearest-neighbor merge algorithm, identical in every respect to mergeNearestNeighborsTree() except that the per-patch spatial search is backed by an EBGeometry::PointCloudHashGrid (a uniform-grid index) instead of an EBGeometry::PointCloudBVH. | |
| template<typename P , typename Packed , typename Traits = ParticleTraits<P>, typename Gather , typename Combine , typename Scatter , typename Allocator , typename PosValid = std::function<bool(const RealVect&)>, typename OnMerge = std::function< void(const MergeParticle<Packed>&, const MergeParticle<Packed>&, const MergeParticle<Packed>&)>> | |
| void | ParticleManagement::mergeNearestNeighborsOneCell (ParticleContainer< P, Traits > &a_particles, const AmrMesh &a_amr, const NNCellBudget &a_cellBudget, const Gather &a_gather, const Combine &a_combine, const Scatter &a_scatter, const Allocator &a_allocateID, const bool a_iterateLocalTierToConvergence=false, const int a_maxFallbackCandidates=0, const PosValid &a_isPositionValid=[](const RealVect &) { return true;}, unsigned long long *a_crossLevelMergeCount=nullptr, const OnMerge &a_onMergeCommitted=[](const MergeParticle< Packed > &, const MergeParticle< Packed > &, const MergeParticle< Packed > &) { }) |
| Run one full round of the one-cell nearest-neighbor merge: the same distributed propose/judge/verdict protocol as mergeNearestNeighborsTree(), but with candidates found via a per-cell PointCloudBVH spatial index (see NNCellSpatialIndex) instead of one whole-patch tree. | |
Declaration of a distributed, MPI-safe nearest-neighbor particle-merge algorithm.
This file adds a nearest-neighbor super-particle merge that is safe across patch and rank boundaries. Candidates are found against a particle's full neighborhood (its own patch plus every ghost, filled once per round); a pair where neither participant is reachable from outside the patch resolves immediately (the "trivial tier"), and everything else goes through a propose/judge/verdict protocol that is safe for any number of simultaneous cross-patch suitors.