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

#include <GIDI.hpp>

Inheritance diagram for GIDI::Suite:

Public Types

typedef std::vector< Form * > Forms
typedef Forms::iterator iterator
typedef Forms::const_iterator const_iterator

Public Member Functions

 Suite (std::string const &a_keyName=GIDI_labelChars)
 Suite (std::string const &a_moniker, std::string const &a_keyName)
 Suite (Construction::Settings const &a_construction, std::string const &a_moniker, std::string const &a_keyName, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, parseSuite a_parseSuite, Styles::Suite const *a_styles, bool a_allowsLazyParsing=false)
 ~Suite ()
std::string const & keyName () const
std::size_t size () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
std::size_t operator[] (std::string const &a_label) const
template<typename T>
T * get (std::size_t a_Index)
template<typename T>
T const * get (std::size_t a_Index) const
template<typename T>
T * get (std::string const &a_label)
template<typename T>
T const * get (std::string const &a_label) const
template<typename T>
T * getViaLineage (std::string const &a_label)
template<typename T>
T * getViaLineage (std::string const &a_label) const
template<typename T>
T * pop (std::size_t a_Index)
template<typename T>
T * pop (std::string const &a_label)
Styles::Suite const * styles ()
std::string const & href () const
void parse (Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, parseSuite a_parseSuite, Styles::Suite const *a_styles)
void add (Form *a_form)
iterator find (std::string const &a_label, bool a_convertLazyParsingHelperForm=false)
const_iterator find (std::string const &a_label, bool a_convertLazyParsingHelperForm=false) const
bool has (std::string const &a_label) const
FormcheckLazyParsingHelperForm (std::size_t a_index)
FormcheckLazyParsingHelperForm (std::size_t a_index) const
iterator checkLazyParsingHelperFormIterator (iterator a_iter)
const_iterator checkLazyParsingHelperFormIterator (const_iterator a_iter) const
void modifiedMultiGroupElasticForTNSL (std::map< std::string, std::size_t > const &a_maximumTNSL_MultiGroupIndex)
GUPI::AncestryfindInAncestry3 (std::string const &a_item)
GUPI::Ancestry const * findInAncestry3 (std::string const &a_item) const
std::vector< iteratorfindAllOfMoniker (std::string const &a_moniker)
std::vector< const_iteratorfindAllOfMoniker (std::string const &a_moniker) const
Form const * findInstanceOfTypeInLineage (std::string const &_label, std::string const &a_moniker) const
FormfindInstanceOfTypeInLineage (Styles::Suite const &a_styles, std::string const &_label, std::string const &a_moniker)
void toXMLList (GUPI::WriteInfo &a_writeInfo, std::string const &a_indent="") const
void printFormLabels (std::string const &a_header) const
template<typename T>
T const * get (std::size_t a_index) const
template<typename T>
T const * get (std::string const &a_label) const
template<typename T>
T const * get (std::size_t a_index) const
template<typename T>
T const * get (std::string const &a_label) 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 LUPI_HOST void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
virtual std::string xlinkItemKey () const
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

This class is used to store a list (i.e., suite) of similar type GNDS nodes.

Definition at line 2567 of file GIDI.hpp.

Member Typedef Documentation

◆ const_iterator

typedef Forms::const_iterator GIDI::Suite::const_iterator

Definition at line 2593 of file GIDI.hpp.

◆ Forms

typedef std::vector<Form *> GIDI::Suite::Forms

The typedef the the m_forms member.

Definition at line 2570 of file GIDI.hpp.

◆ iterator

typedef Forms::iterator GIDI::Suite::iterator

Definition at line 2592 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ Suite() [1/3]

GIDI::Suite::Suite ( std::string const & a_keyName = GIDI_labelChars)

Definition at line 22 of file GIDI_suite.cc.

22 :
23 GUPI::Ancestry( "" ),
24 m_keyName( a_keyName ),
25 m_styles( nullptr ),
26 m_allowsLazyParsing( false ) {
27
28}

Referenced by checkLazyParsingHelperForm(), GIDI::Component::Component(), GIDI::Component::Component(), GIDI::Fluxes::Fluxes(), GIDI::Fluxes::Fluxes(), GIDI::Groups::Groups(), and GIDI::Groups::Groups().

◆ Suite() [2/3]

GIDI::Suite::Suite ( std::string const & a_moniker,
std::string const & a_keyName )
Parameters
a_moniker[in] The GNDS moniker for the Suite instance.
a_keyName[in] The name of the key for elements of this.

Definition at line 35 of file GIDI_suite.cc.

35 :
36 GUPI::Ancestry( a_moniker ),
37 m_keyName( a_keyName ),
38 m_styles( nullptr ),
39 m_allowsLazyParsing( false ) {
40
41}

◆ Suite() [3/3]

GIDI::Suite::Suite ( Construction::Settings const & a_construction,
std::string const & a_moniker,
std::string const & a_keyName,
HAPI::Node const & a_node,
SetupInfo & a_setupInfo,
PoPI::Database const & a_pops,
PoPI::Database const & a_internalPoPs,
parseSuite a_parseSuite,
Styles::Suite const * a_styles,
bool a_allowsLazyParsing = false )
Parameters
a_construction[in] Used to pass user options to the constructor.
a_moniker[in] The GNDS moniker for the Suite instance.
a_node[in] The HAPI::Node to be parsed and used to construct the Suite.
a_keyName[in] The name of the key for referencing up child nodes.
a_setupInfo[in] Information create my the Protare constructor to help in parsing.
a_pops[in] The external PoPI::Database instance used to get particle indices and possibly other particle information.
a_internalPoPs[in] The internal PoPI::Database instance used to get particle indices and possibly other particle information. This is the <PoPs> node under the <reactionSuite> node.
a_parseSuite[in] This function to call to parse each sub-node.
a_styles[in] The <styles> node under the <reactionSuite> node.
a_allowsLazyParsing[in] Boolean stating if the suite allows lazy parsing.

Definition at line 57 of file GIDI_suite.cc.

59 :
60 GUPI::Ancestry( a_moniker ),
61 m_keyName( a_keyName ),
62 m_styles( a_styles ),
63 m_allowsLazyParsing( a_allowsLazyParsing ),
64 m_href( "" ) {
65
66 HAPI::Node const node = a_node.child( a_moniker.c_str( ) );
67 m_href = node.attribute_as_string( GIDI_hrefChars );
68
69 if( !node.empty( ) ) parse( a_construction, node, a_setupInfo, a_pops, a_internalPoPs, a_parseSuite, a_styles );
70}
#define GIDI_hrefChars
Definition GIDI.hpp:440
void parse(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, parseSuite a_parseSuite, Styles::Suite const *a_styles)
Definition GIDI_suite.cc:93
bool empty() const
Definition HAPI_Node.cc:150
std::string attribute_as_string(const char *a_name) const
Definition HAPI.hpp:179

◆ ~Suite()

GIDI::Suite::~Suite ( )

Definition at line 75 of file GIDI_suite.cc.

75 {
76
77 for( std::vector<Form *>::const_iterator iter = m_forms.begin( ); iter < m_forms.end( ); ++iter ) delete *iter;
78}

Member Function Documentation

◆ add()

void GIDI::Suite::add ( Form * a_form)

Adds the node a_form to this.

Parameters
a_form[in] The form to add.

Definition at line 132 of file GIDI_suite.cc.

132 {
133
134 std::size_t i1 = 0;
135
136 for( Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter, ++i1 ) {
137 if( (*iter)->keyValue( ) == a_form->keyValue( ) ) {
138 m_forms[i1] = a_form;
139 a_form->setAncestor( this );
140 return;
141 }
142 }
143 m_map[a_form->keyValue( )] = m_forms.size( );
144 m_forms.push_back( a_form );
145 a_form->setAncestor( this );
146}
Forms::iterator iterator
Definition GIDI.hpp:2592

Referenced by GIDI::Fluxes::addFile(), GIDI::Groups::addFile(), GIDI::Documentation_1_10::Suite::parse(), and parse().

◆ begin() [1/2]

iterator GIDI::Suite::begin ( )
inline

The C++ begin iterator for this.

Definition at line 2594 of file GIDI.hpp.

Referenced by GIDI::Styles::Suite::chains(), and MCGIDI::convertACE_URR_probabilityTablesFromGIDI().

◆ begin() [2/2]

const_iterator GIDI::Suite::begin ( ) const
inline

The C++ const begin iterator for this.

Definition at line 2595 of file GIDI.hpp.

◆ checkLazyParsingHelperForm() [1/2]

Form * GIDI::Suite::checkLazyParsingHelperForm ( std::size_t a_index)

Check to see if the form is a LazyParsingHelperForm, it so, parses the form, loads it before returning the requested form.

Parameters
a_index[in] The index of the child to return.
Returns
The form at index a_index.

Definition at line 156 of file GIDI_suite.cc.

156 {
157
158 Form *form = m_forms[a_index];
159
160 if( form->type( ) == FormType::lazyParsingHelperForm ) {
161 LazyParsingHelperForm *lazyParsingHelperForm = static_cast<LazyParsingHelperForm *>( form );
162 form = lazyParsingHelperForm->parse( );
163 if( form == nullptr ) { // Happens because several forms (e.g., CoulombPlusNuclearElastic) are not needed by transport codes and are not parsed.
164 form = lazyParsingHelperForm; }
165 else {
166 form->setAncestor( this );
167 m_forms[a_index] = form;
169 }
170 }
171
172 return( form );
173}
@ lazyParsingHelperForm
Definition GIDI.hpp:118

Referenced by checkLazyParsingHelperFormIterator(), checkLazyParsingHelperFormIterator(), get(), get(), get(), get(), pop(), and pop().

◆ checkLazyParsingHelperForm() [2/2]

Form * GIDI::Suite::checkLazyParsingHelperForm ( std::size_t a_index) const

Check to see if the form is a LazyParsingHelperForm, it so, parses the form, loads it before returning the requested form.

Parameters
a_index[in] The index of the child to return.
Returns
The form at index a_index.

Definition at line 183 of file GIDI_suite.cc.

183 {
184
185 Form *form = m_forms[a_index];
186
187 if( form->type( ) == FormType::lazyParsingHelperForm ) {
188 LazyParsingHelperForm *lazyParsingHelperForm = static_cast<LazyParsingHelperForm *>( form );
189 form = lazyParsingHelperForm->parse( );
190 if( form != nullptr ) {
191 form->setAncestor( const_cast<Suite *>( this ) );
192 m_forms[a_index] = form;
194 }
195 }
196
197 return( form );
198}
Suite(std::string const &a_keyName=GIDI_labelChars)
Definition GIDI_suite.cc:22

◆ checkLazyParsingHelperFormIterator() [1/2]

Suite::const_iterator GIDI::Suite::checkLazyParsingHelperFormIterator ( Suite::const_iterator a_iter) const

Check to see if the form is a LazyParsingHelperForm, it so, parses the form, loads it before returning the requested form.

Parameters
a_iter[in] Iterator to the Form to check.
Returns
The form at index a_index.

Definition at line 226 of file GIDI_suite.cc.

226 {
227
228 if( a_iter == end( ) ) return( a_iter );
229
230 std::size_t index = (*this)[(*a_iter)->keyValue()];
231 a_iter++;
233
234 return( --a_iter );
235}
Form * checkLazyParsingHelperForm(std::size_t a_index)
iterator end()
Definition GIDI.hpp:2596

◆ checkLazyParsingHelperFormIterator() [2/2]

Suite::iterator GIDI::Suite::checkLazyParsingHelperFormIterator ( Suite::iterator a_iter)

Check to see if the form is a LazyParsingHelperForm, it so, parses the form, loads it before returning the requested form.

Parameters
a_iter[in] Iterator to the Form to check.
Returns
The iterator to the old or converted form.

Definition at line 207 of file GIDI_suite.cc.

207 {
208
209 if( a_iter == end( ) ) return( a_iter );
210
211 std::size_t index = (*this)[(*a_iter)->keyValue()];
212 ++a_iter;
214
215 return( --a_iter );
216}

Referenced by find(), find(), findInstanceOfTypeInLineage(), and findInstanceOfTypeInLineage().

◆ end() [1/2]

◆ end() [2/2]

const_iterator GIDI::Suite::end ( ) const
inline

The C++ const end iterator for this.

Definition at line 2597 of file GIDI.hpp.

◆ find() [1/2]

Suite::iterator GIDI::Suite::find ( std::string const & a_keyValue,
bool a_convertLazyParsingHelperForm = false )

Returns the iterator to the node with keyValue a_keyValue.

Parameters
a_keyValue[in] The keyValue of the node to find.
a_convertLazyParsingHelperForm[in] If true and requested form is a LazyParsingHelperForm instance, that instance is replaced with the parsed form.
Returns
The iterator to the node with keyValue a_keyValue.

Definition at line 246 of file GIDI_suite.cc.

246 {
247
248 for( Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
249 if( (*iter)->keyValue( ) == a_keyValue ) {
250 if( a_convertLazyParsingHelperForm ) return( checkLazyParsingHelperFormIterator( iter ) );
251 return( iter );
252 }
253 }
254 return( m_forms.end( ) );
255}
iterator checkLazyParsingHelperFormIterator(iterator a_iter)

Referenced by findInstanceOfTypeInLineage(), GIDI::Styles::Suite::findLabelInLineage(), GIDI::Transporting::MG::form(), has(), modifiedMultiGroupElasticForTNSL(), and GIDI::Reaction::recalculateMultiGroupData().

◆ find() [2/2]

Suite::const_iterator GIDI::Suite::find ( std::string const & a_keyValue,
bool a_convertLazyParsingHelperForm = false ) const

Returns the iterator to the node with keyValue a_keyValue.

Parameters
a_keyValue[in] The keyValue of the node to find.
a_convertLazyParsingHelperForm[in] If true and requested form is a LazyParsingHelperForm instance, that instance is replaced with the parsed form.
Returns
The iterator to the node with keyValue a_keyValue.

Definition at line 266 of file GIDI_suite.cc.

266 {
267
268 for( Suite::const_iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
269 if( (*iter)->keyValue( ) == a_keyValue ) {
270 if( a_convertLazyParsingHelperForm ) return( checkLazyParsingHelperFormIterator( iter ) );
271 return( iter );
272 }
273 }
274 return( m_forms.end( ) );
275}
Forms::const_iterator const_iterator
Definition GIDI.hpp:2593

◆ findAllOfMoniker() [1/2]

std::vector< Suite::iterator > GIDI::Suite::findAllOfMoniker ( std::string const & a_moniker)

Returns a list of iterators to the nodes in this that have GNDS moniker a_moniker.

Parameters
a_moniker[in] The moniker to search for.
Returns
List of iterators to the nodes in this that have moniker a_moniker.

Definition at line 285 of file GIDI_suite.cc.

285 {
286
287 std::vector<Suite::iterator> iters;
288
289 for( Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
290 if( (*iter)->moniker( ) == a_moniker ) iters.push_back( iter );
291 }
292
293 return( iters );
294}

Referenced by GIDI::Reaction::Reaction().

◆ findAllOfMoniker() [2/2]

std::vector< Suite::const_iterator > GIDI::Suite::findAllOfMoniker ( std::string const & a_moniker) const

Returns a list of iterators to the nodes in this that have GNDS moniker a_moniker.

Parameters
a_moniker[in] The moniker to search for.
Returns
List of iterators to the nodes in this that have moniker a_moniker.

Definition at line 304 of file GIDI_suite.cc.

304 {
305
306 std::vector<Suite::const_iterator> iters;
307
308 for( Suite::const_iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
309 if( (*iter)->moniker( ) == a_moniker ) iters.push_back( iter );
310 }
311
312 return( iters );
313}

◆ findInAncestry3() [1/2]

GUPI::Ancestry * GIDI::Suite::findInAncestry3 ( std::string const & a_item)
virtual

Used by GUPI::Ancestry to tranverse GNDS nodes. This method returns a pointer to a derived class' a_item member or nullptr if none exists.

Parameters
a_item[in] The name of the class member whose pointer is to be return.
Returns
The pointer to the class member or nullptr if class does not have a member named a_item.

Implements GUPI::Ancestry.

Definition at line 396 of file GIDI_suite.cc.

396 {
397
398 std::size_t index( a_item.find( '=' ) ), lastQuote = a_item.size( ) - 2;
399
400 if( index == std::string::npos ) return( nullptr );
401 ++index;
402 if( index > lastQuote ) throw Exception( "Suite::findInAncestry3: invalide xlink" );
403 if( a_item[index] != '\'' ) throw Exception( "Suite::findInAncestry3: invalid xlink, missing '." );
404 ++index;
405 if( a_item[lastQuote] != '\'' ) throw Exception( "Suite::findInAncestry3: invalid xlink, missing endl '." );
406
407 std::string keyValue( a_item.substr( index, lastQuote - index ) );
408
409 return( get<GUPI::Ancestry>( keyValue ) );
410}
T * get(std::size_t a_Index)
Definition GIDI.hpp:2642

◆ findInAncestry3() [2/2]

GUPI::Ancestry const * GIDI::Suite::findInAncestry3 ( std::string const & a_item) const
virtual

Used by GUPI::Ancestry to tranverse GNDS nodes. This method returns a pointer to a derived class' a_item member or nullptr if none exists.

Parameters
a_item[in] The name of the class member whose pointer is to be return.
Returns
The pointer to the class member or nullptr if class does not have a member named a_item.

Implements GUPI::Ancestry.

Definition at line 419 of file GIDI_suite.cc.

419 {
420
421 std::size_t index( a_item.find( '=' ) ), lastQuote = a_item.size( ) - 2;
422
423 if( index == std::string::npos ) return( nullptr );
424 ++index;
425 if( index > lastQuote ) throw Exception( "Suite::findInAncestry3: invalide xlink" );
426 if( a_item[index] != '\'' ) throw Exception( "Suite::findInAncestry3: invalid xlink, missing '." );
427 ++index;
428 if( a_item[lastQuote] != '\'' ) throw Exception( "Suite::findInAncestry3: invalid xlink, missing endl '." );
429
430 std::string keyValue( a_item.substr( index, lastQuote - index ) );
431
432 return( get<GUPI::Ancestry>( keyValue ) );
433}

◆ findInstanceOfTypeInLineage() [1/2]

Form const * GIDI::Suite::findInstanceOfTypeInLineage ( std::string const & a_label,
std::string const & a_moniker ) const

This method finds the nearest form of instance Functions::XYs1d in this that is prior to the form with label a_label.

Parameters
a_label[in] The label of the form to start from when looking backwards.
a_formType[in] The type of form to return.
Returns
Pointer to an Functions::XYs1d instance of nullptr if one not found.

Definition at line 324 of file GIDI_suite.cc.

324 {
325
326 Form const *form1 = nullptr;
327 auto formIter = m_forms.end( );
328
329 for( auto iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
330 if( (*iter)->label( ) == a_label ) break;
331 if( (*iter)->actualMoniker( ) == a_moniker ) formIter = iter;
332 }
333
334 if( formIter != m_forms.end( ) ) {
335 form1 = *checkLazyParsingHelperFormIterator( formIter );
336 }
337
338 return( form1 );
339}

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

◆ findInstanceOfTypeInLineage() [2/2]

Form * GIDI::Suite::findInstanceOfTypeInLineage ( Styles::Suite const & a_styles,
std::string const & a_label,
std::string const & a_moniker )

This method finds the nearest form of instance Functions::XYs1d in this that is prior to the form with label a_label.

Parameters
a_styles[in] The styles suite for the protare.
a_label[in] The label of the form to start from when looking backwards.
a_formType[in] The type of form to return.
Returns
Pointer to an Functions::XYs1d instance of nullptr if one not found.

Definition at line 351 of file GIDI_suite.cc.

351 {
352
353 auto stylesIter = a_styles.find( a_label );
354 if( stylesIter != a_styles.end( ) ) {
355 auto suiteIter = find( a_label );
356 if( suiteIter != end( ) ) {
357 if( (*suiteIter)->actualMoniker( ) == a_moniker ) return( *checkLazyParsingHelperFormIterator( suiteIter ) );
358 }
359 Styles::Base const *style = static_cast<Styles::Base const *>( *stylesIter );
360 return( findInstanceOfTypeInLineage( a_styles, style->getDerivedStyle( )->keyValue( ), a_moniker ) );
361 }
362
363 return( nullptr );
364}
Form const * findInstanceOfTypeInLineage(std::string const &_label, std::string const &a_moniker) const
iterator find(std::string const &a_label, bool a_convertLazyParsingHelperForm=false)

◆ get() [1/8]

template<typename T>
T * GIDI::Suite::get ( std::size_t a_index)

Returns the node at index a_index.

Parameters
a_index[in] The index of the node to return.
Returns
The node at index a_index.

Definition at line 2642 of file GIDI.hpp.

2642 {
2643
2644 Form *__form = checkLazyParsingHelperForm( a_index );
2645 T *object = dynamic_cast<T *>( __form );
2646
2647 if( object == nullptr ) throw Exception( "GIDI::Suite::get( std::size_t ): invalid cast" );
2648
2649 return( object );
2650}

Referenced by GIDI::calculate1dMultiGroupDataInComponent(), GIDI::Product::continuousEnergyProductData(), findInAncestry3(), findInAncestry3(), GIDI::Styles::Suite::findLabelInLineage(), get(), getViaLineage(), getViaLineage(), MCGIDI::HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy(), GIDI::Product::mapContinuousEnergyProductData(), GIDI::Reaction::modifyCrossSection(), MCGIDI::OutputChannel::OutputChannel(), MCGIDI::Distributions::parseGIDI(), MCGIDI::Functions::parseMultiplicityFunction1d(), GIDI::Transporting::Particles::process(), GIDI::Reaction::recalculateMultiGroupData(), and GIDI::ExternalFiles::Suite::registerBinaryFiles().

◆ get() [2/8]

template<typename T>
T const * GIDI::Suite::get ( std::size_t a_Index) const

◆ get() [3/8]

template<typename T>
T const * GIDI::Suite::get ( std::size_t a_index) const

Returns the node at index a_index.

Parameters
a_index[in] The index of the node to return.
Returns
The node at index a_index.

Definition at line 2660 of file GIDI.hpp.

2660 {
2661
2662 Form *__form = checkLazyParsingHelperForm( a_index );
2663 T *object = dynamic_cast<T *>( __form );
2664
2665 if( object == nullptr ) throw Exception( "GIDI::Suite::get( std::size_t ): invalid cast" );
2666
2667 return( object );
2668}

◆ get() [4/8]

template<typename T>
T const * GIDI::Suite::get ( std::size_t a_index) const

Returns the node at index a_index.

Parameters
a_index[in] The index of the node to return.
Returns
The node at index a_index.

Definition at line 319 of file GUPI.hpp.

319 {
320
321 Entry *entry = m_entries[a_index];
322 T *object = dynamic_cast<T *>( entry );
323
324 if( object == nullptr ) throw LUPI::Exception( "GIDI::Suite::get( std::size_t ): invalid cast" );
325
326 return( object );
327}

◆ get() [5/8]

template<typename T>
T * GIDI::Suite::get ( std::string const & a_label)

Returns the node with label a_label.

Parameters
a_label[in] The label of the node to return.
Returns
The node with label a_label.

Definition at line 2678 of file GIDI.hpp.

2678 {
2679
2680 auto index = (*this)[a_label];
2681 Form *__form = checkLazyParsingHelperForm( index );
2682 T *object = dynamic_cast<T *>( __form );
2683
2684 if( object == nullptr ) throw Exception( "GIDI::Suite::get( std::string const & ): invalid cast" );
2685
2686 return( object );
2687}

◆ get() [6/8]

template<typename T>
T const * GIDI::Suite::get ( std::string const & a_label) const

Returns the node with label a_label.

Parameters
a_label[in] The label of the node to return.
Returns
The node with label a_label.

Definition at line 2697 of file GIDI.hpp.

2697 {
2698
2699 auto index = (*this)[a_label];
2700 Form *__form = checkLazyParsingHelperForm( index );
2701 T *object = dynamic_cast<T *>( __form );
2702
2703 if( object == nullptr ) throw Exception( "GIDI::Suite::get( std::string const & ): invalid cast" );
2704
2705 return( object );
2706}

◆ get() [7/8]

template<typename T>
T const * GIDI::Suite::get ( std::string const & a_label) const

◆ get() [8/8]

template<typename T>
T const * GIDI::Suite::get ( std::string const & a_label) const

Returns the node with label a_label.

Parameters
a_label[in] The label of the node to return.
Returns
The node with label a_label.

Definition at line 356 of file GUPI.hpp.

356 {
357
358 auto index = (*this)[a_label];
359 Entry *entry = m_entries[index];
360 T *object = dynamic_cast<T *>( entry );
361
362 if( object == nullptr ) throw LUPI::Exception( "GIDI::Suite::get( std::string const & ): invalid cast" );
363
364 return( object );
365}

◆ getViaLineage() [1/2]

template<typename T>
T * GIDI::Suite::getViaLineage ( std::string const & a_label)

Definition at line 3447 of file GIDI.hpp.

3447 {
3448
3449 std::string const *label = m_styles->findLabelInLineage( (Styles::Suite &) *this, a_label );
3450
3451 return( get<T>( *label ) );
3452}

Referenced by get(), and MCGIDI::Functions::parseMultiplicityFunction1d().

◆ getViaLineage() [2/2]

template<typename T>
T * GIDI::Suite::getViaLineage ( std::string const & a_label) const

Definition at line 3457 of file GIDI.hpp.

3457 {
3458
3459 std::string const *label = m_styles->findLabelInLineage( (Styles::Suite &) *this, a_label );
3460
3461 return( get<T>( *label ) );
3462}

◆ has()

bool GIDI::Suite::has ( std::string const & a_label) const
inline

◆ href()

std::string const & GIDI::Suite::href ( ) const
inline

Returns a reference to the m_ref member.

Definition at line 2609 of file GIDI.hpp.

◆ keyName()

std::string const & GIDI::Suite::keyName ( ) const
inline

Returns a const reference to the m_keyName member.

Definition at line 2590 of file GIDI.hpp.

◆ modifiedMultiGroupElasticForTNSL()

void GIDI::Suite::modifiedMultiGroupElasticForTNSL ( std::map< std::string, std::size_t > const & a_maximumTNSL_MultiGroupIndex)

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_maximumTNSL_MultiGroupIndex[in] A map that contains labels for heated multi-group data and the last valid group boundary for the TNSL data for that boundary.

Definition at line 374 of file GIDI_suite.cc.

374 {
375
376 for( auto iter = a_maximumTNSL_MultiGroupIndex.begin( ); iter != a_maximumTNSL_MultiGroupIndex.end( ); ++iter ) {
377 auto formIter = find( iter->first, true );
378
379 if( formIter == m_forms.end( ) ) continue;
380
381 if( (*formIter)->type( ) == FormType::gridded1d ) {
382 reinterpret_cast<Functions::Gridded1d *>( (*formIter) )->modifiedMultiGroupElasticForTNSL( iter->second ); }
383 else if( (*formIter)->type( ) == FormType::gridded3d ) {
384 reinterpret_cast<Functions::Gridded3d *>( (*formIter) )->modifiedMultiGroupElasticForTNSL( iter->second );
385 }
386 }
387}
void modifiedMultiGroupElasticForTNSL(std::map< std::string, std::size_t > const &a_maximumTNSL_MultiGroupIndex)

Referenced by modifiedMultiGroupElasticForTNSL().

◆ operator[]()

std::size_t GIDI::Suite::operator[] ( std::string const & a_keyValue) const

Returns the index of the node in this that has keyValue a_keyValue.

Returns
[in] The index of the node with keyValue a_keyValue in this.

Definition at line 116 of file GIDI_suite.cc.

116 {
117
118 auto iter = m_map.find( a_keyValue );
119 if( iter == m_map.end( ) ) {
120 throw Exception( "form '" + a_keyValue + "' not in suite " + toXLink( ) + "." );
121 }
122
123 return( iter->second );
124}
std::string toXLink() const

◆ parse()

void GIDI::Suite::parse ( Construction::Settings const & a_construction,
HAPI::Node const & a_node,
SetupInfo & a_setupInfo,
PoPI::Database const & a_pops,
PoPI::Database const & a_internalPoPs,
parseSuite a_parseSuite,
Styles::Suite const * a_styles )

This methods parses all the child nodes of a_node.

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 Product.
a_setupInfo[in] Information create my the Protare constructor to help in parsing.
a_pops[in] The external PoPI::Database instance used to get particle indices and possibly other particle information.
a_internalPoPs[in] The internal PoPI::Database instance used to get particle indices and possibly other particle information. This is the <PoPs> node under the <reactionSuite> node.
a_parseSuite[in] This function to call to parse each sub-node.
a_styles[in] The <styles> node under the <reactionSuite> node.

Definition at line 93 of file GIDI_suite.cc.

94 {
95
96 for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
97 std::string name( child.name( ) );
98
99 Form *form = nullptr;
100
101 if( m_allowsLazyParsing && a_construction.lazyParsing( ) ) {
102 form = new LazyParsingHelperForm( a_construction, this, child, a_setupInfo, a_pops, a_internalPoPs, name, a_styles, a_parseSuite ); }
103 else {
104 form = a_parseSuite( a_construction, this, child, a_setupInfo, a_pops, a_internalPoPs, name, a_styles );
105 }
106 if( form != nullptr ) add( form );
107 }
108}
void add(Form *a_form)
const char * name(G4int ptype)

Referenced by Suite().

◆ pop() [1/2]

template<typename T>
T * GIDI::Suite::pop ( std::size_t a_index)

Removes the form at index a_index and returns it. It is up to the calling function to delete the form, otherwise there will be memory leak.

Parameters
a_index[in] The index of the node to return.
Returns
The node at index a_index.

Definition at line 2717 of file GIDI.hpp.

2717 {
2718
2719 Form *__form = checkLazyParsingHelperForm( a_index );
2720 T *object = dynamic_cast<T *>( __form );
2721
2722 if( object == nullptr ) throw Exception( "GIDI::Suite::pop( std::size_t ): invalid cast" );
2723
2724 for( std::size_t index = a_index + 1; index < m_forms.size( ); ++index ) {
2725 m_forms[index-1] = m_forms[index];
2726 m_map[m_forms[index-1]->label( )] = index - 1;
2727 }
2728 m_forms.resize( m_forms.size( ) - 1 );
2729
2730 return( object );
2731}

Referenced by get().

◆ pop() [2/2]

template<typename T>
T * GIDI::Suite::pop ( std::string const & a_label)

Removes the form with label a_label and returns it. It is up to the calling function to delete the form, otherwise there will be memory leak.

Parameters
a_label[in] The label of the node to return.
Returns
The node at index a_label.

Definition at line 2742 of file GIDI.hpp.

2742 {
2743
2744 auto index = (*this)[a_label]; // This will throw an exception if *a_label* is not in *this*.
2745 Form *__form = checkLazyParsingHelperForm( index );
2746 T *object = dynamic_cast<T *>( __form );
2747
2748 if( object == nullptr ) throw Exception( "GIDI::Suite::pop( std::size_t ): invalid cast" );
2749
2750 for( std::size_t index2 = index + 1; index2 < m_forms.size( ); ++index2 ) {
2751 m_forms[index2-1] = m_forms[index2];
2752 m_map[m_forms[index2-1]->label( )] = index2 - 1;
2753 }
2754 m_forms.resize( m_forms.size( ) - 1 );
2755
2756 return( object );
2757
2758}

◆ printFormLabels()

void GIDI::Suite::printFormLabels ( std::string const & a_header) const

Prints the list of node keyValues to std::cout.

Parameters
a_header[in] A string printed before the list of keyValues is printed.

Definition at line 462 of file GIDI_suite.cc.

462 {
463
464 std::cout << a_header << ": size = " << size( ) << std::endl;
465
466 for( Suite::const_iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter )
467 std::cout << " " << (*iter)->keyValue( ) << std::endl;
468}
std::size_t size() const
Definition GIDI.hpp:2591

◆ size()

std::size_t GIDI::Suite::size ( ) const
inline

◆ styles()

Styles::Suite const * GIDI::Suite::styles ( )
inline

Returns the value of the m_styles member.

Definition at line 2608 of file GIDI.hpp.

Referenced by GIDI::Reaction::modifyCrossSection().

◆ toXMLList()

void GIDI::Suite::toXMLList ( GUPI::WriteInfo & a_writeInfo,
std::string const & a_indent = "" ) 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.

Reimplemented from GUPI::Ancestry.

Definition at line 442 of file GIDI_suite.cc.

442 {
443
444 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
445
446 if( size( ) == 0 ) return;
447
448 std::string XMLLine( a_indent + "<" + moniker( ) + ">" );
449 a_writeInfo.push_back( XMLLine );
450
451 for( Suite::const_iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) (*iter)->toXMLList( a_writeInfo, indent2 );
452
453 a_writeInfo.addNodeEnder( moniker( ) );
454}
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

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