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

#include <GIDI.hpp>

Inheritance diagram for GIDI::Functions::Ys1d:

Public Member Functions

 Ys1d (Axes const &a_axes, ptwXY_interpolation a_interpolation, int a_index=0, double a_outerDomainValue=0.0)
 Ys1d (Axes const &a_axes, ptwXY_interpolation a_interpolation, std::size_t a_start, std::vector< double > const &a_Ys, int a_index=0, double a_outerDomainValue=0.0)
 Ys1d (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
 Ys1d (Ys1d const &a_Ys1d)
 ~Ys1d ()
std::size_t size () const
double operator[] (std::size_t a_index) const
void push_back (double a_y)
Ys1d operator+ (Ys1d const &a_Ys1d) const
Ys1doperator+= (Ys1d const &a_Ys1d)
double domainMin () const
double domainMax () const
std::size_t start () const
void setStart (std::size_t a_start)
std::size_t length () const
std::vector< double > const & Ys () const
std::vector< double > & Ys ()
double evaluate (double a_x1) const
void set (std::size_t a_index, double a_value)
void toXMLList_func (GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions) const
void write (FILE *a_file, std::string const &a_format) 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 mapToXsAndAdd (std::size_t a_offset, std::vector< double > const &a_Xs, std::vector< double > &a_results, double a_scaleFactor) const
virtual XYs1dasXYs1d (bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps) 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 to store GNDS <Ys1d> node.

Definition at line 1141 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ Ys1d() [1/4]

GIDI::Functions::Ys1d::Ys1d ( Axes const & a_axes,
ptwXY_interpolation a_interpolation,
int a_index = 0,
double a_outerDomainValue = 0.0 )
Parameters
a_axes[in] The axes to copy for this.
a_interpolation[in] The interpolation flag.
a_index[in] If imbedded in a two dimensional function, the index of this instance.
a_outerDomainValue[in] If imbedded in a two dimensional function, the domain value for x2.

Definition at line 30 of file GIDI_Ys1d.cc.

30 :
31 Function1dForm( GIDI_Ys1dChars, FormType::Ys1d, a_axes, a_interpolation, a_index, a_outerDomainValue ),
32 m_start( 0 ) {
33
34}
#define GIDI_Ys1dChars
Definition GIDI.hpp:289
Function1dForm(std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
Definition GIDI_form.cc:348

Referenced by operator+(), operator+=(), Ys1d(), Ys1d(), Ys1d(), and Ys1d().

◆ Ys1d() [2/4]

GIDI::Functions::Ys1d::Ys1d ( Axes const & a_axes,
ptwXY_interpolation a_interpolation,
std::size_t a_start,
std::vector< double > const & a_Ys,
int a_index = 0,
double a_outerDomainValue = 0.0 )
Parameters
a_axes[in] The axes to copy for this.
a_interpolation[in] The interpolation flag.
a_start[in] The index of the x1 value the Ys data start at.
a_Ys[in] The list of y values.
a_index[in] If imbedded in a two dimensional function, the index of this instance.
a_outerDomainValue[in] If imbedded in a two dimensional function, the domain value for x2.

Definition at line 46 of file GIDI_Ys1d.cc.

46 :
47 Function1dForm( GIDI_Ys1dChars, FormType::Ys1d, a_axes, a_interpolation, a_index, a_outerDomainValue ),
48 m_start( a_start ),
49 m_Ys( a_Ys ) {
50
51}

◆ Ys1d() [3/4]

GIDI::Functions::Ys1d::Ys1d ( Construction::Settings const & a_construction,
HAPI::Node const & a_node,
SetupInfo & a_setupInfo,
Suite * a_parent )

Constructs the instance from a HAPI::Nodee instance.

Parameters
a_construction[in] Used to pass user options for parsing.
a_node[in] The Ys1d HAPI::Node to be parsed and to construct the instance.
a_setupInfo[in] Information create my the Protare constructor to help in parsing.
a_parent[in] If imbedded in a two dimensional function, its pointers.

Definition at line 63 of file GIDI_Ys1d.cc.

63 :
64 Function1dForm( a_construction, a_node, a_setupInfo, FormType::Ys1d, a_parent ),
65 m_start( static_cast<std::size_t>( a_node.child( GIDI_valuesChars ).attribute( GIDI_startChars ).as_int( ) ) ), // as_int returns 0 if "start" not present.
66 m_Ys( ) {
67
68 HAPI::Node values = a_node.child( GIDI_valuesChars );
69 nf_Buffer<double> data;
70 parseValuesOfDoubles( a_construction, values, a_setupInfo, data );
71 m_Ys.resize( data.size() );
72 for( size_t i1 = 0; i1 < data.size(); ++i1 ) m_Ys[i1] = data[i1];
73}
#define GIDI_valuesChars
Definition GIDI.hpp:260
#define GIDI_startChars
Definition GIDI.hpp:412
void parseValuesOfDoubles(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buffer< double > &a_vector)
Definition GIDI_misc.cc:88

◆ Ys1d() [4/4]

GIDI::Functions::Ys1d::Ys1d ( Ys1d const & a_Ys1d)

The Ys1d copy constructor.

Parameters
a_Ys1d

Definition at line 81 of file GIDI_Ys1d.cc.

81 :
82 Function1dForm( a_Ys1d ),
83 m_start( a_Ys1d.start( ) ),
84 m_Ys( a_Ys1d.Ys( ) ) {
85
86}

◆ ~Ys1d()

GIDI::Functions::Ys1d::~Ys1d ( )

Definition at line 91 of file GIDI_Ys1d.cc.

91 {
92
93}

Member Function Documentation

◆ domainMax()

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

This is currently not implemented.

Returns
The domain maximum for the instance.

Implements GIDI::Functions::FunctionForm.

Definition at line 157 of file GIDI_Ys1d.cc.

157 {
158
159#if !defined(__NVCC__) && !defined(__HIP__)
160 throw Exception( "Ys1d::domainMax: not implemented" );
161#endif
162
163 return( 0. );
164}

◆ domainMin()

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

This is currently not implemented.

Returns
The domain minimum for the instance.

Implements GIDI::Functions::FunctionForm.

Definition at line 142 of file GIDI_Ys1d.cc.

142 {
143
144#if !defined(__NVCC__) && !defined(__HIP__)
145 throw Exception( "Ys1d::domainMin: not implemented" );
146#endif
147
148 return( 0. );
149}

◆ evaluate()

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

This is currently not implemented.

Parameters
a_x1[in] Domain value to evaluate this at.
Returns

Implements GIDI::Functions::Function1dForm.

Definition at line 173 of file GIDI_Ys1d.cc.

173 {
174
175#if !defined(__NVCC__) && !defined(__HIP__)
176 throw Exception( "Ys1d::evaluate: not implemented" );
177#endif
178
179 return( 0. );
180}

◆ length()

std::size_t GIDI::Functions::Ys1d::length ( ) const
inline

Returns the sum of m_start and size( ).

Definition at line 1165 of file GIDI.hpp.

Referenced by operator+=().

◆ operator+()

Ys1d GIDI::Functions::Ys1d::operator+ ( Ys1d const & a_rhs) const

Adds two Ys1d instances and returns the result.

Parameters
a_rhs[in] The Ys1d instance to add to this instance.
Returns
An Ys1d instance that is the sum of this and a_rhs.

Definition at line 102 of file GIDI_Ys1d.cc.

102 {
103
104 Ys1d _Ys1d( *this );
105
106 _Ys1d += a_rhs;
107 return( _Ys1d );
108}
Ys1d(Axes const &a_axes, ptwXY_interpolation a_interpolation, int a_index=0, double a_outerDomainValue=0.0)
Definition GIDI_Ys1d.cc:30

◆ operator+=()

Ys1d & GIDI::Functions::Ys1d::operator+= ( Ys1d const & a_rhs)

Adds an Ys1d instance to this.

Parameters
a_rhs[in] The Ys1d instance to add to this instance.
Returns
This instance.

Definition at line 117 of file GIDI_Ys1d.cc.

117 {
118
119 if( length( ) == 0 ) m_start = a_rhs.length( ); // Allow for empty (uninitialized) this.
120 if( length( ) != a_rhs.length( ) ) throw Exception( "Ys1d::operator+=: lengths not equal." );
121
122 if( a_rhs.start( ) >= m_start ) {
123 std::size_t deltaStart = a_rhs.start( ) - m_start;
124 for( std::size_t i1 = 0; i1 < a_rhs.size( ); ++i1 ) m_Ys[i1+deltaStart] += a_rhs[i1]; }
125 else {
126 std::size_t deltaStart = m_start - a_rhs.start( );
127 std::vector<double> _Ys( a_rhs.Ys( ) );
128
129 for( std::size_t i1 = 0; i1 < size( ); ++i1 ) _Ys[i1+deltaStart] += m_Ys[i1];
130 m_Ys = std::move( _Ys );
131 m_start = a_rhs.start( );
132 }
133 return( *this );
134}
std::size_t length() const
Definition GIDI.hpp:1165
std::size_t size() const
Definition GIDI.hpp:1154

◆ operator[]()

double GIDI::Functions::Ys1d::operator[] ( std::size_t a_index) const
inline

Returns the y value at m_Ys[a_index].

Definition at line 1156 of file GIDI.hpp.

◆ push_back()

void GIDI::Functions::Ys1d::push_back ( double a_y)
inline

Definition at line 1157 of file GIDI.hpp.

1157{ m_Ys.push_back( a_y ); }

Referenced by GIDI::gridded1d2GIDI_Ys1d(), and GIDI::vector2GIDI_Ys1d().

◆ set()

void GIDI::Functions::Ys1d::set ( std::size_t a_index,
double a_value )
inline

Set the value at m_Ys[a_index] to a_value.

Definition at line 1170 of file GIDI.hpp.

Referenced by MCGIDI::HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy().

◆ setStart()

void GIDI::Functions::Ys1d::setStart ( std::size_t a_start)
inline

Sets the m_start member to *a_start.

Definition at line 1164 of file GIDI.hpp.

Referenced by GIDI::gridded1d2GIDI_Ys1d().

◆ size()

std::size_t GIDI::Functions::Ys1d::size ( ) const
inline

Returns the number of values in m_Ys.

Definition at line 1154 of file GIDI.hpp.

Referenced by GIDI::Reaction::modifyCrossSection(), operator+=(), and write().

◆ start()

std::size_t GIDI::Functions::Ys1d::start ( ) const
inline

◆ toXMLList_func()

void GIDI::Functions::Ys1d::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 191 of file GIDI_Ys1d.cc.

191 {
192
193 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
194 std::string attributes = a_writeInfo.addAttribute( GIDI_labelChars, label( ) );
195
196 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
197 axes( ).toXMLList( a_writeInfo, indent2 );
198 doublesToXMLList( a_writeInfo, indent2, m_Ys, m_start );
199 a_writeInfo.addNodeEnder( moniker( ) );
200}
#define GIDI_labelChars
Definition GIDI.hpp:438
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
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
void doublesToXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector< double > const &a_values, std::size_t a_start=0, bool a_newLine=true, std::string const &a_valueType="")
Definition GIDI_misc.cc:180

◆ write()

void GIDI::Functions::Ys1d::write ( FILE * a_file,
std::string const & a_format ) const
virtual

Writes the pair (index, y) values to a_file. The format string must have a long and a double conversion specifiers (e.g., " %10ld %.6f").

Parameters
a_file[in] The C FILE instance to write the data to.
a_format[in] The format string passed to the C printf function.

Reimplemented from GIDI::Functions::Function1dForm.

Definition at line 209 of file GIDI_Ys1d.cc.

209 {
210
211 std::size_t size = m_Ys.size( );
212 for( std::size_t index = 0; index < size; ++index ) fprintf( a_file, a_format.c_str( ), index + m_start, m_Ys[index] );
213}

◆ Ys() [1/2]

std::vector< double > & GIDI::Functions::Ys1d::Ys ( )
inline

Returns a reference to the list of y-values.

Definition at line 1167 of file GIDI.hpp.

◆ Ys() [2/2]

std::vector< double > const & GIDI::Functions::Ys1d::Ys ( ) const
inline

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