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

#include <GIDI.hpp>

Inheritance diagram for GIDI::Functions::Gridded1d:

Public Member Functions

 Gridded1d (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
 ~Gridded1d ()
double domainMin () const
double domainMax () const
Vector const & grid () const
Vector const & data () const
void setData (Vector const &a_data)
void modifiedMultiGroupElasticForTNSL (std::size_t a_maxTNSL_index)
double evaluate (double a_x1) const
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 for the GNDS <gridded1d> node.

Definition at line 1239 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ Gridded1d()

GIDI::Functions::Gridded1d::Gridded1d ( 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 to the constructor.
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_gridded1d.cc.

29 :
30 Function1dForm( a_construction, a_node, a_setupInfo, FormType::gridded1d, a_parent ) {
31
32 Grid const *axis = dynamic_cast<Grid const *>( axes( )[0] );
33 m_grid = axis->data( ).vector();
34
35 parseFlattened1d( a_construction, a_node.child( GIDI_arrayChars ), a_setupInfo, m_data );
36}
#define GIDI_arrayChars
Definition GIDI.hpp:258
Function1dForm(std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
Definition GIDI_form.cc:348
Axes const & axes() const
Definition GIDI.hpp:1012
int parseFlattened1d(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Vector &data)
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668

◆ ~Gridded1d()

GIDI::Functions::Gridded1d::~Gridded1d ( )

Definition at line 41 of file GIDI_gridded1d.cc.

41 {
42
43}

Member Function Documentation

◆ data()

◆ domainMax()

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

Returns the value of the domainMax.

Implements GIDI::Functions::FunctionForm.

Definition at line 1251 of file GIDI.hpp.

◆ domainMin()

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

Returns the value of the domainMin.

Implements GIDI::Functions::FunctionForm.

Definition at line 1250 of file GIDI.hpp.

◆ evaluate()

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

◆ grid()

Vector const & GIDI::Functions::Gridded1d::grid ( ) const
inline

Returns the value of the m_grid member.

Definition at line 1253 of file GIDI.hpp.

Referenced by MCGIDI::Functions::Gridded1d::Gridded1d().

◆ modifiedMultiGroupElasticForTNSL()

void GIDI::Functions::Gridded1d::modifiedMultiGroupElasticForTNSL ( std::size_t a_maxTNSL_index)

Only for internal use. Called by ProtareTNSL instance to zero the lower energy multi-group data covered by the ProtareSingle that contains the TNSL data covers the lower energy multi-group data.

Parameters
a_maxTNSL_index[in] All elements up to a_maxTNSL_index exclusive are zero-ed.

Definition at line 52 of file GIDI_gridded1d.cc.

52 {
53
54 m_data.setToValueInFlatRange( 0, a_maxTNSL_index, 0.0 );
55}

◆ setData()

void GIDI::Functions::Gridded1d::setData ( Vector const & a_data)
inline

Sets the m_data member to a_data.

Definition at line 1255 of file GIDI.hpp.

Referenced by GIDI::calculate1dMultiGroupDataInComponent().

◆ toXMLList_func()

void GIDI::Functions::Gridded1d::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 79 of file GIDI_gridded1d.cc.

79 {
80
81// BRB. This is not correct as it is not converted to a flattened array.
82
83 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
84 std::string indent3 = a_writeInfo.incrementalIndent( indent2 );
85 std::string attributes;
86
87 if( a_embedded ) {
89 else {
90 if( a_inRegions ) {
91 attributes = a_writeInfo.addAttribute( GIDI_indexChars, intToString( index( ) ) ); }
92 else {
93 if( label( ) != "" ) attributes = a_writeInfo.addAttribute( GIDI_labelChars, label( ) );
94 }
95 }
96
97 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
98
99 axes( ).toXMLList( a_writeInfo, indent2 );
100
101 attributes = a_writeInfo.addAttribute( GIDI_shapeChars, size_t_ToString( m_data.size( ) ) );
102 attributes += a_writeInfo.addAttribute( "compression", "flattened" );
103 a_writeInfo.addNodeStarter( indent2, GIDI_arrayChars, attributes );
104
105 std::vector<double> doubles;
106 doubles.reserve( m_data.size( ) );
107 std::size_t i1, i2;
108 for( i1 = 0; i1 < m_data.size( ); ++i1 ) {
109 if( m_data[i1] != 0.0 ) break;
110 }
111 for( i2 = m_data.size( ); i2 > i1; --i2 ) {
112 if( m_data[i2-1] != 0.0 ) break;
113 }
114 std::size_t start( i1 );
115 if( start == m_data.size( ) ) start = 0;
116 a_writeInfo.push_back( indent3 + "<values valueType=\"Integer32\" label=\"starts\">" + size_t_ToString( start ) + "</values>" );
117 for( ; i1 < i2; ++i1 ) doubles.push_back( m_data[i1] );
118 a_writeInfo.push_back( indent3 + "<values valueType=\"Integer32\" label=\"lengths\">" + size_t_ToString( doubles.size( ) ) + "</values>" );
119
120 doublesToXMLList( a_writeInfo, indent3, doubles );
121 a_writeInfo.addNodeEnder( GIDI_arrayChars );
122 a_writeInfo.addNodeEnder( moniker( ) );
123}
#define GIDI_outerDomainValueChars
Definition GIDI.hpp:436
#define GIDI_labelChars
Definition GIDI.hpp:438
#define GIDI_shapeChars
Definition GIDI.hpp:261
#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 push_back(std::string const &a_line)
Definition GUPI.hpp:53
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
std::string size_t_ToString(std::size_t a_value)
Definition GIDI_misc.cc:428
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().

◆ write()

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

This method writes this to a a_file.

Parameters
a_file[in] The C FILE instance to write the data to.
a_format[in] The format string passed to each region's write method.

Reimplemented from GIDI::Functions::Function1dForm.

Definition at line 132 of file GIDI_gridded1d.cc.

132 {
133
134 std::size_t index = 0;
135 char const *fmt = a_format.c_str( );
136
137 for( ; index < m_data.size( ); ++index ) {
138 fprintf( a_file, fmt, m_grid[index], m_data[index] );
139 }
140 if( m_data.size( ) > 0 ) printf( fmt, m_grid[index], m_data[index-1] );
141}

Referenced by evaluate().


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