version 3.11-dev
Dumux::Particles::SimpleParticleCloud< P > Class Template Reference

A simple implementation of a cloud of particles. More...

#include <dumux/particles/simpleparticlecloud.hh>

Description

template<class P>
class Dumux::Particles::SimpleParticleCloud< P >

The simple particle cloud assumes that particles are independent of each other and can be updated in parallel.

It allows to add and remove particles from the cloud and modify particles in place.

Public Types

using Particle = P
 

Public Member Functions

 SimpleParticleCloud ()=default
 
void resize (std::size_t numParticles)
 Resize the cloud to contain numParticles particles. More...
 
std::size_t size (bool onlyActive=true) const
 the number of particles in the cloud More...
 
ParticlespawnParticle ()
 Bring one inactive particle to life Activates one particle from the pool of inactive particles. More...
 
void deactivateParticle (const Particle &p)
 Deactivate a given particle. More...
 
template<class Func >
void forEachActiveParticle (const Func &func)
 For each active particle apply a function. More...
 
template<class Func >
void forEachParticle (const Func &func)
 For each particle apply a function. More...
 

Member Typedef Documentation

◆ Particle

template<class P >
using Dumux::Particles::SimpleParticleCloud< P >::Particle = P

Constructor & Destructor Documentation

◆ SimpleParticleCloud()

template<class P >
Dumux::Particles::SimpleParticleCloud< P >::SimpleParticleCloud ( )
default

Member Function Documentation

◆ deactivateParticle()

template<class P >
void Dumux::Particles::SimpleParticleCloud< P >::deactivateParticle ( const Particle p)
inline

◆ forEachActiveParticle()

template<class P >
template<class Func >
void Dumux::Particles::SimpleParticleCloud< P >::forEachActiveParticle ( const Func &  func)
inline
Note
The function may modify the particle

◆ forEachParticle()

template<class P >
template<class Func >
void Dumux::Particles::SimpleParticleCloud< P >::forEachParticle ( const Func &  func)
inline
Note
The function may modify the particle

◆ resize()

template<class P >
void Dumux::Particles::SimpleParticleCloud< P >::resize ( std::size_t  numParticles)
inline

◆ size()

template<class P >
std::size_t Dumux::Particles::SimpleParticleCloud< P >::size ( bool  onlyActive = true) const
inline

◆ spawnParticle()

template<class P >
Particle & Dumux::Particles::SimpleParticleCloud< P >::spawnParticle ( )
inline
Note
the particle is automatically activated
Take care to place it somewhere afterwards! Otherwise it's hanging somewhere in space.
If no particles are left new particles are added
This method is not thread safe

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