Skip to content

Commit

Permalink
WarpX class: make psatd_solution_type a private member variable (#5602)
Browse files Browse the repository at this point in the history
This PR changes `psatd_solution_type` from a static WarpX class variable
to a private member variable (renamed `m_psatd_solution_type`).
This is a small step towards reducing the use of static variables in the
WarpX class.
  • Loading branch information
lucafedeli88 authored Jan 24, 2025
1 parent 1f6737f commit 1e82e89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ WarpX::InitPML ()
pml_ncell, pml_delta, amrex::IntVect::TheZeroVector(),
dt[0], nox_fft, noy_fft, noz_fft, grid_type,
do_moving_window, pml_has_particles, do_pml_in_domain,
psatd_solution_type, J_in_time, rho_in_time,
m_psatd_solution_type, J_in_time, rho_in_time,
do_pml_dive_cleaning, do_pml_divb_cleaning,
amrex::IntVect(0), amrex::IntVect(0),
eb_enabled,
Expand Down Expand Up @@ -771,7 +771,7 @@ WarpX::InitPML ()
pml_ncell, pml_delta, refRatio(lev-1),
dt[lev], nox_fft, noy_fft, noz_fft, grid_type,
do_moving_window, pml_has_particles, do_pml_in_domain,
psatd_solution_type, J_in_time, rho_in_time, do_pml_dive_cleaning, do_pml_divb_cleaning,
m_psatd_solution_type, J_in_time, rho_in_time, do_pml_dive_cleaning, do_pml_divb_cleaning,
amrex::IntVect(0), amrex::IntVect(0),
eb_enabled,
guard_cells.ng_FieldSolver.max(),
Expand Down
10 changes: 5 additions & 5 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ public:
ParticleBoundaryType::Default,
ParticleBoundaryType::Default)};

//! Integer that corresponds to the order of the PSATD solution
//! (whether the PSATD equations are derived from first-order or
//! second-order solution)
static inline auto psatd_solution_type = PSATDSolutionType::Default;

//! Integers that correspond to the time dependency of J (constant, linear)
//! and rho (linear, quadratic) for the PSATD algorithm
static inline auto J_in_time = JInTime::Default;
Expand Down Expand Up @@ -1642,6 +1637,11 @@ private:
*/
void ExplicitFillBoundaryEBUpdateAux ();

//! Integer that corresponds to the order of the PSATD solution
//! (whether the PSATD equations are derived from first-order or
//! second-order solution)
PSATDSolutionType m_psatd_solution_type = PSATDSolutionType::Default;

void PushPSATD (amrex::Real start_time);

#ifdef WARPX_USE_FFT
Expand Down
6 changes: 3 additions & 3 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,14 +1502,14 @@ WarpX::ReadParameters ()
// Integer that corresponds to the order of the PSATD solution
// (whether the PSATD equations are derived from first-order or
// second-order solution)
pp_psatd.query_enum_sloppy("solution_type", psatd_solution_type, "-_");
pp_psatd.query_enum_sloppy("solution_type", m_psatd_solution_type, "-_");

// Integers that correspond to the time dependency of J (constant, linear)
// and rho (linear, quadratic) for the PSATD algorithm
pp_psatd.query_enum_sloppy("J_in_time", J_in_time, "-_");
pp_psatd.query_enum_sloppy("rho_in_time", rho_in_time, "-_");

if (psatd_solution_type != PSATDSolutionType::FirstOrder || !do_multi_J)
if (m_psatd_solution_type != PSATDSolutionType::FirstOrder || !do_multi_J)
{
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
rho_in_time == RhoInTime::Linear,
Expand Down Expand Up @@ -2904,7 +2904,7 @@ void WarpX::AllocLevelSpectralSolver (amrex::Vector<std::unique_ptr<SpectralSolv
fft_periodic_single_box,
update_with_rho,
fft_do_time_averaging,
psatd_solution_type,
m_psatd_solution_type,
J_in_time,
rho_in_time,
do_dive_cleaning,
Expand Down

0 comments on commit 1e82e89

Please sign in to comment.