43 m_numberOfTNSLReactions( 0 ),
44 m_TNSL_maximumEnergy( 0.0 ),
45 m_TNSL_maximumTemperature( 0.0 ),
46 m_protareWithElastic( nullptr ),
48 m_protareWithoutElastic( nullptr ) {
70 a_domainHash, a_temperatureInfos, a_reactionsToExclude, a_reactionsToExcludeOffset, false ) ) ),
72 TNSL_temperatureInfos( *a_protare.
TNSL( ), a_settings ), a_reactionsToExclude, a_reactionsToExcludeOffset + m_protareWithElastic->numberOfReactions( ), false ) ) ),
73 m_protareWithoutElastic( nullptr ) {
77 reactionsToExclude.insert( 0 );
79 m_protareWithoutElastic->setUpscatterModelASupported(
false );
85 std::set<int> product_intids;
86 std::set<int> product_intids_transportable;
87 std::set<int> product_indices;
88 std::set<int> product_indices_transportable;
94 productIntidsAndIndices( product_intids, product_intids_transportable, product_indices, product_indices_transportable );
102 delete m_protareWithElastic;
104 delete m_protareWithoutElastic;
116 m_protareWithElastic->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
117 m_TNSL->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
118 m_protareWithoutElastic->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
130 m_protareWithElastic->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
131 m_TNSL->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
132 m_protareWithoutElastic->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
146 if( a_index == 0 )
return( m_protareWithElastic );
147 if( a_index == 1 )
return( m_TNSL );
161 if( a_index == 0 )
return( m_protareWithElastic );
162 if( a_index == 1 )
return( m_TNSL );
176 if( a_index < m_numberOfTNSLReactions )
return( m_TNSL );
177 return( m_protareWithElastic->protareWithReaction( a_index - m_numberOfTNSLReactions ) );
190 if( a_index == 0 )
return( m_protareWithElastic->temperatures( 0 ) );
191 if( a_index == 1 )
return( m_TNSL->temperatures( 0 ) );
193 LUPI_THROW(
"ProtareSingle::temperatures: a_index not 0 or 1." );
210 if( a_index < m_numberOfTNSLReactions )
return( m_TNSL->reaction( a_index ) );
211 return( m_protareWithElastic->reaction( a_index - m_numberOfTNSLReactions ) );
224 if( a_index < m_numberOfTNSLReactions )
return(
false );
225 return( m_protareWithElastic->reactionHasURR_probabilityTables( a_index - m_numberOfTNSLReactions ) );
239 if( a_index < m_numberOfTNSLReactions )
return( m_TNSL->threshold( a_index ) );
240 return( m_protareWithElastic->threshold( a_index - m_numberOfTNSLReactions ) );
258 double crossSection1 = 0.0;
260 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
261 crossSection1 = m_TNSL->crossSection( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling ) +
262 m_protareWithoutElastic->crossSection( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling ); }
264 crossSection1 = m_protareWithElastic->crossSection( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
267 return( crossSection1 );
280 double *a_crossSectionVector )
const {
282 if( a_temperature <= m_TNSL_maximumTemperature ) {
283 m_TNSL->crossSectionVector( a_temperature, a_userFactor, a_numberAllocated, a_crossSectionVector );
284 m_protareWithoutElastic->crossSectionVector( a_temperature, a_userFactor, a_numberAllocated, a_crossSectionVector ); }
286 m_protareWithElastic->crossSectionVector( a_temperature, a_userFactor, a_numberAllocated, a_crossSectionVector );
306 std::size_t index = a_reactionIndex - m_numberOfTNSLReactions;
307 double crossSection1 = 0.0;
309 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
310 if( a_reactionIndex < m_numberOfTNSLReactions ) {
311 crossSection1 = m_TNSL->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling ); }
313 if( a_reactionIndex > m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
316 if( a_reactionIndex >= m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
319 return( crossSection1 );
335 std::size_t index = a_reactionIndex - m_numberOfTNSLReactions;
336 double crossSection1 = 0.0;
338 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
339 if( a_reactionIndex < m_numberOfTNSLReactions ) {
340 crossSection1 = m_TNSL->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_temperature, a_energy ); }
342 if( a_reactionIndex > m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_temperature, a_energy );
345 if( a_reactionIndex >= m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_temperature, a_energy );
348 return( crossSection1 );
363 double deposition_energy = 0.0;
365 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
366 deposition_energy = m_TNSL->depositionEnergy( a_hashIndex, a_temperature, a_energy ) +
367 m_protareWithoutElastic->depositionEnergy( a_hashIndex, a_temperature, a_energy ); }
369 deposition_energy = m_protareWithElastic->depositionEnergy( a_hashIndex, a_temperature, a_energy );
372 return( deposition_energy );
387 double deposition_momentum = 0.0;
389 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
390 deposition_momentum = m_TNSL->depositionMomentum( a_hashIndex, a_temperature, a_energy ) +
391 m_protareWithoutElastic->depositionMomentum( a_hashIndex, a_temperature, a_energy ); }
393 deposition_momentum = m_protareWithElastic->depositionMomentum( a_hashIndex, a_temperature, a_energy );
396 return( deposition_momentum );
411 double production_energy = 0.0;
413 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
414 production_energy = m_TNSL->productionEnergy( a_hashIndex, a_temperature, a_energy ) +
415 m_protareWithoutElastic->productionEnergy( a_hashIndex, a_temperature, a_energy ); }
417 production_energy = m_protareWithElastic->productionEnergy( a_hashIndex, a_temperature, a_energy );
420 return( production_energy );
438 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
439 gain1 = m_TNSL->gain( a_hashIndex, a_temperature, a_energy, a_particleIndex ) +
440 m_protareWithoutElastic->gain( a_hashIndex, a_temperature, a_energy, a_particleIndex ); }
442 gain1 = m_protareWithElastic->gain( a_hashIndex, a_temperature, a_energy, a_particleIndex );
463 if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
464 gain1 = m_TNSL->gainViaIntid( a_hashIndex, a_temperature, a_energy, a_particleIntid ) +
465 m_protareWithoutElastic->gainViaIntid( a_hashIndex, a_temperature, a_energy, a_particleIntid ); }
467 gain1 = m_protareWithElastic->gainViaIntid( a_hashIndex, a_temperature, a_energy, a_particleIntid );
483 int numberOfTNSLReactions =
static_cast<int>( m_numberOfTNSLReactions );
485 m_numberOfTNSLReactions =
static_cast<std::size_t
>( numberOfTNSLReactions );
509 m_protareWithElastic->serializeCommon( a_buffer, a_mode );
510 m_protareWithElastic->serialize2( a_buffer, a_mode );
511 m_TNSL->serializeCommon( a_buffer, a_mode );
512 m_TNSL->serialize2( a_buffer, a_mode );
513 m_protareWithoutElastic->serializeCommon( a_buffer, a_mode );
514 m_protareWithoutElastic->serialize2( a_buffer, a_mode );
#define DATA_MEMBER_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
Styles::TemperatureInfos temperatures() const
ProtareSingle * protare(std::size_t a_index=0)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)
LUPI_HOST_DEVICE Vector< double > temperatures(std::size_t a_index=0) const
LUPI_HOST_DEVICE double maximumEnergy() const
LUPI_HOST_DEVICE std::size_t numberOfReactions() const
LUPI_HOST_DEVICE Vector< double > temperatures(std::size_t a_index=0) const
LUPI_HOST_DEVICE double productionEnergy(std::size_t a_hashIndex, double a_temperature, double a_energy) const
LUPI_HOST_DEVICE double depositionMomentum(std::size_t a_hashIndex, double a_temperature, double a_energy) const
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables(std::size_t a_index) const
LUPI_HOST_DEVICE ProtareTNSL()
LUPI_HOST_DEVICE Reaction const * reaction(std::size_t a_index) const
LUPI_HOST_DEVICE ProtareSingle const * TNSL() const
LUPI_HOST void setUserParticleIndex2(int a_particleIndex, int a_userParticleIndex)
LUPI_HOST_DEVICE void serialize2(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double threshold(std::size_t a_index) const
LUPI_HOST_DEVICE double reactionCrossSection(std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling=false) const
LUPI_HOST_DEVICE ~ProtareTNSL()
LUPI_HOST_DEVICE void crossSectionVector(double a_temperature, double a_userFactor, std::size_t a_numberAllocated, double *a_crossSectionVector) const
LUPI_HOST_DEVICE double crossSection(URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling=false) const
LUPI_HOST_DEVICE double gainViaIntid(std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid) const
LUPI_HOST_DEVICE double gain(std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex) const
LUPI_HOST void setUserParticleIndexViaIntid2(int a_particleIntid, int a_userParticleIndex)
LUPI_HOST_DEVICE ProtareSingle const * protareWithReaction(std::size_t a_index) const
LUPI_HOST_DEVICE ProtareSingle const * protare(std::size_t a_index) const
LUPI_HOST_DEVICE double depositionEnergy(std::size_t a_hashIndex, double a_temperature, double a_energy) const
LUPI_HOST Vector< int > const & productIndices(bool a_transportablesOnly) const
LUPI_HOST Vector< int > const & productIntids(bool a_transportablesOnly) const
LUPI_HOST_DEVICE Protare(ProtareType a_protareType)
LUPI_HOST_DEVICE T & back()
std::vector< Styles::TemperatureInfo > TemperatureInfos
std::set< std::size_t > ExcludeReactionsSet
Simple C++ string class, useful as replacement for std::string if this cannot be used,...
LUPI_HOST void addVectorItemsToSet(Vector< int > const &a_from, std::set< int > &a_to)
LUPI_HOST Protare * protareFromGIDIProtare(LUPI::StatusMessageReporting &a_smr, GIDI::Protare const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings, GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos, GIDI::ExcludeReactionsSet const &a_reactionsToExclude, std::size_t a_reactionsToExcludeOffset=0, bool a_allowFixedGrid=true)