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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE Product ()
LUPI_HOST Product (GIDI::Product const *a_product, SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Transporting::Particles const &a_particles, bool a_isFission)
LUPI_HOST Product (PoPI::Database const &a_pop, std::string const &a_ID, std::string const &a_label)
LUPI_HOST_DEVICE ~Product ()
LUPI_HOST String const & ID () const
LUPI_HOST_DEVICE int intid () const
LUPI_HOST_DEVICE int index () const
LUPI_HOST_DEVICE int userParticleIndex () const
LUPI_HOST void setUserParticleIndex (int a_particleIndex, int a_userParticleIndex)
LUPI_HOST void setUserParticleIndexViaIntid (int a_particleIntid, int a_userParticleIndex)
LUPI_HOST void setModelDBRC_data (Sampling::Upscatter::ModelDBRC_data *a_modelDBRC_data)
LUPI_HOST_DEVICE String label () const
LUPI_HOST_DEVICE bool isCompleteParticle () const
LUPI_HOST_DEVICE double mass () const
LUPI_HOST_DEVICE double excitationEnergy () const
LUPI_HOST_DEVICE TwoBodyOrder twoBodyOrder () const
LUPI_HOST_DEVICE double finalQ (double a_x1) const
LUPI_HOST_DEVICE bool hasFission () const
LUPI_HOST_DEVICE Functions::Function1d const * multiplicity () const
LUPI_HOST void setMultiplicity (Functions::Function1d *a_multiplicity)
LUPI_HOST_DEVICE double productAverageMultiplicity (int a_index, double a_projectileEnergy) const
LUPI_HOST_DEVICE double productAverageMultiplicityViaIntid (int a_intid, double a_projectileEnergy) const
LUPI_HOST_DEVICE Distributions::Distribution const * distribution () const
LUPI_HOST_DEVICE Distributions::Distributiondistribution ()
LUPI_HOST void distribution (Distributions::Distribution *a_distribution)
LUPI_HOST_DEVICE OutputChanneloutputChannel ()
template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void sampleProducts (ProtareSingle const *a_protare, double a_projectileEnergy, Sampling::Input &a_input, RNG &&a_rng, PUSHBACK &&a_push_back, Sampling::ProductHandler &a_products) const
template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void sampleFinalState (ProtareSingle const *a_protare, double a_projectileEnergy, Sampling::Input &a_input, RNG &&a_rng, PUSHBACK &&a_push_back, Sampling::ProductHandler &a_products) const
template<typename RNG>
LUPI_HOST_DEVICE void angleBiasing (Reaction const *a_reaction, int a_pid, double a_temperature, double a_energy_in, double a_mu_lab, double &a_probability, double &a_energy_out, RNG &&a_rng, double &a_cumulative_weight) const
template<typename RNG>
LUPI_HOST_DEVICE void angleBiasingViaIntid (Reaction const *a_reaction, int a_intid, double a_temperature, double a_energy_in, double a_mu_lab, double &a_probability, double &a_energy_out, RNG &&a_rng, double &a_cumulative_weight) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Detailed Description

This class represents a GNDS <outputChannel> node with only data needed for Monte Carlo transport.

This class represents a GNDS <product> node with only data needed for Monte Carlo transport.

Definition at line 1173 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ Product() [1/3]

LUPI_HOST_DEVICE MCGIDI::Product::Product ( )

Default constructor used when broadcasting a Protare as needed by MPI or GPUs.

Definition at line 22 of file MCGIDI_product.cc.

22 :
23 m_ID( ),
24 m_intid( -1 ),
25 m_index( -1 ),
26 m_userParticleIndex( -1 ),
27 m_isCompleteParticle( false ),
28 m_mass( 0.0 ),
29 m_excitationEnergy( 0.0 ),
30 m_twoBodyOrder( TwoBodyOrder::notApplicable ),
31 m_initialStateIndex( -1 ),
32 m_multiplicity( nullptr ),
33 m_distribution( nullptr ),
34 m_outputChannel( nullptr ) {
35
36}

◆ Product() [2/3]

LUPI_HOST MCGIDI::Product::Product ( GIDI::Product const * a_product,
SetupInfo & a_setupInfo,
Transporting::MC const & a_settings,
GIDI::Transporting::Particles const & a_particles,
bool a_isFission )
Parameters
a_product[in] The GIDI::Product whose data is to be used to construct this.
a_setupInfo[in] Used internally when constructing a Protare to pass information to other constructors.
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_isFission[in] true if parent channel is a fission channel and false otherwise.

Definition at line 46 of file MCGIDI_product.cc.

47 :
48 m_ID( a_product->particle( ).ID( ).c_str( ) ),
49 m_intid( MCGIDI_popsIntid( a_setupInfo.m_pops, a_product->particle( ).ID( ) ) ),
50 m_index( MCGIDI_popsIndex( a_setupInfo.m_popsUser, a_product->particle( ).ID( ) ) ),
51 m_userParticleIndex( -1 ),
52 m_label( a_product->label( ).c_str( ) ),
53 m_isCompleteParticle( a_product->isCompleteParticle( ) ),
54 m_mass( a_product->particle( ).mass( "MeV/c**2" ) ), // Includes nuclear excitation energy.
55 m_excitationEnergy( a_product->particle( ).excitationEnergy( ).value( ) ),
56 m_twoBodyOrder( a_setupInfo.m_twoBodyOrder ),
57 m_initialStateIndex( -1 ),
58 m_multiplicity( Functions::parseMultiplicityFunction1d( a_setupInfo, a_settings, a_product->multiplicity( ) ) ),
59 m_distribution( nullptr ),
60 m_outputChannel( nullptr ) {
61
62 a_setupInfo.m_product1Mass = mass( ); // Includes nuclear excitation energy.
63 a_setupInfo.m_initialStateIndex = -1;
64 m_distribution = Distributions::parseGIDI( a_product->distribution( ), a_setupInfo, a_settings );
65 m_initialStateIndex = a_setupInfo.m_initialStateIndex;
66
67 GIDI::OutputChannel const *output_channel = a_product->outputChannel( );
68 if( output_channel != nullptr ) m_outputChannel = new OutputChannel( output_channel, a_setupInfo, a_settings, a_particles );
69
70 if( a_isFission && ( m_intid == PoPI::Intids::neutron ) && a_settings.wantTerrellPromptNeutronDistribution( ) ) {
71 Functions::Function1d_d1 *multiplicity1 = static_cast<Functions::Function1d_d1 *>( m_multiplicity );
72
73 m_multiplicity = new Functions::TerrellFissionNeutronMultiplicityModel( -1.0, multiplicity1 );
74 }
75}
LUPI_HOST_DEVICE double mass() const
Definition MCGIDI.hpp:1208
LUPI_HOST Distribution * parseGIDI(GIDI::Suite const &a_distribution, SetupInfo &a_setupInfo, Transporting::MC const &a_settings)
LUPI_HOST Function1d * parseMultiplicityFunction1d(SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
LUPI_HOST int MCGIDI_popsIntid(PoPI::Database const &a_pops, std::string const &a_ID)
LUPI_HOST int MCGIDI_popsIndex(PoPI::Database const &a_pops, std::string const &a_ID)
static int constexpr neutron
Definition PoPI.hpp:177

◆ Product() [3/3]

LUPI_HOST MCGIDI::Product::Product ( PoPI::Database const & a_pops,
std::string const & a_ID,
std::string const & a_label )
Parameters
a_pops[in] A PoPs Database instance used to get particle intids and possibly other particle information.
a_ID[in] The PoPs id for the product.
a_label[in] The GNDS label for the product.

Definition at line 83 of file MCGIDI_product.cc.

83 :
84 m_ID( a_ID.c_str( ) ),
85 m_intid( MCGIDI_popsIntid( a_pops, a_ID ) ),
86 m_index( MCGIDI_popsIndex( a_pops, a_ID ) ),
87 m_userParticleIndex( -1 ),
88 m_label( a_label.c_str( ) ),
89 m_mass( 0.0 ), // FIXME, good for photon but nothing else. Still need to implement.
90 m_excitationEnergy( 0.0 ),
91 m_twoBodyOrder( TwoBodyOrder::notApplicable ),
92 m_initialStateIndex( -1 ),
93 m_multiplicity( nullptr ),
94 m_distribution( nullptr ),
95 m_outputChannel( nullptr ) {
96
97}

◆ ~Product()

LUPI_HOST_DEVICE MCGIDI::Product::~Product ( )

Definition at line 102 of file MCGIDI_product.cc.

102 {
103
104 delete m_multiplicity;
105
107 if( m_distribution != nullptr ) type = m_distribution->type( );
108 switch( type ) {
110 break;
112 delete static_cast<Distributions::Unspecified *>( m_distribution );
113 break;
115 delete static_cast<Distributions::AngularTwoBody *>( m_distribution );
116 break;
118 delete static_cast<Distributions::KalbachMann *>( m_distribution );
119 break;
121 delete static_cast<Distributions::Uncorrelated *>( m_distribution );
122 break;
124 delete static_cast<Distributions::Branching3d *>( m_distribution );
125 break;
127 delete static_cast<Distributions::EnergyAngularMC *>( m_distribution );
128 break;
130 delete static_cast<Distributions::AngularEnergyMC *>( m_distribution );
131 break;
133 delete static_cast<Distributions::CoherentPhotoAtomicScattering *>( m_distribution );
134 break;
136 delete static_cast<Distributions::IncoherentPhotoAtomicScattering *>( m_distribution );
137 break;
139 delete static_cast<Distributions::IncoherentBoundToFreePhotoAtomicScattering *>( m_distribution );
140 break;
142 delete static_cast<Distributions::IncoherentPhotoAtomicScatteringElectron *>( m_distribution );
143 break;
145 delete static_cast<Distributions::PairProductionGamma *>( m_distribution );
146 break;
148 delete static_cast<Distributions::CoherentElasticTNSL *>( m_distribution );
149 break;
151 delete static_cast<Distributions::IncoherentElasticTNSL *>( m_distribution );
152 break;
153 }
154
155 delete m_outputChannel;
156}

Member Function Documentation

◆ angleBiasing()

template<typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Product::angleBiasing ( Reaction const * a_reaction,
int a_index,
double a_temperature,
double a_energy_in,
double a_mu_lab,
double & a_weight,
double & a_energy_out,
RNG && a_rng,
double & a_cumulative_weight ) const
inline

Returns the weight for a projectile with energy a_energy_in to cause this channel to emitted a particle of index a_pid at angle a_mu_lab as seen in the lab frame. If a particle is emitted, a_energy_out is its sampled outgoing energy.

Parameters
a_reaction[in] The reaction containing the particle which this distribution describes.
a_index[in] The index of the particle to emit.
a_temperature[in] Specifies the temperature of the material.
a_energy_in[in] The energy of the incident particle.
a_mu_lab[in] The desired mu in the lab frame for the emitted particle.
a_weight[in] The weight of emitting outgoing particle into lab angle a_mu_lab.
a_energy_out[in] The energy of the emitted outgoing particle.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
a_cumulative_weight[in] The sum of the multiplicity for other outgoing particles with index a_index.

Definition at line 2602 of file MCGIDI_headerSource.hpp.

2603 {
2604
2605#ifdef MCGIDI_USE_OUTPUT_CHANNEL
2606 if( m_outputChannel != nullptr ) {
2607 m_outputChannel->angleBiasing( a_reaction, a_index, a_temperature, a_energy_in, a_mu_lab, a_weight, a_energy_out, a_rng, a_cumulative_weight ); }
2608 else {
2609#endif
2610 if( m_index != a_index ) return;
2611
2612 double probability = 0.0;
2613 double energy_out = 0.0;
2614
2615 if( a_cumulative_weight == 0.0 ) a_energy_out = 0.0;
2616
2617 if( m_multiplicity->type( ) == Function1dType::branching ) { // Needs to handle F1_Branching.
2618 }
2619 else {
2620 probability = m_distribution->angleBiasing( a_reaction, a_temperature, a_energy_in, a_mu_lab, a_rng, energy_out );
2621 }
2622
2623 double weight = m_multiplicity->evaluate( a_energy_in ) * probability;
2624 a_cumulative_weight += weight;
2625 if( weight > a_rng( ) * a_cumulative_weight ) {
2626 a_weight = weight;
2627 a_energy_out = energy_out;
2628 }
2629#ifdef MCGIDI_USE_OUTPUT_CHANNEL
2630 }
2631#endif
2632}

Referenced by angleBiasingViaIntid().

◆ angleBiasingViaIntid()

template<typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Product::angleBiasingViaIntid ( Reaction const * a_reaction,
int a_intid,
double a_temperature,
double a_energy_in,
double a_mu_lab,
double & a_weight,
double & a_energy_out,
RNG && a_rng,
double & a_cumulative_weight ) const
inline

Returns the weight for a projectile with energy a_energy_in to cause this channel to emitted a particle of intid a_intid at angle a_mu_lab as seen in the lab frame. If a particle is emitted, a_energy_out is its sampled outgoing energy.

Parameters
a_reaction[in] The reaction containing the particle which this distribution describes.
a_intid[in] The intid of the particle to emit.
a_temperature[in] Specifies the temperature of the material.
a_energy_in[in] The energy of the incident particle.
a_mu_lab[in] The desired mu in the lab frame for the emitted particle.
a_weight[in] The weight of emitting outgoing particle into lab angle a_mu_lab.
a_energy_out[in] The energy of the emitted outgoing particle.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
a_cumulative_weight[in] The sum of the multiplicity for other outgoing particles with intid a_intid.

Definition at line 2650 of file MCGIDI_headerSource.hpp.

2651 {
2652
2653#ifdef MCGIDI_USE_OUTPUT_CHANNEL
2654 if( m_outputChannel != nullptr ) {
2655 m_outputChannel->angleBiasingViaIntid( a_reaction, a_intid, a_temperature, a_energy_in, a_mu_lab, a_weight, a_energy_out, a_rng, a_cumulative_weight ); }
2656 else {
2657#endif
2658 if( m_intid != a_intid ) return;
2659
2660 angleBiasing( a_reaction, m_index, a_temperature, a_energy_in, a_mu_lab, a_weight, a_energy_out, a_rng, a_cumulative_weight );
2661
2662#ifdef MCGIDI_USE_OUTPUT_CHANNEL
2663 }
2664#endif
2665}
LUPI_HOST_DEVICE void angleBiasing(Reaction const *a_reaction, int a_pid, double a_temperature, double a_energy_in, double a_mu_lab, double &a_probability, double &a_energy_out, RNG &&a_rng, double &a_cumulative_weight) const

◆ distribution() [1/3]

LUPI_HOST_DEVICE Distributions::Distribution * MCGIDI::Product::distribution ( )
inline

Returns the value of the m_distribution.

Definition at line 1221 of file MCGIDI.hpp.

◆ distribution() [2/3]

LUPI_HOST_DEVICE Distributions::Distribution const * MCGIDI::Product::distribution ( ) const
inline

Returns the value of the m_distribution.

Definition at line 1220 of file MCGIDI.hpp.

Referenced by MCGIDI::OutputChannel::OutputChannel().

◆ distribution() [3/3]

LUPI_HOST void MCGIDI::Product::distribution ( Distributions::Distribution * a_distribution)
inline

Definition at line 1222 of file MCGIDI.hpp.

1222{ m_distribution = a_distribution; }

◆ excitationEnergy()

LUPI_HOST_DEVICE double MCGIDI::Product::excitationEnergy ( ) const
inline

Returns the value of the m_excitationEnergy.

Definition at line 1209 of file MCGIDI.hpp.

Referenced by Product().

◆ finalQ()

LUPI_HOST_DEVICE double MCGIDI::Product::finalQ ( double a_x1) const

This method returns the final Q for this by getting its output channel's finalQ.

Parameters
a_x1[in] The energy of the projectile.
Returns
The Q-value at product energy a_x1.

Definition at line 207 of file MCGIDI_product.cc.

207 {
208
209#ifdef MCGIDI_USE_OUTPUT_CHANNEL
210 if( m_outputChannel != nullptr ) return( m_outputChannel->finalQ( a_x1 ) );
211#endif
212 return( m_excitationEnergy );
213}

◆ hasFission()

LUPI_HOST_DEVICE bool MCGIDI::Product::hasFission ( ) const

This method returns true if the output channel or any of its sub-output channels is a fission channel and false otherwise.

Returns
true if any sub-output channel is a fission channel and false otherwise.

Definition at line 221 of file MCGIDI_product.cc.

221 {
222
223#ifdef MCGIDI_USE_OUTPUT_CHANNEL
224 if( m_outputChannel != nullptr ) return( m_outputChannel->hasFission( ) );
225#endif
226 return( false );
227}

◆ ID()

LUPI_HOST String const & MCGIDI::Product::ID ( ) const
inline

Returns a const reference to the m_ID member.

Definition at line 1199 of file MCGIDI.hpp.

Referenced by Product().

◆ index()

LUPI_HOST_DEVICE int MCGIDI::Product::index ( ) const
inline

Returns the value of the m_index member.

Definition at line 1201 of file MCGIDI.hpp.

Referenced by sampleProducts().

◆ intid()

LUPI_HOST_DEVICE int MCGIDI::Product::intid ( ) const
inline

Returns the value of the m_intid member.

Definition at line 1200 of file MCGIDI.hpp.

Referenced by sampleProducts().

◆ isCompleteParticle()

LUPI_HOST_DEVICE bool MCGIDI::Product::isCompleteParticle ( ) const
inline

Returns the value of the m_isCompleteParticle.

Definition at line 1207 of file MCGIDI.hpp.

Referenced by Product().

◆ label()

LUPI_HOST_DEVICE String MCGIDI::Product::label ( ) const
inline

Returns the value of the m_label.

Definition at line 1206 of file MCGIDI.hpp.

Referenced by Product().

◆ mass()

LUPI_HOST_DEVICE double MCGIDI::Product::mass ( ) const
inline

Returns the value of the m_mass.

Definition at line 1208 of file MCGIDI.hpp.

Referenced by Product(), sampleFinalState(), and sampleProducts().

◆ multiplicity()

LUPI_HOST_DEVICE Functions::Function1d const * MCGIDI::Product::multiplicity ( ) const
inline

Returns the value of the m_multiplicity.

Definition at line 1215 of file MCGIDI.hpp.

Referenced by Product().

◆ outputChannel()

LUPI_HOST_DEVICE OutputChannel * MCGIDI::Product::outputChannel ( )
inline

Returns the value of the m_outputChannel.

Definition at line 1224 of file MCGIDI.hpp.

◆ productAverageMultiplicity()

LUPI_HOST_DEVICE double MCGIDI::Product::productAverageMultiplicity ( int a_index,
double a_projectileEnergy ) const

Returns the energy dependent multiplicity for outgoing particle with pops index a_index. The returned value may not be an integer. Energy dependent multiplicities mainly occurs for photons and fission neutrons.

Parameters
a_index[in] The PoPs index of the requested particle.
a_projectileEnergy[in] The energy of the projectile.
Returns
The multiplicity value for the requested particle.

Definition at line 239 of file MCGIDI_product.cc.

239 {
240
241 double multiplicity1 = 0.0;
242
243 if( a_index == m_index ) {
244 if( ( m_multiplicity->domainMin( ) <= a_projectileEnergy ) && ( m_multiplicity->domainMax( ) >= a_projectileEnergy ) )
245 multiplicity1 += m_multiplicity->evaluate( a_projectileEnergy );
246 }
247#ifdef MCGIDI_USE_OUTPUT_CHANNEL
248 if( m_outputChannel != nullptr ) multiplicity1 += m_outputChannel->productAverageMultiplicity( a_index, a_projectileEnergy );
249#endif
250
251 return( multiplicity1 );
252}

◆ productAverageMultiplicityViaIntid()

LUPI_HOST_DEVICE double MCGIDI::Product::productAverageMultiplicityViaIntid ( int a_intid,
double a_projectileEnergy ) const

Returns the energy dependent multiplicity for outgoing particle with pops intid a_intid. The returned value may not be an integer. Energy dependent multiplicities mainly occurs for photons and fission neutrons.

Parameters
a_intid[in] The PoPs intid of the requested particle.
a_projectileEnergy[in] The energy of the projectile.
Returns
The multiplicity value for the requested particle.

Definition at line 264 of file MCGIDI_product.cc.

264 {
265
266 double multiplicity1 = 0.0;
267
268 if( a_intid == m_intid ) {
269 if( ( m_multiplicity->domainMin( ) <= a_projectileEnergy ) && ( m_multiplicity->domainMax( ) >= a_projectileEnergy ) )
270 multiplicity1 += m_multiplicity->evaluate( a_projectileEnergy );
271 }
272#ifdef MCGIDI_USE_OUTPUT_CHANNEL
273 if( m_outputChannel != nullptr ) multiplicity1 += m_outputChannel->productAverageMultiplicityViaIntid( a_intid, a_projectileEnergy );
274#endif
275
276 return( multiplicity1 );
277}

◆ sampleFinalState()

template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void MCGIDI::Product::sampleFinalState ( ProtareSingle const * a_protare,
double a_projectileEnergy,
Sampling::Input & a_input,
RNG && a_rng,
PUSHBACK && a_push_back,
Sampling::ProductHandler & a_products ) const
inline

This method adds sampled products to a_products. In particular, the product is a capture reaction primary gamma what has a finalState attribute. This gamma is added as well as the gammas from the gamma cascade.

Parameters
a_protare[in] The Protare this Reaction belongs to.
a_projectileEnergy[in] The energy of the projectile.
a_input[in] Sample options requested by user.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
a_products[in] The object to add all sampled products to.

Definition at line 2574 of file MCGIDI_headerSource.hpp.

2575 {
2576
2577 m_distribution->sample( a_projectileEnergy, a_input, a_rng );
2578 a_input.m_delayedNeutronIndex = -1;
2579 a_input.m_delayedNeutronDecayRate = 0.0;
2580 a_products.add( a_projectileEnergy, m_intid, m_index, m_userParticleIndex, mass( ), a_input, a_rng, a_push_back, m_intid == PoPI::Intids::photon );
2581
2582 if( m_initialStateIndex >= 0 ) {
2583 a_protare->sampleBranchingGammas( a_input, a_projectileEnergy, m_initialStateIndex, a_rng, a_push_back, a_products );
2584 }
2585}
static int constexpr photon
Definition PoPI.hpp:178

◆ sampleProducts()

template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void MCGIDI::Product::sampleProducts ( ProtareSingle const * a_protare,
double a_projectileEnergy,
Sampling::Input & a_input,
RNG && a_rng,
PUSHBACK && a_push_back,
Sampling::ProductHandler & a_products ) const
inline

This method adds sampled products to a_products.

Parameters
a_protare[in] The Protare this Reaction belongs to.
a_projectileEnergy[in] The energy of the projectile.
a_input[in] Sample options requested by user.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
a_products[in] The object to add all sampled products to.

Definition at line 2531 of file MCGIDI_headerSource.hpp.

2532 {
2533
2534#ifdef MCGIDI_USE_OUTPUT_CHANNEL
2535 if( m_outputChannel != nullptr ) {
2536 m_outputChannel->sampleProducts( a_protare, a_projectileEnergy, a_input, a_rng, a_push_back, a_products ); }
2537 else {
2538#endif
2539 if( m_twoBodyOrder == TwoBodyOrder::secondParticle ) {
2540 a_products.add( a_projectileEnergy, intid( ), index( ), userParticleIndex( ), mass( ), a_input, a_rng, a_push_back, m_intid == PoPI::Intids::photon ); }
2541 else {
2542 int _multiplicity = m_multiplicity->sampleBoundingInteger( a_projectileEnergy, a_rng );
2543 int __multiplicity = _multiplicity;
2544
2545 for( ; _multiplicity > 0; --_multiplicity ) {
2546 m_distribution->sample( a_projectileEnergy, a_input, a_rng );
2547 a_input.m_delayedNeutronIndex = -1;
2548 a_input.m_delayedNeutronDecayRate = 0.0;
2549 a_products.add( a_projectileEnergy, intid( ), index( ), userParticleIndex( ), mass( ), a_input, a_rng, a_push_back, m_intid == PoPI::Intids::photon );
2550 }
2551 if( m_initialStateIndex >= 0 ) {
2552 if( __multiplicity == 0 ) {
2553 a_protare->sampleBranchingGammas( a_input, a_projectileEnergy, m_initialStateIndex, a_rng, a_push_back, a_products );
2554 }
2555 }
2556 }
2557#ifdef MCGIDI_USE_OUTPUT_CHANNEL
2558 }
2559#endif
2560}
LUPI_HOST_DEVICE int userParticleIndex() const
Definition MCGIDI.hpp:1202
LUPI_HOST_DEVICE int index() const
Definition MCGIDI.hpp:1201
LUPI_HOST_DEVICE int intid() const
Definition MCGIDI.hpp:1200

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::Product::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 287 of file MCGIDI_product.cc.

287 {
288
289 DATA_MEMBER_STRING( m_ID, a_buffer, a_mode );
290 DATA_MEMBER_INT( m_intid, a_buffer, a_mode );
291 DATA_MEMBER_INT( m_index, a_buffer, a_mode );
292 DATA_MEMBER_INT( m_userParticleIndex, a_buffer, a_mode );
293 DATA_MEMBER_STRING( m_label, a_buffer, a_mode );
294 DATA_MEMBER_CAST( m_isCompleteParticle, a_buffer, a_mode, bool );
295 DATA_MEMBER_DOUBLE( m_mass, a_buffer, a_mode );
296 DATA_MEMBER_DOUBLE( m_excitationEnergy, a_buffer, a_mode );
297
298 int twoBodyOrder = 0;
299 switch( m_twoBodyOrder ) {
301 break;
303 twoBodyOrder = 1;
304 break;
306 twoBodyOrder = 2;
307 break;
308 }
309 DATA_MEMBER_INT( twoBodyOrder , a_buffer, a_mode );
310 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
311 switch( twoBodyOrder ) {
312 case 0 :
313 m_twoBodyOrder = TwoBodyOrder::notApplicable;
314 break;
315 case 1 :
316 m_twoBodyOrder = TwoBodyOrder::firstParticle;
317 break;
318 case 2 :
319 m_twoBodyOrder = TwoBodyOrder::secondParticle;
320 break;
321 }
322 }
323
324 DATA_MEMBER_INT( m_initialStateIndex, a_buffer, a_mode );
325
326 m_multiplicity = serializeFunction1d( a_buffer, a_mode, m_multiplicity );
327 m_distribution = serializeDistribution( a_buffer, a_mode, m_distribution );
328
329#ifdef MCGIDI_USE_OUTPUT_CHANNEL
330 bool haveChannel = m_outputChannel != nullptr;
331 DATA_MEMBER_CAST( haveChannel, a_buffer, a_mode, bool );
332 if( haveChannel ) {
333 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
334 if (a_buffer.m_placement != nullptr) {
335 m_outputChannel = new(a_buffer.m_placement) OutputChannel();
336 a_buffer.incrementPlacement( sizeof(OutputChannel));
337 }
338 else {
339 m_outputChannel = new OutputChannel();
340 }
341 }
342 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
343 a_buffer.incrementPlacement( sizeof(OutputChannel));
344 }
345 m_outputChannel->serialize( a_buffer, a_mode );
346 }
347#endif
348}
#define DATA_MEMBER_STRING(member, buf, mode)
#define DATA_MEMBER_CAST(member, buf, mode, someType)
#define DATA_MEMBER_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)
LUPI_HOST_DEVICE TwoBodyOrder twoBodyOrder() const
Definition MCGIDI.hpp:1210
LUPI_HOST_DEVICE Distributions::Distribution * serializeDistribution(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Distributions::Distribution *a_distribution)
LUPI_HOST_DEVICE Functions::Function1d * serializeFunction1d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function1d *a_function1d)

◆ setModelDBRC_data()

LUPI_HOST void MCGIDI::Product::setModelDBRC_data ( Sampling::Upscatter::ModelDBRC_data * a_modelDBRC_data)

This method calls the **setModelDBRC_data* method on the distribution of this with a_modelDBRC_data.

Parameters
a_modelDBRC_data[in] The instance storing data needed to treat the DRRC upscatter mode.

Definition at line 194 of file MCGIDI_product.cc.

194 {
195
196 m_distribution->setModelDBRC_data( a_modelDBRC_data );
197}

◆ setMultiplicity()

LUPI_HOST void MCGIDI::Product::setMultiplicity ( Functions::Function1d * a_multiplicity)
inline

Definition at line 1216 of file MCGIDI.hpp.

1216{ m_multiplicity = a_multiplicity; }

Referenced by MCGIDI::OutputChannel::OutputChannel().

◆ setUserParticleIndex()

LUPI_HOST void MCGIDI::Product::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 165 of file MCGIDI_product.cc.

165 {
166
167 if( m_index == a_particleIndex ) m_userParticleIndex = a_userParticleIndex;
168#ifdef MCGIDI_USE_OUTPUT_CHANNEL
169 if( m_outputChannel != nullptr ) m_outputChannel->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
170#endif
171}

◆ setUserParticleIndexViaIntid()

LUPI_HOST void MCGIDI::Product::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 PoPs intid of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 180 of file MCGIDI_product.cc.

180 {
181
182 if( m_intid == a_particleIntid ) m_userParticleIndex = a_userParticleIndex;
183#ifdef MCGIDI_USE_OUTPUT_CHANNEL
184 if( m_outputChannel != nullptr ) m_outputChannel->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
185#endif
186}

◆ twoBodyOrder()

LUPI_HOST_DEVICE TwoBodyOrder MCGIDI::Product::twoBodyOrder ( ) const
inline

Returns the value of the m_twoBodyOrder.

Definition at line 1210 of file MCGIDI.hpp.

Referenced by serialize().

◆ userParticleIndex()

LUPI_HOST_DEVICE int MCGIDI::Product::userParticleIndex ( ) const
inline

Returns the value of the m_userParticleIndex.

Definition at line 1202 of file MCGIDI.hpp.

Referenced by sampleProducts().


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