1 #ifndef AMREX_PARMPARSE_H_
2 #define AMREX_PARMPARSE_H_
3 #include <AMReX_Config.H>
17 #include <string_view>
18 #include <unordered_map>
25 using Box = BoxND<AMREX_SPACEDIM>;
28 using IntVect = IntVectND<AMREX_SPACEDIM>;
32 template <
class T,
class Enable =
void>
44 std::enable_if_t<std::is_arithmetic_v<T>>>
330 explicit ParmParse (std::string prefix = std::string(),
331 std::string parser_prefix = std::string());
334 [[nodiscard]]
bool contains (
const char* name)
const;
340 [[nodiscard]]
int countval (
const char* name,
int n =
LAST)
const;
345 [[nodiscard]]
int countname (
const std::string& name)
const;
357 void getkth (
const char* name,
360 int ival =
FIRST)
const;
362 void get (
const char* name,
364 int ival =
FIRST)
const;
375 int ival =
FIRST)
const;
377 int query (
const char* name,
379 int ival =
FIRST)
const;
381 void add (
const char* name,
bool val);
391 void getkth (
const char* name,
394 int ival =
FIRST)
const;
397 void get (
const char* name,
399 int ival =
FIRST)
const;
410 int ival =
FIRST)
const;
412 int query (
const char* name,
414 int ival =
FIRST)
const;
416 void add (
const char* name,
int val);
426 void getkth (
const char* name,
429 int ival =
FIRST)
const;
431 void get (
const char* name,
433 int ival =
FIRST)
const;
444 int ival =
FIRST)
const;
446 int query (
const char* name,
448 int ival =
FIRST)
const;
450 void add (
const char* name,
long val);
460 void getkth (
const char* name,
463 int ival =
FIRST)
const;
465 void get (
const char* name,
467 int ival =
FIRST)
const;
478 int ival =
FIRST)
const;
480 int query (
const char* name,
482 int ival =
FIRST)
const;
484 void add (
const char* name,
long long val);
494 void getkth (
const char* name,
497 int ival =
FIRST)
const;
499 void get (
const char* name,
501 int ival =
FIRST)
const;
512 int ival =
FIRST)
const;
514 int query (
const char* name,
516 int ival =
FIRST)
const;
518 void add (
const char* name,
float val);
528 void getkth (
const char* name,
531 int ival =
FIRST)
const;
533 void get (
const char* name,
535 int ival =
FIRST)
const;
546 int ival =
FIRST)
const;
548 int query (
const char* name,
550 int ival =
FIRST)
const;
552 void add (
const char* name,
double val);
562 void getkth (
const char* name,
565 int ival =
FIRST)
const;
568 void get (
const char* name,
570 int ival =
FIRST)
const;
581 int ival =
FIRST)
const;
583 int query (
const char* name,
585 int ival =
FIRST)
const;
587 void add (
const char* name,
const std::string& val);
598 void getkth (
const char* name,
601 int ival =
FIRST)
const;
603 void get (
const char* name,
605 int ival =
FIRST)
const;
616 int ival =
FIRST)
const;
618 int query (
const char* name,
620 int ival =
FIRST)
const;
622 void add (
const char* name,
const IntVect& val);
632 void getkth (
const char* name,
635 int ival =
FIRST)
const;
637 void get (
const char* name,
639 int ival =
FIRST)
const;
650 int ival =
FIRST)
const;
652 int query (
const char* name,
654 int ival =
FIRST)
const;
656 void add (
const char* name,
const Box& val);
671 std::vector<int>& ref,
672 int start_ix =
FIRST,
673 int num_val =
ALL)
const;
675 void getarr (
const char* name,
676 std::vector<int>& ref,
677 int start_ix =
FIRST,
678 int num_val =
ALL)
const;
682 std::vector<int>& ref,
683 int start_ix =
FIRST,
684 int num_val =
ALL)
const;
687 std::vector<int>& ref,
688 int start_ix =
FIRST,
689 int num_val =
ALL)
const;
691 void addarr (
const char* name,
const std::vector<int>& ref);
707 std::vector<long>& ref,
708 int start_ix =
FIRST,
709 int num_val =
ALL)
const;
711 void getarr (
const char* name,
712 std::vector<long>& ref,
713 int start_ix =
FIRST,
714 int num_val =
ALL)
const;
718 std::vector<long>& ref,
719 int start_ix =
FIRST,
720 int num_val =
ALL)
const;
723 std::vector<long>& ref,
724 int start_ix =
FIRST,
725 int num_val =
ALL)
const;
727 void addarr (
const char* name,
const std::vector<long>& ref);
743 std::vector<long long>& ref,
744 int start_ix =
FIRST,
745 int num_val =
ALL)
const;
747 void getarr (
const char* name,
748 std::vector<long long>& ref,
749 int start_ix =
FIRST,
750 int num_val =
ALL)
const;
754 std::vector<long long>& ref,
755 int start_ix =
FIRST,
756 int num_val =
ALL)
const;
759 std::vector<long long>& ref,
760 int start_ix =
FIRST,
761 int num_val =
ALL)
const;
763 void addarr (
const char* name,
const std::vector<long long>& ref);
779 std::vector<float>& ref,
780 int start_ix =
FIRST,
781 int num_val =
ALL)
const;
783 void getarr (
const char* name,
784 std::vector<float>& ref,
785 int start_ix =
FIRST,
786 int num_val =
ALL)
const;
790 std::vector<float>& ref,
791 int start_ix =
FIRST,
792 int num_val =
ALL)
const;
795 std::vector<float>& ref,
796 int start_ix =
FIRST,
797 int num_val =
ALL)
const;
799 void addarr (
const char* name,
const std::vector<float>& ref);
814 std::vector<double>& ref,
815 int start_ix =
FIRST,
816 int num_val =
ALL)
const;
818 void getarr (
const char* name,
819 std::vector<double>& ref,
820 int start_ix =
FIRST,
821 int num_val =
ALL)
const;
825 std::vector<double>& ref,
826 int start_ix =
FIRST,
827 int num_val =
ALL)
const;
830 std::vector<double>& ref,
831 int start_ix =
FIRST,
832 int num_val =
ALL)
const;
834 void addarr (
const char* name,
const std::vector<double>& ref);
849 std::vector<std::string>& ref,
850 int start_ix =
FIRST,
851 int num_val =
ALL)
const;
853 void getarr (
const char* name,
854 std::vector<std::string>& ref,
855 int start_ix =
FIRST,
856 int num_val =
ALL)
const;
860 std::vector<std::string>& ref,
861 int start_ix =
FIRST,
862 int num_val =
ALL)
const;
865 std::vector<std::string>& ref,
866 int start_ix =
FIRST,
867 int num_val =
ALL)
const;
869 void addarr (
const char* name,
const std::vector<std::string>& ref);
884 std::vector<IntVect>& ref,
885 int start_ix =
FIRST,
886 int num_val =
ALL)
const;
888 void getarr (
const char* name,
889 std::vector<IntVect>& ref,
890 int start_ix =
FIRST,
891 int num_val =
ALL)
const;
895 std::vector<IntVect>& ref,
896 int start_ix =
FIRST,
897 int num_val =
ALL)
const;
900 std::vector<IntVect>& ref,
901 int start_ix =
FIRST,
902 int num_val =
ALL)
const;
904 void addarr (
const char* name,
const std::vector<IntVect>& ref);
919 std::vector<Box>& ref,
920 int start_ix =
FIRST,
921 int num_val =
ALL)
const;
923 void getarr (
const char* name,
924 std::vector<Box>& ref,
925 int start_ix =
FIRST,
926 int num_val =
ALL)
const;
930 std::vector<Box>& ref,
931 int start_ix =
FIRST,
932 int num_val =
ALL)
const;
935 std::vector<Box>& ref,
936 int start_ix =
FIRST,
937 int num_val =
ALL)
const;
939 void addarr (
const char* name,
const std::vector<Box>& refd);
963 template <
typename T, std::
size_t N>
964 void get (
const char* name, std::array<T,N>& ref)
const {
968 for (std::size_t i = 0; i < N; ++i) {
973 template <
typename T, std::
size_t N>
974 int query (
const char* name, std::array<T,N>& ref)
const {
976 int exist = this->
queryarr(name, v);
979 for (std::size_t i = 0; i < N; ++i) {
992 template <typename T, std::enable_if_t<!IsStdVector<T>::value,
int> = 0>
994 int exist = this->
query(name, ref);
996 this->
add(name, ref);
1002 int exist = this->
query(name, ref);
1003 if (!exist && !ref.empty()) {
1004 this->
add(name, ref);
1018 template <
typename T>
1020 std::vector<T> empty;
1021 int exist = this->
queryarr(name, empty);
1023 ref = std::move(empty);
1025 if (!exist && !ref.empty()) {
1037 template <
typename T>
1038 int queryAdd (
const char* name, std::vector<T>& ref,
int num_val) {
1039 int exist = this->
queryarr(name, ref, 0, num_val);
1052 template <
typename T, std::
size_t N>
1053 int queryAdd (
const char* name, std::array<T,N>& ref) {
1055 int exist = this->
queryarr(name, v);
1058 for (std::size_t i = 0; i < N; ++i) {
1063 for (std::size_t i = 0; i < N; ++i) {
1094 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1095 std::is_same_v<T,
long> ||
1096 std::is_same_v<T,
long long> ||
1097 std::is_same_v<T,
float> ||
1098 std::is_same_v<T,
double>,
int> = 0>
1102 if (
int(ref.size()) < nvals) { ref.resize(nvals); }
1115 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1116 std::is_same_v<T,
long> ||
1117 std::is_same_v<T,
long long> ||
1118 std::is_same_v<T,
float> ||
1119 std::is_same_v<T,
double>,
int> = 0>
1124 this->
add(name, ref);
1134 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1135 std::is_same_v<T,
long> ||
1136 std::is_same_v<T,
long long> ||
1137 std::is_same_v<T,
float> ||
1138 std::is_same_v<T,
double>,
int> = 0>
1143 amrex::Error(std::string(
"ParmParse::getWithParser: failed to get ")+name);
1152 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1153 std::is_same_v<T,
long> ||
1154 std::is_same_v<T,
long long> ||
1155 std::is_same_v<T,
float> ||
1156 std::is_same_v<T,
double>,
int> = 0>
1161 amrex::Error(std::string(
"ParmParse::getarrWithParser: failed to get ")+name);
1170 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1171 std::is_same_v<T,
long> ||
1172 std::is_same_v<T,
long long> ||
1173 std::is_same_v<T,
float> ||
1174 std::is_same_v<T,
double>,
int> = 0>
1179 amrex::Error(std::string(
"ParmParse::getarrWithParser: failed to get ")+name);
1188 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1189 std::is_same_v<T,
long> ||
1190 std::is_same_v<T,
long long> ||
1191 std::is_same_v<T,
float> ||
1192 std::is_same_v<T,
double>,
int> = 0>
1193 T
eval (std::string
const& expr)
const
1195 if constexpr (std::is_integral_v<T>) {
1198 return static_cast<T
>(exe());
1200 auto const parser = this->
makeParser(expr, {});
1202 return static_cast<T
>(exe());
1212 template <
typename T>
1213 int query (
const char* new_name,
const char* old_name, T& ref)
1215 return (this->
query(new_name, ref) ||
1216 this->
query(old_name, ref));
1226 template <
typename T>
1227 void get (
const char* new_name,
const char* old_name, T& ref)
1229 auto exist = this->
query(new_name, old_name, ref);
1232 << new_name <<
" and " << old_name <<
'\n';
1246 template <
typename T,
typename ET = amrex_enum_traits<T>,
1247 std::enable_if_t<ET::value,
int> = 0>
1251 int exist = this->
query(name, s, ival);
1254 ref = amrex::getEnum<T>(s);
1257 amrex::Print() <<
"amrex::ParmParse::query (input name: "
1274 template <
typename T,
typename ET = amrex_enum_traits<T>,
1275 std::enable_if_t<ET::value,
int> = 0>
1276 void get (
const char* name, T& ref,
int ival =
FIRST)
const
1279 this->
get(name, s, ival);
1281 ref = amrex::getEnum<T>(s);
1284 amrex::Print() <<
"amrex::ParmParse::get (input name: "
1292 template <
typename T,
typename ET = amrex_enum_traits<T>,
1293 std::enable_if_t<ET::value,
int> = 0>
1295 std::vector<T>& ref,
1296 int start_ix =
FIRST,
1297 int num_val =
ALL)
const
1299 std::vector<std::string> s;
1300 int exist = this->
queryarr(name, s, start_ix, num_val);
1302 ref.resize(s.size());
1303 for (std::size_t i = 0; i < s.size(); ++i) {
1305 ref[i] = amrex::getEnum<T>(s[i]);
1308 amrex::Print() <<
"amrex::ParmParse::queryarr (input name: "
1319 template <
typename T,
typename ET = amrex_enum_traits<T>,
1320 std::enable_if_t<ET::value,
int> = 0>
1322 std::vector<T>& ref,
1323 int start_ix =
FIRST,
1324 int num_val =
ALL)
const
1326 std::vector<std::string> s;
1327 this->
getarr(name, s, start_ix, num_val);
1328 ref.resize(s.size());
1329 for (std::size_t i = 0; i < s.size(); ++i) {
1331 ref[i] = amrex::getEnum<T>(s[i]);
1334 amrex::Print() <<
"amrex::ParmParse::getarr (input name: "
1352 template <
typename T,
typename ET = amrex_enum_traits<T>,
1353 std::enable_if_t<ET::value,
int> = 0>
1357 int exist = this->
query(name, s, ival);
1360 ref = amrex::getEnumCaseInsensitive<T>(s);
1363 amrex::Print() <<
"amrex::ParmParse::query_enum_case_insensitive (input name: "
1382 template <
typename T,
typename ET = amrex_enum_traits<T>,
1383 std::enable_if_t<ET::value,
int> = 0>
1388 std::string msg(
"get_enum_case_insensitive(\"");
1389 msg.append(name).append(
"\",").append(amrex::getEnumClassName<T>())
1390 .append(
"&) failed.");
1407 template <
typename T,
typename ET = amrex_enum_traits<T>,
1408 std::enable_if_t<ET::value,
int> = 0>
1410 int ival =
FIRST)
const
1413 int exist = this->
query(name, s, ival);
1416 s.erase(std::remove_if(s.begin(), s.end(),
1417 [&] (
auto const& c) {
1418 return ignores.find(c) != std::string_view::npos; }),
1420 ref = amrex::getEnumCaseInsensitive<T>(s);
1423 amrex::Print() <<
"amrex::ParmParse::query_enum_sloppy (input name: "
1444 template <
typename T,
typename ET = amrex_enum_traits<T>,
1445 std::enable_if_t<ET::value,
int> = 0>
1447 int ival =
FIRST)
const
1451 std::string msg(
"get_enum_sloppy(\"");
1452 msg.append(name).append(
"\",").append(amrex::getEnumClassName<T>())
1453 .append(
"&) failed.");
1466 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1473 if (std::is_integral_v<value_type>) {
1474 dref = std::round(dref);
1476 auto vref =
static_cast<value_type
>(dref);
1477 if constexpr (std::is_integral_v<value_type> && !std::is_same_v<value_type,bool>) {
1478 if (
static_cast<double>(vref) != dref) {
1495 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1499 std::vector<double> dref(nvals);
1502 for (
int i = 0; i < nvals; ++i) {
1503 if (std::is_integral_v<value_type>) {
1504 dref[i] = std::round(dref[i]);
1506 auto vref =
static_cast<value_type
>(dref[i]);
1507 if constexpr (std::is_integral_v<value_type> && !std::is_same_v<value_type,bool>) {
1508 if (
static_cast<double>(vref) != dref[i]) {
1509 amrex::Abort(
"ParmParse:: queryarrAsDouble is not safe");
1526 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1531 amrex::Error(std::string(
"ParmParse::getAsDouble: failed to get ")+name);
1543 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1548 amrex::Error(std::string(
"ParmParse::getarrAsDouble: failed to get ")+name);
1553 int remove (
const char* name);
1574 static void Initialize (
int argc,
char** argv,
const char* parfile);
1588 static void dumpTable (std::ostream& os,
bool prettyPrint =
false);
1595 static void addfile (std::string
const& filename);
1600 [[nodiscard]]
static bool hasUnusedInputs (
const std::string& prefix = std::string());
1603 [[nodiscard]]
static std::vector<std::string>
getUnusedInputs (
const std::string& prefix = std::string());
1606 [[nodiscard]]
static std::set<std::string>
getEntries (
const std::string& prefix = std::string());
1613 std::vector<std::vector<std::string>>
m_vals;
1616 using Table = std::unordered_map<std::string, PP_entry>;
1625 [[nodiscard]] std::string
prefixedName (
const std::string_view& str)
const;
#define AMREX_ALWAYS_ASSERT(EX)
Definition: AMReX_BLassert.H:50
Definition: AMReX_IParser.H:58
IParserExecutor< N > compileHost() const
This compiles for CPU only.
Definition: AMReX_IParser.H:110
Parse Parameters From Command Line and Input Files.
Definition: AMReX_ParmParse.H:320
bool contains(const char *name) const
Returns true if name is in table.
Definition: AMReX_ParmParse.cpp:1915
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 u...
Definition: AMReX_ParmParse.cpp:2009
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...
Definition: AMReX_ParmParse.H:1175
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.
Definition: AMReX_ParmParse.cpp:1383
void get(const char *name, bool &ref, int ival=FIRST) const
Same as getkth() but searches for the last occurrence of name.
Definition: AMReX_ParmParse.cpp:1292
void get(const char *name, std::array< T, N > &ref) const
Definition: AMReX_ParmParse.H:964
static void prettyPrintTable(std::ostream &os)
Definition: AMReX_ParmParse.cpp:1245
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 si...
Definition: AMReX_ParmParse.cpp:1088
int queryarrWithParser(const char *name, int nvals, std::vector< T > &ref) const
Definition: AMReX_ParmParse.H:1099
static void addfile(std::string const &filename)
Add keys and values from a file to the end of the PP table.
Definition: AMReX_ParmParse.cpp:1063
int queryAsDouble(const char *name, T &ref) const
Query T with Parser, but treat the number as double precision during parsing.
Definition: AMReX_ParmParse.H:1467
int query(const char *name, T &ref, int ival=FIRST) const
. Query enum value using given name.
Definition: AMReX_ParmParse.H:1248
static std::string const FileKeyword
keyword for files to load
Definition: AMReX_ParmParse.H:1621
static std::string ParserPrefix
Definition: AMReX_ParmParse.H:1623
static int Verbose()
Definition: AMReX_ParmParse.cpp:1169
void getAsDouble(const char *name, T &ref) const
Get T with Parser, but treat the number as double precision during parsing.
Definition: AMReX_ParmParse.H:1527
static void SetVerbose(int v)
Definition: AMReX_ParmParse.cpp:1182
void get(const char *new_name, const char *old_name, T &ref)
Get using two names.
Definition: AMReX_ParmParse.H:1227
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.
Definition: AMReX_ParmParse.cpp:1376
int query_enum_sloppy(const char *name, T &ref, std::string_view const &ignores, int ival=FIRST) const
. Query enum value using given name.
Definition: AMReX_ParmParse.H:1409
int queryAdd(const char *name, T &ref)
If name is found, the value in the ParmParse database will be stored in the ref argument....
Definition: AMReX_ParmParse.H:993
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....
Definition: AMReX_ParmParse.H:1038
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.
Definition: AMReX_ParmParse.cpp:1362
static bool hasUnusedInputs(const std::string &prefix=std::string())
Any unused [prefix.]* parameters?
Definition: AMReX_ParmParse.cpp:1120
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 se...
Definition: AMReX_ParmParse.H:1139
int remove(const char *name)
Remove given name from the table.
Definition: AMReX_ParmParse.cpp:1931
Parser makeParser(std::string const &func, Vector< std::string > const &vars) const
Definition: AMReX_ParmParse.cpp:2039
int query(const char *name, std::array< T, N > &ref) const
Definition: AMReX_ParmParse.H:974
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 ...
Definition: AMReX_ParmParse.cpp:1283
void getarrAsDouble(const char *name, int nvals, T *ref) const
Get T array with Parser, but treat the number as double precision during parsing.
Definition: AMReX_ParmParse.H:1544
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().
Definition: AMReX_ParmParse.cpp:1369
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....
Definition: AMReX_ParmParse.H:1019
static bool QueryUnusedInputs()
Definition: AMReX_ParmParse.cpp:1105
void add(const char *name, bool val)
Add a key 'name'with value 'ref' to the end of the PP table.
Definition: AMReX_ParmParse.cpp:1317
T eval(std::string const &expr) const
Definition: AMReX_ParmParse.H:1193
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,...
Definition: AMReX_ParmParse.cpp:1355
static void Finalize()
The destructor. The internal static table will only be deleted if there are no other ParmParse object...
Definition: AMReX_ParmParse.cpp:1188
std::string m_prefix
Definition: AMReX_ParmParse.H:1629
int countname(const std::string &name) const
Returns the number of times the given name (prepended with prefix) appears in the table.
Definition: AMReX_ParmParse.cpp:1899
std::string prefixedName(const std::string_view &str) const
Definition: AMReX_ParmParse.cpp:1049
static void SetParserPrefix(std::string a_prefix)
Set prefix used by math expression Parser.
Definition: AMReX_ParmParse.cpp:1214
static std::vector< std::string > getUnusedInputs(const std::string &prefix=std::string())
Returns unused [prefix.]* parameters.
Definition: AMReX_ParmParse.cpp:1126
int query(const char *name, bool &ref, int ival=FIRST) const
Same as querykth() but searches for the last occurrence of name.
Definition: AMReX_ParmParse.cpp:1309
@ FIRST
Definition: AMReX_ParmParse.H:322
@ LAST
Definition: AMReX_ParmParse.H:322
@ ALL
Definition: AMReX_ParmParse.H:322
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.
Definition: AMReX_ParmParse.H:1294
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 ...
Definition: AMReX_ParmParse.cpp:1979
const Table & table() const
Definition: AMReX_ParmParse.H:1618
int query(const char *new_name, const char *old_name, T &ref)
Definition: AMReX_ParmParse.H:1213
void get_enum_case_insensitive(const char *name, T &ref, int ival=FIRST) const
. Get enum value using given name.
Definition: AMReX_ParmParse.H:1384
Table * m_table
Definition: AMReX_ParmParse.H:1631
std::string m_parser_prefix
Definition: AMReX_ParmParse.H:1630
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 th...
Definition: AMReX_ParmParse.cpp:1271
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,...
Definition: AMReX_ParmParse.cpp:1300
int queryAdd(const char *name, std::string &ref)
Definition: AMReX_ParmParse.H:1001
static void dumpTable(std::ostream &os, bool prettyPrint=false)
Write the contents of the table in ASCII to the ostream.
Definition: AMReX_ParmParse.cpp:1220
int queryarrAsDouble(const char *name, int nvals, T *ref) const
Query T array with Parser, but treat the number as double precision during parsing.
Definition: AMReX_ParmParse.H:1496
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...
Definition: AMReX_ParmParse.H:1157
void get(const char *name, T &ref, int ival=FIRST) const
. Get enum value using given name.
Definition: AMReX_ParmParse.H:1276
static std::set< std::string > getEntries(const std::string &prefix=std::string())
Returns [prefix.]* parameters.
Definition: AMReX_ParmParse.cpp:1156
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 ...
Definition: AMReX_ParmParse.H:1120
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.
Definition: AMReX_ParmParse.H:1321
int query_enum_case_insensitive(const char *name, T &ref, int ival=FIRST) const
. Query enum value using given name.
Definition: AMReX_ParmParse.H:1354
void get_enum_sloppy(const char *name, T &ref, std::string_view const &ignores, int ival=FIRST) const
. Get enum value using given name.
Definition: AMReX_ParmParse.H:1446
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...
Definition: AMReX_ParmParse.cpp:40
std::unordered_map< std::string, PP_entry > Table
Definition: AMReX_ParmParse.H:1616
IParser makeIParser(std::string const &func, Vector< std::string > const &vars) const
Definition: AMReX_ParmParse.cpp:2046
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....
Definition: AMReX_ParmParse.H:1053
Definition: AMReX_Parser.H:68
ParserExecutor< N > compileHost() const
This compiles for CPU only.
Definition: AMReX_Parser.H:123
This class provides the user with a few print options.
Definition: AMReX_Print.H:35
A Real vector in SpaceDim-dimensional space.
Definition: AMReX_RealVect.H:32
typename ArithmeticOptional_TT< T >::value_type underlying_type_t
Definition: AMReX_ParmParse.H:54
constexpr bool IsArithmeticOptional_v
Definition: AMReX_ParmParse.H:51
Definition: AMReX_Amr.cpp:49
std::ostream & ErrorStream()
Definition: AMReX.cpp:878
BoxND< AMREX_SPACEDIM > Box
Definition: AMReX_BaseFwd.H:27
IntVectND< AMREX_SPACEDIM > IntVect
Definition: AMReX_BaseFwd.H:30
AMREX_GPU_HOST_DEVICE IntVectND(const Array< int, dim > &) -> IntVectND< dim >
void Error(const std::string &msg)
Print out message to cerr and exit via amrex::Abort().
Definition: AMReX.cpp:219
int Verbose() noexcept
Definition: AMReX.cpp:164
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
Definition: AMReX_ParmParse.H:1608
std::vector< std::vector< std::string > > m_vals
Definition: AMReX_ParmParse.H:1613
Long m_count
Definition: AMReX_ParmParse.H:1614
T value_type
Definition: AMReX_ParmParse.H:39
T value_type
Definition: AMReX_ParmParse.H:47
Definition: AMReX_ParmParse.H:33