BioCMAMC-ST
MC::ParticlesContainer< Model > Class Template Reference

Main owning object for Monte-Carlo particles. More...

#include <particles_container.hpp>

Public Types

using UsedModel = Model

Public Member Functions

 ParticlesContainer (std::size_t n_particle, bool virtual_position=false)
 Alias for the model used by the container.
 ParticlesContainer ()
 ParticlesContainer (const ParticlesContainer &)=default
 Default copy and move constructors and assignment operators.
 ParticlesContainer (ParticlesContainer &&)=default
ParticlesContaineroperator= (const ParticlesContainer &)=default
ParticlesContaineroperator= (ParticlesContainer &&)=default
 ~ParticlesContainer ()=default
 Default destructor.
template<typename CviewType>
KOKKOS_INLINE_FUNCTION void get_contributions (std::size_t idx, const CviewType &contributions) const
KOKKOS_INLINE_FUNCTION bool handle_division (const MC::KPRNG::pool_type &random_pool, std::size_t idx1) const
KOKKOS_INLINE_FUNCTION double get_weight (std::size_t idx) const
void force_remove_dead ()
void merge_buffer ()
auto get_buffer_index () const
template<class Archive>
void save (Archive &ar) const
template<class Archive>
void load (Archive &ar)
double get_allocation_factor () const
std::size_t capacity () const
std::size_t get_inactive () const
std::size_t update_and_clean_dead (std::size_t out, std::size_t dead, std::size_t threshold)
KOKKOS_INLINE_FUNCTION std::size_t n_particles () const
 Gets the number of particles in the container.
void clean_dead (std::size_t to_remove)

Public Attributes

Model::SelfParticle model
MC::ParticlePositions position
MC::ParticleStatus status
ParticleWeigths weights
ParticleAges ages

Static Public Attributes

static constexpr double buffer_ratio

Private Member Functions

void __allocate_buffer__ ()
void _resize (std::size_t new_size, bool force=false)

Private Attributes

Model::SelfParticle buffer_model
ParticlePositions buffer_position
Kokkos::View< uint64_t, Kokkos::SharedSpace > buffer_index
double allocation_factor
std::size_t n_allocated_elements
uint64_t n_used_elements
std::size_t inactive_counter = 0
bool flag_virtual_position = false
int begin
int end

Static Private Attributes

static constexpr double default_allocation_factor = 2

Detailed Description

template<ModelType Model>
class MC::ParticlesContainer< Model >

Main owning object for Monte-Carlo particles.

This class is responsible for managing and owning containers related to particles, providing access to them for processing in a Monte-Carlo simulation. It uses a templated model to define the behavior and properties of the particles.

Template Parameters
ModelThe particle model type used for defining the behavior and properties of the particles.

Member Typedef Documentation

◆ UsedModel

template<ModelType Model>
using MC::ParticlesContainer< Model >::UsedModel = Model

Constructor & Destructor Documentation

◆ ParticlesContainer() [1/4]

template<ModelType M>
MC::ParticlesContainer< M >::ParticlesContainer ( std::size_t n_particle,
bool virtual_position = false )
explicit

Alias for the model used by the container.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParticlesContainer() [2/4]

template<ModelType M>
MC::ParticlesContainer< M >::ParticlesContainer ( )

◆ ParticlesContainer() [3/4]

template<ModelType Model>
MC::ParticlesContainer< Model >::ParticlesContainer ( const ParticlesContainer< Model > & )
default

Default copy and move constructors and assignment operators.

Here is the call graph for this function:

◆ ParticlesContainer() [4/4]

template<ModelType Model>
MC::ParticlesContainer< Model >::ParticlesContainer ( ParticlesContainer< Model > && )
default
Here is the call graph for this function:

◆ ~ParticlesContainer()

template<ModelType Model>
MC::ParticlesContainer< Model >::~ParticlesContainer ( )
default

Default destructor.

Member Function Documentation

◆ __allocate_buffer__()

template<ModelType Model>
void MC::ParticlesContainer< Model >::__allocate_buffer__ ( )
private
Here is the caller graph for this function:

◆ _resize()

template<ModelType Model>
void MC::ParticlesContainer< Model >::_resize ( std::size_t new_size,
bool force = false )
private
Here is the caller graph for this function:

◆ capacity()

template<ModelType Model>
std::size_t MC::ParticlesContainer< Model >::capacity ( ) const
nodiscard

◆ clean_dead()

template<ModelType M>
void MC::ParticlesContainer< M >::clean_dead ( std::size_t to_remove)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_remove_dead()

template<ModelType Model>
void MC::ParticlesContainer< Model >::force_remove_dead ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_allocation_factor()

template<ModelType Model>
double MC::ParticlesContainer< Model >::get_allocation_factor ( ) const
nodiscard

◆ get_buffer_index()

template<ModelType Model>
auto MC::ParticlesContainer< Model >::get_buffer_index ( ) const
nodiscard

◆ get_contributions()

template<ModelType Model>
template<typename CviewType>
KOKKOS_INLINE_FUNCTION void MC::ParticlesContainer< Model >::get_contributions ( std::size_t idx,
const CviewType & contributions ) const
inline
Here is the call graph for this function:

◆ get_inactive()

template<ModelType Model>
std::size_t MC::ParticlesContainer< Model >::get_inactive ( ) const
nodiscard

◆ get_weight()

template<ModelType M>
KOKKOS_INLINE_FUNCTION double MC::ParticlesContainer< M >::get_weight ( std::size_t idx) const
nodiscard
Here is the caller graph for this function:

◆ handle_division()

template<ModelType Model>
KOKKOS_INLINE_FUNCTION bool MC::ParticlesContainer< Model >::handle_division ( const MC::KPRNG::pool_type & random_pool,
std::size_t idx1 ) const
nodiscard

◆ load()

template<ModelType Model>
template<class Archive>
void MC::ParticlesContainer< Model >::load ( Archive & ar)
Here is the call graph for this function:

◆ merge_buffer()

template<ModelType Model>
void MC::ParticlesContainer< Model >::merge_buffer ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ n_particles()

template<ModelType Model>
KOKKOS_INLINE_FUNCTION std::size_t MC::ParticlesContainer< Model >::n_particles ( ) const
nodiscard

Gets the number of particles in the container.

Returns
The number of particles currently in the to_process container.
Here is the caller graph for this function:

◆ operator=() [1/2]

template<ModelType Model>
ParticlesContainer & MC::ParticlesContainer< Model >::operator= ( const ParticlesContainer< Model > & )
default
Here is the call graph for this function:

◆ operator=() [2/2]

template<ModelType Model>
ParticlesContainer & MC::ParticlesContainer< Model >::operator= ( ParticlesContainer< Model > && )
default
Here is the call graph for this function:

◆ save()

template<ModelType Model>
template<class Archive>
void MC::ParticlesContainer< Model >::save ( Archive & ar) const

◆ update_and_clean_dead()

template<ModelType Model>
std::size_t MC::ParticlesContainer< Model >::update_and_clean_dead ( std::size_t out,
std::size_t dead,
std::size_t threshold )
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ ages

template<ModelType Model>
ParticleAges MC::ParticlesContainer< Model >::ages

◆ allocation_factor

template<ModelType Model>
double MC::ParticlesContainer< Model >::allocation_factor
private

◆ begin

template<ModelType Model>
int MC::ParticlesContainer< Model >::begin
private

◆ buffer_index

template<ModelType Model>
Kokkos::View<uint64_t, Kokkos::SharedSpace> MC::ParticlesContainer< Model >::buffer_index
private

◆ buffer_model

template<ModelType Model>
Model::SelfParticle MC::ParticlesContainer< Model >::buffer_model
private

◆ buffer_position

template<ModelType Model>
ParticlePositions MC::ParticlesContainer< Model >::buffer_position
private

◆ buffer_ratio

template<ModelType Model>
double MC::ParticlesContainer< Model >::buffer_ratio
staticconstexpr
Initial value:
=
1

Buffer size = ceil(list.size()*buffer_ratio), 0.6 is fine for high division rate or stiff increase to 1

◆ default_allocation_factor

template<ModelType Model>
double MC::ParticlesContainer< Model >::default_allocation_factor = 2
staticconstexprprivate

◆ end

template<ModelType Model>
int MC::ParticlesContainer< Model >::end
private

◆ flag_virtual_position

template<ModelType Model>
bool MC::ParticlesContainer< Model >::flag_virtual_position = false
private

◆ inactive_counter

template<ModelType Model>
std::size_t MC::ParticlesContainer< Model >::inactive_counter = 0
private

◆ model

template<ModelType Model>
Model::SelfParticle MC::ParticlesContainer< Model >::model

◆ n_allocated_elements

template<ModelType Model>
std::size_t MC::ParticlesContainer< Model >::n_allocated_elements
private

◆ n_used_elements

template<ModelType Model>
uint64_t MC::ParticlesContainer< Model >::n_used_elements
private

◆ position

template<ModelType Model>
MC::ParticlePositions MC::ParticlesContainer< Model >::position

◆ status

template<ModelType Model>
MC::ParticleStatus MC::ParticlesContainer< Model >::status

◆ weights

template<ModelType Model>
ParticleWeigths MC::ParticlesContainer< Model >::weights

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