diff options
Diffstat (limited to 'Source/Parser/WarpXParser.H')
-rw-r--r-- | Source/Parser/WarpXParser.H | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Source/Parser/WarpXParser.H b/Source/Parser/WarpXParser.H index ffa61e457..8c1d854d8 100644 --- a/Source/Parser/WarpXParser.H +++ b/Source/Parser/WarpXParser.H @@ -6,6 +6,8 @@ #include <string> #include <set> +#include <AMReX_REAL.H> + #include "wp_parser_c.h" #include "wp_parser_y.h" @@ -23,15 +25,15 @@ public: ~WarpXParser (); void define (std::string const& func_body); - void setConstant (std::string const& name, double c); + void setConstant (std::string const& name, amrex::Real c); // // Option 1: Register every variable to an address provided. // Assign values to external variables. // Call eval(). - void registerVariable (std::string const& name, double& var); + void registerVariable (std::string const& name, amrex::Real& var); // - inline double eval () const noexcept; + inline amrex::Real eval () const noexcept; // // Option 2: Register all variables at once. Parser will create @@ -40,7 +42,7 @@ public: void registerVariables (std::vector<std::string> const& names); // template <typename T, typename... Ts> inline - double eval (T x, Ts... yz) const noexcept; + amrex::Real eval (T x, Ts... yz) const noexcept; void print () const; @@ -54,23 +56,23 @@ private: void clear (); template <typename T> inline - void unpack (double* p, T x) const noexcept; + void unpack (amrex::Real* p, T x) const noexcept; template <typename T, typename... Ts> inline - void unpack (double* p, T x, Ts... yz) const noexcept; + void unpack (amrex::Real* p, T x, Ts... yz) const noexcept; std::string m_expression; #ifdef _OPENMP std::vector<struct wp_parser*> m_parser; - mutable std::vector<std::array<double,16> > m_variables; + mutable std::vector<std::array<amrex::Real,16> > m_variables; #else struct wp_parser* m_parser = nullptr; - mutable std::array<double,16> m_variables; + mutable std::array<amrex::Real,16> m_variables; #endif }; inline -double +amrex::Real WarpXParser::eval () const noexcept { #ifdef _OPENMP @@ -82,7 +84,7 @@ WarpXParser::eval () const noexcept template <typename T, typename... Ts> inline -double +amrex::Real WarpXParser::eval (T x, Ts... yz) const noexcept { #ifdef _OPENMP @@ -96,7 +98,7 @@ WarpXParser::eval (T x, Ts... yz) const noexcept template <typename T> inline void -WarpXParser::unpack (double* p, T x) const noexcept +WarpXParser::unpack (amrex::Real* p, T x) const noexcept { *p = x; } @@ -104,7 +106,7 @@ WarpXParser::unpack (double* p, T x) const noexcept template <typename T, typename... Ts> inline void -WarpXParser::unpack (double* p, T x, Ts... yz) const noexcept +WarpXParser::unpack (amrex::Real* p, T x, Ts... yz) const noexcept { *p++ = x; unpack(p, yz...); |