MCKL
Monte Carlo Kernel Library
Public Types | Public Member Functions | Friends | List of all members
mckl::Particle< T > Class Template Reference

Particle system. More...

#include <mckl/core/particle.hpp>

Public Types

using rng_set_type = RNGSetType< T >
 
using rng_type = typename rng_set_type::rng_type
 
using size_type = SizeType< T >
 
using state_type = T
 
using weight_type = WeightType< T >
 

Public Member Functions

 Particle ()
 Default constructor. More...
 
template<typename... Args>
 Particle (size_type N, Args &&... args)
 Construct a particle system. More...
 
ParticleIndex< T > at (size_type i)
 Get a ParticleIndex<T> object for the i-th particle. More...
 
ParticleIndex< T > begin ()
 Get a ParticleIndex<T> object for the first particle. More...
 
Particle clone () const
 Clone the Particle except the RNG engines. More...
 
ParticleIndex< T > end ()
 Get a ParticleIndex<T> object for one pass the last particle. More...
 
ParticleIndex< T > operator[] (size_type i)
 Get a ParticleIndex<T> object for the i-th particle. More...
 
ParticleRange< T > range (size_type grainsize=1)
 Get a Range<ParticleItrator<T>> object of all particles. More...
 
ParticleRange< T > range (size_type ibegin, size_type iend, size_type grainsize=1)
 Get a ParticleRange<T> object given a range denoted by integral values. More...
 
rng_typerng (size_type i)
 Get an (parallel) RNG stream for a given particle. More...
 
const rng_typerng (size_type i) const
 Get an (parallel) RNG stream for a given particle. More...
 
rng_typerng ()
 Get the (sequential) RNG used stream for resampling. More...
 
const rng_typerng () const
 Get the (sequential) RNG used stream for resampling. More...
 
rng_set_typerng_set ()
 Read and write access to the RNG collection object. More...
 
const rng_set_typerng_set () const
 Read only access to the RNG collection object. More...
 
template<typename InputIter >
void select (size_type n, InputIter index)
 Resize by selecting according to user supplied index vector. More...
 
size_type size () const
 The number of particles. More...
 
state_typestate ()
 Read and write access to the state collection object. More...
 
const state_typestate () const
 Read only access to the state collection object. More...
 
weight_typeweight ()
 Read and write access to the weight collection object. More...
 
const weight_typeweight () const
 Read only access to the weight collection object. More...
 

Friends

bool operator!= (const Particle &p1, const Particle &p2)
 
bool operator== (const Particle &p1, const Particle &p2)
 

Detailed Description

template<typename T>
class mckl::Particle< T >

Particle system.

Template Parameters
TThe sample collection type

A collection of particles is formed by,

Definition at line 45 of file particle.hpp.

Member Typedef Documentation

◆ rng_set_type

template<typename T>
using mckl::Particle< T >::rng_set_type = RNGSetType<T>

Definition at line 285 of file particle.hpp.

◆ rng_type

template<typename T>
using mckl::Particle< T >::rng_type = typename rng_set_type::rng_type

Definition at line 286 of file particle.hpp.

◆ size_type

template<typename T>
using mckl::Particle< T >::size_type = SizeType<T>

Definition at line 282 of file particle.hpp.

◆ state_type

template<typename T>
using mckl::Particle< T >::state_type = T

Definition at line 283 of file particle.hpp.

◆ weight_type

template<typename T>
using mckl::Particle< T >::weight_type = WeightType<T>

Definition at line 284 of file particle.hpp.

Constructor & Destructor Documentation

◆ Particle() [1/2]

template<typename T>
mckl::Particle< T >::Particle ( )
inline

Default constructor.

Definition at line 289 of file particle.hpp.

◆ Particle() [2/2]

template<typename T>
template<typename... Args>
mckl::Particle< T >::Particle ( size_type  N,
Args &&...  args 
)
inlineexplicit

Construct a particle system.

All arguments are passed down to the constructor of T

Definition at line 299 of file particle.hpp.

Member Function Documentation

◆ at()

template<typename T>
ParticleIndex<T> mckl::Particle< T >::at ( size_type  i)
inline

Get a ParticleIndex<T> object for the i-th particle.

Definition at line 370 of file particle.hpp.

◆ begin()

template<typename T>
ParticleIndex<T> mckl::Particle< T >::begin ( )
inline

Get a ParticleIndex<T> object for the first particle.

Definition at line 385 of file particle.hpp.

◆ clone()

template<typename T>
Particle mckl::Particle< T >::clone ( ) const
inline

Clone the Particle except the RNG engines.

Definition at line 308 of file particle.hpp.

◆ end()

template<typename T>
ParticleIndex<T> mckl::Particle< T >::end ( )
inline

Get a ParticleIndex<T> object for one pass the last particle.

Definition at line 388 of file particle.hpp.

◆ operator[]()

template<typename T>
ParticleIndex<T> mckl::Particle< T >::operator[] ( size_type  i)
inline

Get a ParticleIndex<T> object for the i-th particle.

Definition at line 379 of file particle.hpp.

◆ range() [1/2]

template<typename T>
ParticleRange<T> mckl::Particle< T >::range ( size_type  grainsize = 1)
inline

Get a Range<ParticleItrator<T>> object of all particles.

Definition at line 391 of file particle.hpp.

◆ range() [2/2]

template<typename T>
ParticleRange<T> mckl::Particle< T >::range ( size_type  ibegin,
size_type  iend,
size_type  grainsize = 1 
)
inline

Get a ParticleRange<T> object given a range denoted by integral values.

Definition at line 398 of file particle.hpp.

◆ rng() [1/4]

template<typename T>
rng_type& mckl::Particle< T >::rng ( size_type  i)
inline

Get an (parallel) RNG stream for a given particle.

Definition at line 352 of file particle.hpp.

◆ rng() [2/4]

template<typename T>
const rng_type& mckl::Particle< T >::rng ( size_type  i) const
inline

Get an (parallel) RNG stream for a given particle.

Definition at line 358 of file particle.hpp.

◆ rng() [3/4]

template<typename T>
rng_type& mckl::Particle< T >::rng ( )
inline

Get the (sequential) RNG used stream for resampling.

Definition at line 364 of file particle.hpp.

◆ rng() [4/4]

template<typename T>
const rng_type& mckl::Particle< T >::rng ( ) const
inline

Get the (sequential) RNG used stream for resampling.

Definition at line 367 of file particle.hpp.

◆ rng_set() [1/2]

template<typename T>
rng_set_type& mckl::Particle< T >::rng_set ( )
inline

Read and write access to the RNG collection object.

Definition at line 346 of file particle.hpp.

◆ rng_set() [2/2]

template<typename T>
const rng_set_type& mckl::Particle< T >::rng_set ( ) const
inline

Read only access to the RNG collection object.

Definition at line 349 of file particle.hpp.

◆ select()

template<typename T>
template<typename InputIter >
void mckl::Particle< T >::select ( size_type  n,
InputIter  index 
)
inline

Resize by selecting according to user supplied index vector.

Parameters
nThe new sample size
indexN-vector of parent indices

Definition at line 325 of file particle.hpp.

◆ size()

template<typename T>
size_type mckl::Particle< T >::size ( ) const
inline

The number of particles.

Definition at line 318 of file particle.hpp.

◆ state() [1/2]

template<typename T>
state_type& mckl::Particle< T >::state ( )
inline

Read and write access to the state collection object.

Definition at line 334 of file particle.hpp.

◆ state() [2/2]

template<typename T>
const state_type& mckl::Particle< T >::state ( ) const
inline

Read only access to the state collection object.

Definition at line 337 of file particle.hpp.

◆ weight() [1/2]

template<typename T>
weight_type& mckl::Particle< T >::weight ( )
inline

Read and write access to the weight collection object.

Definition at line 340 of file particle.hpp.

◆ weight() [2/2]

template<typename T>
const weight_type& mckl::Particle< T >::weight ( ) const
inline

Read only access to the weight collection object.

Definition at line 343 of file particle.hpp.

Friends And Related Function Documentation

◆ operator!=

template<typename T>
bool operator!= ( const Particle< T > &  p1,
const Particle< T > &  p2 
)
friend

Definition at line 410 of file particle.hpp.

◆ operator==

template<typename T>
bool operator== ( const Particle< T > &  p1,
const Particle< T > &  p2 
)
friend

Definition at line 405 of file particle.hpp.