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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE ACE_URR_probabilityTables ()
LUPI_HOST_DEVICE ACE_URR_probabilityTables (std::size_t a_capacity)
LUPI_HOST_DEVICE ~ACE_URR_probabilityTables ()
LUPI_HOST_DEVICE std::size_t capacity () const
LUPI_HOST_DEVICE std::size_t size () const
LUPI_HOST_DEVICE void reserve (std::size_t a_capacity)
LUPI_HOST_DEVICE void push_back (ACE_URR_probabilityTable *a_ACE_URR_probabilityTable)
LUPI_HOST_DEVICE double domainMin () const
LUPI_HOST_DEVICE double domainMax () const
LUPI_HOST_DEVICE double sample (double a_energy, double a_rng_Value)
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Public Attributes

Vector< double > m_energies
Vector< ACE_URR_probabilityTable * > m_ACE_URR_probabilityTables

Detailed Description

Class to store ACE URR probability tables at a list of projectile energies for one type of reaction (e.g., total, elastic).

Definition at line 499 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ ACE_URR_probabilityTables() [1/2]

LUPI_HOST_DEVICE MCGIDI::ACE_URR_probabilityTables::ACE_URR_probabilityTables ( )

Simple constructor needed for broadcasting.

Definition at line 169 of file MCGIDI_URR.cc.

169 {
170
171}

◆ ACE_URR_probabilityTables() [2/2]

LUPI_HOST_DEVICE MCGIDI::ACE_URR_probabilityTables::ACE_URR_probabilityTables ( std::size_t a_capacity)
Parameters
a_capacity[in] The number of energy slots to reverse.

Definition at line 177 of file MCGIDI_URR.cc.

177 {
178
179 m_energies.reserve( a_capacity );
180 m_ACE_URR_probabilityTables.reserve( a_capacity );
181}
Vector< ACE_URR_probabilityTable * > m_ACE_URR_probabilityTables
Definition MCGIDI.hpp:503

◆ ~ACE_URR_probabilityTables()

LUPI_HOST_DEVICE MCGIDI::ACE_URR_probabilityTables::~ACE_URR_probabilityTables ( )

Definition at line 186 of file MCGIDI_URR.cc.

186 {
187
188 for( auto iter = m_ACE_URR_probabilityTables.begin( ); iter != m_ACE_URR_probabilityTables.end( ); ++iter ) delete (*iter);
189}

Member Function Documentation

◆ capacity()

LUPI_HOST_DEVICE std::size_t MCGIDI::ACE_URR_probabilityTables::capacity ( ) const
inline

Returns the number of energies allocated to store probability tables.

Definition at line 509 of file MCGIDI.hpp.

Referenced by push_back().

◆ domainMax()

LUPI_HOST_DEVICE double MCGIDI::ACE_URR_probabilityTables::domainMax ( ) const
inline

Returns the maximum energy where URR data are specified.

Definition at line 517 of file MCGIDI.hpp.

◆ domainMin()

LUPI_HOST_DEVICE double MCGIDI::ACE_URR_probabilityTables::domainMin ( ) const
inline

Returns the minimum energy where URR data are specified.

Definition at line 516 of file MCGIDI.hpp.

◆ push_back()

LUPI_HOST_DEVICE void MCGIDI::ACE_URR_probabilityTables::push_back ( ACE_URR_probabilityTable * a_ACE_URR_probabilityTable)

Adds a_ACE_URR_probabilityTable to the end of this.

Parameters
a_ACE_URR_probabilityTable[in] ACE_URR_probabilityTable instance to add.

Definition at line 209 of file MCGIDI_URR.cc.

209 {
210
211 if( m_energies.size( ) == capacity( ) ) LUPI_THROW( "ACE_URR_probabilityTables::addEnergyData: adding too many ACE_URR_probabilityTables." );
212 m_energies.push_back( a_ACE_URR_probabilityTable->energy( ) );
213 m_ACE_URR_probabilityTables.push_back( a_ACE_URR_probabilityTable );
214}
#define LUPI_THROW(arg)
LUPI_HOST_DEVICE std::size_t capacity() const
Definition MCGIDI.hpp:509

◆ reserve()

LUPI_HOST_DEVICE void MCGIDI::ACE_URR_probabilityTables::reserve ( std::size_t a_capacity)

Calls reserve for m_energies and m_ACE_URR_probabilityTables with the value a_capacity.

Parameters
a_capacity[in] The size of the space to reserve.

Definition at line 197 of file MCGIDI_URR.cc.

197 {
198
199 m_energies.reserve( a_capacity );
200 m_ACE_URR_probabilityTables.reserve( a_capacity );
201}

◆ sample()

LUPI_HOST_DEVICE double MCGIDI::ACE_URR_probabilityTables::sample ( double a_energy,
double a_rng_Value )

Returns the cross section corresponding to the probability a_rng_Value.

Parameters
a_energy[in] The incident projectiles energy.
a_rng_Value[in] A random number in the range [0,1).
Returns
The cross section associated with probability a_rng_Value;

Definition at line 225 of file MCGIDI_URR.cc.

225 {
226
227 int index = binarySearchVector( a_energy, m_energies, true );
228
229 std::size_t index_t = (std::size_t) index;
230 if( index_t < m_energies.size( ) - 1 ) {
231 if( 0.5 * ( m_energies[index_t] + m_energies[index_t+1] ) < a_energy ) ++index_t; // Find closest energy.
232 }
233
234 return( m_ACE_URR_probabilityTables[index_t]->sample( a_rng_Value ) );
235}
LUPI_HOST_DEVICE double sample(double a_energy, double a_rng_Value)
LUPI_HOST_DEVICE int binarySearchVector(double a_x, Vector< double > const &a_Xs, bool a_boundIndex=false)
Definition MCGIDI.hpp:318

Referenced by sample().

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::ACE_URR_probabilityTables::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 245 of file MCGIDI_URR.cc.

245 {
246
247 DATA_MEMBER_VECTOR_DOUBLE( m_energies, a_buffer, a_mode );
248
249 std::size_t vectorSize = m_energies.size( );
250
251 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_ACE_URR_probabilityTables.resize( vectorSize, &a_buffer.m_placement );
252 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_ACE_URR_probabilityTables.internalSize( );
253
254 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
255 ACE_URR_probabilityTable *ACE_URR_probabilityTable1 = m_ACE_URR_probabilityTables[vectorIndex];
256 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
257 if( a_buffer.m_placement != nullptr ) {
258 ACE_URR_probabilityTable1 = new(a_buffer.m_placement) ACE_URR_probabilityTable;
259 a_buffer.incrementPlacement( sizeof( ACE_URR_probabilityTable ) ); }
260 else {
261 ACE_URR_probabilityTable1 = new ACE_URR_probabilityTable;
262 }
263 m_ACE_URR_probabilityTables[vectorIndex] = ACE_URR_probabilityTable1;
264 }
265 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
266 a_buffer.incrementPlacement( sizeof( ACE_URR_probabilityTable ) );
267 }
268 ACE_URR_probabilityTable1->serialize( a_buffer, a_mode );
269 }
270}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)
@ ACE_URR_probabilityTable
Definition GIDI.hpp:140

Referenced by MCGIDI::serializeACE_URR_probabilityTables().

◆ size()

LUPI_HOST_DEVICE std::size_t MCGIDI::ACE_URR_probabilityTables::size ( ) const
inline

Returns the number of energies that have URR probability tables.

Definition at line 511 of file MCGIDI.hpp.

Member Data Documentation

◆ m_ACE_URR_probabilityTables

Vector<ACE_URR_probabilityTable *> MCGIDI::ACE_URR_probabilityTables::m_ACE_URR_probabilityTables

List of probabilities tables. One for each energy in m_energies.

Definition at line 503 of file MCGIDI.hpp.

Referenced by ACE_URR_probabilityTables(), push_back(), reserve(), sample(), serialize(), and ~ACE_URR_probabilityTables().

◆ m_energies

Vector<double> MCGIDI::ACE_URR_probabilityTables::m_energies

List of energies where probabilities tables are given.

Definition at line 502 of file MCGIDI.hpp.

Referenced by ACE_URR_probabilityTables(), capacity(), domainMax(), domainMin(), push_back(), reserve(), sample(), serialize(), and size().


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