aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpX.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2020-12-02 09:43:11 +0100
committerGravatar GitHub <noreply@github.com> 2020-12-02 00:43:11 -0800
commit2fbb92dca17e624c6d3c4f51caa412a585b10c32 (patch)
treec6b5e4534e65d0cb487061e6108419a7d4fe23a1 /Source/WarpX.cpp
parent330c6c56ea64a3f4183483f529e66f59aff8f92d (diff)
downloadWarpX-2fbb92dca17e624c6d3c4f51caa412a585b10c32.tar.gz
WarpX-2fbb92dca17e624c6d3c4f51caa412a585b10c32.tar.zst
WarpX-2fbb92dca17e624c6d3c4f51caa412a585b10c32.zip
More parser-enabled ParmParse.query and ParmParse.get (#1501)
* Parser can be used for most input parameters, including charge and mass * update documentation for the math parser * eol * remove typo and update doc for parser * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/WarpX.cpp')
-rw-r--r--Source/WarpX.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 99d360291..a8afa17ec 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -321,7 +321,7 @@ WarpX::ReadParameters ()
{
ParmParse pp;// Traditionally, max_step and stop_time do not have prefix.
pp.query("max_step", max_step);
- pp.query("stop_time", stop_time);
+ queryWithParser(pp, "stop_time", stop_time);
pp.query("authors", authors);
}
@@ -368,7 +368,7 @@ WarpX::ReadParameters ()
}
}
- pp.query("cfl", cfl);
+ queryWithParser(pp, "cfl", cfl);
pp.query("verbose", verbose);
pp.query("regrid_int", regrid_int);
pp.query("do_subcycling", do_subcycling);
@@ -388,7 +388,7 @@ WarpX::ReadParameters ()
// pp.query returns 1 if argument zmax_plasma_to_compute_max_step is
// specified by the user, 0 otherwise.
do_compute_max_step_from_zmax =
- pp.query("zmax_plasma_to_compute_max_step",
+ queryWithParser(pp, "zmax_plasma_to_compute_max_step",
zmax_plasma_to_compute_max_step);
pp.query("do_moving_window", do_moving_window);
@@ -439,8 +439,8 @@ WarpX::ReadParameters ()
// Read either dz_snapshots_lab or dt_snapshots_lab
bool snapshot_interval_is_specified = 0;
Real dz_snapshots_lab = 0;
- snapshot_interval_is_specified += pp.query("dt_snapshots_lab", dt_snapshots_lab);
- if ( pp.query("dz_snapshots_lab", dz_snapshots_lab) ){
+ snapshot_interval_is_specified += queryWithParser(pp, "dt_snapshots_lab", dt_snapshots_lab);
+ if ( queryWithParser(pp, "dz_snapshots_lab", dz_snapshots_lab) ){
dt_snapshots_lab = dz_snapshots_lab/PhysConst::c;
snapshot_interval_is_specified = 1;
}
@@ -520,10 +520,12 @@ WarpX::ReadParameters ()
sort_bin_size[i] = vect_sort_bin_size[i];
}
- double quantum_xi;
- int quantum_xi_is_specified = pp.query("quantum_xi", quantum_xi);
- if (quantum_xi_is_specified)
+ amrex::Real quantum_xi_tmp;
+ int quantum_xi_is_specified = queryWithParser(pp, "quantum_xi", quantum_xi_tmp);
+ if (quantum_xi_is_specified) {
+ double const quantum_xi = quantum_xi_tmp;
quantum_xi_c2 = quantum_xi * PhysConst::c * PhysConst::c;
+ }
pp.query("do_pml", do_pml);
pp.query("pml_ncell", pml_ncell);