diff options
author | 2019-04-18 11:26:51 -0700 | |
---|---|---|
committer | 2019-04-18 11:26:51 -0700 | |
commit | 5ed1a16ace5ed9d32e18e25b23ef87996679b4dc (patch) | |
tree | 110be73bd454bf2a673e2aa73b26b16cea29865c /Source/Utils/WarpXConst.cpp | |
parent | be0cbe26c1914f14e059be84b546934a3933ab85 (diff) | |
parent | ae239587668bbadc742ce5992afc6d6f814c5a3c (diff) | |
download | WarpX-5ed1a16ace5ed9d32e18e25b23ef87996679b4dc.tar.gz WarpX-5ed1a16ace5ed9d32e18e25b23ef87996679b4dc.tar.zst WarpX-5ed1a16ace5ed9d32e18e25b23ef87996679b4dc.zip |
Merge branch 'dev' into RZgeometry
Diffstat (limited to 'Source/Utils/WarpXConst.cpp')
-rw-r--r-- | Source/Utils/WarpXConst.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/Source/Utils/WarpXConst.cpp b/Source/Utils/WarpXConst.cpp deleted file mode 100644 index bd3ebc3ef..000000000 --- a/Source/Utils/WarpXConst.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include <limits> -#include <cmath> -#include <algorithm> -#include <numeric> -#include <sstream> - -#include <AMReX_ParmParse.H> -#include <WarpX.H> -#include <WarpXConst.H> -#include <WarpX_f.H> -#include <MultiParticleContainer.H> - -std::string UserConstants::replaceStringValue(std::string math_expr){ - std::string pattern, value_str; - std::string patternexp = "e+"; - std::size_t found; - amrex::Real value; - for (int i=0; i<nb_constants; i++){ - pattern = constant_names[i]; - value = constant_values[i]; - - // Convert value to string, with scientific notation - std::ostringstream streamObj; - streamObj << value; - value_str = streamObj.str(); - - // Replace "e+" by "e" in scientific notation for Fortran compatibility - found = value_str.find(patternexp); - if (found != std::string::npos){ - value_str.replace(found,patternexp.length(),"e"); - } - - // Replace all occurences of variable pattern by a string with its value value_str - found = math_expr.find(pattern); - while (found != std::string::npos){ - if ((found==0 - && !isalnum(math_expr[pattern.length() ])) || - (!isalnum(math_expr[found-1]) - && !isalnum(math_expr[found+pattern.length()]))){ - math_expr.replace(found,pattern.length(),value_str); - } - found = math_expr.find(pattern, found + pattern.length()); - } - } - return math_expr; -} - -void UserConstants::ReadParameters() -{ - if (!initialized){ - amrex::ParmParse pp("constants"); - pp.query("use_my_constants", use_my_constants); - if (use_my_constants){ - pp.getarr("constant_names", constant_names); - nb_constants = constant_names.size(); - pp.getarr("constant_values", constant_values); - BL_ASSERT(constant_values.size() == nb_constants); - } - initialized = true; - } -} |