|
BioCMAMC-ST
|
Main owning object for Monte-Carlo particles. More...
#include <particles_container.hpp>
Public Types | |
| using | UsedModel = Model |
Public Member Functions | |
| ParticlesContainer (RuntimeParameters rt_param, std::size_t n_particle, std::size_t _n_samples) | |
| Alias for the model used by the container. | |
| ParticlesContainer () | |
| ParticlesContainer (const ParticlesContainer &)=default | |
| Default copy and move constructors and assignment operators. | |
| ParticlesContainer (ParticlesContainer &&)=default | |
| ParticlesContainer & | operator= (const ParticlesContainer &)=default |
| ParticlesContainer & | operator= (ParticlesContainer &&)=default |
| ~ParticlesContainer ()=default | |
| Default destructor. | |
| KOKKOS_INLINE_FUNCTION auto | sample (const std::size_t idx, const std::size_t i_sample) const |
| KOKKOS_INLINE_FUNCTION auto | samples () |
| template<typename CviewType> | |
| KOKKOS_INLINE_FUNCTION void | get_contributions (const std::size_t idx, const CviewType &contributions) const |
| Get the contribution if particle at index idx. | |
| KOKKOS_INLINE_FUNCTION bool | handle_division (const MC::pool_type &random_pool, std::size_t idx1) const |
| Attempts to spawn a new particle by performing division on the specified particle. | |
| KOKKOS_INLINE_FUNCTION double | get_weight (std::size_t idx) const |
| Return the particle weight. | |
| void | force_remove_dead () |
| Clean all the non-idle particle even if number smaller than threshold. | |
| void | merge_buffer () |
| Insert particle buffer into the main container. | |
| template<class Archive> | |
| void | save (Archive &ar) const |
| Save data into ar for serialization. | |
| template<class Archive> | |
| void | load (Archive &ar) |
| Load data from ar for deserialization. | |
| double | get_allocation_factor () const noexcept |
| Get the allocation factor. | |
| void | change_nsample (const std::size_t new_n_sample) |
| std::size_t | capacity () const noexcept |
| Returns the total number of elements the container can hold without reallocating. | |
| std::size_t | get_inactive () const noexcept |
| Returns the total number of non-idlde particle. | |
| void | update_and_remove_inactive (std::size_t out, std::size_t dead) |
| Update the number of non-idle particle and remove if total number exceeds threshold May call : remove_inactive_particles. | |
| KOKKOS_INLINE_FUNCTION std::size_t | n_particles () const |
| Gets the number of particles in the container. | |
| void | change_runtime (RuntimeParameters &¶meters) noexcept |
| void | _sort (size_t n_c) |
| void | remove_inactive_particles (std::size_t to_remove) |
| Removes inactive particles from the container. | |
| auto | get_buffer_index () const |
Public Attributes | |
| Model::SelfParticle | model |
| MC::ParticlePositions | position |
| MC::ParticleStatus | status |
| ParticleWeigths | weights |
| ParticleAges | ages |
| ParticleSamples | random |
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 |
| std::size_t | n_allocated_elements |
| uint64_t | n_used_elements |
| std::size_t | inactive_counter |
| std::size_t | n_samples |
| RuntimeParameters | rt_params |
| int | begin |
| int | end |
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.
| Model | The particle model type used for defining the behavior and properties of the particles. |
| using MC::ParticlesContainer< Model >::UsedModel = Model |
|
explicit |
Alias for the model used by the container.
| MC::ParticlesContainer< M >::ParticlesContainer | ( | ) |
|
default |
Default copy and move constructors and assignment operators.
|
default |
|
default |
Default destructor.
|
private |
|
private |
| void MC::ParticlesContainer< M >::_sort | ( | size_t | n_c | ) |
|
nodiscardnoexcept |
Returns the total number of elements the container can hold without reallocating.
|
inline |
|
noexcept |
| void MC::ParticlesContainer< Model >::force_remove_dead | ( | ) |
Clean all the non-idle particle even if number smaller than threshold.
|
nodiscardnoexcept |
Get the allocation factor.
|
nodiscard |
|
inline |
Get the contribution if particle at index idx.
| CviewType | view type fo contribution |
|
nodiscardnoexcept |
Returns the total number of non-idlde particle.
|
nodiscard |
Return the particle weight.
|
nodiscard |
Attempts to spawn a new particle by performing division on the specified particle.
Executes container and buffer manipulations to spawn a new particle and invokes Model::division. The operation may fail if conditions for division are not met (e.g., insufficient space or invalid state).
| random_pool | The random number generator pool for stochastic operations. |
| idx1 | The index of the particle to undergo division. |
| void MC::ParticlesContainer< Model >::load | ( | Archive & | ar | ) |
Load data from ar for deserialization.
| void MC::ParticlesContainer< Model >::merge_buffer | ( | ) |
Insert particle buffer into the main container.
|
nodiscard |
Gets the number of particles in the container.
|
default |
|
default |
| void MC::ParticlesContainer< M >::remove_inactive_particles | ( | std::size_t | to_remove | ) |
Removes inactive particles from the container.
This function handles the removal of inactive particles based on the specified count. Depending on the number of particles to remove, it may:
| to_remove | The number of inactive particles to remove. |
| std::runtime_error | If to_remove is incoherent or exceeds valid bounds. |
|
inline |
|
inline |
| void MC::ParticlesContainer< Model >::save | ( | Archive & | ar | ) | const |
Save data into ar for serialization.
| void MC::ParticlesContainer< Model >::update_and_remove_inactive | ( | std::size_t | out, |
| std::size_t | dead ) |
Update the number of non-idle particle and remove if total number exceeds threshold May call : remove_inactive_particles.
| ParticleAges MC::ParticlesContainer< Model >::ages |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| Model::SelfParticle MC::ParticlesContainer< Model >::model |
|
private |
|
private |
|
private |
| MC::ParticlePositions MC::ParticlesContainer< Model >::position |
| ParticleSamples MC::ParticlesContainer< Model >::random |
|
private |
| MC::ParticleStatus MC::ParticlesContainer< Model >::status |
| ParticleWeigths MC::ParticlesContainer< Model >::weights |