Skip to content

Commit

Permalink
revert to using buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Aug 13, 2024
1 parent 74cbd90 commit fcda79c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ public:

// for cuda
void BuildBufferMasksInBox ( amrex::Box tbx, amrex::IArrayBox &buffer_mask,
const amrex::IArrayBox &guard_mask, const amrex::IntVect ng );
const amrex::IArrayBox &guard_mask, const int ng );

#ifdef AMREX_USE_EB
amrex::EBFArrayBoxFactory const& fieldEBFactory (int lev) const noexcept {
Expand Down
16 changes: 7 additions & 9 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2720,14 +2720,14 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
//
// Copy of the coarse aux
//
if (lev > 0 && (n_field_gather_buffer_each_dir.max() > 0 ||
n_current_deposition_buffer_each_dir.max() > 0 ||
if (lev > 0 && (n_field_gather_buffer > 0 ||
n_current_deposition_buffer > 0 ||
mypc->nSpeciesGatherFromMainGrid() > 0))
{
BoxArray cba = ba;
cba.coarsen(refRatio(lev-1));

if (n_field_gather_buffer_each_dir.max() > 0 || mypc->nSpeciesGatherFromMainGrid() > 0) {
if (n_field_gather_buffer > 0 || mypc->nSpeciesGatherFromMainGrid() > 0) {
if (aux_is_nodal) {
BoxArray const& cnba = amrex::convert(cba,IntVect::TheNodeVector());
AllocInitMultiFab(Bfield_cax[lev][0], cnba,dm,ncomps,ngEB,lev, "Bfield_cax[x]");
Expand All @@ -2754,7 +2754,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
AllocInitMultiFab(interp_weight_gbuffer[lev], amrex::convert(ba, IntVect::TheNodeVector()), dm, ncomps, ngEB, lev, "interp_weight_gbuffer", 0.0_rt);
}

if (n_current_deposition_buffer_each_dir.max() > 0) {
if (n_current_deposition_buffer > 0) {
amrex::Print() << " current dep buffer : " << n_current_deposition_buffer << "\n";
AllocInitMultiFab(current_buf[lev][0], amrex::convert(cba,jx_nodal_flag),dm,ncomps,ngJ,lev, "current_buf[x]");
AllocInitMultiFab(current_buf[lev][1], amrex::convert(cba,jy_nodal_flag),dm,ncomps,ngJ,lev, "current_buf[y]");
Expand Down Expand Up @@ -3129,9 +3129,7 @@ WarpX::BuildBufferMasks ()
{
for (int ipass = 0; ipass < 2; ++ipass)
{
//const int ngbuffer = (ipass == 0) ? n_current_deposition_buffer : n_field_gather_buffer;
const amrex::IntVect ngbuffer = (ipass == 0) ? n_current_deposition_buffer_each_dir
: n_field_gather_buffer_each_dir;
const int ngbuffer = (ipass == 0) ? n_current_deposition_buffer : n_field_gather_buffer;
iMultiFab* bmasks = (ipass == 0) ? current_buffer_masks[lev].get() : gather_buffer_masks[lev].get();
if (bmasks)
{
Expand Down Expand Up @@ -3167,11 +3165,11 @@ WarpX::BuildBufferMasks ()
*/
void
WarpX::BuildBufferMasksInBox ( const amrex::Box tbx, amrex::IArrayBox &buffer_mask,
const amrex::IArrayBox &guard_mask, const amrex::IntVect ng )
const amrex::IArrayBox &guard_mask, const int ng )
{
auto const& msk = buffer_mask.array();
auto const& gmsk = guard_mask.const_array();
const amrex::Dim3 ng3 = ng.dim3();
const amrex::Dim3 ng3 = amrex::IntVect(ng).dim3();
amrex::ParallelFor(tbx, [=] AMREX_GPU_DEVICE (int i, int j, int k)
{
for (int kk = k-ng3.z; kk <= k+ng3.z; ++kk) {
Expand Down

0 comments on commit fcda79c

Please sign in to comment.