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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE GRIN_captureLevelProbability ()
LUPI_HOST GRIN_captureLevelProbability (SetupInfo &a_setupInfo, PoPI::Database const &a_pops, GIDI::GRIN::CaptureLevelProbability const *a_captureLevelProbability)
LUPI_HOST_DEVICE ~GRIN_captureLevelProbability ()
template<typename RNG>
LUPI_HOST_DEVICE int sampleCaptureLevel (ProtareSingle const *a_protare, double a_energy, RNG &&a_rng)
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Detailed Description

This class represents

Definition at line 1121 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ GRIN_captureLevelProbability() [1/2]

LUPI_HOST_DEVICE MCGIDI::GRIN_captureLevelProbability::GRIN_captureLevelProbability ( )

Definition at line 374 of file MCGIDI_GRIN.cc.

374 {
375
376}

◆ GRIN_captureLevelProbability() [2/2]

LUPI_HOST MCGIDI::GRIN_captureLevelProbability::GRIN_captureLevelProbability ( SetupInfo & a_setupInfo,
PoPI::Database const & a_pops,
GIDI::GRIN::CaptureLevelProbability const * a_captureLevelProbability )
Parameters
a_setupInfo[in] Used internally when constructing a Protare to pass information to other constructors.
a_captureLevelProbability[in] GIDI instance with the data.

Definition at line 383 of file MCGIDI_GRIN.cc.

384 :
385 m_knownLevelsAndProbabilities( a_setupInfo, a_pops, a_captureLevelProbability->table( ), false ) {
386
387 auto capturePrimaryToContinua = LUPI::Misc::splitString( a_captureLevelProbability->capturePrimaryToContinua( ), true );
388 m_captureToCompounds.reserve( capturePrimaryToContinua.size( ) );
389 for( std::size_t i1 = 0; i1 < capturePrimaryToContinua.size( ); ++i1 ) {
390 m_captureToCompounds.push_back( new GRIN_captureToCompound( a_setupInfo, a_pops, capturePrimaryToContinua[i1] ) );
391 }
392}
std::vector< std::string > splitString(std::string const &a_string, char a_delimiter, bool a_strip=false)
Definition LUPI_misc.cc:103

◆ ~GRIN_captureLevelProbability()

LUPI_HOST_DEVICE MCGIDI::GRIN_captureLevelProbability::~GRIN_captureLevelProbability ( )

Definition at line 397 of file MCGIDI_GRIN.cc.

397 {
398
399}

Member Function Documentation

◆ sampleCaptureLevel()

template<typename RNG>
LUPI_HOST_DEVICE int MCGIDI::GRIN_captureLevelProbability::sampleCaptureLevel ( ProtareSingle const * a_protare,
double a_energy,
RNG && a_rng )
inline

This method samples a capture state level and returns an index into the a_protare->m_nuclideGammaBranchStateInfos vector of the sampled state level.

Parameters
a_protare[in] The ProtareSingle this Reaction belongs to.
a_energy[in] The neutron separation energy plus the projectile energy.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
Returns
An integer of the sampled state in a_protare->m_nuclideGammaBranchStateInfos.

Definition at line 3208 of file MCGIDI_headerSource.hpp.

3208 {
3209
3210 double random = a_rng( );
3211 for( std::size_t index = 0; index < m_knownLevelsAndProbabilities.m_levels.size( ); ++index ) {
3212 if( m_knownLevelsAndProbabilities.m_summedProbabilities[index] >= random ) {
3213 return( m_knownLevelsAndProbabilities.m_levels[index] );
3214 }
3215 }
3216
3217 for( std::size_t i1 = 0; i1 < m_captureToCompounds.size( ) - 1; ++i1 ) {
3218 GRIN_captureToCompound const *GRIN_captureToCompound1 = m_captureToCompounds[i1];
3219
3220 int index = GRIN_captureToCompound1->sampleCaptureLevel( a_protare, a_energy, a_rng, true );
3221 if( index > -1 ) return( index );
3222 }
3223
3224 return( m_captureToCompounds.back( )->sampleCaptureLevel( a_protare, a_energy, a_rng, false ) );
3225}

Referenced by MCGIDI::GRIN_capture::sampleProducts().

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::GRIN_captureLevelProbability::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 409 of file MCGIDI_GRIN.cc.

409 {
410
411 m_knownLevelsAndProbabilities.serialize( a_buffer, a_mode );
412
413 std::size_t vectorSize = m_captureToCompounds.size( );
414 int vectorSizeInt = (int) vectorSize;
415 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
416 vectorSize = (std::size_t) vectorSizeInt;
417
418 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
419 m_captureToCompounds.resize( vectorSize, &a_buffer.m_placement );
420 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
421 if( a_buffer.m_placement != nullptr ) {
422 m_captureToCompounds[vectorIndex] = new(a_buffer.m_placement) GRIN_captureToCompound;
423 a_buffer.incrementPlacement( sizeof( GRIN_captureToCompound ) ); }
424 else {
425 m_captureToCompounds[vectorIndex] = new GRIN_captureToCompound;
426 }
427 } }
428 else if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
429 a_buffer.m_placement += m_captureToCompounds.internalSize( );
430 a_buffer.incrementPlacement( sizeof( GRIN_captureToCompound ) * vectorSize );
431 }
432
433 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
434 m_captureToCompounds[vectorIndex]->serialize( a_buffer, a_mode );
435 }
436}
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)

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