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

#include <GIDI.hpp>

Inheritance diagram for GIDI::PhysicalQuantity:

Public Member Functions

 PhysicalQuantity (HAPI::Node const &a_node, SetupInfo &a_setupInfo)
 PhysicalQuantity (double a_value, std::string const &a_unit)
 PhysicalQuantity (PhysicalQuantity const &a_physicalQuantity)
 ~PhysicalQuantity ()
PhysicalQuantityoperator= (PhysicalQuantity const &a_rhs)
double value () const
std::string const & unit () 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

Friends

std::ostream & operator<< (std::ostream &a_os, PhysicalQuantity const &a_physicalQuantity)

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 a physical quantity. A physical quantity is a value (e.g., 13.2) with a unit (e.g., 'cm'). The physical quantity can be unitless (i.e., the unit can be an empty string). Examples a physical quantities are '13.2 cm', '0.132 m', '4.5 kg'.

Definition at line 712 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ PhysicalQuantity() [1/3]

GIDI::PhysicalQuantity::PhysicalQuantity ( HAPI::Node const & a_node,
SetupInfo & a_setupInfo )
Parameters
a_node[in] The HAPI::Node to be parsed and used to construct the PhysicalQuantity.
a_setupInfo[in] Information create my the Protare constructor to help in parsing.

Definition at line 26 of file GIDI_physicalQuantity.cc.

26 :
27 Form( a_node, a_setupInfo, FormType::physicalQuantity ),
28 m_value( a_node.attribute_as_double( GIDI_valueChars ) ),
29 m_unit( a_node.attribute_as_string( GIDI_unitChars ) ) {
30
31}
#define GIDI_unitChars
Definition GIDI.hpp:439
#define GIDI_valueChars
Definition GIDI.hpp:445
Form(FormType a_type)
Definition GIDI_form.cc:25

Referenced by operator<<, operator=(), and PhysicalQuantity().

◆ PhysicalQuantity() [2/3]

GIDI::PhysicalQuantity::PhysicalQuantity ( double a_value,
std::string const & a_unit )
Parameters
a_value[in] The physical quantity's value.
a_unit[in] The physical quantity's unit.

Definition at line 39 of file GIDI_physicalQuantity.cc.

39 :
41 m_value( a_value ),
42 m_unit( a_unit ) {
43
44}

◆ PhysicalQuantity() [3/3]

GIDI::PhysicalQuantity::PhysicalQuantity ( PhysicalQuantity const & a_physicalQuantity)
inline

Definition at line 721 of file GIDI.hpp.

721 :
723 m_value( a_physicalQuantity.value( ) ),
724 m_unit( a_physicalQuantity.unit( ) ) { }

◆ ~PhysicalQuantity()

GIDI::PhysicalQuantity::~PhysicalQuantity ( )

Definition at line 49 of file GIDI_physicalQuantity.cc.

49 {
50
51}

Member Function Documentation

◆ operator=()

PhysicalQuantity & GIDI::PhysicalQuantity::operator= ( PhysicalQuantity const & a_rhs)

The assignment operator. This method sets the members of this to those of a_rhs except for those not set by base classes.

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

Definition at line 60 of file GIDI_physicalQuantity.cc.

60 {
61
62 if( this != &a_rhs ) {
63 Form::operator=( a_rhs );
64
65 m_value = a_rhs.value( );
66 m_unit = a_rhs.unit( );
67 }
68
69 return( *this );
70}
Form & operator=(Form const &a_rhs)
Definition GIDI_form.cc:93

◆ toXMLList()

void GIDI::PhysicalQuantity::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 79 of file GIDI_physicalQuantity.cc.

79 {
80
81 std::string attributes = a_writeInfo.addAttribute( GIDI_valueChars, LUPI::Misc::doubleToShortestString( value( ) ) ) + a_writeInfo.addAttribute( GIDI_unitChars, unit( ) );
82
83 a_writeInfo.addNodeStarterEnder( a_indent, moniker( ), attributes );
84}
std::string const & unit() const
Definition GIDI.hpp:729
double value() const
Definition GIDI.hpp:728
std::string const & moniker() const
Definition GUPI.hpp:102
void addNodeStarterEnder(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
Definition GUPI.hpp:57
std::string addAttribute(std::string const &a_name, std::string const &a_value) const
Definition GUPI.hpp:60
std::string doubleToShortestString(double a_value, int a_significantDigits=15, int a_favorEFormBy=0)
Definition LUPI_misc.cc:349

◆ unit()

std::string const & GIDI::PhysicalQuantity::unit ( ) const
inline

Returns the value of the m_unit member.

Definition at line 729 of file GIDI.hpp.

Referenced by operator<<, operator=(), PhysicalQuantity(), and toXMLList().

◆ value()

double GIDI::PhysicalQuantity::value ( ) const
inline

Returns the value of the m_value member.

Definition at line 728 of file GIDI.hpp.

Referenced by operator<<, operator=(), PhysicalQuantity(), GIDI::Reaction::recalculateMultiGroupData(), GIDI::ProtareSingle::temperatures(), and toXMLList().

◆ operator<<

std::ostream & operator<< ( std::ostream & a_os,
PhysicalQuantity const & a_physicalQuantity )
friend

Writes the information of a_physicalQuantity to a_os.

Parameters
a_os[out] The stream to write to.
a_physicalQuantity[in] The PhysicalQuantity whose information is written.

Definition at line 93 of file GIDI_physicalQuantity.cc.

93 {
94
95 a_os << a_physicalQuantity.value( ) << " " << a_physicalQuantity.unit( );
96
97 return( a_os );
98}

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