|
| ParmParse (std::string prefix=std::string(), std::string parser_prefix=std::string()) |
| Construct an additional ParmParse object sharing the same internal table as any other such objects in existence. If prefix is specified, load this string as the code prefix for this particular ParmParse object. If parser_prefix is specified, it will be used as prefixed in math expression evaluations. More...
|
|
bool | contains (const char *name) const |
| Returns true if name is in table. More...
|
|
int | countval (const char *name, int n=LAST) const |
| Returns the number of values associated with nth occurrence of name (prepended with the prefix) in the table. n == -1 implies the last occurrence. More...
|
|
int | countname (const std::string &name) const |
| Returns the number of times the given name (prepended with prefix) appears in the table. More...
|
|
void | getkth (const char *name, int k, bool &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to a bool and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to an bool, an error message is output and the program halts. Note that ival == 0 is the first value in the list. ParmParse converte the value 'true', and non-zero integers or floats to bool(true), and bool(false) for 'false' or zero integer or float values. More...
|
|
void | get (const char *name, bool &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, bool &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, bool &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, bool val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, int &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to an int and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list. More...
|
|
void | get (const char *name, int &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, int &ref, int ival=FIRST) const |
|
int | query (const char *name, int &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, int val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, long &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to an int and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list. More...
|
|
void | get (const char *name, long &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, long &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, long &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, long val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, long long &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to an int and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list. More...
|
|
void | get (const char *name, long long &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, long long &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, long long &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, long long val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, float &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to a float and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a float, an error message is output and the program halts. Note that ival == 0 is the first value in the list. More...
|
|
void | get (const char *name, float &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, float &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, float &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, float val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, double &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to a double and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a double, an error message is output and the program halts. Note that ival = 0 is the first value in the list. More...
|
|
void | get (const char *name, double &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, double &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, double &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, double val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, std::string &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to a std::string and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a std::string, an error message is output and the program halts. Note that ival = 0 is the first value in the list. More...
|
|
void | get (const char *name, std::string &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, std::string &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, std::string &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, const std::string &val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, IntVect &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to an IntVect and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a IntVect, an error message is output and the program halts. Note that ival = 0 is the first value in the list. More...
|
|
void | get (const char *name, IntVect &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, IntVect &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, IntVect &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, const IntVect &val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getkth (const char *name, int k, Box &ref, int ival=FIRST) const |
| Get the ival'th value of kth occurrence of the requested name. If successful, the value is converted to a Box and stored in reference ref. If the kth occurrence does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a Box, an error message is output and the program halts. Note that ival = 0 is the first value in the list. More...
|
|
void | get (const char *name, Box &ref, int ival=FIRST) const |
| Same as getkth() but searches for the last occurrence of name. More...
|
|
int | querykth (const char *name, int k, Box &ref, int ival=FIRST) const |
| Similar to getkth() but returns 0 if there is no kth occurrence of name. If successful, it returns 1 and stores the value in ref. If the kth occurrence exists, but ival'th value of that occurrence does not, or if there is a type mismatch, then the program signals an error and halts. More...
|
|
int | query (const char *name, Box &ref, int ival=FIRST) const |
| Same as querykth() but searches for the last occurrence of name. More...
|
|
void | add (const char *name, const Box &val) |
| Add a key 'name'with value 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<int> of num_val values from kth occurrence of given name. If successful, the values are converted to an int and stored in the std::vector<int> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<int>[0], std::vector<int>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to an int, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name. More...
|
|
void | addarr (const char *name, const std::vector< int > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<long> of num_val values from kth occurrence of given name. If successful, the values are converted to a long and stored in the std::vector<long> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<long>[0], std::vector<long>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to a long, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name. More...
|
|
void | addarr (const char *name, const std::vector< long > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< long long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<long long> of num_val values from kth occurrence of given name. If successful, the values are converted to a long long and stored in the std::vector<long long> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<long long>[0], std::vector<long long>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to a long long, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< long long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< long long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< long long > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name. More...
|
|
void | addarr (const char *name, const std::vector< long long > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< float > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<float> of num_val values from kth occurrence of given name. If successful, the values are converted to a float and stored in the std::vector<float> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<float>[0], std::vector<float>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to a float, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< float > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< float > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< float > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name. More...
|
|
void | addarr (const char *name, const std::vector< float > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< double > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<double> of num_val values from kth occurrence of given name. If successful, the values are converted to a double and stored in the std::vector<double> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<double>[0], std::vector<double>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to a double, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< double > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< double > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< double > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name. More...
|
|
void | addarr (const char *name, const std::vector< double > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< std::string > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<std::string> of num_val values from kth occurrence of given name. If successful, the values are converted to an std::string and stored in the std::vector<std::string> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<std::string>[0], std::vector<std::string>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to an std::string, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< std::string > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< std::string > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< std::string > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name.2. More...
|
|
void | addarr (const char *name, const std::vector< std::string > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< IntVect > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<IntVect> of num_val values from kth occurrence of given name. If successful, the values are converted to an IntVect and stored in the std::vector<IntVect> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<IntVect>[0], std::vector<IntVect>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to an IntVect, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< IntVect > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< IntVect > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< IntVect > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name.2. More...
|
|
void | addarr (const char *name, const std::vector< IntVect > &ref) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
void | getktharr (const char *name, int k, std::vector< Box > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Gets an std::vector<Box> of num_val values from kth occurrence of given name. If successful, the values are converted to an Box and stored in the std::vector<Box> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<Box>[0], std::vector<Box>[1] holds start_ix+1, etc. If the kth occurrence does not exist or there are fewer than start_ix + num_val values associated with the kth occurrence, or if some of the values cannot be converted to an Box, an error message is reported and the program halts. More...
|
|
void | getarr (const char *name, std::vector< Box > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as getktharr() but searches for last occurrence of name. More...
|
|
int | queryktharr (const char *name, int k, std::vector< Box > &ref, int start_ix=FIRST, int num_val=ALL) const |
| queryktharr() is to querykth() as getktharr() is to getkth(). More...
|
|
int | queryarr (const char *name, std::vector< Box > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Same as queryktharr() but searches for last occurrence of name.2. More...
|
|
void | addarr (const char *name, const std::vector< Box > &refd) |
| Add a key 'name' with vector of values 'ref' to the end of the PP table. More...
|
|
int | queryarr (const char *name, IntVect &ref) const |
|
void | getarr (const char *name, IntVect &ref) const |
|
int | queryarr (const char *name, RealVect &ref) const |
| Query RealVect from array. More...
|
|
void | getarr (const char *name, RealVect &ref) const |
| Get RealVect from array. More...
|
|
template<typename T , std::size_t N> |
void | get (const char *name, std::array< T, N > &ref) const |
|
template<typename T , std::size_t N> |
int | query (const char *name, std::array< T, N > &ref) const |
|
template<typename T , std::enable_if_t<!IsStdVector< T >::value, int > = 0> |
int | queryAdd (const char *name, T &ref) |
| If name is found, the value in the ParmParse database will be stored in the ref argument. If not, the value in ref will be added to the ParmParse database. The return value indicates if it existed previously. More...
|
|
int | queryAdd (const char *name, std::string &ref) |
|
template<typename T > |
int | queryAdd (const char *name, std::vector< T > &ref) |
| If name is found, the value in the ParmParse database will be stored in the ref argument. If not, the value in ref will be added to the ParmParse database. The return value indicates if it existed previously. More...
|
|
template<typename T > |
int | queryAdd (const char *name, std::vector< T > &ref, int num_val) |
| If name is found, the value in the ParmParse database will be stored in the ref argument. If not, the value in ref will be added to the ParmParse database. The return value indicates if it existed previously. More...
|
|
template<typename T , std::size_t N> |
int | queryAdd (const char *name, std::array< T, N > &ref) |
| If name is found, the value in the ParmParse database will be stored in the ref argument. If not, the value in ref will be added to the ParmParse database. The return value indicates if it existed previously. More...
|
|
int | queryWithParser (const char *name, int &ref) const |
| Query with Parser. If name is found, this uses amrex::Parser to parse the entire list of empty space separated values as a single scalar. The return value indicates whether it's found. Note that queryWithParser will be used recursively for unresolved symbols. More...
|
|
int | queryWithParser (const char *name, long &ref) const |
|
int | queryWithParser (const char *name, long long &ref) const |
|
int | queryWithParser (const char *name, float &ref) const |
|
int | queryWithParser (const char *name, double &ref) const |
|
int | queryarrWithParser (const char *name, int nvals, int *ref) const |
| Query with Parser. The return value indicates whether it's found. Note that queryWithParser will be used for unresolved symbols. If the number of elements in the input does not equal to nvals , it's a runtime error. More...
|
|
int | queryarrWithParser (const char *name, int nvals, long *ref) const |
|
int | queryarrWithParser (const char *name, int nvals, long long *ref) const |
|
int | queryarrWithParser (const char *name, int nvals, float *ref) const |
|
int | queryarrWithParser (const char *name, int nvals, double *ref) const |
|
template<typename T , std::enable_if_t< std::is_same_v< T, int >||std::is_same_v< T, long >||std::is_same_v< T, long long >||std::is_same_v< T, float >||std::is_same_v< T, double >, int > = 0> |
int | queryarrWithParser (const char *name, int nvals, std::vector< T > &ref) const |
|
template<typename T , std::enable_if_t< std::is_same_v< T, int >||std::is_same_v< T, long >||std::is_same_v< T, long long >||std::is_same_v< T, float >||std::is_same_v< T, double >, int > = 0> |
int | queryAddWithParser (const char *name, T &ref) const |
| Query with Parser. If name is found, this uses amrex::Parser to parse the entire list of empty space separated values as a single scalar. If not, the value in ref will be added to the ParmParse database. The return value indicates whether it's found. More...
|
|
template<typename T , std::enable_if_t< std::is_same_v< T, int >||std::is_same_v< T, long >||std::is_same_v< T, long long >||std::is_same_v< T, float >||std::is_same_v< T, double >, int > = 0> |
void | getWithParser (const char *name, T &ref) const |
| Get with Parser. If name is found, this uses amrex::Parser to parse the entire list of empty space separated values as a single scalar. If not, it's a runtime error. More...
|
|
template<typename T , std::enable_if_t< std::is_same_v< T, int >||std::is_same_v< T, long >||std::is_same_v< T, long long >||std::is_same_v< T, float >||std::is_same_v< T, double >, int > = 0> |
void | getarrWithParser (const char *name, int nvals, T *ref) const |
| Get with Parser. If name is not found, it's a runtime error. If the number of elements does not equal to nvals , it's also a runtime error. More...
|
|
template<typename T , std::enable_if_t< std::is_same_v< T, int >||std::is_same_v< T, long >||std::is_same_v< T, long long >||std::is_same_v< T, float >||std::is_same_v< T, double >, int > = 0> |
void | getarrWithParser (const char *name, int nvals, std::vector< T > &ref) const |
| Get with Parser. If name is not found, it's a runtime error. If the number of elements does not equal to nvals , it's also a runtime error. More...
|
|
template<typename T , std::enable_if_t< std::is_same_v< T, int >||std::is_same_v< T, long >||std::is_same_v< T, long long >||std::is_same_v< T, float >||std::is_same_v< T, double >, int > = 0> |
T | eval (std::string const &expr) const |
|
template<typename T > |
int | query (const char *new_name, const char *old_name, T &ref) |
|
template<typename T > |
void | get (const char *new_name, const char *old_name, T &ref) |
| Get using two names. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
int | query (const char *name, T &ref, int ival=FIRST) const |
| . Query enum value using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
void | get (const char *name, T &ref, int ival=FIRST) const |
| . Get enum value using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
int | queryarr (const char *name, std::vector< T > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Query an array of enum values using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
void | getarr (const char *name, std::vector< T > &ref, int start_ix=FIRST, int num_val=ALL) const |
| Get an array of enum values using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
int | query_enum_case_insensitive (const char *name, T &ref, int ival=FIRST) const |
| . Query enum value using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
void | get_enum_case_insensitive (const char *name, T &ref, int ival=FIRST) const |
| . Get enum value using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
int | query_enum_sloppy (const char *name, T &ref, std::string_view const &ignores, int ival=FIRST) const |
| . Query enum value using given name. More...
|
|
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0> |
void | get_enum_sloppy (const char *name, T &ref, std::string_view const &ignores, int ival=FIRST) const |
| . Get enum value using given name. More...
|
|
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0> |
int | queryAsDouble (const char *name, T &ref) const |
| Query T with Parser, but treat the number as double precision during parsing. More...
|
|
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0> |
int | queryarrAsDouble (const char *name, int nvals, T *ref) const |
| Query T array with Parser, but treat the number as double precision during parsing. More...
|
|
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0> |
void | getAsDouble (const char *name, T &ref) const |
| Get T with Parser, but treat the number as double precision during parsing. More...
|
|
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0> |
void | getarrAsDouble (const char *name, int nvals, T *ref) const |
| Get T array with Parser, but treat the number as double precision during parsing. More...
|
|
int | remove (const char *name) |
| Remove given name from the table. More...
|
|
Parser | makeParser (std::string const &func, Vector< std::string > const &vars) const |
|
IParser | makeIParser (std::string const &func, Vector< std::string > const &vars) const |
|
const Table & | table () const |
|
std::string | prefixedName (const std::string_view &str) const |
|
Parse Parameters From Command Line and Input Files.
The ParmParse class is used to interpret parameters passed in to a program from the command line and an arbitrary collection of input files. The parameters are stored in static table that can be queried by any object of type ParmParse. A parameter is a "definition". A definition is of the form "\<name\> = \<value\>\<value\>...\<value\>". It is stored in the table as a name, value-list pair.
In the following example, niter is a definition with the single integer value 10; name is a definition with the string value "big
code" and dx is a definition with the two floating point values 0.5 and 0.75 and iv is an IntVect(5,4)
prog niter = 10 name = "big code" dx = 0.5 0.75 iv=(5,4)
The ParmParse class has two constructors. The first is responsible for building the table and is usually called by the main routine of an application. It has arguments for the command line argc and argv parameters, as well as an optional filename argument for reading definitions from an input file. The table is built by reading the input file first (if it exists) with the command line arguments added to the end of the table. The order of a definition in the table is significant, so command line parameters can be used to override definitions in the input file. A definition of the explicit form: FILE=<filename> is not added to the table but is a directive to include the named file at that point in the table.
The second constructor is generally used by other classes in the code. It permits access to the table via a large collection of query functions. Both constructors have an optional prefix argument that narrows the search to entries in the table with the same prefix. For example, let PlanR be a ParmParse object with code prefix "ope". PlanR.get("val",v) will look for an entry in the parameter list of the form: ope.val==<value>, and will reject all entries not starting with the correct code prefix.
The query functions search the table for definition names that match a given string (and prefix) and return values from the corresponding value list. The values can be returned as ints, Vector<int>s, floats, Vector<float>s, doubles, Vector<double>s, std::strings, or Vector<aSring>s. All values in the table are stored as std::string objects, but if an int, float, or double is requested, the translation is done automatically. In the previous example, the value of niter could be returned as either an std::string, an int, a double, or a float. The values of dx can be returned as std::strings, floats, or doubles, but the value of name can be returned only as an std::string.
Comments in an input file include all text from a # character to the end of the line. Here is a sample input file:
niter = 100
title = "Double Wammy"
cell_size = 0.5 0.75
plot.var = Density 1 10
plot.var = Energy 5 12
bigarray = 1 2 3 4 5 6 7 8 \ 9 10 11 12
multi_line_string = "This is a
multi-line string."
aBox = ((0,0) (5,5))
test = apple "boy blue" 10 20 30 40
FILE = prob_file
Preprocessing of AMREX_SPACEDIM is supported. It supports if, #elif, #else, and #endif. The condition must be AMREX_SPACEDIM op D
, where op is >, <, >=, <=, or ==, and D is 1, 2, or 3. The parentheses around the condition are optional. Some examples are shown below.
if (AMREX_SPACEDIM == 1) n_cell = 256 #elif (AMREX_SPACEDIM == 2) n_cell = 128 128 #else n_cell = 64 64 64 #endif
if AMREX_SPACEDIM >= 2 t = 0.5 #else t = 1.5 #endif
Math expression is supported for integers and reals. For example
n_cell = 128 amrex.n_cell = n_cell*2 8 16**2
becomes
n_cell = 128 amrex.n_cell = 256 8 256
More details can be found at https://amrex-codes.github.io/amrex/docs_html/Basics.html#parmparse