aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils/WarpXUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Utils/WarpXUtil.cpp')
-rw-r--r--Source/Utils/WarpXUtil.cpp129
1 files changed, 0 insertions, 129 deletions
diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp
index 9ab96873a..afe8b7daa 100644
--- a/Source/Utils/WarpXUtil.cpp
+++ b/Source/Utils/WarpXUtil.cpp
@@ -388,135 +388,6 @@ parseStringtoInt(std::string str, std::string name)
return ival;
}
-// Overloads for float/double instead of amrex::Real to allow makeParser() to query for
-// my_constants as double even in single precision mode
-// Always parsing in double precision avoids potential overflows that may occur when parsing user's
-// expressions because of the limited range of exponentials in single precision
-int
-queryWithParser (const amrex::ParmParse& a_pp, char const * const str, float& val)
-{
- // call amrex::ParmParse::query, check if the user specified str.
- std::string tmp_str;
- int is_specified = a_pp.query(str, tmp_str);
- if (is_specified)
- {
- // If so, create a parser object and apply it to the value provided by the user.
- std::string str_val;
- Store_parserString(a_pp, str, str_val);
- val = static_cast<float>(parseStringtoReal(str_val));
- }
- // return the same output as amrex::ParmParse::query
- return is_specified;
-}
-
-void
-getWithParser (const amrex::ParmParse& a_pp, char const * const str, float& val)
-{
- // If so, create a parser object and apply it to the value provided by the user.
- std::string str_val;
- Store_parserString(a_pp, str, str_val);
- val = static_cast<float>(parseStringtoReal(str_val));
-}
-
-int
-queryWithParser (const amrex::ParmParse& a_pp, char const * const str, double& val)
-{
- // call amrex::ParmParse::query, check if the user specified str.
- std::string tmp_str;
- int is_specified = a_pp.query(str, tmp_str);
- if (is_specified)
- {
- // If so, create a parser object and apply it to the value provided by the user.
- std::string str_val;
- Store_parserString(a_pp, str, str_val);
- val = parseStringtoReal(str_val);
- }
- // return the same output as amrex::ParmParse::query
- return is_specified;
-}
-
-void
-getWithParser (const amrex::ParmParse& a_pp, char const * const str, double& val)
-{
- // If so, create a parser object and apply it to the value provided by the user.
- std::string str_val;
- Store_parserString(a_pp, str, str_val);
- val = parseStringtoReal(str_val);
-}
-
-int
-queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val,
- const int start_ix, const int num_val)
-{
- // call amrex::ParmParse::query, check if the user specified str.
- std::vector<std::string> tmp_str_arr;
- int is_specified = a_pp.queryarr(str, tmp_str_arr, start_ix, num_val);
- if (is_specified)
- {
- // If so, create parser objects and apply them to the values provided by the user.
- int const n = static_cast<int>(tmp_str_arr.size());
- val.resize(n);
- for (int i=0 ; i < n ; i++) {
- val[i] = static_cast<amrex::Real>(parseStringtoReal(tmp_str_arr[i]));
- }
- }
- // return the same output as amrex::ParmParse::query
- return is_specified;
-}
-
-void
-getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val,
- const int start_ix, const int num_val)
-{
- // Create parser objects and apply them to the values provided by the user.
- std::vector<std::string> tmp_str_arr;
- a_pp.getarr(str, tmp_str_arr, start_ix, num_val);
-
- int const n = static_cast<int>(tmp_str_arr.size());
- val.resize(n);
- for (int i=0 ; i < n ; i++) {
- val[i] = static_cast<amrex::Real>(parseStringtoReal(tmp_str_arr[i]));
- }
-}
-
-int queryWithParser (const amrex::ParmParse& a_pp, char const * const str, int& val) {
- amrex::Real rval;
- const int result = queryWithParser(a_pp, str, rval);
- if (result) {
- val = safeCastToInt(std::round(rval), str);
- }
- return result;
-}
-
-void getWithParser (const amrex::ParmParse& a_pp, char const * const str, int& val) {
- amrex::Real rval;
- getWithParser(a_pp, str, rval);
- val = safeCastToInt(std::round(rval), str);
-}
-
-int queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val,
- const int start_ix, const int num_val) {
- std::vector<amrex::Real> rval;
- const int result = queryArrWithParser(a_pp, str, rval, start_ix, num_val);
- if (result) {
- val.resize(rval.size());
- for (unsigned long i = 0 ; i < val.size() ; i++) {
- val[i] = safeCastToInt(std::round(rval[i]), str);
- }
- }
- return result;
-}
-
-void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val,
- const int start_ix, const int num_val) {
- std::vector<amrex::Real> rval;
- getArrWithParser(a_pp, str, rval, start_ix, num_val);
- val.resize(rval.size());
- for (unsigned long i = 0 ; i < val.size() ; i++) {
- val[i] = safeCastToInt(std::round(rval[i]), str);
- }
-}
-
void CheckDims ()
{
// Ensure that geometry.dims is set properly.