aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/BTDiagnostics.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2022-10-10 20:36:14 +0200
committerGravatar GitHub <noreply@github.com> 2022-10-10 11:36:14 -0700
commite9cc65ffeb0684a97618b67c2164d95ea497226c (patch)
treeed65f7ac86cc4e8945021dc36a79c8bc246c150d /Source/Diagnostics/BTDiagnostics.cpp
parent56e04c1b911f9399662c4ff9ecf6630d686cc220 (diff)
downloadWarpX-e9cc65ffeb0684a97618b67c2164d95ea497226c.tar.gz
WarpX-e9cc65ffeb0684a97618b67c2164d95ea497226c.tar.zst
WarpX-e9cc65ffeb0684a97618b67c2164d95ea497226c.zip
Partial refactoring of the utils directory (#3404)
* initial work to clean WarpX Utils * remove AMRCore from Ionization tables * progress * refactoring of a part of the utils directory * fix bug * fixed bug * fixed bug * remove debug line accidentally slipped into the code * remove debug line accidentally slipped into the code * remove debug line accidentally slipped into the code * cleaning * fixed bug
Diffstat (limited to 'Source/Diagnostics/BTDiagnostics.cpp')
-rw-r--r--Source/Diagnostics/BTDiagnostics.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp
index 77cc9a30d..dd82bcf0e 100644
--- a/Source/Diagnostics/BTDiagnostics.cpp
+++ b/Source/Diagnostics/BTDiagnostics.cpp
@@ -14,10 +14,11 @@
#include "Diagnostics/Diagnostics.H"
#include "Diagnostics/FlushFormats/FlushFormat.H"
#include "ComputeDiagFunctors/BackTransformParticleFunctor.H"
+#include "Utils/Algorithms/IsIn.H"
#include "Utils/CoarsenIO.H"
+#include "Utils/Parser/ParserUtils.H"
#include "Utils/TextMsg.H"
#include "Utils/WarpXConst.H"
-#include "Utils/WarpXUtil.H"
#include "WarpX.H"
#include <ablastr/utils/Communication.H>
@@ -164,7 +165,8 @@ BTDiagnostics::ReadParameters ()
std::vector<std::string> intervals_string_vec = {"0"};
- bool const num_snapshots_specified = queryWithParser(pp_diag_name, "num_snapshots_lab", m_num_snapshots_lab);
+ bool const num_snapshots_specified = utils::parser::queryWithParser(
+ pp_diag_name, "num_snapshots_lab", m_num_snapshots_lab);
bool const intervals_specified = pp_diag_name.queryarr("intervals", intervals_string_vec);
if (num_snapshots_specified)
{
@@ -172,20 +174,20 @@ BTDiagnostics::ReadParameters ()
"For back-transformed diagnostics, user should specify either num_snapshots_lab or intervals, not both");
intervals_string_vec = {":" + std::to_string(m_num_snapshots_lab-1)};
}
- m_intervals = BTDIntervalsParser(intervals_string_vec);
+ m_intervals = utils::parser::BTDIntervalsParser(intervals_string_vec);
m_num_buffers = m_intervals.NumSnapshots();
// Read either dz_snapshots_lab or dt_snapshots_lab
- bool snapshot_interval_is_specified = false;
- snapshot_interval_is_specified = queryWithParser(pp_diag_name, "dt_snapshots_lab", m_dt_snapshots_lab);
- if ( queryWithParser(pp_diag_name, "dz_snapshots_lab", m_dz_snapshots_lab) ) {
+ bool snapshot_interval_is_specified = utils::parser::queryWithParser(
+ pp_diag_name, "dt_snapshots_lab", m_dt_snapshots_lab);
+ if ( utils::parser::queryWithParser(pp_diag_name, "dz_snapshots_lab", m_dz_snapshots_lab) ) {
m_dt_snapshots_lab = m_dz_snapshots_lab/PhysConst::c;
snapshot_interval_is_specified = true;
}
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(snapshot_interval_is_specified,
"For back-transformed diagnostics, user should specify either dz_snapshots_lab or dt_snapshots_lab");
- if (queryWithParser(pp_diag_name, "buffer_size", m_buffer_size)) {
+ if (utils::parser::queryWithParser(pp_diag_name, "buffer_size", m_buffer_size)) {
if(m_max_box_size < m_buffer_size) m_max_box_size = m_buffer_size;
}
@@ -194,8 +196,12 @@ BTDiagnostics::ReadParameters ()
"jx", "jy", "jz", "rho"};
for (const auto& var : m_varnames) {
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( (WarpXUtilStr::is_in(BTD_varnames_supported, var )), "Input error: field variable " + var + " in " + m_diag_name
- + ".fields_to_plot is not supported for BackTransformed diagnostics. Currently supported field variables for BackTransformed diagnostics include Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, and rho");
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
+ (utils::algorithms::is_in(BTD_varnames_supported, var )),
+ "Input error: field variable " + var + " in " + m_diag_name
+ + ".fields_to_plot is not supported for BackTransformed diagnostics."
+ + " Currently supported field variables for BackTransformed diagnostics "
+ + "include Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, and rho");
}
bool particle_fields_to_plot_specified = pp_diag_name.queryarr("particle_fields_to_plot", m_pfield_varnames);