From e3eb21e4edb655b7b53139e0f84ac1f911ab411d Mon Sep 17 00:00:00 2001 From: Justin Angus Date: Sat, 24 Aug 2024 23:51:03 -0700 Subject: [PATCH] putting check for dotMask define inside SetDotMask(). --- Source/WarpX.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 16545e7ac82..0f61a7f6dc8 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -3633,24 +3633,16 @@ WarpX::getFieldDotMaskPointer ( FieldType field_type, int lev, int dir ) const switch(field_type) { case FieldType::Efield_fp : - if (Efield_dotMask[lev][dir] == nullptr) { - SetDotMask( Efield_dotMask[lev][dir], field_type, lev, dir ); - } + SetDotMask( Efield_dotMask[lev][dir], field_type, lev, dir ); return Efield_dotMask[lev][dir].get(); case FieldType::Bfield_fp : - if (Bfield_dotMask[lev][dir] == nullptr) { - SetDotMask( Bfield_dotMask[lev][dir], field_type, lev, dir ); - } + SetDotMask( Bfield_dotMask[lev][dir], field_type, lev, dir ); return Bfield_dotMask[lev][dir].get(); case FieldType::vector_potential_fp : - if (Afield_dotMask[lev][dir] == nullptr) { - SetDotMask( Afield_dotMask[lev][dir], field_type, lev, dir ); - } + SetDotMask( Afield_dotMask[lev][dir], field_type, lev, dir ); return Afield_dotMask[lev][dir].get(); case FieldType::phi_fp : - if (phi_dotMask[lev] == nullptr) { - SetDotMask( phi_dotMask[lev], field_type, lev, 0 ); - } + SetDotMask( phi_dotMask[lev], field_type, lev, 0 ); return phi_dotMask[lev].get(); default: WARPX_ABORT_WITH_MESSAGE("Invalid field type for dotMask"); @@ -3663,6 +3655,7 @@ void WarpX::SetDotMask( std::unique_ptr& field_dotMask, { // Define the dot mask for this field_type needed to properly compute dotProduct() // for field values that have shared locations on different MPI ranks + if (field_dotMask != nullptr) return; const amrex::MultiFab* this_field = getFieldPointer(field_type,lev,dir); const amrex::BoxArray& this_ba = this_field->boxArray();