Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_resonancesWithBackground1d.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#include <HAPI.hpp>
12
13namespace GIDI {
14
15namespace Functions {
16
17static ResonanceBackgroundRegion1d *resonanceBackground1dParse( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent );
18
19/*! \class ResonancesWithBackground1d
20 * Class for the GNDS <**resonancesWithBackground**> node.
21 */
22
23/* *********************************************************************************************************//**
24 * @param a_construction [in] Used to pass user options to the constructor.
25 * @param a_node [in] The **HAPI::Node** to be parsed.
26 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
27 * @param a_parent [in] The parent GIDI::Suite.
28 ***********************************************************************************************************/
29
31 SetupInfo &a_setupInfo, Suite *a_parent ) :
32 Function1dForm( a_construction, a_node, a_setupInfo, FormType::resonancesWithBackground1d, a_parent ),
33 m_resonances( a_node.child( GIDI_resonancesChars ).attribute_as_string( GIDI_hrefChars ) ),
34 m_background( a_construction, a_node.child( GIDI_resonanceBackground1dChars ), a_setupInfo, nullptr ) {
35
36 for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
37 std::string name( child.name( ) );
38
39 if( name == "resonanceRegion" ) {
40 m_resonances = a_node.attribute_as_string( "href" ); }
41 else {
42 /*
43 if( m_background != NULL ) {
44 throw new std::runtime_error("Oops");
45 }
46 m_background = data1dParse( child, NULL );
47 */
48 }
49 }
50}
51
52/* *********************************************************************************************************//**
53 ***********************************************************************************************************/
54
58
59/* *********************************************************************************************************//**
60 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
61 *
62 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
63 * @param a_indent [in] The amount to indent *this* node.
64 * @param a_embedded [in] If *true*, *this* function is embedded in a higher dimensional function.
65 * @param a_inRegions [in] If *true*, *this* is in a Regions2d container.
66 ***********************************************************************************************************/
67
68void ResonancesWithBackground1d::toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, LUPI_maybeUnused bool a_embedded, LUPI_maybeUnused bool a_inRegions ) const {
69
70 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
71 std::string attributes;
72
73 a_writeInfo.addNodeStarter( a_indent, moniker( ) );
74
75 attributes += a_writeInfo.addAttribute( GIDI_hrefChars, m_resonances );
76 a_writeInfo.addNodeStarter( indent2, GIDI_resonancesChars, attributes );
77
78 m_background.toXMLList_func( a_writeInfo, indent2, false, false );
79
80 a_writeInfo.addNodeEnder( moniker( ) );
81}
82
83/*! \class ResonanceBackground1d
84 * Class for the GNDS <**background**> node.
85 */
86
87/* *********************************************************************************************************//**
88 * @param a_construction [in] Used to pass user options to the constructor.
89 * @param a_node [in] The **HAPI::Node** to be parsed.
90 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
91 * @param a_parent [in] The parent GIDI::Suite.
92 ***********************************************************************************************************/
93
95 Suite *a_parent ) :
96 Function1dForm( a_construction, a_node, a_setupInfo, FormType::resonanceBackground1d, a_parent ),
97 m_resolvedRegion( resonanceBackground1dParse( a_construction, a_node.child( GIDI_resolvedRegionChars ), a_setupInfo, nullptr ) ),
98 m_unresolvedRegion( resonanceBackground1dParse( a_construction, a_node.child( GIDI_unresolvedRegionChars ), a_setupInfo, nullptr ) ),
99 m_fastRegion( resonanceBackground1dParse( a_construction, a_node.child( GIDI_fastRegionChars ), a_setupInfo, nullptr ) ) {
100
101}
102
103/* *********************************************************************************************************//**
104 ***********************************************************************************************************/
105
107
108 delete m_resolvedRegion;
109 delete m_unresolvedRegion;
110 delete m_fastRegion;
111}
112
113/* *********************************************************************************************************//**
114 * Returns the domain minimum for the instance.
115 *
116 * @return The domain minimum for the instance.
117 ***********************************************************************************************************/
118
120
121 throw Exception( "ResonanceBackground1d::domainMin: not implemented" );
122}
123
124/* *********************************************************************************************************//**
125 * Returns the domain maximum for the instance.
126 *
127 * @return The domain maximum for the instance.
128 ***********************************************************************************************************/
129
131
132 throw Exception( "ResonanceBackground1d::domainMax: not implemented" );
133}
134
135/* *********************************************************************************************************//**
136 * The value of *y(x1)* at the point *a_x1*.
137 * Currently not implemented.
138 *
139 * @param a_x1 [in] The point for the *x1* axis.
140 * @return The value of the function at the point *a_x1*.
141 ***********************************************************************************************************/
142
144
145 throw Exception( "ResonanceBackground1d::evaluate: not implemented" );
146}
147
148/* *********************************************************************************************************//**
149 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
150 *
151 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
152 * @param a_indent [in] The amount to indent *this* node.
153 * @param a_embedded [in] If *true*, *this* function is embedded in a higher dimensional function.
154 * @param a_inRegions [in] If *true*, *this* is in a Regions2d container.
155 ***********************************************************************************************************/
156
157void ResonanceBackground1d::toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, LUPI_maybeUnused bool a_embedded, LUPI_maybeUnused bool a_inRegions ) const {
158
159 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
160
161 a_writeInfo.addNodeStarter( a_indent, moniker( ) );
162
163 m_resolvedRegion->toXMLList_func( a_writeInfo, indent2, false, false );
164 m_unresolvedRegion->toXMLList_func( a_writeInfo, indent2, false, false );
165 m_fastRegion->toXMLList_func( a_writeInfo, indent2, false, false );
166
167 a_writeInfo.addNodeEnder( moniker( ) );
168}
169
170/*! \class ResonanceBackgroundRegion1d
171 * Class for the GNDS <**resolvedRegion**> or GNDS <**fastRegion**> node.
172 */
173
174/* *********************************************************************************************************//**
175 * @param a_construction [in] Used to pass user options to the constructor.
176 * @param a_node [in] The **HAPI::Node** to be parsed.
177 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
178 * @param a_parent [in] The parent GIDI::Suite.
179 ***********************************************************************************************************/
180
182 SetupInfo &a_setupInfo, Suite *a_parent ) :
183 Function1dForm( a_construction, a_node, a_setupInfo, FormType::resonanceBackgroundRegion1d, a_parent ),
184 m_function1d( data1dParse( a_construction, a_node.first_child( ), a_setupInfo, nullptr ) ) {
185
186}
187
188/* *********************************************************************************************************//**
189 ***********************************************************************************************************/
190
195
196/* *********************************************************************************************************//**
197 * Returns the domain minimum for the instance.
198 *
199 * @return The domain minimum for the instance.
200 ***********************************************************************************************************/
201
203
204 throw Exception( "ResonanceBackgroundRegion1d::domainMin: not implemented" );
205}
206
207/* *********************************************************************************************************//**
208 * Returns the domain maximum for the instance.
209 *
210 * @return The domain maximum for the instance.
211 ***********************************************************************************************************/
212
214
215 throw Exception( "ResonanceBackgroundRegion1d::domainMax: not implemented" );
216}
217
218/* *********************************************************************************************************//**
219 * The value of *y(x1)* at the point *a_x1*.
220 * Currently not implemented.
221 *
222 * @param a_x1 [in] The point for the *x1* axis.
223 * @return The value of the function at the point *a_x1*.
224 ***********************************************************************************************************/
225
227
228 throw Exception( "ResonanceBackgroundRegion1d::evaluate: not implemented" );
229}
230
231/* *********************************************************************************************************//**
232 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
233 *
234 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
235 * @param a_indent [in] The amount to indent *this* node.
236 * @param a_embedded [in] If *true*, *this* function is embedded in a higher dimensional function.
237 * @param a_inRegions [in] If *true*, *this* is in a Regions2d container.
238 ***********************************************************************************************************/
239
240void ResonanceBackgroundRegion1d::toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, LUPI_maybeUnused bool a_embedded, LUPI_maybeUnused bool a_inRegions ) const {
241
242 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
243
244 a_writeInfo.addNodeStarter( a_indent, moniker( ) );
245
246 if( m_function1d != nullptr ) m_function1d->toXMLList_func( a_writeInfo, indent2, false, false );
247
248 a_writeInfo.addNodeEnder( moniker( ) );
249}
250
251/* *********************************************************************************************************//**
252 * Function that parses a node one-d function node. Called from a Suite::parse instance.
253 *
254 * @param a_construction [in] Used to pass user options to the constructor.
255 * @param a_node [in] The **HAPI::Node** to be parsed.
256 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
257 * @param a_parent [in] The parent GIDI::Suite that the returned Form will be added to.
258 *
259 * @return The parsed and constructed resonanceBackground region instance.
260 ***********************************************************************************************************/
261
262static ResonanceBackgroundRegion1d *resonanceBackground1dParse( Construction::Settings const &a_construction, HAPI::Node const &a_node,
263 SetupInfo &a_setupInfo, Suite *a_parent ) {
264
265 std::string name( a_node.name( ) );
266
267 if( name == "" ) return( nullptr );
268
269 return( new ResonanceBackgroundRegion1d( a_construction, a_node, a_setupInfo, a_parent ) );
270}
271
272} // End namespace Functions.
273
274} // End namespace GIDI.
#define GIDI_resonanceBackground1dChars
Definition GIDI.hpp:370
#define GIDI_hrefChars
Definition GIDI.hpp:440
#define GIDI_resolvedRegionChars
Definition GIDI.hpp:371
#define GIDI_fastRegionChars
Definition GIDI.hpp:373
#define GIDI_unresolvedRegionChars
Definition GIDI.hpp:372
#define GIDI_resonancesChars
Definition GIDI.hpp:369
#define LUPI_maybeUnused
Function1dForm(std::string const &a_moniker, FormType a_type, ptwXY_interpolation a_interpolation, int a_index, double a_outerDomainValue)
Definition GIDI_form.cc:348
ResonanceBackground1d(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
void toXMLList_func(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions) const
void toXMLList_func(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions) const
ResonanceBackgroundRegion1d(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
ResonancesWithBackground1d(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent)
void toXMLList_func(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions) const
std::string const & moniker() const
Definition GUPI.hpp:102
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
std::string name() const
Definition HAPI_Node.cc:136
bool empty() const
Definition HAPI_Node.cc:150
Node first_child() const
Definition HAPI_Node.cc:82
Definition GIDI.hpp:32
Functions::Function1dForm * data1dParse(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *parent)
FormType
Definition GIDI.hpp:118
@ resonancesWithBackground1d
Definition GIDI.hpp:124
@ resonanceBackgroundRegion1d
Definition GIDI.hpp:124
@ resonanceBackground1d
Definition GIDI.hpp:124