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

Implementation of CD_NearestNeighborParticleMerge.H. More...

#include <algorithm>
#include <cmath>
#include <CH_Timer.H>
#include <MayDay.H>
#include <SPMD.H>
#include <DataIterator.H>
#include <BoxIterator.H>
#include <CD_NearestNeighborParticleMerge.H>
#include <CD_AmrMesh.H>
#include <CD_NamespaceHeader.H>
#include <CD_NamespaceFooter.H>
Include dependency graph for CD_NearestNeighborParticleMergeImplem.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

Real ParticleManagement::detail::nnMergeDistSquared (const RealVect &a_a, const RealVect &a_b) noexcept
 Squared Euclidean distance between two physical positions.
 
int ParticleManagement::detail::nnMergeChebyshevCellDistance (const IntVect &a_a, const IntVect &a_b) noexcept
 Chebyshev (max-per-axis) distance between two cell-index vectors – see CD_NearestNeighborParticleMerge.H's a_maxCellDistance docs.
 
bool ParticleManagement::detail::nnMergeCrossLevelTooFar (const RealVect &a_posA, const int a_levelA, const RealVect &a_posB, const int a_levelB, const RealVect &a_probLo, const std::vector< RealVect > &a_dxByLevel, const int a_maxCellDistance) noexcept
 a_maxCellDistance check for two positions that may be on DIFFERENT AMR levels.
 
void ParticleManagement::detail::nnMergeWeightedCentroid (RealVect &a_mergedPos, Real &a_mergedWeight, const RealVect &a_posA, const Real a_weightA, const RealVect &a_posB, const Real a_weightB) noexcept
 Weighted-centroid merge of two positions/weights – shared by resolveTrivialTier() and judgeProposals() so the formula is written exactly once.
 
Real ParticleManagement::detail::nnMergePointToCellDistSquared (const RealVect &a_point, const IntVect &a_cell, const RealVect &a_probLo, const RealVect &a_dx) noexcept
 Squared distance from a physical point to a cell's axis-aligned bounding box (0 if the point is inside).
 
template<typename T >
std::vector< T > ParticleManagement::detail::nnMergeExchangeByRank (const std::vector< std::vector< T > > &a_sendByRank)
 Generic alltoallv-style exchange: send a per-destination-rank bucket of trivially- copyable records, return the flat concatenation of everything received.
 
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 Packed >
bool ParticleManagement::detail::nnMergeAnyCellCrowded (const std::vector< MergeParticle< Packed > > &a_localValid, const std::vector< MergeParticle< Packed > > &a_ghosts, const RealVect &a_probLo, const RealVect &a_dx, const NNCellBudget &a_cellBudget) noexcept
 Exact per-cell crowding pre-filter shared by buildNNSpatialIndex()/buildNNCellSpatialIndex(): is any cell in this patch's local+ghost particle set over its a_cellBudget?
 
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.
 

Detailed Description

Implementation of CD_NearestNeighborParticleMerge.H.

Author
Robert Marskar