Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GUPI::Ancestry Class Referenceabstract

#include <GUPI.hpp>

Inheritance diagram for GUPI::Ancestry:

Public Member Functions

 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)
virtual std::string xlinkItemKey () const
std::string toXLink () const
virtual void toXMLList (WriteInfo &a_writeInfo, std::string const &a_indent="") const
void printXML () const

Static Public Member Functions

static std::string buildXLinkItemKey (std::string const &a_name, std::string const &a_key)

Detailed Description

This is a base class inherit by most other classes. It allows one to construct a node's xlink or get another node from its xlink.

Definition at line 75 of file GUPI.hpp.

Constructor & Destructor Documentation

◆ Ancestry()

GUPI::Ancestry::Ancestry ( std::string const & a_moniker,
std::string const & a_attribute = "" )

◆ ~Ancestry()

GUPI::Ancestry::~Ancestry ( )
virtual

Definition at line 36 of file GUPI_ancestry.cc.

36 {
37
38}

Member Function Documentation

◆ ancestor() [1/2]

Ancestry * GUPI::Ancestry::ancestor ( )
inline

Returns the value of the m_ancestor member.

Definition at line 104 of file GUPI.hpp.

◆ ancestor() [2/2]

Ancestry const * GUPI::Ancestry::ancestor ( ) const
inline

Returns the value of the m_ancestor member.

Definition at line 105 of file GUPI.hpp.

◆ attribute()

◆ buildXLinkItemKey()

std::string GUPI::Ancestry::buildXLinkItemKey ( std::string const & a_name,
std::string const & a_key )
inlinestatic

Constructs and returns the key name/value for the this node.

Returns
The constructed key name/value.

Definition at line 83 of file GUPI.hpp.

83 {
84
85 if( a_key.size( ) == 0 ) return( "" );
86 return( "[@" + a_name + "='" + a_key + "']" );
87 }

Referenced by GIDI::Form::xlinkItemKey(), GIDI::Reaction::xlinkItemKey(), and GUPI::Entry::xlinkItemKey().

◆ findInAncestry() [1/2]

Ancestry * GUPI::Ancestry::findInAncestry ( std::string const & a_href)

Returns a pointer to the node whose xlink (i.e., a_href) is a_href.

Parameters
a_href[in] The xlink whose node is to be returned.
Returns
Returns the root node (i.e., the top level node).

Definition at line 93 of file GUPI_ancestry.cc.

93 {
94
95 std::vector<std::string> segments = LUPI::Misc::splitXLinkString( a_href );
96
97 return( findInAncestry2( 0, segments ) );
98}
std::vector< std::string > splitXLinkString(std::string const &a_string)
Definition LUPI_misc.cc:206

Referenced by MCGIDI::Distributions::CoherentPhotoAtomicScattering::CoherentPhotoAtomicScattering(), and MCGIDI::Distributions::IncoherentPhotoAtomicScattering::IncoherentPhotoAtomicScattering().

◆ findInAncestry() [2/2]

Ancestry const * GUPI::Ancestry::findInAncestry ( std::string const & a_href) const

Returns a pointer to the node whose xlink (i.e., a_href) is a_href.

Parameters
a_href[in] The xlink whose node is to be returned.
Returns
Returns the root node (i.e., the top level node).

Definition at line 107 of file GUPI_ancestry.cc.

107 {
108
109 std::vector<std::string> segments = LUPI::Misc::splitXLinkString( a_href );
110
111 return( findInAncestry2( 0, segments ) );
112}

◆ findInAncestry3() [1/2]

◆ findInAncestry3() [2/2]

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

Used 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.

Implemented in GIDI::DelayedNeutron, GIDI::FissionFragmentData, GIDI::GRIN::GRIN_continuumGammas, GIDI::OutputChannel, GIDI::Product, GIDI::Protare, GIDI::ProtareSingle, GIDI::Reaction, GIDI::Suite, GIDI::Sums::CrossSectionSum, GIDI::Sums::Sums, and GUPI::Suite.

◆ isChild()

bool GUPI::Ancestry::isChild ( Ancestry * a_instance)
inline

Returns true if a_instance is a child of this.

Definition at line 111 of file GUPI.hpp.

◆ isParent()

bool GUPI::Ancestry::isParent ( Ancestry * a_parent)
inline

Returns true if a_instance is the parent of this.

Definition at line 112 of file GUPI.hpp.

◆ isRoot()

bool GUPI::Ancestry::isRoot ( ) const
inline

Returns true if this is the root ancestor.

Definition at line 113 of file GUPI.hpp.

Referenced by toXLink().

◆ moniker()

std::string const & GUPI::Ancestry::moniker ( ) const
inline

Returns the value of the m_moniker member.

Definition at line 102 of file GUPI.hpp.

Referenced by GIDI::Form::actualMoniker(), GIDI::Array::Array::Array(), GIDI::calculate1dMultiGroupFissionEnergyRelease(), GIDI::Form::Form(), GIDI::Styles::Base::getDerivedStyle(), GIDI::Functions::Function1dForm::mapToXsAndAdd(), GIDI::ProtareSingle::muCutoffForCoulombPlusNuclearElastic(), GIDI::Reaction::multiGroupDepositionEnergy(), GIDI::Reaction::multiGroupDepositionMomentum(), operator=(), GIDI::Sums::Sums::parse(), MCGIDI::Probabilities::parseProbability1d(), GIDI::Reaction::recalculateMultiGroupData(), GIDI::ProtareSingle::temperatures(), GIDI::ACE_URR::IncidentEnergy::toXMLList(), GIDI::ACE_URR::ProbabilityTable::toXMLList(), GIDI::Axes::toXMLList(), GIDI::Axis::toXMLList(), GIDI::AxisDomain::toXMLList(), GIDI::DelayedNeutron::toXMLList(), GIDI::Distributions::AngularEnergy::toXMLList(), GIDI::Distributions::AngularEnergyMC::toXMLList(), GIDI::Distributions::AngularTwoBody::toXMLList(), GIDI::Distributions::CoulombPlusNuclearElastic::toXMLList(), GIDI::Distributions::EnergyAngular::toXMLList(), GIDI::Distributions::EnergyAngularMC::toXMLList(), GIDI::Distributions::KalbachMann::toXMLList(), GIDI::Distributions::LLNLAngularEnergy::toXMLList(), GIDI::Distributions::LLNLLegendre::toXMLList(), GIDI::Distributions::MultiGroup3d::toXMLList(), GIDI::Distributions::Reference3d::toXMLList(), GIDI::Distributions::Uncorrelated::toXMLList(), GIDI::Distributions::Unspecified::toXMLList(), GIDI::ExternalFile::toXMLList(), GIDI::FissionFragmentData::toXMLList(), GIDI::FlattenedArrayData::toXMLList(), GIDI::Flux::toXMLList(), GIDI::Functions::FissionEnergyRelease::toXMLList(), GIDI::Functions::Gridded2d::toXMLList(), GIDI::Functions::Gridded3d::toXMLList(), GIDI::Functions::Reference1d::toXMLList(), GIDI::Grid::toXMLList(), GIDI::Group::toXMLList(), GIDI::Map::Import::toXMLList(), GIDI::Map::Map::toXMLList(), GIDI::Map::Protare::toXMLList(), GIDI::Map::TNSL::toXMLList(), GIDI::OutputChannel::toXMLList(), GIDI::PhysicalQuantity::toXMLList(), GIDI::Product::toXMLList(), GIDI::ProtareSingle::toXMLList(), GIDI::Reaction::toXMLList(), GIDI::Styles::AngularDistributionReconstructed::toXMLList(), GIDI::Styles::AverageProductData::toXMLList(), GIDI::Styles::CoulombPlusNuclearElasticMuCutoff::toXMLList(), GIDI::Styles::CrossSectionReconstructed::toXMLList(), GIDI::Styles::Evaluated::toXMLList(), GIDI::Styles::GriddedCrossSection::toXMLList(), GIDI::Styles::Heated::toXMLList(), GIDI::Styles::HeatedMultiGroup::toXMLList(), GIDI::Styles::MonteCarlo_cdf::toXMLList(), GIDI::Styles::MultiGroup::toXMLList(), GIDI::Styles::Realization::toXMLList(), GIDI::Styles::SnElasticUpScatter::toXMLList(), GIDI::Styles::URR_probabilityTables::toXMLList(), GIDI::Suite::toXMLList(), GIDI::Sums::CrossSectionSum::toXMLList(), GIDI::Sums::MultiplicitySum::toXMLList(), GIDI::Sums::Summand::Base::toXMLList(), GIDI::Sums::Summands::toXMLList(), GIDI::Sums::Sums::toXMLList(), GIDI::Table::Column::toXMLList(), GIDI::Table::Data::toXMLList(), GIDI::Table::Table::toXMLList(), GIDI::TargetInfo::ChemicalElement::toXMLList(), GIDI::TargetInfo::IsotopicAbundances::toXMLList(), GIDI::TargetInfo::Nuclide::toXMLList(), GIDI::TargetInfo::TargetInfo::toXMLList(), GIDI::Transportable::toXMLList(), toXMLList(), GUPI::Suite::toXMLList(), GIDI::Functions::Constant1d::toXMLList_func(), GIDI::Functions::DiscreteGamma2d::toXMLList_func(), GIDI::Functions::Evaporation2d::toXMLList_func(), GIDI::Functions::FunctionForm::toXMLList_func(), GIDI::Functions::GeneralEvaporation2d::toXMLList_func(), GIDI::Functions::Gridded1d::toXMLList_func(), GIDI::Functions::Isotropic2d::toXMLList_func(), GIDI::Functions::Legendre1d::toXMLList_func(), GIDI::Functions::MadlandNix2d::toXMLList_func(), GIDI::Functions::Polynomial1d::toXMLList_func(), GIDI::Functions::PrimaryGamma2d::toXMLList_func(), GIDI::Functions::Recoil2d::toXMLList_func(), GIDI::Functions::Regions1d::toXMLList_func(), GIDI::Functions::Regions2d::toXMLList_func(), GIDI::Functions::ResonanceBackground1d::toXMLList_func(), GIDI::Functions::ResonanceBackgroundRegion1d::toXMLList_func(), GIDI::Functions::ResonancesWithBackground1d::toXMLList_func(), GIDI::Functions::SimpleMaxwellianFission2d::toXMLList_func(), GIDI::Functions::Unspecified1d::toXMLList_func(), GIDI::Functions::URR_probabilityTables1d::toXMLList_func(), GIDI::Functions::Watt2d::toXMLList_func(), GIDI::Functions::Xs_pdf_cdf1d::toXMLList_func(), GIDI::Functions::XYs1d::toXMLList_func(), GIDI::Functions::XYs2d::toXMLList_func(), GIDI::Functions::XYs3d::toXMLList_func(), GIDI::Functions::Ys1d::toXMLList_func(), GIDI::Distributions::Distribution::toXMLNodeStarter(), GIDI::Styles::Suite::updateChainEnds(), and GIDI::Functions::Function1dForm::write().

◆ operator=()

Ancestry & GUPI::Ancestry::operator= ( Ancestry const & a_ancestry)

The assignment operator. This method sets the member's of this to those of a_ancestry except for the member m_ancestor which is set to nullptr.

Parameters
a_ancestry[in] Instance whose member are used to set the members of this.

Definition at line 47 of file GUPI_ancestry.cc.

47 {
48
49 if( this != &a_ancestry ) {
50 m_moniker = a_ancestry.moniker( );
51 m_ancestor = nullptr;
52 m_attribute = a_ancestry.attribute( );
53 }
54
55 return( *this );
56}

Referenced by GIDI::Form::operator=().

◆ printXML()

void GUPI::Ancestry::printXML ( ) const

Calls toXMLList and then writes the XML lines to the file "test.xml".

Definition at line 229 of file GUPI_ancestry.cc.

229 {
230
231 WriteInfo writeInfo;
232
233 toXMLList( writeInfo, "" );
234
235 std::ofstream fileio;
236 fileio.open( "test.xml" );
237 for( std::list<std::string>::iterator iter = writeInfo.m_lines.begin( ); iter != writeInfo.m_lines.end( ); ++iter ) {
238 fileio << *iter << std::endl;
239 }
240 fileio.close( );
241}
virtual void toXMLList(WriteInfo &a_writeInfo, std::string const &a_indent="") const

◆ root() [1/2]

Ancestry * GUPI::Ancestry::root ( )

Returns the root node, ascending all parent nodes until one is found without an ancester. That node is returned.

Returns
Returns the root node (i.e., the top level node).

Definition at line 64 of file GUPI_ancestry.cc.

64 {
65
66 Ancestry *_root = this;
67
68 while( _root->m_ancestor != nullptr ) _root = _root->m_ancestor;
69 return( _root );
70}
Ancestry(std::string const &a_moniker, std::string const &a_attribute="")

Referenced by GIDI::Transporting::MG::form(), GIDI::Reaction::modifyCrossSection(), GIDI::parseReactionType(), and GIDI::Reaction::recalculateMultiGroupData().

◆ root() [2/2]

Ancestry const * GUPI::Ancestry::root ( ) const

Returns the root node, ascending all parent nodes until one is found without an ancester. That node is returned.

Returns
Returns the root node (i.e., the top level node).

Definition at line 78 of file GUPI_ancestry.cc.

78 {
79
80 Ancestry const *_root = this;
81
82 while( _root->m_ancestor != nullptr ) _root = _root->m_ancestor;
83 return( _root );
84}

◆ serialize()

LUPI_HOST void GUPI::Ancestry::serialize ( LUPI::DataBuffer & a_buffer,
LUPI::DataBuffer::Mode a_mode )
virtual

This method serializes this for broadcasting as needed for MPI and GPUs. The method can count the number of required bytes, pack this or unpack this depending on a_mode.

Parameters
a_buffer[in] The buffer to read or write data to depending on a_mode.
a_mode[in] Specifies the action of this method.

Reimplemented in GUPI::Entry.

Definition at line 192 of file GUPI_ancestry.cc.

192 {
193
194 DATA_MEMBER_STD_STRING( m_moniker, a_buffer, a_mode );
195 DATA_MEMBER_STD_STRING( m_attribute, a_buffer, a_mode );
196 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_ancestor = nullptr;
197}
#define DATA_MEMBER_STD_STRING(member, buf, mode)

Referenced by GUPI::Entry::serialize().

◆ setAncestor()

◆ setMoniker()

void GUPI::Ancestry::setMoniker ( std::string const & a_moniker)
inline

◆ toXLink()

std::string GUPI::Ancestry::toXLink ( ) const

Constructs and returns the xlink for this.

Returns
The constructed xlink.

Definition at line 205 of file GUPI_ancestry.cc.

205 {
206
207 std::string xlink( "/" + m_moniker + xlinkItemKey( ) );
208
209 if( isRoot( ) ) return( xlink );
210 return( m_ancestor->toXLink( ) + xlink );
211}
bool isRoot() const
Definition GUPI.hpp:113
virtual std::string xlinkItemKey() const
Definition GUPI.hpp:128

Referenced by GIDI::calculate1dMultiGroupDataInComponent(), GIDI::calculate1dMultiGroupFissionEnergyRelease(), GIDI::Product::continuousEnergyProductData(), GIDI::Transporting::MG::form(), GIDI::Product::mapContinuousEnergyProductData(), GIDI::Suite::operator[](), and MCGIDI::Probabilities::parseProbability1d().

◆ toXMLList()

void GUPI::Ancestry::toXMLList ( 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 in GIDI::ACE_URR::IncidentEnergy, GIDI::ACE_URR::ProbabilityTable, GIDI::Array3d, GIDI::Array::Array, GIDI::Axes, GIDI::Axis, GIDI::AxisDomain, GIDI::DelayedNeutron, GIDI::Distributions::AngularEnergy, GIDI::Distributions::AngularEnergyMC, GIDI::Distributions::AngularTwoBody, GIDI::Distributions::CoulombPlusNuclearElastic, GIDI::Distributions::EnergyAngular, GIDI::Distributions::EnergyAngularMC, GIDI::Distributions::KalbachMann, GIDI::Distributions::LLNLAngularEnergy, GIDI::Distributions::LLNLLegendre, GIDI::Distributions::MultiGroup3d, GIDI::Distributions::Reference3d, GIDI::Distributions::Uncorrelated, GIDI::Distributions::Unspecified, GIDI::ExternalFile, GIDI::FissionFragmentData, GIDI::FlattenedArrayData, GIDI::Flux, GIDI::Functions::FissionEnergyRelease, GIDI::Functions::FunctionForm, GIDI::Functions::Gridded2d, GIDI::Functions::Gridded3d, GIDI::Functions::Reference1d, GIDI::Grid, GIDI::Group, GIDI::Map::BaseEntry, GIDI::Map::Import, GIDI::Map::Map, GIDI::Map::Protare, GIDI::Map::TNSL, GIDI::OutputChannel, GIDI::PhysicalQuantity, GIDI::Product, GIDI::ProtareSingle, GIDI::Reaction, GIDI::Styles::AngularDistributionReconstructed, GIDI::Styles::AverageProductData, GIDI::Styles::CoulombPlusNuclearElasticMuCutoff, GIDI::Styles::CrossSectionReconstructed, GIDI::Styles::Evaluated, GIDI::Styles::GriddedCrossSection, GIDI::Styles::Heated, GIDI::Styles::HeatedMultiGroup, GIDI::Styles::MonteCarlo_cdf, GIDI::Styles::MultiGroup, GIDI::Styles::Realization, GIDI::Styles::SnElasticUpScatter, GIDI::Styles::URR_probabilityTables, GIDI::Suite, GIDI::Sums::CrossSectionSum, GIDI::Sums::MultiplicitySum, GIDI::Sums::Summand::Base, GIDI::Sums::Summands, GIDI::Sums::Sums, GIDI::Table::Column, GIDI::Table::Data, GIDI::Table::Table, GIDI::TargetInfo::ChemicalElement, GIDI::TargetInfo::IsotopicAbundances, GIDI::TargetInfo::Nuclide, GIDI::TargetInfo::TargetInfo, GIDI::Transportable, and GUPI::Suite.

Definition at line 220 of file GUPI_ancestry.cc.

220 {
221
222 std::cout << "Node '" << moniker( ) << "' needs toXMLList methods." << std::endl;
223}
std::string const & moniker() const
Definition GUPI.hpp:102

Referenced by printXML().

◆ xlinkItemKey()

virtual std::string GUPI::Ancestry::xlinkItemKey ( ) const
inlinevirtual

Returns the value of this's key.

Reimplemented in GIDI::Form, GIDI::Reaction, and GUPI::Entry.

Definition at line 128 of file GUPI.hpp.

Referenced by toXLink().


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