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

#include <GIDI.hpp>

Inheritance diagram for GIDI::Functions::Constant1d:

Public Member Functions

 Constant1d (Axes const &a_axes, double value, double a_domainMin, double a_domainMax, int a_index=0, double a_outerDomainValue=0.0)
 Constant1d (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
 ~Constant1d ()
double value () const
double domainMin () const
double domainMax () const
double evaluate (double a_x1) const
void mapToXsAndAdd (std::size_t a_offset, std::vector< double > const &a_Xs, std::vector< double > &a_results, double a_scaleFactor) const
XYs1dasXYs1d (bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps) const
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::Function1dForm
 Function1dForm (std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
 Function1dForm (std::string const &a_moniker, FormType a_type, Axes const &a_axes, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
 Function1dForm (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, FormType a_type, Suite *a_suite=nullptr)
 Function1dForm (Function1dForm const &a_form)
 ~Function1dForm ()
Function1dFormoperator= (Function1dForm const &a_rhs)
virtual void write (FILE *a_file, std::string const &a_format) const
void print (std::string const &a_format) const
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 <constant1d> node.

Definition at line 1054 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ Constant1d() [1/2]

GIDI::Functions::Constant1d::Constant1d ( Axes const & a_axes,
double a_value,
double a_domainMin,
double a_domainMax,
int a_index = 0,
double a_outerDomainValue = 0.0 )
Parameters
a_axes[in] The axes to copy for this.
a_value[in] The GNDS value for this.
a_domainMin[in] The minimum value for the domain.
a_domainMax[in] The maximum value for the domain.
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 31 of file GIDI_constant1d.cc.

31 :
33 m_value( a_value ),
34 m_domainMin( a_domainMin ),
35 m_domainMax( a_domainMax ) {
36
37}
#define GIDI_constant1dChars
Definition GIDI.hpp:287
Function1dForm(std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
Definition GIDI_form.cc:348
@ ptwXY_interpolationLinLin
Definition ptwXY.h:37

◆ Constant1d() [2/2]

GIDI::Functions::Constant1d::Constant1d ( 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 47 of file GIDI_constant1d.cc.

47 :
48 Function1dForm( a_construction, a_node, a_setupInfo, FormType::constant1d, a_parent ),
49 m_value( a_node.attribute( GIDI_valueChars ).as_double( ) ),
50 m_domainMin( a_node.attribute( GIDI_domainMinChars ).as_double( ) ),
51 m_domainMax( a_node.attribute( GIDI_domainMaxChars ).as_double( ) ) {
52
53}
#define GIDI_valueChars
Definition GIDI.hpp:445
#define GIDI_domainMaxChars
Definition GIDI.hpp:447
#define GIDI_domainMinChars
Definition GIDI.hpp:446

◆ ~Constant1d()

GIDI::Functions::Constant1d::~Constant1d ( )

Definition at line 58 of file GIDI_constant1d.cc.

58 {
59
60}

Member Function Documentation

◆ asXYs1d()

XYs1d * GIDI::Functions::Constant1d::asXYs1d ( bool a_asLinlin,
double a_accuray,
double a_lowerEps,
double a_upperEps ) const
virtual

This methods returns an XYs1d representation of this. The calling function owns the created instance and is responible for freeing it.

Parameters
a_asLinlin[in] This argument is not used but retained to make the methods API at same as other asXYs1d functions.
a_accuracy[in] This argument is not used but retained to make the methods API at same as other asXYs1d functions.
a_lowerEps[in] This argument is not used but retained to make the methods API at same as other asXYs1d functions.
a_upperEps[in] This argument is not used but retained to make the methods API at same as other asXYs1d functions.
Returns
A pointer to an XYs1d instance that must be freed by the calling function.

Reimplemented from GIDI::Functions::Function1dForm.

Definition at line 106 of file GIDI_constant1d.cc.

106 {
107
108 std::vector<double> xys( 4 );
109
110 xys[0] = m_domainMin;
111 xys[1] = m_value;
112 xys[2] = m_domainMax;
113 xys[3] = m_value;
114
115 return( new XYs1d( axes( ), ptwXY_interpolationLinLin, xys ) );
116}
Axes const & axes() const
Definition GIDI.hpp:1012

Referenced by evaluate().

◆ domainMax()

double GIDI::Functions::Constant1d::domainMax ( ) const
inlinevirtual

Returns the value of the m_domainMax member.

Implements GIDI::Functions::FunctionForm.

Definition at line 1068 of file GIDI.hpp.

Referenced by GIDI::calculate1dMultiGroupDataInComponent().

◆ domainMin()

double GIDI::Functions::Constant1d::domainMin ( ) const
inlinevirtual

Returns the value of the m_domainMin member.

Implements GIDI::Functions::FunctionForm.

Definition at line 1067 of file GIDI.hpp.

Referenced by GIDI::calculate1dMultiGroupDataInComponent().

◆ evaluate()

double GIDI::Functions::Constant1d::evaluate ( double a_x1) const
virtual

◆ mapToXsAndAdd()

void GIDI::Functions::Constant1d::mapToXsAndAdd ( std::size_t a_offset,
std::vector< double > const & a_Xs,
std::vector< double > & a_results,
double a_scaleFactor ) const
virtual

Evaluates this at the X-values in a_Xs[a_offset:] and adds the results to a_results[a_offset:]. a_Xs and a_results must be the same size otherwise a throw is executed.

Parameters
a_offset[in] The offset in a_Xs to start.
a_Xs[in] The list of domain values to evaluate this at.
a_results[in] The list whose values are added to by the Y-values of this.
a_scaleFactor[in] A factor applied to each evaluation before it is added to a_results.

Reimplemented from GIDI::Functions::Function1dForm.

Definition at line 85 of file GIDI_constant1d.cc.

85 {
86
87 if( a_Xs.size( ) != a_results.size( ) ) throw Exception( "Constant1d::mapToXsAndAdd: a_Xs.size( ) != a_results.size( )." );
88
89 for( std::size_t index = a_offset; index < a_Xs.size( ); ++index ) {
90 a_results[index] += a_scaleFactor * m_value;
91 }
92}

Referenced by evaluate().

◆ toXMLList_func()

void GIDI::Functions::Constant1d::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 Regions1d container.

Reimplemented from GIDI::Functions::FunctionForm.

Definition at line 127 of file GIDI_constant1d.cc.

127 {
128
129 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
130 std::string attributes;
131
132 if( a_embedded ) {
134 else {
135 if( a_inRegions ) {
136 attributes = a_writeInfo.addAttribute( GIDI_indexChars, intToString( index( ) ) ); }
137 else {
138 attributes = a_writeInfo.addAttribute( GIDI_labelChars, label( ) );
139 }
140 }
141
142 attributes += a_writeInfo.addAttribute( GIDI_valueChars, LUPI::Misc::doubleToShortestString( m_value ) );
143 attributes += a_writeInfo.addAttribute( GIDI_domainMinChars, LUPI::Misc::doubleToShortestString( m_domainMin ) );
144 attributes += a_writeInfo.addAttribute( GIDI_domainMaxChars, LUPI::Misc::doubleToShortestString( m_domainMax ) );
145
146 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
147 axes( ).toXMLList( a_writeInfo, indent2 );
148 a_writeInfo.addNodeEnder( moniker( ) );
149}
#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
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

Referenced by evaluate().

◆ value()

double GIDI::Functions::Constant1d::value ( ) const
inline

Returns the value of the m_value member.

Definition at line 1066 of file GIDI.hpp.

Referenced by GIDI::calculate1dMultiGroupDataInComponent(), and GIDI::Reaction::Reaction().


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