diff options
author | 2021-07-13 23:04:31 -0700 | |
---|---|---|
committer | 2021-07-13 23:04:31 -0700 | |
commit | ffb3bb8e0ac21c2489906c1cf51d3f4dae235542 (patch) | |
tree | 8632faa062e3e76bfec4cd85671a56514b18b444 /Source/Utils/WarpXUtil.cpp | |
parent | 40e36e1860015214601d618c9ab847f623328867 (diff) | |
download | WarpX-ffb3bb8e0ac21c2489906c1cf51d3f4dae235542.tar.gz WarpX-ffb3bb8e0ac21c2489906c1cf51d3f4dae235542.tar.zst WarpX-ffb3bb8e0ac21c2489906c1cf51d3f4dae235542.zip |
amrex::Parser (#2063)
* amrex::Parser
Replace WarpXParser with amrex::Parser. Roundoff errors are expected because
of additional optimization in amrex::Parser.
* Reset the Langmuir_multi_psatd_single_precision benchmark due to change in single precision parser
* enable Intel oneAPI CI again
* Update Source/EmbeddedBoundary/WarpXInitEB.cpp
* Replace hard-coded number in ParticleDiag with a constexpr
Diffstat (limited to 'Source/Utils/WarpXUtil.cpp')
-rw-r--r-- | Source/Utils/WarpXUtil.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index 8faa20246..112a66bd6 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -25,6 +25,7 @@ #include <AMReX_MFIter.H> #include <AMReX_MultiFab.H> #include <AMReX_ParmParse.H> +#include <AMReX_Parser.H> #include <algorithm> #include <array> @@ -238,13 +239,13 @@ void Store_parserString(const amrex::ParmParse& pp, std::string query_string, f.clear(); } -WarpXParser makeParser (std::string const& parse_function, std::vector<std::string> const& varnames) +Parser makeParser (std::string const& parse_function, amrex::Vector<std::string> const& varnames) { // Since queryWithParser recursively calls this routine, keep track of symbols // in case an infinite recursion is found (a symbol's value depending on itself). static std::set<std::string> recursive_symbols; - WarpXParser parser(parse_function); + Parser parser(parse_function); parser.registerVariables(varnames); ParmParse pp_my_constants("my_constants"); std::set<std::string> symbols = parser.symbols(); @@ -307,7 +308,9 @@ queryWithParser (const amrex::ParmParse& a_pp, char const * const str, amrex::Re Store_parserString(a_pp, str, str_val); auto parser = makeParser(str_val, {}); - val = parser.eval(); + auto exe = parser.compileHost<0>(); + + val = exe(); } // return the same output as amrex::ParmParse::query return is_specified; @@ -321,7 +324,8 @@ getWithParser (const amrex::ParmParse& a_pp, char const * const str, amrex::Real Store_parserString(a_pp, str, str_val); auto parser = makeParser(str_val, {}); - val = parser.eval(); + auto exe = parser.compileHost<0>(); + val = exe(); } int @@ -338,7 +342,8 @@ queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::v val.resize(n); for (int i=0 ; i < n ; i++) { auto parser = makeParser(tmp_str_arr[i], {}); - val[i] = parser.eval(); + auto exe = parser.compileHost<0>(); + val[i] = exe(); } } // return the same output as amrex::ParmParse::query @@ -356,7 +361,8 @@ getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vec val.resize(n); for (int i=0 ; i < n ; i++) { auto parser = makeParser(tmp_str_arr[i], {}); - val[i] = parser.eval(); + auto exe = parser.compileHost<0>(); + val[i] = exe(); } } @@ -372,7 +378,8 @@ getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vec val.resize(n); for (int i=0 ; i < n ; i++) { auto parser = makeParser(tmp_str_arr[i], {}); - val[i] = parser.eval(); + auto exe = parser.compileHost<0>(); + val[i] = exe(); } } |