Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_URR_probabilityTables.cc
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright 2019, Lawrence Livermore National Security, LLC.
4# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
5# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
6# SPDX-License-Identifier: MIT
7# <<END-copyright>>
8*/
9
10#include "GIDI.hpp"
11
12namespace GIDI {
13
14namespace ACE_URR {
15
16/*! \class ProbabilityTable
17 * Class for the LLNL defined **probabilityTable** node which is not a part of the **GNDS* 2.0 specifications.
18 * This node currently can be found in the **applicationData** node of a **reactionSuite** file with the label
19 * "*LLNL::URR_probability_tables*".
20 */
21
22/* *********************************************************************************************************//**
23 * @param a_construction [in] Used to pass user options to the constructor.
24 * @param a_node [in] The **HAPI::Node** to be parsed.
25 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
26 * @param a_parent [in] The parent GIDI::Suite.
27 ***********************************************************************************************************/
28
29ProbabilityTable::ProbabilityTable( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent ) :
30 Form( a_node, a_setupInfo, FormType::ACE_URR_probabilityTable, a_parent ) {
31
32 for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
33 m_forms.push_back( new IncidentEnergy( a_construction, child, a_setupInfo ) );
34 }
35}
36
37/* *********************************************************************************************************//**
38 ***********************************************************************************************************/
39
41
42 for( auto iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) delete *iter;
43}
44
45/* *********************************************************************************************************//**
46 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
47 *
48 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
49 * @param a_indent [in] The amount to indent *this* node.
50 ***********************************************************************************************************/
51
52void ProbabilityTable::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
53
54 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
55 std::string attributes;
56
57 attributes = a_writeInfo.addAttribute( GIDI_labelChars, label( ) );
58 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
59
60 for( auto iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) (*iter)->toXMLList( a_writeInfo, indent2 );
61
62 a_writeInfo.addNodeEnder( moniker( ) );
63}
64
65/*! \class IncidentEnergy
66 * Class for the LLNL define **incidentEnergy** node which is not a **GNDS* 2.0 specifications. This node currently can be
67 * found in the **applicationData** node of a **reactionSuite** file with the label "*LLNL::ACE_URR_probability_tables*".
68 */
69
70/* *********************************************************************************************************//**
71 * @param a_construction [in] Used to pass user options to the constructor.
72 * @param a_node [in] The **HAPI::Node** to be parsed.
73 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
74 ***********************************************************************************************************/
75
76IncidentEnergy::IncidentEnergy( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo ) :
77 Form( a_node, a_setupInfo, FormType::ACE_URR_probabilityTable ),
78 m_value( a_node.attribute( GIDI_valueChars ).as_double( ) ),
79 m_unit( a_node.attribute_as_string( GIDI_unitChars ) ),
80 m_table( a_construction, a_node.first_child( ), a_setupInfo ) {
81
82}
83
84/* *********************************************************************************************************//**
85 ***********************************************************************************************************/
86
90
91/* *********************************************************************************************************//**
92 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
93 *
94 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
95 * @param a_indent [in] The amount to indent *this* node.
96 ***********************************************************************************************************/
97
98void IncidentEnergy::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
99
100 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
101 std::string attributes;
102
103 attributes = a_writeInfo.addAttribute( GIDI_valueChars, LUPI::Misc::doubleToShortestString( m_value ) );
104 attributes += a_writeInfo.addAttribute( GIDI_unitChars, m_unit );
105 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
106
107 m_table.toXMLList( a_writeInfo, indent2 );
108
109 a_writeInfo.addNodeEnder( moniker( ) );
110}
111
112} // End namespace ACE_URR.
113
114} // End namespace GIDI.
#define GIDI_unitChars
Definition GIDI.hpp:439
#define GIDI_valueChars
Definition GIDI.hpp:445
#define GIDI_labelChars
Definition GIDI.hpp:438
IncidentEnergy(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo)
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent) const
ProbabilityTable(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent) const
std::string const & label() const
Definition GIDI.hpp:658
Form(FormType a_type)
Definition GIDI_form.cc:25
std::string const & moniker() const
Definition GUPI.hpp:102
std::string attribute() const
Definition GUPI.hpp:107
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
bool empty() const
Definition HAPI_Node.cc:150
Node first_child() const
Definition HAPI_Node.cc:82
Definition GIDI.hpp:32
FormType
Definition GIDI.hpp:118
@ ACE_URR_probabilityTable
Definition GIDI.hpp:140
std::string doubleToShortestString(double a_value, int a_significantDigits=15, int a_favorEFormBy=0)
Definition LUPI_misc.cc:349