Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI::GRIN_levelsAndProbabilities Class Reference

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE GRIN_levelsAndProbabilities ()
LUPI_HOST GRIN_levelsAndProbabilities (SetupInfo &a_setupInfo, PoPI::Database const &a_pops, GIDI::Table::Table const &a_table, bool a_normalize)
LUPI_HOST_DEVICE ~GRIN_levelsAndProbabilities ()
LUPI_HOST void set (std::vector< int > const &a_levels, std::vector< double > const &a_probabilities)
template<typename RNG>
LUPI_HOST_DEVICE int sampleInelasticLevel (double a_energy, RNG &&a_rng)
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Public Attributes

Vector< int > m_levels
Vector< double > m_summedProbabilities
Vector< bool > m_isModelledLevel

Detailed Description

This class stores a Vector of summed probabilities and a Vector of their associated nuclide level as needed by inelastic and cpature GRIN continuum reaction data.

Definition at line 1006 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ GRIN_levelsAndProbabilities() [1/2]

LUPI_HOST_DEVICE MCGIDI::GRIN_levelsAndProbabilities::GRIN_levelsAndProbabilities ( )

Definition at line 22 of file MCGIDI_GRIN.cc.

22 {
23
24}

◆ GRIN_levelsAndProbabilities() [2/2]

LUPI_HOST MCGIDI::GRIN_levelsAndProbabilities::GRIN_levelsAndProbabilities ( SetupInfo & a_setupInfo,
PoPI::Database const & a_pops,
GIDI::Table::Table const & a_table,
bool a_normalize )
Parameters
a_setupInfo[in] Used internally when constructing a Protare to pass information to other constructors.
a_table[in] The table with a column containing nucide ids and a column with their probabilities.

Definition at line 31 of file MCGIDI_GRIN.cc.

32 {
33
34 m_summedProbabilities.reserve( a_table.rows( ) );
35 m_levels.reserve( a_table.rows( ) );
36 m_isModelledLevel.reserve( a_table.rows( ) );
37
38 double sum = 0.0;
39 auto cells = LUPI::Misc::splitString( LUPI::Misc::stripString( a_table.data( ).body( ) ), ' ', true );
40 for( std::size_t index = 0; index < cells.size( ); ++index ) {
41 m_levels.push_back( a_setupInfo.m_stateNamesToIndices[cells[index]] );
42 PoPI::Nuclide const &nuclide = a_pops.get<PoPI::Nuclide const>( cells[index] );
43
44 ++index;
45 sum += std::stod( cells[index] );
46 m_summedProbabilities.push_back( sum );
47
48 m_isModelledLevel.push_back( nuclide.kind( ) == PoPI_continuumChars );
49 }
50
51 if( a_normalize ) {
52 for( auto iter = m_summedProbabilities.begin( ); iter != m_summedProbabilities.end( ); ++iter ) (*iter) /= sum;
53 }
54}
#define PoPI_continuumChars
Definition PoPI.hpp:99
Vector< double > m_summedProbabilities
Definition MCGIDI.hpp:1010
std::vector< std::string > splitString(std::string const &a_string, char a_delimiter, bool a_strip=false)
Definition LUPI_misc.cc:103
std::string stripString(std::string const &a_string, bool a_left=true, bool a_right=true)
Definition LUPI_misc.cc:68

◆ ~GRIN_levelsAndProbabilities()

LUPI_HOST_DEVICE MCGIDI::GRIN_levelsAndProbabilities::~GRIN_levelsAndProbabilities ( )

Definition at line 59 of file MCGIDI_GRIN.cc.

59 {
60
61}

Member Function Documentation

◆ sampleInelasticLevel()

template<typename RNG>
LUPI_HOST_DEVICE int MCGIDI::GRIN_levelsAndProbabilities::sampleInelasticLevel ( double a_energy,
RNG && a_rng )
inline

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::GRIN_levelsAndProbabilities::serialize ( LUPI::DataBuffer & a_buffer,
LUPI::DataBuffer::Mode a_mode )

This method serializes this for broadcasting as needed for MPI and GPUs. The method can count the number of required bytes, pack this or unpack this depending on a_mode.

Parameters
a_buffer[in] The buffer to read or write data to depending on a_mode.
a_mode[in] Specifies the action of this method.

Definition at line 93 of file MCGIDI_GRIN.cc.

93 {
94
95 DATA_MEMBER_VECTOR_INT( m_levels, a_buffer, a_mode );
97 DATA_MEMBER_VECTOR_BOOL( m_isModelledLevel, a_buffer, a_mode );
98}
#define DATA_MEMBER_VECTOR_INT(member, buf, mode)
#define DATA_MEMBER_VECTOR_BOOL(member, buf, mode)
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)

◆ set()

LUPI_HOST void MCGIDI::GRIN_levelsAndProbabilities::set ( std::vector< int > const & a_levels,
std::vector< double > const & a_probabilities )

Definition at line 66 of file MCGIDI_GRIN.cc.

66 {
67
68 m_levels.reserve( a_levels.size( ) );
69 m_summedProbabilities.reserve( a_levels.size( ) );
70 m_isModelledLevel.reserve( a_levels.size( ) );
71
72 double sum = 0;
73 for( std::size_t index = 0; index < a_levels.size( ); ++index ) {
74 m_levels.push_back( a_levels[index] );
75 sum += a_probabilities[index];
76 m_summedProbabilities.push_back( sum );
77 m_isModelledLevel.push_back( true );
78 }
79
80 for( auto iter = m_summedProbabilities.begin( ); iter != m_summedProbabilities.end( ); ++iter ) {
81 *iter /= sum;
82 }
83}

Member Data Documentation

◆ m_isModelledLevel

Vector<bool> MCGIDI::GRIN_levelsAndProbabilities::m_isModelledLevel

The entry for each item in m_levels which is true if the level is a modelled level and false otherwise.

Definition at line 1011 of file MCGIDI.hpp.

Referenced by GRIN_levelsAndProbabilities(), serialize(), and set().

◆ m_levels

Vector<int> MCGIDI::GRIN_levelsAndProbabilities::m_levels

The list of nuclide indices for the nuclides in m_state as stored in member ProtareSingle::m_nuclideGammaBranchStateInfos.

Definition at line 1009 of file MCGIDI.hpp.

Referenced by GRIN_levelsAndProbabilities(), serialize(), and set().

◆ m_summedProbabilities

Vector<double> MCGIDI::GRIN_levelsAndProbabilities::m_summedProbabilities

The running sum of the probability for choosing a state from m_states.

Definition at line 1010 of file MCGIDI.hpp.

Referenced by GRIN_levelsAndProbabilities(), serialize(), and set().


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