12 #ifndef CD_ParticleManagement_H
13 #define CD_ParticleManagement_H
26 #include <CD_NamespaceHeader.H>
40 void(List<P>& a_particles,
const CellInfo& a_cellInfo,
const int a_numTargetParticles)>;
72 template <
class P, Real& (P::*weight)(), const RealVect& (P::*position)() const>
74 partitionAndSplitEqualWeightKD(
99 template <
class P, Real& (P::*weight)(), const RealVect& (P::*position)() const>
100 static inline std::vector<std::shared_ptr<KDNode<P>>>
101 recursivePartitionAndSplitEqualWeightKD(
103 const int a_maxLeaves,
104 const BinaryParticleReconcile<P> a_particleReconcile = [](P& p1, P& p2,
const P& p0) ->
void {
113 template <typename P, typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
122 template <
typename P>
124 deleteParticles(List<P>& a_particles,
const Real a_weightThresh) noexcept;
131 template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
132 static inline std::vector<T>
140 template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
152 template <typename P, typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
154 drawRandomParticles(List<P>& a_particles,
const T a_numParticles,
const std::function<RealVect()>& a_distribution);
165 template <typename P, typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
168 const T a_numParticles,
169 const RealVect a_center,
170 const Real a_radius) noexcept;
181 template <typename P, typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
184 const T a_numParticles,
185 const RealVect a_loCorner,
186 const RealVect a_hiCorner) noexcept;
197 template <typename P, typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
200 const T a_numParticles,
201 const RealVect a_center,
202 const Real a_radius) noexcept;
206 #include <CD_NamespaceFooter.H>
Simple class for holding some quantities relevant in a grid cell.
Namespace containing various particle management utilities.
Implementation of CD_ParticleManagement.H.
Class for the cell-information that is often queried when merging particles inside a cell.
Definition: CD_CellInfo.H:25
Node in a particle-merging KD-tree.
Definition: CD_KDNode.H:33
std::vector< P > ParticleList
List of particles. This is aliased because the KD-tree construction may require both random access an...
Definition: CD_KDNode.H:39
Namespace for various particle management tools.
Definition: CD_ParticleManagement.H:31
void deleteParticles(List< P > &a_particles, const Real a_weightThresh) noexcept
Remove particles if their weight is below the input weight.
Definition: CD_ParticleManagementImplem.H:349
void removePhysicalParticles(List< P > &a_particles, const T a_numPhysPartToRemove) noexcept
Remove physical particles from the input particles.
Definition: CD_ParticleManagementImplem.H:264
std::function< void(P &p1, P &p2, const P &p0)> BinaryParticleReconcile
Declaration of a reconciliation function when splitting particles.
Definition: CD_ParticleManagement.H:50
void drawGaussianParticles(List< P > &a_particles, const T a_numParticles, const RealVect a_center, const Real a_radius) noexcept
Draw particles from a Gaussian distribution.
Definition: CD_ParticleManagementImplem.H:488
std::vector< T > partitionParticleWeights(const T a_numPhysicalParticles, const T a_maxCompParticles) noexcept
Partition particle weights among a number of computational particles.
Definition: CD_ParticleManagementImplem.H:365
void drawSphereParticles(List< P > &a_particles, const T a_numParticles, const RealVect a_center, const Real a_radius) noexcept
Draw particles in a sphere.
Definition: CD_ParticleManagementImplem.H:436
std::function< void(List< P > &a_particles, const CellInfo &a_cellInfo, const int a_numTargetParticles)> ParticleMerger
Concept for splitting/merging particles.
Definition: CD_ParticleManagement.H:40
T partitionParticles(const T a_numParticles)
Partition particles so that all MPI rank draw a cumulative number of particles equal to a_numParticle...
Definition: CD_ParticleManagementImplem.H:399
void drawBoxParticles(List< P > &a_particles, const T a_numParticles, const RealVect a_loCorner, const RealVect a_hiCorner) noexcept
Draw particles in a box.
Definition: CD_ParticleManagementImplem.H:468
void drawRandomParticles(List< P > &a_particles, const T a_numParticles, const std::function< RealVect()> &a_distribution)
Draw a specified number of random particles distributed according to a predefined distribution.
Definition: CD_ParticleManagementImplem.H:419