aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization/GuardCellManager.cpp
diff options
context:
space:
mode:
authorGravatar Axel Huebl <axel.huebl@plasma.ninja> 2023-05-08 19:47:54 -0700
committerGravatar GitHub <noreply@github.com> 2023-05-08 19:47:54 -0700
commit63f8f713e2ea37c63b5c5ca82beb41683dd0b7ce (patch)
treee77d9b7701f3b1d46cc4966a224c7dc71e1e6a42 /Source/Parallelization/GuardCellManager.cpp
parent1708f1aeecf0a808353980584b75e1792fdb5483 (diff)
downloadWarpX-63f8f713e2ea37c63b5c5ca82beb41683dd0b7ce.tar.gz
WarpX-63f8f713e2ea37c63b5c5ca82beb41683dd0b7ce.tar.zst
WarpX-63f8f713e2ea37c63b5c5ca82beb41683dd0b7ce.zip
Field Gather: Generalize FGcell (#3909)
Replace explicit array with little formula for the range of the support function of shape factors.
Diffstat (limited to 'Source/Parallelization/GuardCellManager.cpp')
-rw-r--r--Source/Parallelization/GuardCellManager.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp
index 5c151412b..9c413cc40 100644
--- a/Source/Parallelization/GuardCellManager.cpp
+++ b/Source/Parallelization/GuardCellManager.cpp
@@ -299,14 +299,19 @@ guardCellManager::Init (
ng_MovingWindow = ng_alloc_EB;
}
} else {
- // Compute number of cells required for Field Gather
- int FGcell[4] = {0,1,1,2}; // Index is nox
- IntVect ng_FieldGather_noNCI = IntVect(AMREX_D_DECL(FGcell[nox],FGcell[nox],FGcell[nox]));
+ // Compute number of cells required for Field Gather:
+ // When increasing the shape by order by one, support of the shape
+ // factor grows symmetrically by half a cell on each side. So every
+ // +2 orders, one touches one more cell point.
+ int const FGcell = (nox + 1) / 2; // integer division
+ IntVect ng_FieldGather_noNCI = IntVect(AMREX_D_DECL(FGcell,FGcell,FGcell));
ng_FieldGather_noNCI = ng_FieldGather_noNCI.min(ng_alloc_EB);
+
// If NCI filter, add guard cells in the z direction
IntVect ng_NCIFilter = IntVect::TheZeroVector();
if (do_fdtd_nci_corr)
ng_NCIFilter[WARPX_ZINDEX] = NCIGodfreyFilter::m_stencil_width;
+
// Note: communications of guard cells for bilinear filter are handled
// separately.
ng_FieldGather = ng_FieldGather_noNCI + ng_NCIFilter;