|
template<class P , Real &(P::*)() weight, const RealVect &(P::*)() const position> |
std::vector< std::shared_ptr< KDNode< P > > > | recursivePartitionAndSplitEqualWeightKD (typename KDNode< P >::ParticleList &a_inputParticles, const int a_maxLeaves, const BinaryParticleReconcile< P > a_particleReconcile) noexcept |
| Recursively build a KD-tree following the "equal weight" principle when partitioning nodes. More...
|
|
template<typename P , typename T , typename > |
void | removePhysicalParticles (List< P > &a_particles, const T a_numPhysPartToRemove) noexcept |
| Remove physical particles from the input particles. More...
|
|
template<typename P > |
void | deleteParticles (List< P > &a_particles, const Real a_weightThresh) noexcept |
| Remove particles if their weight is below the input weight. More...
|
|
template<typename T , typename > |
std::vector< T > | partitionParticleWeights (const T a_numPhysicalParticles, const T a_maxCompParticles) noexcept |
| Partition particle weights among a number of computational particles. More...
|
|
template<typename T , typename > |
T | partitionParticles (const T a_numParticles) |
| Partition particles so that all MPI rank draw a cumulative number of particles equal to a_numParticles. More...
|
|
template<typename P , typename T , typename > |
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. More...
|
|
template<typename P , typename T , typename > |
void | drawSphereParticles (List< P > &a_particles, const T a_numParticles, const RealVect a_center, const Real a_radius) noexcept |
| Draw particles in a sphere. More...
|
|
template<typename P , typename T , typename > |
void | drawBoxParticles (List< P > &a_particles, const T a_numParticles, const RealVect a_loCorner, const RealVect a_hiCorner) noexcept |
| Draw particles in a box. More...
|
|
template<typename P , typename T , typename > |
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. More...
|
|
Namespace for various particle management tools.
Declaration of a reconciliation function when splitting particles.
This is, for example, passed into the KD-tree equal-weight partioning structure, which may split a particle such that the weight of the two nodes differ by at most one physical particle. By default, that method will call the particle copy constructor, but this function permits the user to input a reconciliation function that manipulates other class members in the split particles.
template<typename P , typename T , typename >
void ParticleManagement::drawGaussianParticles |
( |
List< P > & |
a_particles, |
|
|
const T |
a_numParticles, |
|
|
const RealVect |
a_center, |
|
|
const Real |
a_radius |
|
) |
| |
|
inlinenoexcept |
Draw particles from a Gaussian distribution.
The implementation will partition a_numParticles among the ranks so the total number of particles drawn is a_numParticles. P is the particle type (must have a RealVect& position() function) and T is an integer type.
- Parameters
-
[out] | a_particles | Output particles (different for each rank) |
[in] | a_numParticles | Number of particles |
[in] | a_center | Gaussian blob Center |
[in] | a_radius | Gaussian blob radius |
template<typename P , typename T , typename >
void ParticleManagement::drawRandomParticles |
( |
List< P > & |
a_particles, |
|
|
const T |
a_numParticles, |
|
|
const std::function< RealVect()> & |
a_distribution |
|
) |
| |
|
inline |
Draw a specified number of random particles distributed according to a predefined distribution.
The implementation will partition a_numParticles among the ranks so the total number of particles drawn is a_numParticles. P is the particle type (must derived from BinItem) and T is an integer type.
- Parameters
-
[out] | a_particles | Output particles (different for each rank) |
[in] | a_numParticles | Number of particles |
[in] | a_distribution | Particle distribution. Must return a random position when calling the function. |
template<typename P , typename T , typename >
void ParticleManagement::drawSphereParticles |
( |
List< P > & |
a_particles, |
|
|
const T |
a_numParticles, |
|
|
const RealVect |
a_center, |
|
|
const Real |
a_radius |
|
) |
| |
|
inlinenoexcept |
Draw particles in a sphere.
The implementation will partition a_numParticles among the ranks so the total number of particles drawn is a_numParticles. P is the particle type (must have a RealVect& position() function) and T is an integer type.
- Parameters
-
[out] | a_particles | Output particles (different for each rank) |
[in] | a_numParticles | Number of particles |
[in] | a_center | Sphere center |
[in] | a_radius | Sphere radius |
template<class P , Real &(P::*)() weight, const RealVect &(P::*)() const position>
std::vector<std::shared_ptr<KDNode<P> > > ParticleManagement::recursivePartitionAndSplitEqualWeightKD |
( |
typename KDNode< P >::ParticleList & |
a_inputParticles, |
|
|
const int |
a_maxLeaves, |
|
|
const BinaryParticleReconcile< P > |
a_particleReconcile = [](P &p1, P &p2, const P &p0) -> void { } |
|
) |
| |
|
inlinenoexcept |
Recursively build a KD-tree following the "equal weight" principle when partitioning nodes.
- Parameters
-
[in,out] | a_inputParticles | Input particles. These are destroyed on output. |
[in] | a_maxLeaves | Maximum number of leaves in the tree. |
- Returns
- Returns leaf nodes containing the particles
If the number of leaves is a factor of two, leaves exist on the same level and the weight in each node will differ by at most one physical particle. The template parameters are
P -> Particle type P::*weight -> Function pointer to particle weight P::*position -> Function pointer to particle position.
A possible call signature is e.g. recursivePartitionAndSplitEqualWeightKD<P, &P::weight, &P::position>.
The user can input a particle reconciliation function that manipulates the particle properties of the split particles. By default, the split particles will use the copy constructor and thus inherit class members from p0, with the exception of the particle weights. The reconcile function lets the user manipulate other particle properties, e.g. ones that are not properly captured by the particle copy constructor, or that need some other form of reconciliation.