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

#include <MCGIDI_functions.hpp>

Inheritance diagram for MCGIDI::Probabilities::Regions2d:

Public Member Functions

LUPI_HOST_DEVICE Regions2d ()
LUPI_HOST Regions2d (GIDI::Functions::Regions2d const &a_regions2d)
LUPI_HOST_DEVICE ~Regions2d ()
LUPI_HOST_DEVICE double evaluate (double a_x2, double a_x1) const
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase2d_d1
LUPI_HOST_DEVICE ProbabilityBase2d_d1 ()
LUPI_HOST ProbabilityBase2d_d1 (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase2d_d1 (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE double evaluate (double a_x2, double a_x1) const
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
template<typename RNG>
LUPI_HOST_DEVICE double sample2dOf3d (double a_x2, double a_rngValue, RNG &&a_rng, double *a_x1_1, double *a_x1_2) const
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase2d
LUPI_HOST_DEVICE ProbabilityBase2d ()
LUPI_HOST ProbabilityBase2d (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase2d (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE ~ProbabilityBase2d ()
LUPI_HOST_DEVICE ProbabilityBase2dType type () const
LUPI_HOST_DEVICE String typeString () const
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate (double a_x2, double a_x1) const MCGIDI_TRUE_VIRTUAL
template<typename RNG>
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double sample (double a_x2, double a_rngValue, RNG &&a_rng) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase
LUPI_HOST_DEVICE ProbabilityBase ()
LUPI_HOST ProbabilityBase (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE ~ProbabilityBase ()
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
Public Member Functions inherited from MCGIDI::Functions::FunctionBase
LUPI_HOST_DEVICE FunctionBase ()
LUPI_HOST FunctionBase (GIDI::Functions::FunctionForm const &a_function)
LUPI_HOST_DEVICE FunctionBase (int a_dimension, double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue=0)
virtual LUPI_HOST_DEVICE ~FunctionBase ()=0
LUPI_HOST_DEVICE Interpolation interpolation () const
LUPI_HOST_DEVICE double domainMin () const
LUPI_HOST_DEVICE double domainMax () const
LUPI_HOST_DEVICE double outerDomainValue () const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Additional Inherited Members

Protected Attributes inherited from MCGIDI::Probabilities::ProbabilityBase2d
ProbabilityBase2dType m_type
Protected Attributes inherited from MCGIDI::Probabilities::ProbabilityBase
Vector< double > m_Xs

Detailed Description

Definition at line 487 of file MCGIDI_functions.hpp.

Constructor & Destructor Documentation

◆ Regions2d() [1/2]

LUPI_HOST_DEVICE MCGIDI::Probabilities::Regions2d::Regions2d ( )

Definition at line 1682 of file MCGIDI_functions.cc.

1682 :
1683 m_probabilities( ) {
1684
1686}

◆ Regions2d() [2/2]

LUPI_HOST MCGIDI::Probabilities::Regions2d::Regions2d ( GIDI::Functions::Regions2d const & a_regions2d)

Definition at line 1690 of file MCGIDI_functions.cc.

1690 :
1691 ProbabilityBase2d_d1( a_regions2d, a_regions2d.Xs( ) ) {
1692
1694
1695 Vector<GIDI::Functions::Function2dForm *> const &function2ds = a_regions2d.function2ds( );
1696 m_probabilities.resize( function2ds.size( ) );
1697 for( std::size_t i1 = 0; i1 < function2ds.size( ); ++i1 ) m_probabilities[i1] = parseProbability2d_d2( function2ds[i1], nullptr );
1698}
LUPI_HOST ProbabilityBase2d_d2 * parseProbability2d_d2(GIDI::Functions::Function2dForm const *form2d, SetupInfo *a_setupInfo)

◆ ~Regions2d()

LUPI_HOST_DEVICE MCGIDI::Probabilities::Regions2d::~Regions2d ( )

Definition at line 1703 of file MCGIDI_functions.cc.

1703 {
1704
1705 for( std::size_t i1 = 0; i1 < m_probabilities.size( ); ++i1 ) delete m_probabilities[i1];
1706}

Member Function Documentation

◆ evaluate()

LUPI_HOST_DEVICE double MCGIDI::Probabilities::Regions2d::evaluate ( double a_x2,
double a_x1 ) const

Definition at line 1710 of file MCGIDI_functions.cc.

1710 {
1711
1712 int intLower = binarySearchVector( a_x2, m_Xs );
1713
1714 if( intLower < 0 ) {
1715 if( intLower == -1 ) { // a_x2 > last value of m_Xs.
1716 return( m_probabilities.back( )->evaluate( a_x2, a_x1 ) );
1717 }
1718 intLower = 0; // a_x2 < first value of m_Xs.
1719 }
1720
1721 std::size_t lower = static_cast<std::size_t>( intLower );
1722
1723 return( m_probabilities[lower]->evaluate( a_x2, a_x1 ) );
1724}
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE int binarySearchVector(double a_x, Vector< double > const &a_Xs, bool a_boundIndex=false)
Definition MCGIDI.hpp:318

Referenced by evaluate().

◆ sample()

template<typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Probabilities::Regions2d::sample ( double a_x2,
double a_rngValue,
RNG && a_rng ) const

Definition at line 1968 of file MCGIDI_headerSource.hpp.

1968 {
1969
1970 int intLower = binarySearchVector( a_x2, m_Xs );
1971
1972 if( intLower < 0 ) {
1973 if( intLower == -1 ) { // a_x2 > last value of m_Xs.
1974 return( m_probabilities.back( )->sample( a_x2, a_rngValue, a_rng ) );
1975 }
1976 intLower = 0; // a_x2 < first value of m_Xs.
1977 }
1978
1979 std::size_t lower = static_cast<std::size_t>( intLower );
1980
1981 return( m_probabilities[lower]->sample( a_x2, a_rngValue, a_rng ) );
1982}
LUPI_HOST_DEVICE double sample(double a_x2, double a_rngValue, RNG &&a_rng) const

Referenced by sample().

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::Probabilities::Regions2d::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 1734 of file MCGIDI_functions.cc.

1734 {
1735
1736 ProbabilityBase2d::serialize( a_buffer, a_mode );
1737
1738 std::size_t vectorSize = m_probabilities.size( );
1739 int vectorSizeInt = (int) vectorSize;
1740 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1741 vectorSize = (std::size_t) vectorSizeInt;
1742
1743 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_probabilities.resize( vectorSize, &a_buffer.m_placement );
1744 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_probabilities.internalSize();
1745 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
1746 m_probabilities[vectorIndex] = serializeProbability2d_d2( a_buffer, a_mode, m_probabilities[vectorIndex] );
1747 }
1748}
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d_d2 * serializeProbability2d_d2(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase2d_d2 *a_probability2d)

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