Skip to content

Commit e9c7eb3

Browse files
lucafedeli88Andrew Myers
authored andcommitted
PML_RZ: don't use warpx static variables directly (BLAST-WarpX#5893)
This PR avoids accessing directly `WarpX::do_single_precision_comms` inside `PML_RZ.cpp` . Instead, this variable is passes as an argument.
1 parent aba9fc8 commit e9c7eb3

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

Source/BoundaryConditions/PML_RZ.H

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public:
4444
void PushPSATD (int lev, ablastr::fields::MultiFabRegister& fields, SpectralSolverRZ& spec_solver);
4545
#endif
4646

47-
void FillBoundaryE (ablastr::fields::MultiFabRegister& fields,
48-
PatchType patch_type, std::optional<bool> nodal_sync=std::nullopt);
49-
void FillBoundaryB (ablastr::fields::MultiFabRegister& fields,
50-
PatchType patch_type, std::optional<bool> nodal_sync=std::nullopt);
47+
void FillBoundaryE (ablastr::fields::MultiFabRegister& fields, PatchType patch_type,
48+
bool do_single_precision_comms, std::optional<bool> nodal_sync=std::nullopt);
49+
void FillBoundaryB (ablastr::fields::MultiFabRegister& fields, PatchType patch_type,
50+
bool do_single_precision_comms, std::optional<bool> nodal_sync=std::nullopt);
5151

5252
void CheckPoint (ablastr::fields::MultiFabRegister& fields, std::string const& dir) const;
5353
void Restart (ablastr::fields::MultiFabRegister& fields, std::string const& dir);

Source/BoundaryConditions/PML_RZ.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# include "FieldSolver/SpectralSolver/SpectralFieldDataRZ.H"
1414
#endif
1515
#include "Utils/WarpXConst.H"
16-
#include "WarpX.H"
1716

1817
#include <ablastr/utils/Communication.H>
1918

@@ -132,7 +131,8 @@ PML_RZ::ApplyDamping (amrex::MultiFab* Et_fp, amrex::MultiFab* Ez_fp,
132131
}
133132

134133
void
135-
PML_RZ::FillBoundaryE (ablastr::fields::MultiFabRegister& fields, PatchType patch_type, std::optional<bool> nodal_sync)
134+
PML_RZ::FillBoundaryE (ablastr::fields::MultiFabRegister& fields, PatchType patch_type,
135+
const bool do_single_precision_comms, const std::optional<bool> nodal_sync)
136136
{
137137
using ablastr::fields::Direction;
138138

@@ -143,12 +143,13 @@ PML_RZ::FillBoundaryE (ablastr::fields::MultiFabRegister& fields, PatchType patc
143143
{
144144
amrex::Periodicity const& period = m_geom->periodicity();
145145
const amrex::Vector<amrex::MultiFab*> mf = {pml_Er, pml_Et};
146-
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period, nodal_sync);
146+
ablastr::utils::communication::FillBoundary(mf, do_single_precision_comms, period, nodal_sync);
147147
}
148148
}
149149

150150
void
151-
PML_RZ::FillBoundaryB (ablastr::fields::MultiFabRegister& fields, PatchType patch_type, std::optional<bool> nodal_sync)
151+
PML_RZ::FillBoundaryB (ablastr::fields::MultiFabRegister& fields, PatchType patch_type,
152+
const bool do_single_precision_comms, const std::optional<bool> nodal_sync)
152153
{
153154
if (patch_type == PatchType::fine)
154155
{
@@ -159,7 +160,7 @@ PML_RZ::FillBoundaryB (ablastr::fields::MultiFabRegister& fields, PatchType patc
159160

160161
amrex::Periodicity const& period = m_geom->periodicity();
161162
const amrex::Vector<amrex::MultiFab*> mf = {pml_Br, pml_Bt};
162-
ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period, nodal_sync);
163+
ablastr::utils::communication::FillBoundary(mf, do_single_precision_comms, period, nodal_sync);
163164
}
164165
}
165166

Source/Parallelization/WarpXComm.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ WarpX::FillBoundaryE (const int lev, const PatchType patch_type, const amrex::In
760760
#if (defined WARPX_DIM_RZ) && (defined WARPX_USE_FFT)
761761
if (pml_rz[lev])
762762
{
763-
pml_rz[lev]->FillBoundaryE(m_fields, patch_type, nodal_sync);
763+
pml_rz[lev]->FillBoundaryE(m_fields, patch_type, do_single_precision_comms, nodal_sync);
764764
}
765765
#endif
766766
}
@@ -773,7 +773,7 @@ WarpX::FillBoundaryE (const int lev, const PatchType patch_type, const amrex::In
773773
"Error: in FillBoundaryE, requested more guard cells than allocated");
774774

775775
const amrex::IntVect nghost = (m_safe_guard_cells) ? mf[i]->nGrowVect() : ng;
776-
ablastr::utils::communication::FillBoundary(*mf[i], nghost, WarpX::do_single_precision_comms, period, nodal_sync);
776+
ablastr::utils::communication::FillBoundary(*mf[i], nghost, do_single_precision_comms, period, nodal_sync);
777777
}
778778
}
779779

@@ -825,7 +825,7 @@ WarpX::FillBoundaryB (const int lev, const PatchType patch_type, const amrex::In
825825
#if (defined WARPX_DIM_RZ) && (defined WARPX_USE_FFT)
826826
if (pml_rz[lev])
827827
{
828-
pml_rz[lev]->FillBoundaryB(m_fields, patch_type, nodal_sync);
828+
pml_rz[lev]->FillBoundaryB(m_fields, patch_type, do_single_precision_comms, nodal_sync);
829829
}
830830
#endif
831831
}
@@ -838,7 +838,7 @@ WarpX::FillBoundaryB (const int lev, const PatchType patch_type, const amrex::In
838838
"Error: in FillBoundaryB, requested more guard cells than allocated");
839839

840840
const amrex::IntVect nghost = (m_safe_guard_cells) ? mf[i]->nGrowVect() : ng;
841-
ablastr::utils::communication::FillBoundary(*mf[i], nghost, WarpX::do_single_precision_comms, period, nodal_sync);
841+
ablastr::utils::communication::FillBoundary(*mf[i], nghost, do_single_precision_comms, period, nodal_sync);
842842
}
843843
}
844844

0 commit comments

Comments
 (0)