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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE HeatedCrossSectionsMultiGroup ()
LUPI_HOST_DEVICE ~HeatedCrossSectionsMultiGroup ()
LUPI_HOST_DEVICE double minimumEnergy () const
LUPI_HOST_DEVICE double maximumEnergy () const
LUPI_HOST_DEVICE Vector< double > const & temperatures () const
LUPI_HOST void update (LUPI::StatusMessageReporting &a_smr, GIDI::ProtareSingle const &a_protare, SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Transporting::Particles const &a_particles, GIDI::Styles::TemperatureInfos const &a_temperatureInfos, std::vector< GIDI::Reaction const * > const &a_reactions, std::vector< GIDI::Reaction const * > const &a_orphanProducts, bool a_zeroReactions, GIDI::ExcludeReactionsSet const &a_reactionsToExclude)
LUPI_HOST_DEVICE int multiGroupThresholdIndex (std::size_t a_index) const
LUPI_HOST_DEVICE Vector< double > const & projectileMultiGroupBoundariesCollapsed () const
LUPI_HOST_DEVICE Vector< HeatedCrossSectionMultiGroup * > const & heatedCrossSections () const
LUPI_HOST_DEVICE double threshold (std::size_t a_index) const
LUPI_HOST_DEVICE double crossSection (std::size_t a_hashIndex, double a_temperature, bool a_sampling=false) const
LUPI_HOST_DEVICE void crossSectionVector (double a_temperature, double a_userFactor, std::size_t a_numberAllocated, double *a_crossSectionVector) const
LUPI_HOST_DEVICE double reactionCrossSection (std::size_t a_reactionIndex, std::size_t a_hashIndex, double a_temperature, bool a_sampling=false) const
LUPI_HOST_DEVICE double reactionCrossSection (std::size_t a_reactionIndex, double a_temperature, double a_energy_in) const
template<typename RNG>
LUPI_HOST_DEVICE std::size_t sampleReaction (std::size_t a_hashIndex, double a_temperature, double a_energy_in, double a_crossSection, RNG &&rng) const
LUPI_HOST_DEVICE double depositionEnergy (std::size_t a_hashIndex, double a_temperature) const
LUPI_HOST_DEVICE double depositionMomentum (std::size_t a_hashIndex, double a_temperature) const
LUPI_HOST_DEVICE double productionEnergy (std::size_t a_hashIndex, double a_temperature) const
LUPI_HOST_DEVICE double gain (std::size_t a_hashIndex, double a_temperature, int a_particleIndex) const
LUPI_HOST_DEVICE double gainViaIntid (std::size_t a_hashIndex, double a_temperature, 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, int a_temperatureIndex) const
LUPI_HOST void print () const

Detailed Description

Definition at line 881 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ HeatedCrossSectionsMultiGroup()

LUPI_HOST_DEVICE MCGIDI::HeatedCrossSectionsMultiGroup::HeatedCrossSectionsMultiGroup ( )

Generic constructor.

Definition at line 1889 of file MCGIDI_heatedCrossSections.cc.

1889 {
1890
1891}

Referenced by HeatedCrossSectionsMultiGroup().

◆ ~HeatedCrossSectionsMultiGroup()

LUPI_HOST_DEVICE MCGIDI::HeatedCrossSectionsMultiGroup::~HeatedCrossSectionsMultiGroup ( )

Generic constructor.

Definition at line 1897 of file MCGIDI_heatedCrossSections.cc.

1897 {
1898
1899 for( Vector<HeatedCrossSectionMultiGroup *>::const_iterator iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) delete *iter;
1900}

Referenced by ~HeatedCrossSectionsMultiGroup().

Member Function Documentation

◆ crossSection()

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

Returns the total multi-group cross section for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
a_sampling[in] Used for multi-group look up. If true, use augmented cross sections.

Definition at line 1951 of file MCGIDI_heatedCrossSections.cc.

1951 {
1952
1953 double cross_section;
1954
1955 if( a_temperature <= m_temperatures[0] ) {
1956 cross_section = m_heatedCrossSections[0]->crossSection( a_hashIndex, a_sampling ); }
1957 else if( a_temperature >= m_temperatures.back( ) ) {
1958 cross_section = m_heatedCrossSections.back( )->crossSection( a_hashIndex, a_sampling ); }
1959 else {
1960 std::size_t i1;
1961 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1962 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1963
1964 cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->crossSection( a_hashIndex, a_sampling )
1965 + fraction * m_heatedCrossSections[i1]->crossSection( a_hashIndex, a_sampling );
1966 }
1967
1968 return( cross_section );
1969}
LUPI_HOST_DEVICE double crossSection(std::size_t a_hashIndex, double a_temperature, bool a_sampling=false) const

Referenced by crossSection().

◆ crossSectionVector()

LUPI_HOST_DEVICE void MCGIDI::HeatedCrossSectionsMultiGroup::crossSectionVector ( double a_temperature,
double a_userFactor,
std::size_t a_numberAllocated,
double * a_crossSectionVector ) const

Adds the energy dependent, total cross section corresponding to the temperature a_temperature multiplied by a_userFactor to a_crossSectionVector.

Parameters
a_temperature[in] Specifies the temperature of the material.
a_userFactor[in] User factor which all cross sections are multiplied by.
a_numberAllocated[in] The length of memory allocated for a_crossSectionVector.
a_crossSectionVector[in/out] The energy dependent, total cross section to add cross section data to.

Definition at line 1980 of file MCGIDI_heatedCrossSections.cc.

1981 {
1982
1983 std::size_t index1 = 0, index2 = 0;
1984 double fraction = 0.0;
1985
1986 if( a_temperature <= m_temperatures[0] ) {
1987 }
1988 else if( a_temperature >= m_temperatures.back( ) ) {
1989 index1 = index2 = m_temperatures.size( ) - 1;
1990 fraction = 1.0; }
1991 else {
1992 for( ; index2 < m_temperatures.size( ); ++index2 ) if( a_temperature < m_temperatures[index2] ) break;
1993 index1 = index2 - 1;
1994 fraction = ( a_temperature - m_temperatures[index1] ) / ( m_temperatures[index2] - m_temperatures[index1] );
1995 }
1996
1997 Vector<double> &totalCrossSection1 = m_heatedCrossSections[index1]->totalCrossSection( );
1998 Vector<double> &totalCrossSection2 = m_heatedCrossSections[index2]->totalCrossSection( );
1999 std::size_t size = totalCrossSection1.size( );
2000 double factor1 = a_userFactor * ( 1.0 - fraction ), factor2 = a_userFactor * fraction;
2001
2002 if( a_numberAllocated < totalCrossSection1.size( ) ) LUPI_THROW( "HeatedCrossSectionsMultiGroup::crossSectionVector: a_numberAllocated too small." );
2003 for( std::size_t i1 = 0; i1 < size; ++i1 ) {
2004 a_crossSectionVector[i1] += factor1 * totalCrossSection1[i1] + factor2 * totalCrossSection2[i1];
2005 }
2006}
#define LUPI_THROW(arg)

Referenced by crossSectionVector().

◆ depositionEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::depositionEnergy ( std::size_t a_hashIndex,
double a_temperature ) const

Returns the multi-group deposition energy for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
Returns
The deposition energy.

Definition at line 2068 of file MCGIDI_heatedCrossSections.cc.

2068 {
2069
2070 double deposition_energy;
2071
2072 if( a_temperature <= m_temperatures[0] ) {
2073 deposition_energy = m_heatedCrossSections[0]->depositionEnergy( a_hashIndex ); }
2074 else if( a_temperature >= m_temperatures.back( ) ) {
2075 deposition_energy = m_heatedCrossSections.back( )->depositionEnergy( a_hashIndex ); }
2076 else {
2077 std::size_t i1;
2078 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2079 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
2080 deposition_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionEnergy( a_hashIndex )
2081 + fraction * m_heatedCrossSections[i1]->depositionEnergy( a_hashIndex );
2082 }
2083
2084 return( deposition_energy );
2085}
LUPI_HOST_DEVICE double depositionEnergy(std::size_t a_hashIndex, double a_temperature) const

Referenced by depositionEnergy().

◆ depositionMomentum()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::depositionMomentum ( std::size_t a_hashIndex,
double a_temperature ) const

Returns the multi-group deposition momentum for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
Returns
The deposition energy.

Definition at line 2096 of file MCGIDI_heatedCrossSections.cc.

2096 {
2097
2098 double deposition_momentum;
2099
2100 if( a_temperature <= m_temperatures[0] ) {
2101 deposition_momentum = m_heatedCrossSections[0]->depositionMomentum( a_hashIndex ); }
2102 else if( a_temperature >= m_temperatures.back( ) ) {
2103 deposition_momentum = m_heatedCrossSections.back( )->depositionMomentum( a_hashIndex ); }
2104 else {
2105 std::size_t i1;
2106 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2107 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
2108 deposition_momentum = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionMomentum( a_hashIndex )
2109 + fraction * m_heatedCrossSections[i1]->depositionMomentum( a_hashIndex );
2110 }
2111
2112 return( deposition_momentum );
2113}
LUPI_HOST_DEVICE double depositionMomentum(std::size_t a_hashIndex, double a_temperature) const

Referenced by depositionMomentum().

◆ gain()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::gain ( std::size_t a_hashIndex,
double a_temperature,
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_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
a_particleIndex[in] The index of the particle whose gain is to be returned.
Returns
The multi-group gain.

Definition at line 2154 of file MCGIDI_heatedCrossSections.cc.

2154 {
2155
2156 if( a_temperature <= m_temperatures[0] ) {
2157 return( m_heatedCrossSections[0]->gain( a_hashIndex, a_particleIndex ) ); }
2158 else if( a_temperature >= m_temperatures.back( ) ) {
2159 return( m_heatedCrossSections.back( )->gain( a_hashIndex, a_particleIndex ) );
2160 }
2161
2162 std::size_t i1;
2163 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2164 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
2165
2166 double gain1 = m_heatedCrossSections[i1-1]->gain( a_hashIndex, a_particleIndex );
2167 double gain2 = m_heatedCrossSections[i1]->gain( a_hashIndex, a_particleIndex );
2168
2169 return( ( 1. - fraction ) * gain1 + fraction * gain2 );
2170}
LUPI_HOST_DEVICE double gain(std::size_t a_hashIndex, double a_temperature, int a_particleIndex) const

Referenced by gain().

◆ gainViaIntid()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::gainViaIntid ( std::size_t a_hashIndex,
double a_temperature,
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_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
a_particleIntid[in] The intid of the particle whose gain is to be returned.
Returns
The multi-group gain.

Definition at line 2182 of file MCGIDI_heatedCrossSections.cc.

2182 {
2183
2184 if( a_temperature <= m_temperatures[0] ) {
2185 return( m_heatedCrossSections[0]->gainViaIntid( a_hashIndex, a_particleIntid ) ); }
2186 else if( a_temperature >= m_temperatures.back( ) ) {
2187 return( m_heatedCrossSections.back( )->gainViaIntid( a_hashIndex, a_particleIntid ) );
2188 }
2189
2190 std::size_t i1;
2191 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2192 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
2193
2194 double gain1 = m_heatedCrossSections[i1-1]->gainViaIntid( a_hashIndex, a_particleIntid );
2195 double gain2 = m_heatedCrossSections[i1]->gainViaIntid( a_hashIndex, a_particleIntid );
2196
2197 return( ( 1. - fraction ) * gain1 + fraction * gain2 );
2198}
LUPI_HOST_DEVICE double gainViaIntid(std::size_t a_hashIndex, double a_temperature, int a_particleIntid) const

Referenced by gainViaIntid().

◆ heatedCrossSections()

LUPI_HOST_DEVICE Vector< HeatedCrossSectionMultiGroup * > const & MCGIDI::HeatedCrossSectionsMultiGroup::heatedCrossSections ( ) const
inline

Definition at line 906 of file MCGIDI.hpp.

906{ return( m_heatedCrossSections ); }

◆ maximumEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::maximumEnergy ( ) const
inline

Definition at line 895 of file MCGIDI.hpp.

895{ return( m_projectileMultiGroupBoundariesCollapsed.back( ) ); }

◆ minimumEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::minimumEnergy ( ) const
inline

Definition at line 894 of file MCGIDI.hpp.

894{ return( m_projectileMultiGroupBoundariesCollapsed[0] ); }

◆ multiGroupThresholdIndex()

LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsMultiGroup::multiGroupThresholdIndex ( std::size_t a_index) const
inline

Returns the threshold for the reaction at index a_index.

Definition at line 902 of file MCGIDI.hpp.

◆ print()

LUPI_HOST void MCGIDI::HeatedCrossSectionsMultiGroup::print ( ) const

This method calls write for every temperature dataset in this with the file type stdout.

Definition at line 2293 of file MCGIDI_heatedCrossSections.cc.

2293 {
2294
2295 for( std::size_t index = 0; index < m_heatedCrossSections.size( ); ++index ) write( stdout, static_cast<int>( index ) );
2296}
LUPI_HOST void write(FILE *a_file, int a_temperatureIndex) const

Referenced by print().

◆ productionEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::productionEnergy ( std::size_t a_hashIndex,
double a_temperature ) const

Returns the multi-group production energy for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
Returns
The deposition energy.

Definition at line 2124 of file MCGIDI_heatedCrossSections.cc.

2124 {
2125
2126 double production_energy;
2127
2128 if( a_temperature <= m_temperatures[0] ) {
2129 production_energy = m_heatedCrossSections[0]->productionEnergy( a_hashIndex ); }
2130 else if( a_temperature >= m_temperatures.back( ) ) {
2131 production_energy = m_heatedCrossSections.back( )->productionEnergy( a_hashIndex ); }
2132 else {
2133 std::size_t i1;
2134 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2135 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
2136
2137 production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->productionEnergy( a_hashIndex )
2138 + fraction * m_heatedCrossSections[i1]->productionEnergy( a_hashIndex );
2139 }
2140
2141 return( production_energy );
2142}
LUPI_HOST_DEVICE double productionEnergy(std::size_t a_hashIndex, double a_temperature) const

Referenced by productionEnergy().

◆ projectileMultiGroupBoundariesCollapsed()

LUPI_HOST_DEVICE Vector< double > const & MCGIDI::HeatedCrossSectionsMultiGroup::projectileMultiGroupBoundariesCollapsed ( ) const
inline

Returns the value of the m_projectileMultiGroupBoundariesCollapsed.

Definition at line 904 of file MCGIDI.hpp.

◆ reactionCrossSection() [1/2]

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsMultiGroup::reactionCrossSection ( std::size_t a_reactionIndex,
double a_temperature,
double a_energy_in ) const

Returns the requested reaction's multi-group cross section for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_reactionIndex[in] The index of the reaction.
a_temperature[in] The temperature of the target.
a_energy_in[in] The energy of the projectile.

Definition at line 2044 of file MCGIDI_heatedCrossSections.cc.

2044 {
2045
2046 int intEnergyIndex = binarySearchVector( a_energy_in, m_projectileMultiGroupBoundariesCollapsed );
2047 std::size_t energyIndex = static_cast<std::size_t>( intEnergyIndex );
2048
2049 if( intEnergyIndex == -2 ) {
2050 energyIndex = 0; }
2051 else {
2052 energyIndex = m_projectileMultiGroupBoundariesCollapsed.size( ) - 2;
2053 }
2054
2055
2056 return( reactionCrossSection( a_reactionIndex, energyIndex, a_temperature, false ) );
2057}
LUPI_HOST_DEVICE double reactionCrossSection(std::size_t a_reactionIndex, std::size_t a_hashIndex, double a_temperature, bool a_sampling=false) const
LUPI_HOST_DEVICE int binarySearchVector(double a_x, Vector< double > const &a_Xs, bool a_boundIndex=false)
Definition MCGIDI.hpp:318

◆ reactionCrossSection() [2/2]

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

Returns the requested reaction's multi-group cross section for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_reactionIndex[in] The index of the reaction.
a_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
a_sampling[in] If true, use augmented cross sections.

Definition at line 2017 of file MCGIDI_heatedCrossSections.cc.

2017 {
2018
2019 double cross_section;
2020
2021 if( a_temperature <= m_temperatures[0] ) {
2022 cross_section = m_heatedCrossSections[0]->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling ); }
2023 else if( a_temperature >= m_temperatures.back( ) ) {
2024 cross_section = m_heatedCrossSections.back( )->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling ); }
2025 else {
2026 std::size_t i1;
2027 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2028 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
2029 cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling )
2030 + fraction * m_heatedCrossSections[i1]->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling );
2031 }
2032
2033 return( cross_section );
2034}

Referenced by reactionCrossSection(), and reactionCrossSection().

◆ sampleReaction()

template<typename RNG>
LUPI_HOST_DEVICE std::size_t MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction ( std::size_t a_hashIndex,
double a_temperature,
double a_energy,
double a_crossSection,
RNG && a_rng ) const
inline

Returns the requested reaction's multi-group cross section for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] The multi-group index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.
a_crossSection[in] The total cross section for the protare at a_temperature and a_energy.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).

Definition at line 2267 of file MCGIDI_headerSource.hpp.

2268 {
2269
2270 std::size_t i1, sampled_reaction_index, temperatureIndex1, temperatureIndex2, numberOfTemperatures = m_temperatures.size( );
2271 double sampleCrossSection = a_crossSection * a_rng( );
2272
2273 if( a_temperature <= m_temperatures[0] ) {
2274 temperatureIndex1 = 0;
2275 temperatureIndex2 = temperatureIndex1; }
2276 else if( a_temperature >= m_temperatures.back( ) ) {
2277 temperatureIndex1 = m_temperatures.size( ) - 1;
2278 temperatureIndex2 = temperatureIndex1; }
2279 else {
2280 for( i1 = 0; i1 < numberOfTemperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2281 temperatureIndex1 = i1 - 1;
2282 temperatureIndex2 = i1;
2283 }
2284
2285 std::size_t numberOfReactions = m_heatedCrossSections[0]->numberOfReactions( );
2286 double crossSectionSum = 0;
2287 HeatedCrossSectionMultiGroup &heatedCrossSection1 = *m_heatedCrossSections[temperatureIndex1];
2288
2289 if( temperatureIndex1 == temperatureIndex2 ) {
2290 for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) {
2291 crossSectionSum += heatedCrossSection1.reactionCrossSection( sampled_reaction_index, a_hashIndex, true );
2292 if( crossSectionSum >= sampleCrossSection ) break;
2293 } }
2294 else {
2295 double temperatureFraction2 = ( a_temperature - m_temperatures[temperatureIndex1] ) / ( m_temperatures[temperatureIndex2] - m_temperatures[temperatureIndex1] );
2296 double temperatureFraction1 = 1.0 - temperatureFraction2;
2297 HeatedCrossSectionMultiGroup &heatedCrossSection2 = *m_heatedCrossSections[temperatureIndex2];
2298
2299 for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) {
2300 if( m_thresholds[sampled_reaction_index] >= a_energy ) continue;
2301 crossSectionSum += temperatureFraction1 * heatedCrossSection1.reactionCrossSection( sampled_reaction_index, a_hashIndex, true );
2302 crossSectionSum += temperatureFraction2 * heatedCrossSection2.reactionCrossSection( sampled_reaction_index, a_hashIndex, true );
2303 if( crossSectionSum >= sampleCrossSection ) break;
2304 }
2305 }
2306
2307 if( sampled_reaction_index == numberOfReactions ) return( MCGIDI_nullReaction );
2308
2309 if( m_multiGroupThresholdIndex[sampled_reaction_index] == static_cast<int>( a_hashIndex ) ) {
2310 double energyAboveThreshold = a_energy - m_thresholds[sampled_reaction_index];
2311
2312 if( energyAboveThreshold <= ( a_rng( ) * ( m_projectileMultiGroupBoundariesCollapsed[a_hashIndex+1] - m_thresholds[sampled_reaction_index] ) ) )
2313 return( MCGIDI_nullReaction );
2314 }
2315
2316 return( sampled_reaction_index );
2317}
#define MCGIDI_nullReaction
Definition MCGIDI.hpp:64

◆ serialize()

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

2232 {
2233
2234 DATA_MEMBER_VECTOR_DOUBLE( m_temperatures, a_buffer, a_mode );
2235 DATA_MEMBER_VECTOR_DOUBLE( m_thresholds, a_buffer, a_mode );
2236 DATA_MEMBER_VECTOR_INT( m_multiGroupThresholdIndex, a_buffer, a_mode );
2237 DATA_MEMBER_VECTOR_DOUBLE( m_projectileMultiGroupBoundariesCollapsed, a_buffer, a_mode );
2238
2239 std::size_t vectorSize = m_heatedCrossSections.size( );
2240 int vectorSizeInt = (int) vectorSize;
2241 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
2242 vectorSize = (std::size_t) vectorSizeInt;
2243
2244 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_heatedCrossSections.resize( vectorSize, &a_buffer.m_placement );
2245 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_heatedCrossSections.internalSize();
2246 for( std::size_t memberIndex = 0; memberIndex < vectorSize; ++memberIndex ) {
2247 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
2248 if( a_buffer.m_placement != nullptr ) {
2249 m_heatedCrossSections[memberIndex] = new(a_buffer.m_placement) HeatedCrossSectionMultiGroup;
2250 a_buffer.incrementPlacement( sizeof( HeatedCrossSectionMultiGroup ) ); }
2251 else {
2252 m_heatedCrossSections[memberIndex] = new HeatedCrossSectionMultiGroup;
2253 }
2254 }
2255 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
2256 a_buffer.incrementPlacement( sizeof( HeatedCrossSectionMultiGroup ) );
2257 }
2258 m_heatedCrossSections[memberIndex]->serialize( a_buffer, a_mode );
2259 }
2260}
#define DATA_MEMBER_VECTOR_INT(member, buf, mode)
#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::HeatedCrossSectionsMultiGroup::setUserParticleIndex ( int a_particleIndex,
int a_userParticleIndex )

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

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

Definition at line 2207 of file MCGIDI_heatedCrossSections.cc.

2207 {
2208
2209 for( auto iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) (*iter)->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
2210}

Referenced by setUserParticleIndex().

◆ setUserParticleIndexViaIntid()

LUPI_HOST void MCGIDI::HeatedCrossSectionsMultiGroup::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 2219 of file MCGIDI_heatedCrossSections.cc.

2219 {
2220
2221 for( auto iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) (*iter)->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
2222}

Referenced by setUserParticleIndexViaIntid().

◆ temperatures()

LUPI_HOST_DEVICE Vector< double > const & MCGIDI::HeatedCrossSectionsMultiGroup::temperatures ( ) const
inline

Returns the value of the m_temperatures.

Definition at line 896 of file MCGIDI.hpp.

◆ threshold()

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

Returns the threshold for the reaction at index a_index.

Definition at line 908 of file MCGIDI.hpp.

Referenced by update().

◆ update()

LUPI_HOST void MCGIDI::HeatedCrossSectionsMultiGroup::update ( LUPI::StatusMessageReporting & a_smr,
GIDI::ProtareSingle const & a_protare,
SetupInfo & a_setupInfo,
Transporting::MC const & a_settings,
GIDI::Transporting::Particles const & a_particles,
GIDI::Styles::TemperatureInfos const & a_temperatureInfos,
std::vector< GIDI::Reaction const * > const & a_reactions,
std::vector< GIDI::Reaction const * > const & a_orphanProducts,
bool a_zeroReactions,
GIDI::ExcludeReactionsSet const & a_reactionsToExclude )

Fills in this with the requested temperature data.

Parameters
a_smr[Out] If errors are not to be thrown, then the error is reported via this instance.
a_protare[in] The GIDI::Protare used to constuct the Protare that this is a part of.
a_setupInfo[in] Used internally when constructing a Protare to pass information to other components.
a_settings[in] Used to pass user options to the this to instruct it which data are desired.
a_particles[in] List of transporting particles and their information (e.g., multi-group boundaries and fluxes).
a_temperatureInfos[in] The list of temperatures to use.
a_reactions[in] The list of reactions to use.
a_orphanProducts[in] The list of orphan products to use.
a_zeroReactions[in] Special case where no reaction in a protare is wanted so the first one is used but its cross section is set to 0.0 at all energies.

Definition at line 1916 of file MCGIDI_heatedCrossSections.cc.

1920 {
1921
1922 m_temperatures.reserve( a_temperatureInfos.size( ) );
1923 m_heatedCrossSections.reserve( a_temperatureInfos.size( ) );
1924
1925 for( GIDI::Styles::TemperatureInfos::const_iterator iter = a_temperatureInfos.begin( ); iter != a_temperatureInfos.end( ); ++iter ) {
1926 m_temperatures.push_back( iter->temperature( ).value( ) );
1927 m_heatedCrossSections.push_back( new HeatedCrossSectionMultiGroup( a_smr, a_protare, a_setupInfo, a_settings, *iter, a_particles,
1928 a_reactions, iter->heatedMultiGroup( ), a_zeroReactions, a_reactionsToExclude ) );
1929 }
1930
1931 m_thresholds.resize( m_heatedCrossSections[0]->numberOfReactions( ) );
1932 for( std::size_t i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) m_thresholds[i1] = m_heatedCrossSections[0]->threshold( i1 );
1933
1934 m_multiGroupThresholdIndex.resize( m_heatedCrossSections[0]->numberOfReactions( ) );
1935 for( std::size_t i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) {
1936 m_multiGroupThresholdIndex[i1] = -1;
1937 if( m_thresholds[i1] > 0 ) m_multiGroupThresholdIndex[i1] = static_cast<int>( m_heatedCrossSections[0]->thresholdOffset( i1 ) );
1938 }
1939
1940 m_projectileMultiGroupBoundariesCollapsed = a_setupInfo.m_protare.projectileMultiGroupBoundariesCollapsed( );
1941}
LUPI_HOST_DEVICE double threshold(std::size_t a_index) const
Definition MCGIDI.hpp:908

Referenced by update().

◆ write()

LUPI_HOST void MCGIDI::HeatedCrossSectionsMultiGroup::write ( FILE * a_file,
int a_temperatureIndex ) const

This method writes the multi-group data at temperature index a_temperatureIndex to a_file.

Parameters
a_file[in] The buffer to read or write data to depending on a_mode.
a_temperatureIndex[in] The index of the temperature whose data are written.

Definition at line 2269 of file MCGIDI_heatedCrossSections.cc.

2269 {
2270
2271 if( a_temperatureIndex < 0 ) return;
2272
2273 std::size_t temperatureIndex = (std::size_t) a_temperatureIndex;
2274 if( temperatureIndex >= m_temperatures.size( ) ) return;
2275
2276 printf( "HeatedCrossSectionsMultiGroup::write for temperature %.4e\n", m_temperatures[temperatureIndex] );
2277
2278 fprintf( a_file, " boundaries index " );
2279 std::string space( 14, ' ' );
2280 for( std::size_t index = 0; index < m_projectileMultiGroupBoundariesCollapsed.size( ); ++index ) {
2281 fprintf( a_file, "%s%6zu", space.c_str( ), index );
2282 }
2283 fprintf( a_file, "\n" );
2284 writeVector( a_file, "boundaries", 0, m_projectileMultiGroupBoundariesCollapsed );
2285
2286 m_heatedCrossSections[temperatureIndex]->write( a_file );
2287}

Referenced by print(), and write().


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