1#ifndef AMREX_PARMPARSE_H_
2#define AMREX_PARMPARSE_H_
3#include <AMReX_Config.H>
21#include <unordered_map>
29using Box = BoxND<AMREX_SPACEDIM>;
32using IntVect = IntVectND<AMREX_SPACEDIM>;
36 template <
class T,
class Enable =
void>
48 std::enable_if_t<std::is_arithmetic_v<T>>>
334 explicit ParmParse (std::string prefix = std::string(),
335 std::string parser_prefix = std::string());
338 [[nodiscard]]
bool contains (
const char* name)
const;
344 [[nodiscard]]
int countval (
const char* name,
int n =
LAST)
const;
349 [[nodiscard]]
int countname (
const std::string& name)
const;
361 void getkth (
const char* name,
364 int ival =
FIRST)
const;
366 void get (
const char* name,
368 int ival =
FIRST)
const;
379 int ival =
FIRST)
const;
381 int query (
const char* name,
383 int ival =
FIRST)
const;
385 void add (
const char* name,
bool val);
395 void getkth (
const char* name,
398 int ival =
FIRST)
const;
401 void get (
const char* name,
403 int ival =
FIRST)
const;
414 int ival =
FIRST)
const;
416 int query (
const char* name,
418 int ival =
FIRST)
const;
420 void add (
const char* name,
int val);
430 void getkth (
const char* name,
433 int ival =
FIRST)
const;
435 void get (
const char* name,
437 int ival =
FIRST)
const;
448 int ival =
FIRST)
const;
450 int query (
const char* name,
452 int ival =
FIRST)
const;
454 void add (
const char* name,
long val);
464 void getkth (
const char* name,
467 int ival =
FIRST)
const;
469 void get (
const char* name,
471 int ival =
FIRST)
const;
482 int ival =
FIRST)
const;
484 int query (
const char* name,
486 int ival =
FIRST)
const;
488 void add (
const char* name,
long long val);
498 void getkth (
const char* name,
501 int ival =
FIRST)
const;
503 void get (
const char* name,
505 int ival =
FIRST)
const;
516 int ival =
FIRST)
const;
518 int query (
const char* name,
520 int ival =
FIRST)
const;
522 void add (
const char* name,
float val);
532 void getkth (
const char* name,
535 int ival =
FIRST)
const;
537 void get (
const char* name,
539 int ival =
FIRST)
const;
550 int ival =
FIRST)
const;
552 int query (
const char* name,
554 int ival =
FIRST)
const;
556 void add (
const char* name,
double val);
566 void getkth (
const char* name,
569 int ival =
FIRST)
const;
572 void get (
const char* name,
574 int ival =
FIRST)
const;
585 int ival =
FIRST)
const;
587 int query (
const char* name,
589 int ival =
FIRST)
const;
591 void add (
const char* name,
const std::string& val);
602 void getline (
const char* name, std::string& ref)
const;
612 int queryline (
const char* name, std::string& ref)
const;
623 void getkth (
const char* name,
626 int ival =
FIRST)
const;
628 void get (
const char* name,
630 int ival =
FIRST)
const;
641 int ival =
FIRST)
const;
643 int query (
const char* name,
645 int ival =
FIRST)
const;
647 void add (
const char* name,
const IntVect& val);
657 void getkth (
const char* name,
660 int ival =
FIRST)
const;
662 void get (
const char* name,
664 int ival =
FIRST)
const;
675 int ival =
FIRST)
const;
677 int query (
const char* name,
679 int ival =
FIRST)
const;
681 void add (
const char* name,
const Box& val);
696 std::vector<int>& ref,
697 int start_ix =
FIRST,
698 int num_val =
ALL)
const;
700 void getarr (
const char* name,
701 std::vector<int>& ref,
702 int start_ix =
FIRST,
703 int num_val =
ALL)
const;
707 std::vector<int>& ref,
708 int start_ix =
FIRST,
709 int num_val =
ALL)
const;
712 std::vector<int>& ref,
713 int start_ix =
FIRST,
714 int num_val =
ALL)
const;
716 void addarr (
const char* name,
const std::vector<int>& ref);
732 std::vector<long>& ref,
733 int start_ix =
FIRST,
734 int num_val =
ALL)
const;
736 void getarr (
const char* name,
737 std::vector<long>& ref,
738 int start_ix =
FIRST,
739 int num_val =
ALL)
const;
743 std::vector<long>& ref,
744 int start_ix =
FIRST,
745 int num_val =
ALL)
const;
748 std::vector<long>& ref,
749 int start_ix =
FIRST,
750 int num_val =
ALL)
const;
752 void addarr (
const char* name,
const std::vector<long>& ref);
768 std::vector<long long>& ref,
769 int start_ix =
FIRST,
770 int num_val =
ALL)
const;
772 void getarr (
const char* name,
773 std::vector<long long>& ref,
774 int start_ix =
FIRST,
775 int num_val =
ALL)
const;
779 std::vector<long long>& ref,
780 int start_ix =
FIRST,
781 int num_val =
ALL)
const;
784 std::vector<long long>& ref,
785 int start_ix =
FIRST,
786 int num_val =
ALL)
const;
788 void addarr (
const char* name,
const std::vector<long long>& ref);
804 std::vector<float>& ref,
805 int start_ix =
FIRST,
806 int num_val =
ALL)
const;
808 void getarr (
const char* name,
809 std::vector<float>& ref,
810 int start_ix =
FIRST,
811 int num_val =
ALL)
const;
815 std::vector<float>& ref,
816 int start_ix =
FIRST,
817 int num_val =
ALL)
const;
820 std::vector<float>& ref,
821 int start_ix =
FIRST,
822 int num_val =
ALL)
const;
824 void addarr (
const char* name,
const std::vector<float>& ref);
839 std::vector<double>& ref,
840 int start_ix =
FIRST,
841 int num_val =
ALL)
const;
843 void getarr (
const char* name,
844 std::vector<double>& ref,
845 int start_ix =
FIRST,
846 int num_val =
ALL)
const;
850 std::vector<double>& ref,
851 int start_ix =
FIRST,
852 int num_val =
ALL)
const;
855 std::vector<double>& ref,
856 int start_ix =
FIRST,
857 int num_val =
ALL)
const;
859 void addarr (
const char* name,
const std::vector<double>& ref);
874 std::vector<std::string>& ref,
875 int start_ix =
FIRST,
876 int num_val =
ALL)
const;
878 void getarr (
const char* name,
879 std::vector<std::string>& ref,
880 int start_ix =
FIRST,
881 int num_val =
ALL)
const;
885 std::vector<std::string>& ref,
886 int start_ix =
FIRST,
887 int num_val =
ALL)
const;
890 std::vector<std::string>& ref,
891 int start_ix =
FIRST,
892 int num_val =
ALL)
const;
894 void addarr (
const char* name,
const std::vector<std::string>& ref);
909 std::vector<IntVect>& ref,
910 int start_ix =
FIRST,
911 int num_val =
ALL)
const;
913 void getarr (
const char* name,
914 std::vector<IntVect>& ref,
915 int start_ix =
FIRST,
916 int num_val =
ALL)
const;
920 std::vector<IntVect>& ref,
921 int start_ix =
FIRST,
922 int num_val =
ALL)
const;
925 std::vector<IntVect>& ref,
926 int start_ix =
FIRST,
927 int num_val =
ALL)
const;
929 void addarr (
const char* name,
const std::vector<IntVect>& ref);
944 std::vector<Box>& ref,
945 int start_ix =
FIRST,
946 int num_val =
ALL)
const;
948 void getarr (
const char* name,
949 std::vector<Box>& ref,
950 int start_ix =
FIRST,
951 int num_val =
ALL)
const;
955 std::vector<Box>& ref,
956 int start_ix =
FIRST,
957 int num_val =
ALL)
const;
960 std::vector<Box>& ref,
961 int start_ix =
FIRST,
962 int num_val =
ALL)
const;
964 void addarr (
const char* name,
const std::vector<Box>& refd);
988 template <
typename T, std::
size_t N>
989 void get (
const char* name, std::array<T,N>& ref)
const {
993 for (std::size_t i = 0; i < N; ++i) {
998 template <
typename T, std::
size_t N>
999 int query (
const char* name, std::array<T,N>& ref)
const {
1001 int exist = this->
queryarr(name, v);
1004 for (std::size_t i = 0; i < N; ++i) {
1017 template <typename T, std::enable_if_t<!IsStdVector<T>::value,
int> = 0>
1019 int exist = this->
query(name, ref);
1021 this->
add(name, ref);
1027 int exist = this->
query(name, ref);
1028 if (!exist && !ref.empty()) {
1029 this->
add(name, ref);
1043 template <
typename T>
1045 std::vector<T> empty;
1046 int exist = this->
queryarr(name, empty);
1048 ref = std::move(empty);
1050 if (!exist && !ref.empty()) {
1062 template <
typename T>
1063 int queryAdd (
const char* name, std::vector<T>& ref,
int num_val) {
1064 int exist = this->
queryarr(name, ref, 0, num_val);
1077 template <
typename T, std::
size_t N>
1078 int queryAdd (
const char* name, std::array<T,N>& ref) {
1080 int exist = this->
queryarr(name, v);
1083 for (std::size_t i = 0; i < N; ++i) {
1088 for (std::size_t i = 0; i < N; ++i) {
1119 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1120 std::is_same_v<T,
long> ||
1121 std::is_same_v<T,
long long> ||
1122 std::is_same_v<T,
float> ||
1123 std::is_same_v<T,
double>,
int> = 0>
1127 if (
int(ref.size()) < nvals) { ref.resize(nvals); }
1140 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1141 std::is_same_v<T,
long> ||
1142 std::is_same_v<T,
long long> ||
1143 std::is_same_v<T,
float> ||
1144 std::is_same_v<T,
double>,
int> = 0>
1149 this->
add(name, ref);
1159 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1160 std::is_same_v<T,
long> ||
1161 std::is_same_v<T,
long long> ||
1162 std::is_same_v<T,
float> ||
1163 std::is_same_v<T,
double>,
int> = 0>
1168 amrex::Error(std::string(
"ParmParse::getWithParser: failed to get ")+name);
1177 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1178 std::is_same_v<T,
long> ||
1179 std::is_same_v<T,
long long> ||
1180 std::is_same_v<T,
float> ||
1181 std::is_same_v<T,
double>,
int> = 0>
1186 amrex::Error(std::string(
"ParmParse::getarrWithParser: failed to get ")+name);
1195 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1196 std::is_same_v<T,
long> ||
1197 std::is_same_v<T,
long long> ||
1198 std::is_same_v<T,
float> ||
1199 std::is_same_v<T,
double>,
int> = 0>
1204 amrex::Error(std::string(
"ParmParse::getarrWithParser: failed to get ")+name);
1213 template <
typename T, std::enable_if_t<std::is_same_v<T,
int> ||
1214 std::is_same_v<T,
long> ||
1215 std::is_same_v<T,
long long> ||
1216 std::is_same_v<T,
float> ||
1217 std::is_same_v<T,
double>,
int> = 0>
1218 T
eval (std::string
const& expr)
const
1220 if constexpr (std::is_integral_v<T>) {
1223 return static_cast<T
>(exe());
1225 auto const parser = this->
makeParser(expr, {});
1227 return static_cast<T
>(exe());
1237 template <
typename T>
1238 int query (
const char* new_name,
const char* old_name, T& ref)
1240 return (this->
query(new_name, ref) ||
1241 this->
query(old_name, ref));
1251 template <
typename T>
1252 void get (
const char* new_name,
const char* old_name, T& ref)
1254 auto exist = this->
query(new_name, old_name, ref);
1257 << new_name <<
" and " << old_name <<
'\n';
1271 template <
typename T,
typename ET = amrex_enum_traits<T>,
1272 std::enable_if_t<ET::value,
int> = 0>
1276 int exist = this->
query(name, s, ival);
1279 ref = amrex::getEnum<T>(s);
1282 amrex::Print() <<
"amrex::ParmParse::query (input name: "
1299 template <
typename T,
typename ET = amrex_enum_traits<T>,
1300 std::enable_if_t<ET::value,
int> = 0>
1301 void get (
const char* name, T& ref,
int ival =
FIRST)
const
1304 this->
get(name, s, ival);
1306 ref = amrex::getEnum<T>(s);
1309 amrex::Print() <<
"amrex::ParmParse::get (input name: "
1317 template <
typename T,
typename ET = amrex_enum_traits<T>,
1318 std::enable_if_t<ET::value,
int> = 0>
1320 std::vector<T>& ref,
1321 int start_ix =
FIRST,
1322 int num_val =
ALL)
const
1324 std::vector<std::string> s;
1325 int exist = this->
queryarr(name, s, start_ix, num_val);
1327 ref.resize(s.size());
1328 for (std::size_t i = 0; i < s.size(); ++i) {
1330 ref[i] = amrex::getEnum<T>(s[i]);
1333 amrex::Print() <<
"amrex::ParmParse::queryarr (input name: "
1344 template <
typename T,
typename ET = amrex_enum_traits<T>,
1345 std::enable_if_t<ET::value,
int> = 0>
1347 std::vector<T>& ref,
1348 int start_ix =
FIRST,
1349 int num_val =
ALL)
const
1351 std::vector<std::string> s;
1352 this->
getarr(name, s, start_ix, num_val);
1353 ref.resize(s.size());
1354 for (std::size_t i = 0; i < s.size(); ++i) {
1356 ref[i] = amrex::getEnum<T>(s[i]);
1359 amrex::Print() <<
"amrex::ParmParse::getarr (input name: "
1377 template <
typename T,
typename ET = amrex_enum_traits<T>,
1378 std::enable_if_t<ET::value,
int> = 0>
1382 int exist = this->
query(name, s, ival);
1385 ref = amrex::getEnumCaseInsensitive<T>(s);
1388 amrex::Print() <<
"amrex::ParmParse::query_enum_case_insensitive (input name: "
1407 template <
typename T,
typename ET = amrex_enum_traits<T>,
1408 std::enable_if_t<ET::value,
int> = 0>
1413 std::string msg(
"get_enum_case_insensitive(\"");
1414 msg.append(name).append(
"\",").append(amrex::getEnumClassName<T>())
1415 .append(
"&) failed.");
1432 template <
typename T,
typename ET = amrex_enum_traits<T>,
1433 std::enable_if_t<ET::value,
int> = 0>
1435 int ival =
FIRST)
const
1438 int exist = this->
query(name, s, ival);
1441 s.erase(std::remove_if(s.begin(), s.end(),
1442 [&] (
auto const& c) {
1443 return ignores.find(c) != std::string_view::npos; }),
1445 ref = amrex::getEnumCaseInsensitive<T>(s);
1448 amrex::Print() <<
"amrex::ParmParse::query_enum_sloppy (input name: "
1469 template <
typename T,
typename ET = amrex_enum_traits<T>,
1470 std::enable_if_t<ET::value,
int> = 0>
1472 int ival =
FIRST)
const
1476 std::string msg(
"get_enum_sloppy(\"");
1477 msg.append(name).append(
"\",").append(amrex::getEnumClassName<T>())
1478 .append(
"&) failed.");
1491 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1498 if (std::is_integral_v<value_type>) {
1499 dref = std::round(dref);
1501 auto vref =
static_cast<value_type
>(dref);
1502 if constexpr (std::is_integral_v<value_type> && !std::is_same_v<value_type,bool>) {
1503 if (
static_cast<double>(vref) != dref) {
1520 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1524 std::vector<double> dref(nvals);
1527 for (
int i = 0; i < nvals; ++i) {
1528 if (std::is_integral_v<value_type>) {
1529 dref[i] = std::round(dref[i]);
1531 auto vref =
static_cast<value_type
>(dref[i]);
1532 if constexpr (std::is_integral_v<value_type> && !std::is_same_v<value_type,bool>) {
1533 if (
static_cast<double>(vref) != dref[i]) {
1534 amrex::Abort(
"ParmParse:: queryarrAsDouble is not safe");
1551 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1556 amrex::Error(std::string(
"ParmParse::getAsDouble: failed to get ")+name);
1568 template <
typename T, std::enable_if_t<ppdetail::IsArithmeticOptional_v<T>,
int> = 0>
1573 amrex::Error(std::string(
"ParmParse::getarrAsDouble: failed to get ")+name);
1578 int remove (
const char* name);
1599 static void Initialize (
int argc,
char** argv,
const char* parfile);
1613 static void dumpTable (std::ostream& os,
bool prettyPrint =
false);
1620 static void addfile (std::string
const& filename);
1625 [[nodiscard]]
static bool hasUnusedInputs (
const std::string& prefix = std::string());
1628 [[nodiscard]]
static std::vector<std::string>
getUnusedInputs (
const std::string& prefix = std::string());
1631 [[nodiscard]]
static std::set<std::string>
getEntries (
const std::string& prefix = std::string());
1638 std::vector<std::vector<std::string>>
m_vals;
1652 using Table = std::unordered_map<std::string, PP_entry>;
1661 [[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:111
Parse Parameters From Command Line and Input Files.
Definition AMReX_ParmParse.H:324
bool contains(const char *name) const
Returns true if name is in table.
Definition AMReX_ParmParse.cpp:1947
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:2041
int queryAddWithParser(const char *name, T &ref)
Query with Parser. If name is found, this uses amrex::Parser to parse the entire list of empty space ...
Definition AMReX_ParmParse.H:1145
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:1200
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:1396
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:1305
void get(const char *name, std::array< T, N > &ref) const
Definition AMReX_ParmParse.H:989
static void prettyPrintTable(std::ostream &os)
Definition AMReX_ParmParse.cpp:1258
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:1100
int queryarrWithParser(const char *name, int nvals, std::vector< T > &ref) const
Definition AMReX_ParmParse.H:1124
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:1075
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:1492
int query(const char *name, T &ref, int ival=FIRST) const
. Query enum value using given name.
Definition AMReX_ParmParse.H:1273
static std::string const FileKeyword
keyword for files to load
Definition AMReX_ParmParse.H:1657
static std::string ParserPrefix
Definition AMReX_ParmParse.H:1659
static int Verbose()
Definition AMReX_ParmParse.cpp:1181
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:1552
static void SetVerbose(int v)
Definition AMReX_ParmParse.cpp:1194
void get(const char *new_name, const char *old_name, T &ref)
Get using two names.
Definition AMReX_ParmParse.H:1252
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:1389
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:1434
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:1018
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:1063
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:1375
static bool hasUnusedInputs(const std::string &prefix=std::string())
Any unused [prefix.]* parameters?
Definition AMReX_ParmParse.cpp:1132
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:1164
int remove(const char *name)
Remove given name from the table.
Definition AMReX_ParmParse.cpp:1963
Parser makeParser(std::string const &func, Vector< std::string > const &vars) const
Definition AMReX_ParmParse.cpp:2071
int query(const char *name, std::array< T, N > &ref) const
Definition AMReX_ParmParse.H:999
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:1296
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:1569
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:1382
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:1044
static bool QueryUnusedInputs()
Definition AMReX_ParmParse.cpp:1117
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:1330
T eval(std::string const &expr) const
Definition AMReX_ParmParse.H:1218
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:1368
static void Finalize()
The destructor. The internal static table will only be deleted if there are no other ParmParse object...
Definition AMReX_ParmParse.cpp:1200
std::string m_prefix
Definition AMReX_ParmParse.H:1665
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:1931
void getline(const char *name, std::string &ref) const
Definition AMReX_ParmParse.cpp:1908
const Table & table() const
Definition AMReX_ParmParse.H:1654
std::string prefixedName(const std::string_view &str) const
Definition AMReX_ParmParse.cpp:1061
static void SetParserPrefix(std::string a_prefix)
Set prefix used by math expression Parser.
Definition AMReX_ParmParse.cpp:1227
static std::vector< std::string > getUnusedInputs(const std::string &prefix=std::string())
Returns unused [prefix.]* parameters.
Definition AMReX_ParmParse.cpp:1138
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:1322
@ FIRST
Definition AMReX_ParmParse.H:326
@ LAST
Definition AMReX_ParmParse.H:326
@ ALL
Definition AMReX_ParmParse.H:326
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:1319
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:2011
int query(const char *new_name, const char *old_name, T &ref)
Definition AMReX_ParmParse.H:1238
void get_enum_case_insensitive(const char *name, T &ref, int ival=FIRST) const
. Get enum value using given name.
Definition AMReX_ParmParse.H:1409
Table * m_table
Definition AMReX_ParmParse.H:1667
int queryline(const char *name, std::string &ref) const
Definition AMReX_ParmParse.cpp:1916
std::string m_parser_prefix
Definition AMReX_ParmParse.H:1666
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:1284
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:1313
int queryAdd(const char *name, std::string &ref)
Definition AMReX_ParmParse.H:1026
static void dumpTable(std::ostream &os, bool prettyPrint=false)
Write the contents of the table in ASCII to the ostream.
Definition AMReX_ParmParse.cpp:1233
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:1521
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:1182
void get(const char *name, T &ref, int ival=FIRST) const
. Get enum value using given name.
Definition AMReX_ParmParse.H:1301
static std::set< std::string > getEntries(const std::string &prefix=std::string())
Returns [prefix.]* parameters.
Definition AMReX_ParmParse.cpp:1168
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:1346
int query_enum_case_insensitive(const char *name, T &ref, int ival=FIRST) const
. Query enum value using given name.
Definition AMReX_ParmParse.H:1379
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:1471
std::unordered_map< std::string, PP_entry > Table
Definition AMReX_ParmParse.H:1652
IParser makeIParser(std::string const &func, Vector< std::string > const &vars) const
Definition AMReX_ParmParse.cpp:2078
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:1078
Definition AMReX_Parser.H:68
ParserExecutor< N > compileHost() const
This compiles for CPU only.
Definition AMReX_Parser.H:124
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
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:27
typename ArithmeticOptional_TT< T >::value_type underlying_type_t
Definition AMReX_ParmParse.H:58
constexpr bool IsArithmeticOptional_v
Definition AMReX_ParmParse.H:55
Definition AMReX_Amr.cpp:49
std::ostream & ErrorStream()
Definition AMReX.cpp:905
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:224
int Verbose() noexcept
Definition AMReX.cpp:169
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:230
Definition AMReX_ParmParse.H:1633
std::variant< std::string *, bool *, int *, long *, long long *, amrex::IntVect *, amrex::Box *, float *, double * > m_typehint
Definition AMReX_ParmParse.H:1650
std::vector< std::vector< std::string > > m_vals
Definition AMReX_ParmParse.H:1638
Long m_count
Definition AMReX_ParmParse.H:1639
T value_type
Definition AMReX_ParmParse.H:43
T value_type
Definition AMReX_ParmParse.H:51
Definition AMReX_ParmParse.H:37