Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
amrex::ParmParse Class Reference

Parse Parameters From Command Line and Input Files. More...

#include <AMReX_ParmParse.H>

Classes

struct  PP_entry
 

Public Types

enum  { LAST = -1 , FIRST = 0 , ALL = -1 }
 
using Table = std::unordered_map< std::string, PP_entry >
 

Public Member Functions

 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.
 
bool contains (std::string_view name) const
 Returns true if name is in table.
 
int countval (std::string_view 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.
 
int countname (std::string_view name) const
 Returns the number of times the given name (prepended with prefix) appears in the table.
 
void getkth (std::string_view 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 converts the value 'true', and non-zero integers or floats to bool(true), and bool(false) for 'false' or zero integer or float values.
 
void get (std::string_view name, bool &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, bool &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, bool val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, int &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view name, int k, int &ref, int ival=FIRST) const
 
int query (std::string_view name, int &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, int val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, long &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, long &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, long val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, long long &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, long long &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, long long val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, float &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, float &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, float val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, double &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, double &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, double val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, std::string &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, std::string &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, const std::string &val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getline (std::string_view name, std::string &ref) const
 
int queryline (std::string_view name, std::string &ref) const
 
void getkth (std::string_view 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.
 
void get (std::string_view name, IntVect &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, IntVect &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, const IntVect &val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getkth (std::string_view 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.
 
void get (std::string_view name, Box &ref, int ival=FIRST) const
 Same as getkth() but searches for the last occurrence of name.
 
int querykth (std::string_view 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.
 
int query (std::string_view name, Box &ref, int ival=FIRST) const
 Same as querykth() but searches for the last occurrence of name.
 
void add (std::string_view name, const Box &val)
 Add a key 'name' with value 'val' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as getktharr() but searches for last occurrence of name.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as queryktharr() but searches for last occurrence of name.
 
void addarr (std::string_view name, const std::vector< int > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view name, std::vector< long > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as getktharr() but searches for last occurrence of name.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view name, std::vector< long > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as queryktharr() but searches for last occurrence of name.
 
void addarr (std::string_view name, const std::vector< long > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view 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.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view 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.
 
void addarr (std::string_view name, const std::vector< long long > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view name, std::vector< float > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as getktharr() but searches for last occurrence of name.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view name, std::vector< float > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as queryktharr() but searches for last occurrence of name.
 
void addarr (std::string_view name, const std::vector< float > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view name, std::vector< double > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as getktharr() but searches for last occurrence of name.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view name, std::vector< double > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as queryktharr() but searches for last occurrence of name.
 
void addarr (std::string_view name, const std::vector< double > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view 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.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view 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.
 
void addarr (std::string_view name, const std::vector< std::string > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view name, std::vector< IntVect > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as getktharr() but searches for last occurrence of name.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view 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.
 
void addarr (std::string_view name, const std::vector< IntVect > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
void getktharr (std::string_view 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.
 
void getarr (std::string_view name, std::vector< Box > &ref, int start_ix=FIRST, int num_val=ALL) const
 Same as getktharr() but searches for last occurrence of name.
 
int queryktharr (std::string_view 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().
 
int queryarr (std::string_view 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.
 
void addarr (std::string_view name, const std::vector< Box > &ref)
 Add a key 'name' with vector of values 'ref' to the end of the PP table.
 
int queryarr (std::string_view name, IntVect &ref) const
 
void getarr (std::string_view name, IntVect &ref) const
 
int queryarr (std::string_view name, RealVect &ref) const
 Query RealVect from array.
 
void getarr (std::string_view name, RealVect &ref) const
 Get RealVect from array.
 
template<typename T , std::size_t N>
void get (std::string_view name, std::array< T, N > &ref) const
 
template<typename T , std::size_t N>
int query (std::string_view name, std::array< T, N > &ref) const
 
template<typename T , std::enable_if_t<!IsStdVector< T >::value, int > = 0>
int queryAdd (std::string_view 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.
 
int queryAdd (std::string_view name, std::string &ref)
 
template<typename T >
int queryAdd (std::string_view 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.
 
template<typename T >
int queryAdd (std::string_view 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.
 
template<typename T , std::size_t N>
int queryAdd (std::string_view 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.
 
int queryWithParser (std::string_view name, bool &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.
 
int queryWithParser (std::string_view name, int &ref) const
 
int queryWithParser (std::string_view name, long &ref) const
 
int queryWithParser (std::string_view name, long long &ref) const
 
int queryWithParser (std::string_view name, float &ref) const
 
int queryWithParser (std::string_view name, double &ref) const
 
int queryarrWithParser (std::string_view name, int nvals, bool *ptr) 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.
 
int queryarrWithParser (std::string_view name, int nvals, int *ptr) const
 
int queryarrWithParser (std::string_view name, int nvals, long *ptr) const
 
int queryarrWithParser (std::string_view name, int nvals, long long *ptr) const
 
int queryarrWithParser (std::string_view name, int nvals, float *ptr) const
 
int queryarrWithParser (std::string_view name, int nvals, double *ptr) const
 
template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 (std::string_view name, int nvals, std::vector< T > &ref) const
 
template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 (std::string_view name, T &ref)
 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.
 
template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 (std::string_view 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.
 
template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 (std::string_view name, int nvals, T *ptr) 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.
 
template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 (std::string_view 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.
 
template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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>
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.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int query (std::string_view name, T &ref, int ival=FIRST) const
 . Query enum value using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void add (std::string_view name, T const &val)
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void get (std::string_view name, T &ref, int ival=FIRST) const
 . Get enum value using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int queryarr (std::string_view name, std::vector< T > &ref, int start_ix=FIRST, int num_val=ALL) const
 Query an array of enum values using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void getarr (std::string_view name, std::vector< T > &ref, int start_ix=FIRST, int num_val=ALL) const
 Get an array of enum values using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int query_enum_case_insensitive (std::string_view name, T &ref, int ival=FIRST) const
 . Query enum value using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void get_enum_case_insensitive (std::string_view name, T &ref, int ival=FIRST) const
 . Get enum value using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int query_enum_sloppy (std::string_view name, T &ref, std::string_view const &ignores, int ival=FIRST) const
 . Query enum value using given name.
 
template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void get_enum_sloppy (std::string_view name, T &ref, std::string_view const &ignores, int ival=FIRST) const
 . Get enum value using given name.
 
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
int queryAsDouble (std::string_view name, T &ref) const
 Query T with Parser, but treat the number as double precision during parsing.
 
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
int queryarrAsDouble (std::string_view name, int nvals, T *ptr) const
 Query T array with Parser, but treat the number as double precision during parsing.
 
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
void getAsDouble (std::string_view name, T &ref) const
 Get T with Parser, but treat the number as double precision during parsing.
 
template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
void getarrAsDouble (std::string_view name, int nvals, T *ptr) const
 Get T array with Parser, but treat the number as double precision during parsing.
 
int remove (std::string_view name)
 Remove given name from the table.
 
Parser makeParser (std::string const &func, Vector< std::string > const &vars) const
 
IParser makeIParser (std::string const &func, Vector< std::string > const &vars) const
 
int querytable (std::string_view name, std::vector< std::vector< double > > &ref) const
 Query vector of vector. The return value indicates whether it's found. The table (i.e., vector of vector) is in the format of {{a00, a01, a02...} {a10, a11, a12...} ...}.
 
int querytable (std::string_view name, std::vector< std::vector< float > > &ref) const
 
int querytable (std::string_view name, std::vector< std::vector< int > > &ref) const
 
template<typename T >
void gettable (std::string_view name, std::vector< std::vector< T > > &ref) const
 Get vector of vector. It's an error if it is not found. The table (i.e., vector of vector) is in the format of {{a00, a01, * a02...} {a10, a11, a12...} ...}.
 
const Tabletable () const
 
std::string const & getPrefix () const
 
std::string prefixedName (std::string_view str) const
 

Static Public Member Functions

static void Initialize (int argc, char **argv, const char *parfile)
 Construct an initial ParmParse object from the argc and argv passed in to main(). An error will be signalled if another ParmParse object currently exists. If parfile is specified, read the parameters in from that file first and then append those derived from argv to the table.
 
static void Initialize (int argc, char **argv, const std::string &parfile)
 
static void Finalize ()
 The destructor. The internal static table will only be deleted if there are no other ParmParse objects in existence.
 
static void SetParserPrefix (std::string a_prefix)
 Set prefix used by math expression Parser.
 
static int Verbose ()
 
static void SetVerbose (int v)
 
static void dumpTable (std::ostream &os, bool prettyPrint=false)
 Write the contents of the table in ASCII to the ostream.
 
static void prettyPrintTable (std::ostream &os)
 
static void prettyPrintUnusedInputs (std::ostream &os)
 
static void prettyPrintUsedInputs (std::ostream &os)
 
static void addfile (std::string const &filename)
 Add keys and values from a file to the end of the PP table.
 
static bool QueryUnusedInputs ()
 
static bool hasUnusedInputs (const std::string &prefix=std::string())
 Any unused [prefix.]* parameters?
 
static std::vector< std::string > getUnusedInputs (const std::string &prefix=std::string())
 Returns unused [prefix.]* parameters.
 
static std::set< std::string > getEntries (const std::string &prefix=std::string())
 Returns [prefix.]* parameters.
 

Static Public Attributes

static std::string const FileKeyword = "FILE"
 keyword for files to load
 
static std::string ParserPrefix
 

Protected Attributes

std::string m_prefix
 
std::string m_parser_prefix
 
Tablem_table
 

Detailed Description

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)

executable 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
Definition AMReX_Amr.cpp:49

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

Member Typedef Documentation

◆ Table

using amrex::ParmParse::Table = std::unordered_map<std::string, PP_entry>

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LAST 
FIRST 
ALL 

Constructor & Destructor Documentation

◆ ParmParse()

amrex::ParmParse::ParmParse ( std::string  prefix = std::string(),
std::string  parser_prefix = std::string() 
)
explicit

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.

Member Function Documentation

◆ add() [1/10]

void amrex::ParmParse::add ( std::string_view  name,
bool  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [2/10]

void amrex::ParmParse::add ( std::string_view  name,
const Box val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [3/10]

void amrex::ParmParse::add ( std::string_view  name,
const IntVect val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [4/10]

void amrex::ParmParse::add ( std::string_view  name,
const std::string &  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [5/10]

void amrex::ParmParse::add ( std::string_view  name,
double  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [6/10]

void amrex::ParmParse::add ( std::string_view  name,
float  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [7/10]

void amrex::ParmParse::add ( std::string_view  name,
int  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [8/10]

void amrex::ParmParse::add ( std::string_view  name,
long long  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [9/10]

void amrex::ParmParse::add ( std::string_view  name,
long  val 
)

Add a key 'name' with value 'val' to the end of the PP table.

◆ add() [10/10]

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void amrex::ParmParse::add ( std::string_view  name,
T const &  val 
)
inline

Add a key 'name' with value 'val' to the end of the ParmParse database. Here T is an AMREX_ENUM type.

◆ addarr() [1/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< Box > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [2/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< double > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [3/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< float > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [4/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< int > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [5/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< IntVect > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [6/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< long > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [7/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< long long > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addarr() [8/8]

void amrex::ParmParse::addarr ( std::string_view  name,
const std::vector< std::string > &  ref 
)

Add a key 'name' with vector of values 'ref' to the end of the PP table.

◆ addfile()

void amrex::ParmParse::addfile ( std::string const &  filename)
static

Add keys and values from a file to the end of the PP table.

◆ contains()

bool amrex::ParmParse::contains ( std::string_view  name) const

Returns true if name is in table.

◆ countname()

int amrex::ParmParse::countname ( std::string_view  name) const

Returns the number of times the given name (prepended with prefix) appears in the table.

◆ countval()

int amrex::ParmParse::countval ( std::string_view  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.

◆ dumpTable()

void amrex::ParmParse::dumpTable ( std::ostream &  os,
bool  prettyPrint = false 
)
static

Write the contents of the table in ASCII to the ostream.

◆ eval()

template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 amrex::ParmParse::eval ( std::string const &  expr) const
inline

◆ Finalize()

void amrex::ParmParse::Finalize ( )
static

The destructor. The internal static table will only be deleted if there are no other ParmParse objects in existence.

◆ get() [1/12]

template<typename T >
void amrex::ParmParse::get ( const char *  new_name,
const char *  old_name,
T &  ref 
)
inline

Get using two names.

This function queries with new_name first, If it's not found, it will try again with old_name. It's an error if neither name is found.

◆ get() [2/12]

void amrex::ParmParse::get ( std::string_view  name,
bool &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [3/12]

void amrex::ParmParse::get ( std::string_view  name,
Box ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [4/12]

void amrex::ParmParse::get ( std::string_view  name,
double &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [5/12]

void amrex::ParmParse::get ( std::string_view  name,
float &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [6/12]

void amrex::ParmParse::get ( std::string_view  name,
int &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [7/12]

void amrex::ParmParse::get ( std::string_view  name,
IntVect ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [8/12]

void amrex::ParmParse::get ( std::string_view  name,
long &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [9/12]

void amrex::ParmParse::get ( std::string_view  name,
long long &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [10/12]

template<typename T , std::size_t N>
void amrex::ParmParse::get ( std::string_view  name,
std::array< T, N > &  ref 
) const
inline

◆ get() [11/12]

void amrex::ParmParse::get ( std::string_view  name,
std::string &  ref,
int  ival = FIRST 
) const

Same as getkth() but searches for the last occurrence of name.

◆ get() [12/12]

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void amrex::ParmParse::get ( std::string_view  name,
T &  ref,
int  ival = FIRST 
) const
inline

. Get enum value using given name.

Here T is an enum class defined by AMREX_ENUM. It's a runtime error, if name is not found. An exception is thrown, if the found string associated with the name cannot be converted to an enumerator (i.e., the string does not match any names in the definition of T).

◆ get_enum_case_insensitive()

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void amrex::ParmParse::get_enum_case_insensitive ( std::string_view  name,
T &  ref,
int  ival = FIRST 
) const
inline

. Get enum value using given name.

Here T is an enum class defined by AMREX_ENUM. It's a runtime error, if name is not found. An exception is thrown, if the found string associated with the name cannot be case-insensitively converted to an enumerator (i.e., the found string, not name, does not case-insensitively match any names in the definition of T). If there are multiple matches, the first one is used.

◆ get_enum_sloppy()

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void amrex::ParmParse::get_enum_sloppy ( std::string_view  name,
T &  ref,
std::string_view const &  ignores,
int  ival = FIRST 
) const
inline

. Get enum value using given name.

Here T is an enum class defined by AMREX_ENUM. It's a runtime error, if name is not found. An exception is thrown, if the found string associated with the name cannot be case-insensitively converted to an enumerator (i.e., the found string, not name, does not case-insensitively match any names in the definition of T). If there are multiple matches, the first one is used. Characters in ignores will be ignored as if they don't exist in the value part of ParamParse entries (e.g., name = value).

◆ getarr() [1/11]

void amrex::ParmParse::getarr ( std::string_view  name,
IntVect ref 
) const

◆ getarr() [2/11]

void amrex::ParmParse::getarr ( std::string_view  name,
RealVect ref 
) const

Get RealVect from array.

◆ getarr() [3/11]

void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< Box > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as getktharr() but searches for last occurrence of name.

◆ getarr() [4/11]

void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< double > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as getktharr() but searches for last occurrence of name.

◆ getarr() [5/11]

void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< float > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as getktharr() but searches for last occurrence of name.

◆ getarr() [6/11]

void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< int > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as getktharr() but searches for last occurrence of name.

◆ getarr() [7/11]

void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< IntVect > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as getktharr() but searches for last occurrence of name.

◆ getarr() [8/11]

void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< long > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as getktharr() but searches for last occurrence of name.

◆ getarr() [9/11]

void amrex::ParmParse::getarr ( std::string_view  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.

◆ getarr() [10/11]

void amrex::ParmParse::getarr ( std::string_view  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.

◆ getarr() [11/11]

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
void amrex::ParmParse::getarr ( std::string_view  name,
std::vector< T > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const
inline

Get an array of enum values using given name.

◆ getarrAsDouble()

template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
void amrex::ParmParse::getarrAsDouble ( std::string_view  name,
int  nvals,
T *  ptr 
) const
inline

Get T array with Parser, but treat the number as double precision during parsing.

The final result is cast to T's. It may result in a runtime error if the conversion is not safe. T is either arithmetic type or std::optional of arithmetic type.

◆ getarrWithParser() [1/2]

template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 amrex::ParmParse::getarrWithParser ( std::string_view  name,
int  nvals,
std::vector< T > &  ref 
) const
inline

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.

◆ getarrWithParser() [2/2]

template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 amrex::ParmParse::getarrWithParser ( std::string_view  name,
int  nvals,
T *  ptr 
) const
inline

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.

◆ getAsDouble()

template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
void amrex::ParmParse::getAsDouble ( std::string_view  name,
T &  ref 
) const
inline

Get T with Parser, but treat the number as double precision during parsing.

The final result is cast to T. It may result in a runtime error if the conversion is not safe. T is either arithmetic type or std::optional of arithmetic type.

◆ getEntries()

std::set< std::string > amrex::ParmParse::getEntries ( const std::string &  prefix = std::string())
static

Returns [prefix.]* parameters.

◆ getkth() [1/9]

void amrex::ParmParse::getkth ( std::string_view  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 converts the value 'true', and non-zero integers or floats to bool(true), and bool(false) for 'false' or zero integer or float values.

◆ getkth() [2/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [3/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [4/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [5/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [6/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [7/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [8/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getkth() [9/9]

void amrex::ParmParse::getkth ( std::string_view  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.

◆ getktharr() [1/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [2/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [3/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [4/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [5/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [6/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [7/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getktharr() [8/8]

void amrex::ParmParse::getktharr ( std::string_view  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.

◆ getline()

void amrex::ParmParse::getline ( std::string_view  name,
std::string &  ref 
) const

Similar to get() but store the whole line including empty spaces in the middle if present as a single string. For example, foo = a b c is treated by this function as a single string "a b c", whereas get() will give only "a" and getarr() will store the results in std::vectcor<std::string>. Note this does not preserve the number of empty spaces, because of how ParmParse parses the line. For example, a b c with two spaces between b and c will become "a b c".

◆ getPrefix()

std::string const & amrex::ParmParse::getPrefix ( ) const

◆ gettable()

template<typename T >
void amrex::ParmParse::gettable ( std::string_view  name,
std::vector< std::vector< T > > &  ref 
) const
inline

Get vector of vector. It's an error if it is not found. The table (i.e., vector of vector) is in the format of {{a00, a01, * a02...} {a10, a11, a12...} ...}.

◆ getUnusedInputs()

std::vector< std::string > amrex::ParmParse::getUnusedInputs ( const std::string &  prefix = std::string())
static

Returns unused [prefix.]* parameters.

◆ getWithParser()

template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 amrex::ParmParse::getWithParser ( std::string_view  name,
T &  ref 
) const
inline

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.

◆ hasUnusedInputs()

bool amrex::ParmParse::hasUnusedInputs ( const std::string &  prefix = std::string())
static

Any unused [prefix.]* parameters?

◆ Initialize() [1/2]

void amrex::ParmParse::Initialize ( int  argc,
char **  argv,
const char *  parfile 
)
static

Construct an initial ParmParse object from the argc and argv passed in to main(). An error will be signalled if another ParmParse object currently exists. If parfile is specified, read the parameters in from that file first and then append those derived from argv to the table.

◆ Initialize() [2/2]

static void amrex::ParmParse::Initialize ( int  argc,
char **  argv,
const std::string &  parfile 
)
inlinestatic

◆ makeIParser()

IParser amrex::ParmParse::makeIParser ( std::string const &  func,
Vector< std::string > const &  vars 
) const

Make IParser using given string func as function body and vars as variable names. Constants known to ParmParse will be set. It's a runtime error, if there are unknown symbols in func.

◆ makeParser()

Parser amrex::ParmParse::makeParser ( std::string const &  func,
Vector< std::string > const &  vars 
) const

Make Parser using given string func as function body and vars as variable names. Constants known to ParmParse will be set. It's a runtime error, if there are unknown symbols in func.

◆ prefixedName()

std::string amrex::ParmParse::prefixedName ( std::string_view  str) const

◆ prettyPrintTable()

void amrex::ParmParse::prettyPrintTable ( std::ostream &  os)
static

Write all entries in the table in a pretty way to the ostream. If there are duplicates, only the last one is printed.

◆ prettyPrintUnusedInputs()

void amrex::ParmParse::prettyPrintUnusedInputs ( std::ostream &  os)
static

Write unused inputs in a pretty way to the ostream. If there are duplicates, only the last one is printed.

◆ prettyPrintUsedInputs()

void amrex::ParmParse::prettyPrintUsedInputs ( std::ostream &  os)
static

Write used inputs in a pretty way to the ostream. If there are duplicates, only the last one is printed.

◆ query() [1/12]

template<typename T >
int amrex::ParmParse::query ( const char *  new_name,
const char *  old_name,
T &  ref 
)
inline

◆ query() [2/12]

int amrex::ParmParse::query ( std::string_view  name,
bool &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [3/12]

int amrex::ParmParse::query ( std::string_view  name,
Box ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [4/12]

int amrex::ParmParse::query ( std::string_view  name,
double &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [5/12]

int amrex::ParmParse::query ( std::string_view  name,
float &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [6/12]

int amrex::ParmParse::query ( std::string_view  name,
int &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [7/12]

int amrex::ParmParse::query ( std::string_view  name,
IntVect ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [8/12]

int amrex::ParmParse::query ( std::string_view  name,
long &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [9/12]

int amrex::ParmParse::query ( std::string_view  name,
long long &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [10/12]

template<typename T , std::size_t N>
int amrex::ParmParse::query ( std::string_view  name,
std::array< T, N > &  ref 
) const
inline

◆ query() [11/12]

int amrex::ParmParse::query ( std::string_view  name,
std::string &  ref,
int  ival = FIRST 
) const

Same as querykth() but searches for the last occurrence of name.

◆ query() [12/12]

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int amrex::ParmParse::query ( std::string_view  name,
T &  ref,
int  ival = FIRST 
) const
inline

. Query enum value using given name.

Here T is an enum class defined by AMREX_ENUM. The return value indicates if name is found. An exception is thrown, if the found string associated with the name cannot be converted to an enumerator (i.e., the string does not match any names in the definition of T).

◆ query_enum_case_insensitive()

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int amrex::ParmParse::query_enum_case_insensitive ( std::string_view  name,
T &  ref,
int  ival = FIRST 
) const
inline

. Query enum value using given name.

Here T is an enum class defined by AMREX_ENUM. The return value indicates if name is found. An exception is thrown, if the found string associated with the name cannot be case-insensitively converted to an enumerator (i.e., the found string, not name, does not case-insensitively match any names in the definition of T). If there are multiple matches, the first one is used.

◆ query_enum_sloppy()

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int amrex::ParmParse::query_enum_sloppy ( std::string_view  name,
T &  ref,
std::string_view const &  ignores,
int  ival = FIRST 
) const
inline

. Query enum value using given name.

Here T is an enum class defined by AMREX_ENUM. The return value indicates if name is found. An exception is thrown, if the found string associated with the name cannot be case-insensitively converted to an enumerator (i.e., the found string, not name, does not case-insensitively match any names in the definition of T). If there are multiple matches, the first one is used. Characters in ignores will be ignored as if they don't exist in the value part of ParamParse entries (e.g., name = value).

◆ queryAdd() [1/5]

template<typename T , std::size_t N>
int amrex::ParmParse::queryAdd ( std::string_view  name,
std::array< T, N > &  ref 
)
inline

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.

◆ queryAdd() [2/5]

int amrex::ParmParse::queryAdd ( std::string_view  name,
std::string &  ref 
)
inline

◆ queryAdd() [3/5]

template<typename T >
int amrex::ParmParse::queryAdd ( std::string_view  name,
std::vector< T > &  ref 
)
inline

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.

If name is found, then the ref argument will be reallocated (and resized) according to the number of values in the inputs.

◆ queryAdd() [4/5]

template<typename T >
int amrex::ParmParse::queryAdd ( std::string_view  name,
std::vector< T > &  ref,
int  num_val 
)
inline

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.

◆ queryAdd() [5/5]

template<typename T , std::enable_if_t<!IsStdVector< T >::value, int > = 0>
int amrex::ParmParse::queryAdd ( std::string_view  name,
T &  ref 
)
inline

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.

◆ queryAddWithParser()

template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 amrex::ParmParse::queryAddWithParser ( std::string_view  name,
T &  ref 
)
inline

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.

◆ queryarr() [1/11]

int amrex::ParmParse::queryarr ( std::string_view  name,
IntVect ref 
) const

◆ queryarr() [2/11]

int amrex::ParmParse::queryarr ( std::string_view  name,
RealVect ref 
) const

Query RealVect from array.

◆ queryarr() [3/11]

int amrex::ParmParse::queryarr ( std::string_view  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.

◆ queryarr() [4/11]

int amrex::ParmParse::queryarr ( std::string_view  name,
std::vector< double > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as queryktharr() but searches for last occurrence of name.

◆ queryarr() [5/11]

int amrex::ParmParse::queryarr ( std::string_view  name,
std::vector< float > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as queryktharr() but searches for last occurrence of name.

◆ queryarr() [6/11]

int amrex::ParmParse::queryarr ( std::string_view  name,
std::vector< int > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as queryktharr() but searches for last occurrence of name.

◆ queryarr() [7/11]

int amrex::ParmParse::queryarr ( std::string_view  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.

◆ queryarr() [8/11]

int amrex::ParmParse::queryarr ( std::string_view  name,
std::vector< long > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

Same as queryktharr() but searches for last occurrence of name.

◆ queryarr() [9/11]

int amrex::ParmParse::queryarr ( std::string_view  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.

◆ queryarr() [10/11]

int amrex::ParmParse::queryarr ( std::string_view  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.

◆ queryarr() [11/11]

template<typename T , typename ET = amrex_enum_traits<T>, std::enable_if_t< ET::value, int > = 0>
int amrex::ParmParse::queryarr ( std::string_view  name,
std::vector< T > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const
inline

Query an array of enum values using given name.

◆ queryarrAsDouble()

template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
int amrex::ParmParse::queryarrAsDouble ( std::string_view  name,
int  nvals,
T *  ptr 
) const
inline

Query T array with Parser, but treat the number as double precision during parsing.

The final result is cast to T's. It may result in a runtime error if the conversion is not safe. T is either arithmetic type or std::optional of arithmetic type.

◆ queryarrWithParser() [1/7]

int amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
bool *  ptr 
) 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.

◆ queryarrWithParser() [2/7]

int amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
double *  ptr 
) const

◆ queryarrWithParser() [3/7]

int amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
float *  ptr 
) const

◆ queryarrWithParser() [4/7]

int amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
int *  ptr 
) const

◆ queryarrWithParser() [5/7]

int amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
long *  ptr 
) const

◆ queryarrWithParser() [6/7]

int amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
long long *  ptr 
) const

◆ queryarrWithParser() [7/7]

template<typename T , std::enable_if_t< std::is_same_v< T, bool >||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 amrex::ParmParse::queryarrWithParser ( std::string_view  name,
int  nvals,
std::vector< T > &  ref 
) const
inline

◆ queryAsDouble()

template<typename T , std::enable_if_t< ppdetail::IsArithmeticOptional_v< T >, int > = 0>
int amrex::ParmParse::queryAsDouble ( std::string_view  name,
T &  ref 
) const
inline

Query T with Parser, but treat the number as double precision during parsing.

The final result is cast to T. It may result in a runtime error if the conversion is not safe. T is either arithmetic type or std::optional of arithmetic type.

◆ querykth() [1/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [2/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [3/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [4/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [5/9]

int amrex::ParmParse::querykth ( std::string_view  name,
int  k,
int &  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.

◆ querykth() [6/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [7/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [8/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ querykth() [9/9]

int amrex::ParmParse::querykth ( std::string_view  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.

◆ queryktharr() [1/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< Box > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [2/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< double > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [3/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< float > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [4/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< int > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [5/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< IntVect > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [6/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< long > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [7/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< long long > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryktharr() [8/8]

int amrex::ParmParse::queryktharr ( std::string_view  name,
int  k,
std::vector< std::string > &  ref,
int  start_ix = FIRST,
int  num_val = ALL 
) const

◆ queryline()

int amrex::ParmParse::queryline ( std::string_view  name,
std::string &  ref 
) const

Similar to query() but store the whole line including empty spaces in the middle if present as a single string. For example, foo = a b c is treated by this function as a single string "a b c", whereas query() will give only "a" and queryarr() will store the results in std::vectcor<std::string>. Note this does not preserve the number of empty spaces, because of how ParmParse parses the line. For example, a b c with two spaces between b and c will become "a b c".

◆ querytable() [1/3]

int amrex::ParmParse::querytable ( std::string_view  name,
std::vector< std::vector< double > > &  ref 
) const

Query vector of vector. The return value indicates whether it's found. The table (i.e., vector of vector) is in the format of {{a00, a01, a02...} {a10, a11, a12...} ...}.

◆ querytable() [2/3]

int amrex::ParmParse::querytable ( std::string_view  name,
std::vector< std::vector< float > > &  ref 
) const

◆ querytable() [3/3]

int amrex::ParmParse::querytable ( std::string_view  name,
std::vector< std::vector< int > > &  ref 
) const

◆ QueryUnusedInputs()

bool amrex::ParmParse::QueryUnusedInputs ( )
static

◆ queryWithParser() [1/6]

int amrex::ParmParse::queryWithParser ( std::string_view  name,
bool &  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.

◆ queryWithParser() [2/6]

int amrex::ParmParse::queryWithParser ( std::string_view  name,
double &  ref 
) const

◆ queryWithParser() [3/6]

int amrex::ParmParse::queryWithParser ( std::string_view  name,
float &  ref 
) const

◆ queryWithParser() [4/6]

int amrex::ParmParse::queryWithParser ( std::string_view  name,
int &  ref 
) const

◆ queryWithParser() [5/6]

int amrex::ParmParse::queryWithParser ( std::string_view  name,
long &  ref 
) const

◆ queryWithParser() [6/6]

int amrex::ParmParse::queryWithParser ( std::string_view  name,
long long &  ref 
) const

◆ remove()

int amrex::ParmParse::remove ( std::string_view  name)

Remove given name from the table.

◆ SetParserPrefix()

void amrex::ParmParse::SetParserPrefix ( std::string  a_prefix)
static

Set prefix used by math expression Parser.

◆ SetVerbose()

void amrex::ParmParse::SetVerbose ( int  v)
static

◆ table()

const Table & amrex::ParmParse::table ( ) const
inline

◆ Verbose()

int amrex::ParmParse::Verbose ( )
static

Member Data Documentation

◆ FileKeyword

std::string const amrex::ParmParse::FileKeyword = "FILE"
static

keyword for files to load

◆ m_parser_prefix

std::string amrex::ParmParse::m_parser_prefix
protected

◆ m_prefix

std::string amrex::ParmParse::m_prefix
protected

◆ m_table

Table* amrex::ParmParse::m_table
protected

◆ ParserPrefix

std::string amrex::ParmParse::ParserPrefix
static

The documentation for this class was generated from the following files: