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

#include <MCGIDI_functions.hpp>

Inheritance diagram for MCGIDI::Functions::Gridded1d:

Public Member Functions

LUPI_HOST_DEVICE Gridded1d ()
LUPI_HOST Gridded1d (GIDI::Functions::Gridded1d const &a_gridded1d)
LUPI_HOST_DEVICE ~Gridded1d ()
LUPI_HOST_DEVICE double evaluate (double a_x1) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
Public Member Functions inherited from MCGIDI::Functions::Function1d_d2
LUPI_HOST_DEVICE Function1d_d2 ()
LUPI_HOST_DEVICE Function1d_d2 (double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue=0)
LUPI_HOST_DEVICE double evaluate (double a_x1) const
Public Member Functions inherited from MCGIDI::Functions::Function1d_d1
LUPI_HOST_DEVICE Function1d_d1 ()
LUPI_HOST_DEVICE Function1d_d1 (double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue=0)
LUPI_HOST_DEVICE double evaluate (double a_x1) const
Public Member Functions inherited from MCGIDI::Functions::Function1d
LUPI_HOST_DEVICE Function1d ()
LUPI_HOST_DEVICE Function1d (double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue=0)
LUPI_HOST_DEVICE ~Function1d ()
LUPI_HOST_DEVICE Function1dType type () const
LUPI_HOST_DEVICE String typeString () const
template<typename RNG>
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION int sampleBoundingInteger (double a_x1, RNG &&a_rng) const
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate (double a_x1) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
template<typename RNG>
LUPI_HOST_DEVICE int sampleBoundingInteger (double a_x1, RNG &&a_rng) const
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::Functions::Function1d
Function1dType m_type

Detailed Description

Definition at line 181 of file MCGIDI_functions.hpp.

Constructor & Destructor Documentation

◆ Gridded1d() [1/2]

LUPI_HOST_DEVICE MCGIDI::Functions::Gridded1d::Gridded1d ( )

Definition at line 611 of file MCGIDI_functions.cc.

611 :
612 m_grid( ),
613 m_data( ) {
614
616}

◆ Gridded1d() [2/2]

LUPI_HOST MCGIDI::Functions::Gridded1d::Gridded1d ( GIDI::Functions::Gridded1d const & a_gridded1d)

Definition at line 620 of file MCGIDI_functions.cc.

620 :
621 Function1d_d2( a_gridded1d.domainMin( ), a_gridded1d.domainMax( ), Interpolation::FLAT, a_gridded1d.outerDomainValue( ) ) {
622
624
625 GIDI::Vector const &grid = a_gridded1d.grid( );
626 m_grid.resize( grid.size( ) );
627 for( std::size_t i1 = 0; i1 < grid.size( ); ++i1 ) m_grid[i1] = grid[i1];
628
629 GIDI::Vector const &data = a_gridded1d.data( );
630 m_data.resize( data.size( ) );
631 for( std::size_t i1 = 0; i1 < data.size( ); ++i1 ) m_data[i1] = data[i1];
632}
std::size_t size() const
Definition GIDI_data.hpp:79

◆ ~Gridded1d()

LUPI_HOST_DEVICE MCGIDI::Functions::Gridded1d::~Gridded1d ( )

Definition at line 637 of file MCGIDI_functions.cc.

637 {
638
639}

Member Function Documentation

◆ evaluate()

LUPI_HOST_DEVICE double MCGIDI::Functions::Gridded1d::evaluate ( double a_x1) const

Definition at line 643 of file MCGIDI_functions.cc.

643 {
644
645 return( m_data[(std::size_t) binarySearchVector( a_x1, m_grid, true )] );
646}
LUPI_HOST_DEVICE int binarySearchVector(double a_x, Vector< double > const &a_Xs, bool a_boundIndex=false)
Definition MCGIDI.hpp:318

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::Functions::Gridded1d::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 656 of file MCGIDI_functions.cc.

656 {
657
658 Function1d::serialize( a_buffer, a_mode );
659 DATA_MEMBER_VECTOR_DOUBLE( m_grid, a_buffer, a_mode );
660 DATA_MEMBER_VECTOR_DOUBLE( m_data, a_buffer, a_mode );
661}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

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