Hipace
Namespaces | Functions
Parser.H File Reference
#include "Constants.H"
#include <AMReX_ParmParse.H>
#include <AMReX_Parser.H>
#include <AMReX_RealVect.H>
#include <AMReX_IntVect.H>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <limits>
#include <vector>
#include <set>
#include <string>
#include <sstream>

Go to the source code of this file.

Namespaces

 Parser
 

Functions

template<class T >
bool queryWithParser (const amrex::ParmParse &pp, char const *const str, T &val)
 return if input file contains the expression, if so it is parsed into val More...
 
void Parser::addConstantsToParser ()
 add Physical constants to Parser constants More...
 
template<class T >
void Parser::replaceWithParser (amrex::ParmParse &pp, char const *const str)
 replace ParmParse input with a Parsed version More...
 
template<class T >
void Parser::replaceArrWithParser (amrex::ParmParse &pp, char const *const str)
 array version of replaceWithParser More...
 
void Parser::replaceAmrexParamsWithParser ()
 replace AMReX input parameters with Parsed version More...
 
void Parser::setDefaultParams ()
 set default ParmParse parameters before AMReX is initialized More...
 
int Parser::safeCastToInt (const double x, const std::string &real_name)
 return valid int, asserts if inf or NaN More...
 
amrex::Long Parser::safeCastToLong (const double x, const std::string &real_name)
 return valid Long, asserts if inf or NaN More...
 
void Parser::initParser (amrex::Parser &parser, amrex::Vector< std::string > const &varnames)
 init Parser ready to compile More...
 
void Parser::fillWithParser (std::string const &str, double &val)
 fill second argument val with a value obtained through Parsing str for std::string: val is same as str More...
 
void Parser::fillWithParser (std::string const &str, float &val)
 
void Parser::fillWithParser (std::string const &str, int &val)
 
void Parser::fillWithParser (std::string const &str, amrex::Long &val)
 
void Parser::fillWithParser (std::string const &str, bool &val)
 
void Parser::fillWithParser (std::string const &str, std::string &val, bool do_escape_backtransform=true)
 
template<class T >
void Parser::fillWithParserArr (std::vector< std::string > const &str_arr, T &val)
 fill second argument val of array type with a value obtained through Parsing str_arr if val is just a single value, str_arr is reduced to a single string with spaces as separators More...
 
template<class T >
void Parser::fillWithParserArr (std::vector< std::string > const &str_arr, std::vector< T > &val_arr)
 
template<class T >
void Parser::fillWithParserArr (std::vector< std::string > const &str_arr, amrex::Vector< T > &val_arr)
 
template<class T , std::size_t size>
void Parser::fillWithParserArr (std::vector< std::string > const &str_arr, std::array< T, size > &val_arr)
 
void Parser::fillWithParserArr (std::vector< std::string > const &str_arr, amrex::RealVect &val_arr)
 
void Parser::fillWithParserArr (std::vector< std::string > const &str_arr, amrex::IntVect &val_arr)
 
template<class T >
void getWithParser (const amrex::ParmParse &pp, char const *const str, T &val)
 fill val with the evaluated expression from the input file More...
 
template<class T >
bool queryWithParserAlt (const amrex::ParmParse &pp, char const *const str, T &val, const amrex::ParmParse &pp_alt)
 return if input file contains the expression, if so it is parsed into val. The input is searched in pp first, if it is not found pp_alt is searched More...
 
template<class T >
void getWithParserAlt (const amrex::ParmParse &pp, char const *const str, T &val, const amrex::ParmParse &pp_alt)
 fill val with the evaluated expression from the input file The input is searched in pp first, if it is not found pp_alt is searched More...
 
template<int N>
auto makeFunctionWithParser (std::string const &func_str, amrex::Parser &parser, amrex::Vector< std::string > const &varnames)
 return function object for Host and Device from the input file More...
 

Function Documentation

◆ getWithParser()

template<class T >
void getWithParser ( const amrex::ParmParse pp,
char const *const  str,
T &  val 
)
inline

fill val with the evaluated expression from the input file

Parameters
[in]ppParmParse that is searched for the expression
[in]strname of expression
[out]valvalue to be filled, see fillWithParserArr and fillWithParser for supported types

◆ getWithParserAlt()

template<class T >
void getWithParserAlt ( const amrex::ParmParse pp,
char const *const  str,
T &  val,
const amrex::ParmParse pp_alt 
)
inline

fill val with the evaluated expression from the input file The input is searched in pp first, if it is not found pp_alt is searched

Parameters
[in]ppParmParse that is first searched for the expression
[in]strname of expression
[out]valvalue to be filled, see fillWithParserArr and fillWithParser for supported types
[in]pp_altAlternative ParmParse that is searched for the expression with lower priority

◆ makeFunctionWithParser()

template<int N>
auto makeFunctionWithParser ( std::string const &  func_str,
amrex::Parser parser,
amrex::Vector< std::string > const &  varnames 
)
inline

return function object for Host and Device from the input file

Parameters
[in]func_strstring that gets Parsed to a function
[out]parserParser which owns the data of the returned function
[in]varnamesnames of the N arguments used in the parsed function

◆ queryWithParser()

template<class T >
bool queryWithParser ( const amrex::ParmParse pp,
char const *const  str,
T &  val 
)
inline

return if input file contains the expression, if so it is parsed into val

Parameters
[in]ppParmParse that is searched for the expression
[in]strname of expression
[out]valvalue to be filled, see fillWithParserArr and fillWithParser for supported types

◆ queryWithParserAlt()

template<class T >
bool queryWithParserAlt ( const amrex::ParmParse pp,
char const *const  str,
T &  val,
const amrex::ParmParse pp_alt 
)
inline

return if input file contains the expression, if so it is parsed into val. The input is searched in pp first, if it is not found pp_alt is searched

Parameters
[in]ppParmParse that is first searched for the expression
[in]strname of expression
[out]valvalue to be filled, see fillWithParserArr and fillWithParser for supported types
[in]pp_altAlternative ParmParse that is searched for the expression with lower priority