chombo-discharge
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KDNode< P > Class Template Reference

Node in a particle-merging KD-tree. More...

#include <CD_KDNode.H>

Public Types

using ParticleList = std::vector< P >
 List of particles. This is aliased because the KD-tree construction may require both random access and something sortable.
 

Public Member Functions

 KDNode (const KDNode &)=delete
 Disallowed constructor.
 
 KDNode (const KDNode &&)=delete
 Disallowed constructor.
 
KDNodeoperator= (const KDNode &)=delete
 Disallowed assignment.
 
KDNodeoperator= (const KDNode &&)=delete
 Disallowed assignment.
 
 KDNode ()
 Default constructor.
 
 KDNode (ParticleList &a_particles)
 Valid constructor. Takes list of particles. More...
 
virtual ~KDNode ()
 Destructor. Does nothing.
 
const Real & weight () const noexcept
 Get the node weight.
 
Real & weight () noexcept
 Get the node weight.
 
const ParticleListgetParticles () const noexcept
 Get particles in this node.
 
ParticleListgetParticles () noexcept
 Get particles in this node.
 
bool isLeafNode () const noexcept
 Is leaf node or not.
 
bool isInteriorNode () const noexcept
 Is leaf node or not.
 
ParticleList gatherParticles () const noexcept
 Gather particles further down in the subtree and return all particles (in the leaf nodes)
 
ParticleList moveParticles () noexcept
 Move the particles list further down in the subtree into this vector. More...
 
std::shared_ptr< KDNode< P > > & getLeft () noexcept
 Get the left node.
 
std::shared_ptr< KDNode< P > > & getRight () noexcept
 Get the right node.
 

Protected Member Functions

void gatherParticles (ParticleList &a_particles) const noexcept
 Gather particles further down in the subtree and return all particles (in the leaf nodes) More...
 
void moveParticles (ParticleList &a_particles) noexcept
 Move particles further down in the subtree and return all particles (in the leaf nodes) More...
 

Protected Attributes

std::shared_ptr< KDNodem_left
 Left KD-node.
 
std::shared_ptr< KDNodem_right
 Right KD-node.
 
Real m_weight
 Node weight.
 
ParticleList m_particles
 List of particles.
 

Detailed Description

template<class P>
class KDNode< P >

Node in a particle-merging KD-tree.

This node type is used for partitioning particles into spatial subsets and merging/splitting them.

The template argument P is the particle type - the users decides how to merge/split/partition.

Constructor & Destructor Documentation

◆ KDNode()

template<class P >
KDNode< P >::KDNode ( ParticleList a_particles)
inline

Valid constructor. Takes list of particles.

Parameters
[in,out]a_particlesList of particles to be partitioned later.
Note
The input particle list is transferred to m_particles.

Member Function Documentation

◆ gatherParticles()

template<class P >
void KDNode< P >::gatherParticles ( ParticleList a_particles) const
inlineprotectednoexcept

Gather particles further down in the subtree and return all particles (in the leaf nodes)

Parameters
[in,out]a_particlesList of particles

◆ moveParticles() [1/2]

template<class P >
KDNode< P >::ParticleList KDNode< P >::moveParticles
inlinenoexcept

Move the particles list further down in the subtree into this vector.

Note
This clears the particles from the leaf nodes. Use gatherParticles if you do not want to change the tree contents.

◆ moveParticles() [2/2]

template<class P >
void KDNode< P >::moveParticles ( ParticleList a_particles)
inlineprotectednoexcept

Move particles further down in the subtree and return all particles (in the leaf nodes)

Parameters
[in,out]a_particlesList of particles
Note
This clears the particles from the leaf nodes. Use gatherParticles if you do not want to change the tree contents.

The documentation for this class was generated from the following files: