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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE HeatedCrossSectionMultiGroup ()
LUPI_HOST HeatedCrossSectionMultiGroup (LUPI::StatusMessageReporting &a_smr, GIDI::ProtareSingle const &a_protare, SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Styles::TemperatureInfo const &a_temperatureInfo, GIDI::Transporting::Particles const &a_particles, std::vector< GIDI::Reaction const * > const &a_reactions, std::string const &a_label, bool a_zeroReactions, GIDI::ExcludeReactionsSet const &a_reactionsToExclude)
LUPI_HOST_DEVICE ~HeatedCrossSectionMultiGroup ()
LUPI_HOST_DEVICE HeatedReactionCrossSectionMultiGroupoperator[] (std::size_t a_index) const
LUPI_HOST_DEVICE std::size_t numberOfReactions () const
LUPI_HOST_DEVICE std::size_t thresholdOffset (std::size_t a_index) const
LUPI_HOST_DEVICE double threshold (std::size_t a_index) const
LUPI_HOST_DEVICE Vector< double > & totalCrossSection ()
LUPI_HOST_DEVICE double crossSection (std::size_t a_hashIndex, bool a_sampling=false) const
LUPI_HOST_DEVICE double augmentedCrossSection (std::size_t a_hashIndex) const
LUPI_HOST_DEVICE double reactionCrossSection (std::size_t a_reactionIndex, std::size_t a_hashIndex, bool a_sampling=false) const
LUPI_HOST_DEVICE double depositionEnergy (std::size_t a_hashIndex) const
LUPI_HOST_DEVICE double depositionMomentum (std::size_t a_hashIndex) const
LUPI_HOST_DEVICE double productionEnergy (std::size_t a_hashIndex) const
LUPI_HOST_DEVICE double gain (std::size_t a_hashIndex, int a_particleIndex) const
LUPI_HOST_DEVICE double gainViaIntid (std::size_t a_hashIndex, int a_particleIntid) const
LUPI_HOST void setUserParticleIndex (int a_particleIndex, int a_userParticleIndex)
LUPI_HOST void setUserParticleIndexViaIntid (int a_particleIntid, int a_userParticleIndex)
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST void write (FILE *a_file) const

Detailed Description

Definition at line 826 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ HeatedCrossSectionMultiGroup() [1/2]

LUPI_HOST_DEVICE MCGIDI::HeatedCrossSectionMultiGroup::HeatedCrossSectionMultiGroup ( )

Definition at line 1629 of file MCGIDI_heatedCrossSections.cc.

1629 {
1630
1631}

◆ HeatedCrossSectionMultiGroup() [2/2]

LUPI_HOST MCGIDI::HeatedCrossSectionMultiGroup::HeatedCrossSectionMultiGroup ( LUPI::StatusMessageReporting & a_smr,
GIDI::ProtareSingle const & a_protare,
SetupInfo & a_setupInfo,
Transporting::MC const & a_settings,
GIDI::Styles::TemperatureInfo const & a_temperatureInfo,
GIDI::Transporting::Particles const & a_particles,
std::vector< GIDI::Reaction const * > const & a_reactions,
std::string const & a_label,
bool a_zeroReactions,
GIDI::ExcludeReactionsSet const & a_reactionsToExclude )

◆ ~HeatedCrossSectionMultiGroup()

LUPI_HOST_DEVICE MCGIDI::HeatedCrossSectionMultiGroup::~HeatedCrossSectionMultiGroup ( )

Definition at line 1715 of file MCGIDI_heatedCrossSections.cc.

1715 {
1716
1717 for( auto iter = m_reactionCrossSections.begin( ); iter < m_reactionCrossSections.end( ); ++iter ) delete *iter;
1718 for( auto iter = m_gains.begin( ); iter < m_gains.end( ); ++iter ) delete *iter;
1719}

Referenced by ~HeatedCrossSectionMultiGroup().

Member Function Documentation

◆ augmentedCrossSection()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::augmentedCrossSection ( std::size_t a_hashIndex) const
inline

Returns the value of the of the augmented cross section the reaction at index a_index.

Definition at line 856 of file MCGIDI.hpp.

◆ crossSection()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::crossSection ( std::size_t a_hashIndex,
bool a_sampling = false ) const

Returns the multi-group cross section.

Parameters
a_hashIndex[in] The multi-group index.
a_sampling[in] Fix me.
Returns
A vector of the length of the number of multi-group groups.

Definition at line 1730 of file MCGIDI_heatedCrossSections.cc.

1730 {
1731
1732 double crossSection2 = m_totalCrossSection[a_hashIndex];
1733
1734 if( a_sampling ) crossSection2 += m_augmentedCrossSection[a_hashIndex];
1735
1736 return( crossSection2 );
1737}

Referenced by crossSection(), and reactionCrossSection().

◆ depositionEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::depositionEnergy ( std::size_t a_hashIndex) const
inline

Definition at line 863 of file MCGIDI.hpp.

863{ return( m_depositionEnergy[a_hashIndex] ); }

◆ depositionMomentum()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::depositionMomentum ( std::size_t a_hashIndex) const
inline

Definition at line 864 of file MCGIDI.hpp.

864{ return( m_depositionMomentum[a_hashIndex] ); }

◆ gain()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::gain ( std::size_t a_hashIndex,
int a_particleIndex ) const

Returns the multi-group gain for particle with index a_particleIndex. If no particle is found, a Vector of all 0's is returned.

Parameters
a_particleIndex[in] The index of the particle whose gain is to be returned.
a_hashIndex[in] The multi-group index.
Returns
A vector of the length of the number of multi-group groups.

Definition at line 1748 of file MCGIDI_heatedCrossSections.cc.

1748 {
1749
1750 for( std::size_t i1 = 0; i1 < m_gains.size( ); ++i1 ) {
1751 if( a_particleIndex == m_gains[i1]->particleIndex( ) ) return( m_gains[i1]->gain( a_hashIndex ) );
1752 }
1753
1754 return( 0.0 );
1755}
LUPI_HOST_DEVICE double gain(std::size_t a_hashIndex, int a_particleIndex) const

Referenced by gain(), and gainViaIntid().

◆ gainViaIntid()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::gainViaIntid ( std::size_t a_hashIndex,
int a_particleIntid ) const

Returns the multi-group gain for particle with intid a_particleIntid. If no particle is found, a Vector of all 0's is returned.

Parameters
a_particleIntid[in] The intid of the particle whose gain is to be returned.
a_hashIndex[in] The multi-group index.
Returns
A vector of the length of the number of multi-group groups.

Definition at line 1766 of file MCGIDI_heatedCrossSections.cc.

1766 {
1767
1768 for( std::size_t i1 = 0; i1 < m_gains.size( ); ++i1 ) {
1769 if( a_particleIntid == m_gains[i1]->particleIntid( ) ) return( m_gains[i1]->gain( a_hashIndex ) );
1770 }
1771
1772 return( 0.0 );
1773}

Referenced by gainViaIntid().

◆ numberOfReactions()

LUPI_HOST_DEVICE std::size_t MCGIDI::HeatedCrossSectionMultiGroup::numberOfReactions ( ) const
inline

Returns the number of reactions stored in this.

Definition at line 847 of file MCGIDI.hpp.

◆ operator[]()

LUPI_HOST_DEVICE HeatedReactionCrossSectionMultiGroup * MCGIDI::HeatedCrossSectionMultiGroup::operator[] ( std::size_t a_index) const
inline

Returns the HeatedReactionCrossSectionMultiGroup for the reaction at index a_index *a_index.

Definition at line 845 of file MCGIDI.hpp.

◆ productionEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::productionEnergy ( std::size_t a_hashIndex) const
inline

Definition at line 865 of file MCGIDI.hpp.

865{ return( m_productionEnergy[a_hashIndex] ); }

◆ reactionCrossSection()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::reactionCrossSection ( std::size_t a_reactionIndex,
std::size_t a_hashIndex,
bool a_sampling = false ) const
inline

Returns the reaction's cross section for the reaction at index a_reactionIndex and multi-group index a_hashIndex.

Definition at line 858 of file MCGIDI.hpp.

Referenced by MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction().

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::HeatedCrossSectionMultiGroup::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 1807 of file MCGIDI_heatedCrossSections.cc.

1807 {
1808
1809 DATA_MEMBER_VECTOR_DOUBLE( m_totalCrossSection, a_buffer, a_mode );
1810 DATA_MEMBER_VECTOR_DOUBLE( m_augmentedCrossSection, a_buffer, a_mode );
1811 DATA_MEMBER_VECTOR_DOUBLE( m_depositionEnergy, a_buffer, a_mode );
1812 DATA_MEMBER_VECTOR_DOUBLE( m_depositionMomentum, a_buffer, a_mode );
1813 DATA_MEMBER_VECTOR_DOUBLE( m_productionEnergy, a_buffer, a_mode );
1814
1815 std::size_t vectorSize = m_reactionCrossSections.size( );
1816 int vectorSizeInt = (int) vectorSize;
1817 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1818 vectorSize = (std::size_t) vectorSizeInt;
1819
1820 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_reactionCrossSections.resize( vectorSize, &a_buffer.m_placement );
1821 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_reactionCrossSections.internalSize();
1822 for( std::size_t memberIndex = 0; memberIndex < vectorSize; ++memberIndex ) {
1823 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
1824 if( a_buffer.m_placement != nullptr ) {
1825 m_reactionCrossSections[memberIndex] = new(a_buffer.m_placement) HeatedReactionCrossSectionMultiGroup;
1826 a_buffer.incrementPlacement( sizeof( HeatedReactionCrossSectionMultiGroup ) ); }
1827 else {
1828 m_reactionCrossSections[memberIndex] = new HeatedReactionCrossSectionMultiGroup;
1829 }
1830 }
1831 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
1832 a_buffer.incrementPlacement( sizeof( HeatedReactionCrossSectionMultiGroup ) );
1833 }
1834 m_reactionCrossSections[memberIndex]->serialize( a_buffer, a_mode );
1835 }
1836
1837 vectorSize = m_gains.size( );
1838 vectorSizeInt = (int) vectorSize;
1839 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1840 vectorSize = (std::size_t) vectorSizeInt;
1841 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_gains.resize( vectorSize, &a_buffer.m_placement );
1842 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_gains.internalSize();
1843 for( std::size_t memberIndex = 0; memberIndex < vectorSize; ++memberIndex ) {
1844 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
1845 if( a_buffer.m_placement != nullptr ) {
1846 m_gains[memberIndex] = new(a_buffer.m_placement) MultiGroupGain;
1847 a_buffer.incrementPlacement( sizeof( MultiGroupGain ) ); }
1848 else {
1849 m_gains[memberIndex] = new MultiGroupGain;
1850 }
1851 }
1852 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
1853 a_buffer.incrementPlacement( sizeof( MultiGroupGain ) );
1854 }
1855 m_gains[memberIndex]->serialize( a_buffer, a_mode );
1856 }
1857}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)

Referenced by serialize().

◆ setUserParticleIndex()

LUPI_HOST void MCGIDI::HeatedCrossSectionMultiGroup::setUserParticleIndex ( int a_particleIndex,
int a_userParticleIndex )

Updates the m_userParticleIndex to a_userParticleIndex for all particles with PoPs index a_particleIntid.

Parameters
a_particleIndex[in] The index of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 1782 of file MCGIDI_heatedCrossSections.cc.

1782 {
1783
1784 for( auto iter = m_gains.begin( ); iter != m_gains.end( ); ++iter ) (*iter)->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
1785}

Referenced by setUserParticleIndex().

◆ setUserParticleIndexViaIntid()

LUPI_HOST void MCGIDI::HeatedCrossSectionMultiGroup::setUserParticleIndexViaIntid ( int a_particleIntid,
int a_userParticleIndex )

Updates the m_userParticleIndex to a_userParticleIndex for all particles with PoPs intid a_particleIntid.

Parameters
a_particleIntid[in] The intid of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 1794 of file MCGIDI_heatedCrossSections.cc.

1794 {
1795
1796 for( auto iter = m_gains.begin( ); iter != m_gains.end( ); ++iter ) (*iter)->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
1797}

Referenced by setUserParticleIndexViaIntid().

◆ threshold()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionMultiGroup::threshold ( std::size_t a_index) const
inline

Definition at line 852 of file MCGIDI.hpp.

852{ return( m_reactionCrossSections[a_index]->threshold( ) ); }
LUPI_HOST_DEVICE double threshold(std::size_t a_index) const
Definition MCGIDI.hpp:852

Referenced by threshold().

◆ thresholdOffset()

LUPI_HOST_DEVICE std::size_t MCGIDI::HeatedCrossSectionMultiGroup::thresholdOffset ( std::size_t a_index) const
inline

Returns the offset for the cross section for the reaction with index a_index.

Definition at line 850 of file MCGIDI.hpp.

◆ totalCrossSection()

LUPI_HOST_DEVICE Vector< double > & MCGIDI::HeatedCrossSectionMultiGroup::totalCrossSection ( )
inline

Returns a reference to member m_totalCrossSection.

Definition at line 854 of file MCGIDI.hpp.

◆ write()

LUPI_HOST void MCGIDI::HeatedCrossSectionMultiGroup::write ( FILE * a_file) const

This method writes the multi-group data.

Parameters
a_file[in] The buffer to read or write data to depending on a_mode.

Definition at line 1865 of file MCGIDI_heatedCrossSections.cc.

1865 {
1866
1867 writeVector( a_file, "Total cross section", 0, m_totalCrossSection );
1868 writeVector( a_file, "Augmented cross section", 0, m_augmentedCrossSection );
1869 writeVector( a_file, "Deposition energy", 0, m_depositionEnergy );
1870 writeVector( a_file, "Deposition momentum", 0, m_depositionMomentum );
1871 writeVector( a_file, "Production energy", 0, m_productionEnergy );
1872
1873 for( auto iter = m_gains.begin( ); iter != m_gains.end( ); ++iter ) (*iter)->write( a_file );
1874 std::size_t reactionIndex = 0;
1875 for( Vector<HeatedReactionCrossSectionMultiGroup *>::const_iterator iter = m_reactionCrossSections.begin( ); iter < m_reactionCrossSections.end( ); ++iter ) {
1876 (*iter)->write( a_file, reactionIndex );
1877 ++reactionIndex;
1878 }
1879}

Referenced by write().


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