Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_settings_group Class Reference

#include <GIDI_settings.hh>

Public Member Functions

 GIDI_settings_group (std::string const &label="empty", int size=0)
 
 GIDI_settings_group (std::string const &label, int length, double const *values)
 
 GIDI_settings_group (std::string const &label, std::vector< double > const &boundaries)
 
 GIDI_settings_group (GIDI_settings_group const &group)
 
GIDI_settings_groupoperator= (const GIDI_settings_group &group)
 
 ~GIDI_settings_group ()
 
double operator[] (int const index) const
 
int size (void) const
 
int getNumberOfGroups (void) const
 
double const * pointer (void) const
 
void setFromCDoubleArray (int length, double *values)
 
std::string getLabel () const
 
int getGroupIndexFromEnergy (double energy, bool encloseOutOfRange) const
 
bool isLabel (std::string &label) const
 
void print (bool outline=false, int valuesPerLine=10) const
 

Detailed Description

Definition at line 35 of file GIDI_settings.hh.

Constructor & Destructor Documentation

◆ GIDI_settings_group() [1/4]

GIDI_settings_group::GIDI_settings_group ( std::string const & label = "empty",
int size = 0 )

Definition at line 14 of file GIDI_settings_group.cc.

14 {
15
16 initialize( label, size1, size1, NULL );
17}

◆ GIDI_settings_group() [2/4]

GIDI_settings_group::GIDI_settings_group ( std::string const & label,
int length,
double const * values )

Definition at line 21 of file GIDI_settings_group.cc.

21 {
22
23 initialize( label, length, length, boundaries );
24}

◆ GIDI_settings_group() [3/4]

GIDI_settings_group::GIDI_settings_group ( std::string const & label,
std::vector< double > const & boundaries )

Definition at line 28 of file GIDI_settings_group.cc.

28 {
29
30 int size1 = (int) boundaries.size( );
31
32 initialize( label, size1, size1, &(boundaries[0]) );
33}

◆ GIDI_settings_group() [4/4]

GIDI_settings_group::GIDI_settings_group ( GIDI_settings_group const & group)

Definition at line 37 of file GIDI_settings_group.cc.

37 {
38
39 initialize( group.mLabel, group.size( ), group.size( ), &(group.mBoundaries[0]) );
40}

◆ ~GIDI_settings_group()

GIDI_settings_group::~GIDI_settings_group ( )

Definition at line 66 of file GIDI_settings_group.cc.

66 {
67
68}

Member Function Documentation

◆ getGroupIndexFromEnergy()

int GIDI_settings_group::getGroupIndexFromEnergy ( double energy,
bool encloseOutOfRange ) const

Definition at line 72 of file GIDI_settings_group.cc.

72 {
73
74 int iMin = 0, iMid, iMax = (int) mBoundaries.size( ), iMaxM1 = iMax - 1;
75
76 if( iMax == 0 ) return( -3 );
77 if( energy < mBoundaries[0] ) {
78 if( encloseOutOfRange ) return( 0 );
79 return( -2 );
80 }
81 if( energy > mBoundaries[iMaxM1] ) {
82 if( encloseOutOfRange ) return( iMax - 2 );
83 return( -1 );
84 }
85 while( 1 ) { // Loop checking, 11.06.2015, T. Koi
86 iMid = ( iMin + iMax ) >> 1;
87 if( iMid == iMin ) break;
88 if( energy < mBoundaries[iMid] ) {
89 iMax = iMid; }
90 else {
91 iMin = iMid;
92 }
93 }
94 if( iMin == iMaxM1 ) iMin--;
95 return( iMin );
96}

Referenced by GIDI_settings_particle::getGroupIndexFromEnergy(), and MCGIDI_reaction_recast().

◆ getLabel()

std::string GIDI_settings_group::getLabel ( ) const
inline

Definition at line 55 of file GIDI_settings.hh.

55{ return( mLabel ); }

◆ getNumberOfGroups()

int GIDI_settings_group::getNumberOfGroups ( void ) const
inline

Definition at line 51 of file GIDI_settings.hh.

51{ return( (int) ( mBoundaries.size( ) - 1 ) ); }

Referenced by GIDI_settings_particle::getNumberOfGroups().

◆ isLabel()

bool GIDI_settings_group::isLabel ( std::string & label) const
inline

Definition at line 57 of file GIDI_settings.hh.

57{ return( label == mLabel ); }

◆ operator=()

GIDI_settings_group & GIDI_settings_group::operator= ( const GIDI_settings_group & group)

Definition at line 57 of file GIDI_settings_group.cc.

57 {
58 if ( this != &group ) {
59 initialize( group.mLabel, group.size(), group.size(), &(group.mBoundaries[0]) );
60 }
61 return *this;
62}
int size(void) const

◆ operator[]()

double GIDI_settings_group::operator[] ( int const index) const
inline

Definition at line 49 of file GIDI_settings.hh.

49{ return( mBoundaries[index] ); }

◆ pointer()

double const * GIDI_settings_group::pointer ( void ) const
inline

Definition at line 52 of file GIDI_settings.hh.

52{ return( &(mBoundaries[0]) ); }

Referenced by GIDI_settings_particle::setGroup().

◆ print()

void GIDI_settings_group::print ( bool outline = false,
int valuesPerLine = 10 ) const

Definition at line 100 of file GIDI_settings_group.cc.

100 {
101
102 int nbs = size( );
103 char buffer[128];
104
105 std::cout << "GROUP: label = '" << mLabel << "': length = " << nbs << std::endl;
106 if( outline ) return;
107 for( int ib = 0; ib < nbs; ib++ ) {
108 snprintf( buffer, sizeof buffer, "%16.8e", mBoundaries[ib] );
109 std::cout << buffer;
110 if( ( ( ib + 1 ) % valuesPerLine ) == 0 ) std::cout << std::endl;
111 }
112 if( nbs % valuesPerLine ) std::cout << std::endl;
113}

◆ setFromCDoubleArray()

void GIDI_settings_group::setFromCDoubleArray ( int length,
double * values )

◆ size()

int GIDI_settings_group::size ( void ) const
inline

Definition at line 50 of file GIDI_settings.hh.

50{ return( (int) mBoundaries.size( ) ); }

Referenced by GIDI_settings_group(), operator=(), print(), and GIDI_settings_particle::setGroup().


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