9 #ifndef WARPX_UTILS_PARSER_PARSERUTILS_H_ 10 #define WARPX_UTILS_PARSER_PARSERUTILS_H_ 19 #include <type_traits> 54 std::string
const& parse_function,
68 std::string query_string,
69 std::string& stored_string);
117 template <
typename T>
122 int is_specified = a_pp.
query(str, tmp_str);
136 val =
static_cast<T
>(
parser.compileHost<0>()());
144 template <
typename T>
148 std::vector<std::string> tmp_str_arr;
149 int is_specified = a_pp.
queryarr(str, tmp_str_arr);
153 int const n =
static_cast<int>(tmp_str_arr.size());
155 for (
int i=0 ;
i <
n ;
i++) {
161 val[
i] =
static_cast<T
>(
parser.compileHost<0>()());
185 template <
typename T>
187 const int start_ix,
const int num_val)
190 std::vector<std::string> tmp_str_arr;
191 int is_specified = a_pp.
queryarr(str, tmp_str_arr, start_ix, num_val);
195 int const n =
static_cast<int>(tmp_str_arr.size());
197 for (
int i=0 ;
i <
n ;
i++) {
203 val[
i] =
static_cast<T
>(
parser.compileHost<0>()());
223 template <
typename T>
235 val =
static_cast<T
>(
parser.compileHost<0>()());
239 template <
typename T>
243 std::vector<std::string> tmp_str_arr;
244 a_pp.
getarr(str, tmp_str_arr);
246 int const n =
static_cast<int>(tmp_str_arr.size());
248 for (
int i=0 ;
i <
n ;
i++) {
254 val[
i] =
static_cast<T
>(
parser.compileHost<0>()());
275 template <
typename T>
277 const int start_ix,
const int num_val)
280 std::vector<std::string> tmp_str_arr;
281 a_pp.
getarr(str, tmp_str_arr, start_ix, num_val);
283 int const n =
static_cast<int>(tmp_str_arr.size());
285 for (
int i=0 ;
i <
n ;
i++) {
291 val[
i] =
static_cast<T
>(
parser.compileHost<0>()());
298 #endif // WARPX_UTILS_PARSER_PARSERUTILS_H_ int query(const char *name, bool &ref, int ival=FIRST) const
str
Definition: run_alltests_1node.py:72
parser
Definition: run_alltests.py:111
void getArrWithParser(const amrex::ParmParse &a_pp, char const *const str, std::vector< T > &val)
Definition: ParserUtils.H:240
ParserExecutor< N > compile() const
int queryarr(const char *name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const
int parseStringtoInt(const std::string &str, const std::string &name)
Definition: ParserUtils.cpp:160
long safeCastToLong(amrex::Real x, const std::string &real_name)
Do a safe cast of a real to a long This ensures that the float value is within the range of longs and...
Definition: ParserUtils.cpp:73
int queryWithParser(const amrex::ParmParse &a_pp, char const *const str, T &val)
Definition: ParserUtils.H:118
int queryArrWithParser(const amrex::ParmParse &a_pp, char const *const str, std::vector< T > &val)
Definition: ParserUtils.H:145
void Store_parserString(const amrex::ParmParse &pp, std::string query_string, std::string &stored_string)
Parse a string (typically a mathematical expression) from the input file and store it into a variable...
Definition: ParserUtils.cpp:21
amrex::Parser makeParser(std::string const &parse_function, amrex::Vector< std::string > const &varnames)
Initialize an amrex::Parser object from a string containing a math expression.
Definition: ParserUtils.cpp:78
int safeCastToInt(amrex::Real x, const std::string &real_name)
Do a safe cast of a real to an int This ensures that the float value is within the range of ints and ...
Definition: ParserUtils.cpp:68
int n
Definition: run_libensemble_on_warpx.py:67
i
Definition: check_interp_points_and_weights.py:174
void getWithParser(const amrex::ParmParse &a_pp, char const *const str, T &val)
Definition: ParserUtils.H:224
void getarr(const char *name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const
string name
Definition: Stencil.py:485
Definition: IntervalsParser.H:16
double parseStringtoDouble(const std::string &str)
Definition: ParserUtils.cpp:150
value
Definition: updateAMReX.py:141
amrex::ParserExecutor< N > compileParser(amrex::Parser const *parser)
Definition: ParserUtils.H:96