20static std::size_t startIndexAttribute( HAPI::Node
const &a_node );
37 std::size_t size = a_Xs.size( );
38 std::size_t imin = 0, imid, imax = size - 1;
40 if( a_x < a_Xs[0] )
return( -2 );
41 if( a_x > a_Xs[size-1] )
return( -1 );
43 imid = ( imin + imax ) >> 1;
44 if( imid == imin )
break;
45 if( a_x < a_Xs[imid] ) {
51 return(
static_cast<long>( imin ) );
63void intsToXMLList(
GUPI::WriteInfo &a_writeInfo, std::string
const &a_indent, std::vector<int>
const &a_values, std::string
const &a_attributes ) {
67 std::string intString;
68 std::string sep(
"" );
70 for( std::size_t i1 = 0; i1 < a_values.size( ); ++i1 ) {
72 if( i1 == 0 ) sep = a_writeInfo.
m_sep;
75 a_writeInfo.
m_lines.back( ) += intString;
89 nf_Buffer<double> &a_values) {
108 std::size_t startIndex = startIndexAttribute( a_node );
111 throw Exception(
"parseValuesOfDoubles: Cannot read from HDF5 file as GIDI+ was compiled without HDF5 support." );
151 std::size_t startIndex = startIndexAttribute( a_node );
154 throw Exception(
"parseValuesOfInts: Cannot read from HDF5 file as GIDI+ was compiled without HDF5 support." );
180void doublesToXMLList(
GUPI::WriteInfo &a_writeInfo, std::string
const &a_indent, std::vector<double>
const &a_values, std::size_t a_start,
bool a_newLine, std::string
const &a_valueType ) {
183 std::string indent( a_indent );
184 std::string attributes;
187 std::string sep =
"";
189 if( !a_newLine ) indent =
"";
194 if( valuesPerLine < 1 ) valuesPerLine = 1;
195 int numberOfValuesInLine = 0;
196 for( std::size_t i1 = 0; i1 < a_values.size( ); ++i1 ) {
198 sep = a_writeInfo.
m_sep;
199 ++numberOfValuesInLine;
201 if( numberOfValuesInLine == valuesPerLine ) {
205 a_writeInfo.
m_lines.back( ) += XMLLine;
207 numberOfValuesInLine = 0;
214 if( numberOfValuesInLine > 0 ) {
218 a_writeInfo.
m_lines.back( ) += XMLLine;
220 else if( a_values.size( ) == 0 ) {
254 std::vector<double> ys;
257 switch( a_function1d.
type( ) ) {
262 std::size_t start = 0;
264 for( ; start < data.
size( ); ++start ) {
265 if( data[start] != 0 )
break;
269 for( std::size_t i1 = start; i1 < data.
size( ); ++i1 ) ys1d.
push_back( data[i1] );
273 throw Exception(
"gridded1d2GIDI_Ys1d: unsupported 1d function type " + a_function1d.
label( ) );
290 std::size_t start = 0;
291 for( ; start < a_vector.
size( ); ++start ) {
292 if( a_vector[start] != 0 )
break;
295 std::vector<double> ys;
298 for( std::size_t i1 = start; i1 < a_vector.
size( ); ++i1 ) ys1d.
push_back( a_vector[i1] );
338 std::vector<std::string> vectorOfStrings1;
340 vectorOfStrings1.push_back( a_string );
341 return( vectorOfStrings1 );
353std::vector<std::string>
sortedListOfStrings( std::vector<std::string>
const &a_strings,
bool a_orderIsAscending ) {
355 std::vector<std::string> keys( a_strings );
357 std::sort( keys.begin( ), keys.end( ) );
359 if( a_orderIsAscending )
return( keys );
361 std::vector<std::string> keys2;
363 for( std::vector<std::string>::reverse_iterator iter = keys.rbegin( ); iter != keys.rend( ); ++iter ) keys2.push_back( *iter );
393 std::string xml = a_writeInfo.
nodeStarter(
"", a_nodeName );
394 std::string sep(
"" );
397 for( std::size_t i1 = 0; i1 < a_values.size( ); ++i1 ) {
399 if( i1 == 0 ) sep =
" ";
402 xml += a_writeInfo.
nodeEnder( a_nodeName );
446 if( a_function ==
nullptr )
return;
449 a_function->
toXMLList( a_writeInfo, indent2 );
465 for(
auto iter = a_excludeReactionsSet.begin( ); iter != a_excludeReactionsSet.end( ); ++iter ) {
471 a_excludeReactionsSet = std::move( excludeReactionsSet );
482static std::size_t startIndexAttribute(
HAPI::Node const &a_node ) {
484 std::size_t startIndex = 0;
487 if( attribute !=
"" ) {
494 return( startIndex );
#define GIDI_centerOfMassChars
#define GIDI_startIndexChars
#define GIDI_valueTypeChars
int useSystem_strtod() const
void push_back(double a_y)
void setStart(std::size_t a_start)
HAPI::DataManager * dataManager()
virtual std::size_t numberOfReactions() const =0
ProtareSingle * m_protare
std::vector< double > & data()
void push_back(std::string const &a_line)
std::list< std::string > m_lines
void addNodeEnder(std::string const &a_moniker)
std::string incrementalIndent(std::string const &indent)
void addNodeStarter(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
std::string nodeEnder(std::string const &a_moniker)
std::string nodeStarter(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
std::string addAttribute(std::string const &a_name, std::string const &a_value) const
virtual void getInts(nf_Buffer< int > &result, size_t startIndex, size_t endIndex)=0
virtual void getDoubles(nf_Buffer< double > &result, size_t startIndex, size_t endIndex)=0
void getDoubles(nf_Buffer< double > &buffer)
void getInts(nf_Buffer< int > &buffer)
long attribute_as_long(const char *a_name) const
std::string attribute_as_string(const char *a_name) const
void parseValuesOfDoubles(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buffer< double > &a_vector)
std::string LLNL_gidToLabel(int a_gid)
void doublesToXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector< double > const &a_values, std::size_t a_start=0, bool a_newLine=true, std::string const &a_valueType="")
std::string LLNL_fidToLabel(int a_fid)
void intsToXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector< int > const &a_values, std::string const &a_attributes)
void parseValuesOfInts(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, std::vector< int > &a_vector)
void excludeReactionsSetAdjust(ExcludeReactionsSet &a_excludeReactionsSet, Protare const &a_protare)
Functions::Ys1d gridded1d2GIDI_Ys1d(Functions::Function1dForm const &a_function1d)
Functions::Ys1d vector2GIDI_Ys1d(Axes const &a_axes, Vector const &a_vector)
std::string frameToString(Frame a_frame)
std::string nodeWithValuesToDoubles(GUPI::WriteInfo &a_writeInfo, std::string const &a_nodeName, std::vector< double > const &a_values)
std::vector< std::string > sortedListOfStrings(std::vector< std::string > const &a_strings, bool a_orderIsAscending=true)
std::string size_t_ToString(std::size_t a_value)
std::set< std::size_t > ExcludeReactionsSet
void energy2dToXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_moniker, std::string const &a_indent, Functions::Function1dForm *a_function)
long binarySearchVector(double a_x, std::vector< double > const &a_Xs)
Frame parseFrame(HAPI::Node const &a_node, SetupInfo &a_setupInfo, std::string const &a_name)
std::string intToString(int a_value)
std::vector< std::string > vectorOfStrings(std::string const &a_string)
std::string doubleToShortestString(double a_value, int a_significantDigits=15, int a_favorEFormBy=0)
std::string argumentsToString(char const *a_format,...)
@ ptwXY_interpolationFlat
@ ptwXY_interpolationLinLin