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

#include <GIDI.hpp>

Inheritance diagram for GIDI::Functions::XYs3d:

Public Member Functions

 XYs3d (Axes const &a_axes, ptwXY_interpolation a_interpolation=ptwXY_interpolationLinLin, int a_index=0, double a_outerDomainValue=0.0)
 XYs3d (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
 ~XYs3d ()
std::string interpolationQualifier () const
void setInterpolationQualifier (std::string a_interpolationQualifier)
double domainMin () const
double domainMax () const
double evaluate (double a_x3, double a_x2, double a_x1) const
std::vector< double > const & Xs () const
std::vector< Function2dForm * > const & function2ds () const
void append (Function2dForm *a_function2d)
void toXMLList_func (GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions) const
Public Member Functions inherited from GIDI::Functions::Function3dForm
 Function3dForm (std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
 Function3dForm (std::string const &a_moniker, FormType a_type, Axes const &a_axes, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
 Function3dForm (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, FormType a_type, Suite *a_suite=nullptr)
 Function3dForm (Function3dForm const &a_form)
 ~Function3dForm ()
Public Member Functions inherited from GIDI::Functions::FunctionForm
 FunctionForm (std::string const &a_moniker, FormType a_type, int a_dimension, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
 FunctionForm (std::string const &a_moniker, FormType a_type, int a_dimension, Axes const &a_axes, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
 FunctionForm (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, FormType a_type, int a_dimension, Suite *a_suite=nullptr)
 FunctionForm (FunctionForm const &a_form)
 ~FunctionForm ()
FunctionFormoperator= (FunctionForm const &a_rhs)
int dimension () const
int index () const
double outerDomainValue () const
void setOuterDomainValue (double a_outerDomainValue)
Axes const & axes () const
Axesaxes ()
ptwXY_interpolation interpolation () const
void setInterpolation (ptwXY_interpolation a_interpolation)
std::string interpolationString () const
void toXMLList (GUPI::WriteInfo &a_writeInfo, std::string const &a_indent) const
Public Member Functions inherited from GIDI::Form
 Form (FormType a_type)
 Form (std::string const &a_moniker, FormType a_type, std::string const &a_label)
 Form (HAPI::Node const &a_node, SetupInfo &a_setupInfo, FormType a_type, Suite *a_suite=nullptr)
 Form (Form const &a_form)
virtual ~Form ()
Formoperator= (Form const &a_rhs)
Suiteparent () const
std::string const & label () const
void setLabel (std::string const &a_label)
virtual std::string actualMoniker () const
std::string const & keyName () const
void setKeyName (std::string const &a_keyName)
std::string const & keyValue () const
virtual void setKeyValue (std::string const &a_keyName) const
FormType type () const
Form const * sibling (std::string a_label) const
GUPI::AncestryfindInAncestry3 (LUPI_maybeUnused std::string const &a_item)
GUPI::Ancestry const * findInAncestry3 (LUPI_maybeUnused std::string const &a_item) const
std::string xlinkItemKey () const
Public Member Functions inherited from GUPI::Ancestry
 Ancestry (std::string const &a_moniker, std::string const &a_attribute="")
virtual ~Ancestry ()
Ancestryoperator= (Ancestry const &a_ancestry)
std::string const & moniker () const
void setMoniker (std::string const &a_moniker)
Ancestryancestor ()
Ancestry const * ancestor () const
void setAncestor (Ancestry *a_ancestor)
std::string attribute () const
Ancestryroot ()
Ancestry const * root () const
bool isChild (Ancestry *a_instance)
bool isParent (Ancestry *a_parent)
bool isRoot () const
AncestryfindInAncestry (std::string const &a_href)
Ancestry const * findInAncestry (std::string const &a_href) const
virtual AncestryfindInAncestry3 (std::string const &a_item)=0
virtual Ancestry const * findInAncestry3 (std::string const &a_item) const =0
virtual LUPI_HOST void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
std::string toXLink () const
void printXML () const

Additional Inherited Members

Static Public Member Functions inherited from GUPI::Ancestry
static std::string buildXLinkItemKey (std::string const &a_name, std::string const &a_key)

Detailed Description

Class for the GNDS <XYs3d> node.

Definition at line 1930 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ XYs3d() [1/2]

GIDI::Functions::XYs3d::XYs3d ( Axes const & a_axes,
ptwXY_interpolation a_interpolation = ptwXY_interpolationLinLin,
int a_index = 0,
double a_outerDomainValue = 0.0 )
Parameters
a_axes[in] The axes to copy for this.
a_interpolation[in] The interpolation along the outer most independent axis and the dependent axis.
a_index[in] Currently not used.
a_outerDomainValue[in] If embedded in a higher dimensional function, the value of the domain of the next higher dimension.

Definition at line 63 of file GIDI_XYs3d.cc.

63 :
64 Function3dForm( GIDI_XYs3dChars, FormType::XYs3d, a_axes, a_interpolation, a_index, a_outerDomainValue ),
65 m_interpolationQualifier( "" ) {
66
67}
#define GIDI_XYs3dChars
Definition GIDI.hpp:316
Function3dForm(std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)

Referenced by XYs3d(), and XYs3d().

◆ XYs3d() [2/2]

GIDI::Functions::XYs3d::XYs3d ( Construction::Settings const & a_construction,
HAPI::Node const & a_node,
SetupInfo & a_setupInfo,
Suite * a_parent )
Parameters
a_construction[in] Used to pass user options for parsing.
a_node[in] The HAPI::Node to be parsed and used to construct the XYs2d.
a_setupInfo[in] Information create my the Protare constructor to help in parsing.
a_parent[in] The parent GIDI::Suite.

Definition at line 29 of file GIDI_XYs3d.cc.

29 :
30 Function3dForm( a_construction, a_node, a_setupInfo, FormType::XYs3d, a_parent ),
31 m_interpolationQualifier( a_node.attribute_as_string( GIDI_interpolationQualifierChars ) ) {
32
33 if( a_setupInfo.m_formatVersion.format( ) != GNDS_formatVersion_1_10Chars ) {
34 data2dListParse( a_construction, a_node.child( GIDI_function2dsChars ), a_setupInfo, m_function2ds );
35 checkOuterDomainValues2d( m_function2ds, m_Xs );
36 return; // Need to add uncertainty parsing.
37 }
38
39 for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
40 std::string name( child.name( ) );
41
42 if( name == GIDI_axesChars ) continue;
43 if( name == GIDI_uncertaintyChars ) continue;
44
45 Function2dForm *_form = data2dParse( a_construction, child, a_setupInfo, nullptr );
46 if( _form == nullptr ) throw Exception( "XYs3d::XYs3d: data2dParse returned nullptr." );
47 if( m_Xs.size( ) > 0 ) {
48 if( _form->outerDomainValue( ) <= m_Xs[m_Xs.size( )-1] ) throw Exception( "XYs3d::XYs3d: next outerDomainValue <= current outerDomainValue." );
49 }
50 m_Xs.push_back( _form->outerDomainValue( ) );
51 m_function2ds.push_back( _form );
52 }
53
54}
#define GIDI_function2dsChars
Definition GIDI.hpp:388
#define GIDI_axesChars
Definition GIDI.hpp:382
#define GIDI_uncertaintyChars
Definition GIDI.hpp:389
#define GIDI_interpolationQualifierChars
Definition GIDI.hpp:435
#define GNDS_formatVersion_1_10Chars
Definition LUPI.hpp:48
const char * name(G4int ptype)
void data2dListParse(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, std::vector< Functions::Function2dForm * > &a_function2ds)
Functions::Function2dForm * data2dParse(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *parent)
void checkOuterDomainValues2d(std::vector< Functions::Function2dForm * > &a_functions, std::vector< double > &a_Xs)

◆ ~XYs3d()

GIDI::Functions::XYs3d::~XYs3d ( )

Definition at line 72 of file GIDI_XYs3d.cc.

72 {
73
74 for( std::vector<Function2dForm *>::iterator iter = m_function2ds.begin( ); iter < m_function2ds.end( ); ++iter ) delete *iter;
75}

Member Function Documentation

◆ append()

void GIDI::Functions::XYs3d::append ( Function2dForm * a_function2d)

Appends the 2d function a_function2d to the end the this.

Appends a_function2d to the end of this.

Parameters
a_function2d[in] The 2d-function to append to this.

Definition at line 133 of file GIDI_XYs3d.cc.

133 {
134
135 if( m_function2ds.size( ) > 0 ) {
136 if( a_function2d->outerDomainValue( ) <= m_Xs.back( ) ) throw Exception( "XYs3d::append: outerDomainValue not greater than current maximum outer domain's value." );
137 }
138
139 m_Xs.push_back( a_function2d->outerDomainValue( ) );
140 m_function2ds.push_back( a_function2d );
141 a_function2d->setAncestor( this );
142}

Referenced by GIDI::Transporting::Fluxes_from_bdfls::get3dViaFID().

◆ domainMax()

double GIDI::Functions::XYs3d::domainMax ( ) const
virtual

Returns the domain maximum for the instance.

Returns
The domain maximum for the instance.

Implements GIDI::Functions::FunctionForm.

Definition at line 95 of file GIDI_XYs3d.cc.

95 {
96
97 if( m_Xs.size( ) == 0 ) throw Exception( "XYs3d::domainMax: XYs3d has no 2d-functions" );
98 return( m_Xs[m_Xs.size( )-1] );
99}

◆ domainMin()

double GIDI::Functions::XYs3d::domainMin ( ) const
virtual

Returns the domain minimum for the instance.

Returns
The domain minimum for the instance.

Implements GIDI::Functions::FunctionForm.

Definition at line 83 of file GIDI_XYs3d.cc.

83 {
84
85 if( m_Xs.size( ) == 0 ) throw Exception( "XYs3d::domainMin: XYs3d has no 2d-functions" );
86 return( m_Xs[0] );
87}

◆ evaluate()

double GIDI::Functions::XYs3d::evaluate ( double a_x3,
double a_x2,
double a_x1 ) const
virtual

Returns the value of the function f(x3,x2,x1) at the specified point a_x3, a_x2 and a_x1.

Parameters
a_x3[in] The value of the x3 axis.
a_x2[in] The value of the x2 axis.
a_x1[in] The value of the x1 axis.
Returns
The value of the function evaluated at a_x3, a_x2 and a_x1.

Implements GIDI::Functions::Function3dForm.

Definition at line 110 of file GIDI_XYs3d.cc.

110 {
111
112 if( m_Xs.size( ) == 0 ) throw Exception( "XYs3d::evaluate: XYs3d has no 2d functions." );
113
114 long iX3 = binarySearchVector( a_x3, m_Xs );
115
116 if( iX3 < 0 ) {
117 if( iX3 == -1 ) { /* x3 > last value of Xs. */
118 return( m_function2ds.back( )->evaluate( a_x2, a_x1 ) );
119 }
120 return( m_function2ds[0]->evaluate( a_x2, a_x1 ) ); /* x3 < first value of Xs. */
121 }
122
123// Currently does not interpolate;
124 return( m_function2ds[static_cast<std::size_t>(iX3)]->evaluate( a_x2, a_x1 ) );
125}
double evaluate(double a_x3, double a_x2, double a_x1) const
long binarySearchVector(double a_x, std::vector< double > const &a_Xs)
Definition GIDI_misc.cc:33

Referenced by evaluate().

◆ function2ds()

std::vector< Function2dForm * > const & GIDI::Functions::XYs3d::function2ds ( ) const
inline

Returns a const reference to the m_function2ds member.

Definition at line 1951 of file GIDI.hpp.

Referenced by GIDI::settingsFluxesFromFunction3d(), and MCGIDI::Probabilities::XYs3d::XYs3d().

◆ interpolationQualifier()

std::string GIDI::Functions::XYs3d::interpolationQualifier ( ) const
inline

Returns the value of the m_interpolationQualifier member.

Definition at line 1942 of file GIDI.hpp.

◆ setInterpolationQualifier()

void GIDI::Functions::XYs3d::setInterpolationQualifier ( std::string a_interpolationQualifier)
inline

Sets the m_interpolationQualifier member to a_interpolationQualifier.

Definition at line 1943 of file GIDI.hpp.

◆ toXMLList_func()

void GIDI::Functions::XYs3d::toXMLList_func ( GUPI::WriteInfo & a_writeInfo,
std::string const & a_indent,
bool a_embedded,
bool a_inRegions ) const
virtual

Fills the argument a_writeInfo with the XML lines that represent this. Recursively enters each sub-node.

Parameters
a_writeInfo[in/out] Instance containing incremental indentation and other information and stores the appended lines.
a_indent[in] The amount to indent this node.
a_embedded[in] If true, this function is embedded in a higher dimensional function.
a_inRegions[in] If true, this is in a Regions2d container.

Reimplemented from GIDI::Functions::FunctionForm.

Definition at line 153 of file GIDI_XYs3d.cc.

153 {
154
155 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
156 std::string attributes;
157
158 if( a_embedded ) {
160 else {
161 if( a_inRegions ) {
162 attributes = a_writeInfo.addAttribute( GIDI_indexChars, intToString( index( ) ) ); }
163 else {
164 if( label( ) != "" ) attributes = a_writeInfo.addAttribute( GIDI_labelChars, label( ) );
165 }
166 }
167
168 if( m_interpolationQualifier != "" ) attributes = a_writeInfo.addAttribute( GIDI_interpolationQualifierChars, m_interpolationQualifier );
169
170 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
171 axes( ).toXMLList( a_writeInfo, indent2 );
172 for( std::vector<Function2dForm *>::const_iterator iter = m_function2ds.begin( ); iter != m_function2ds.end( ); ++iter ) (*iter)->toXMLList_func( a_writeInfo, indent2, true, false );
173 a_writeInfo.addNodeEnder( moniker( ) );
174}
#define GIDI_outerDomainValueChars
Definition GIDI.hpp:436
#define GIDI_labelChars
Definition GIDI.hpp:438
#define GIDI_indexChars
Definition GIDI.hpp:437
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent="") const
Definition GIDI_axes.cc:113
std::string const & label() const
Definition GIDI.hpp:658
Axes const & axes() const
Definition GIDI.hpp:1012
double outerDomainValue() const
Definition GIDI.hpp:1010
std::string const & moniker() const
Definition GUPI.hpp:102
void addNodeEnder(std::string const &a_moniker)
Definition GUPI.hpp:59
std::string incrementalIndent(std::string const &indent)
Definition GUPI.hpp:52
void addNodeStarter(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
Definition GUPI.hpp:55
std::string addAttribute(std::string const &a_name, std::string const &a_value) const
Definition GUPI.hpp:60
std::string intToString(int a_value)
Definition GIDI_misc.cc:415
std::string doubleToShortestString(double a_value, int a_significantDigits=15, int a_favorEFormBy=0)
Definition LUPI_misc.cc:349

◆ Xs()

std::vector< double > const & GIDI::Functions::XYs3d::Xs ( ) const
inline

Returns the value of the m_Xs member.

Definition at line 1950 of file GIDI.hpp.


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