Skip to content

Commit

Permalink
putting check for dotMask define inside SetDotMask().
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinRayAngus committed Aug 25, 2024
1 parent 81aa988 commit e3eb21e
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -3663,6 +3655,7 @@ void WarpX::SetDotMask( std::unique_ptr<amrex::iMultiFab>& 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();
Expand Down

0 comments on commit e3eb21e

Please sign in to comment.