WarpX
WarpXSumGuardCells.H
Go to the documentation of this file.
1 /* Copyright 2019 Maxence Thevenet, Remi Lehe, Weiqun Zhang
2  *
3  *
4  * This file is part of WarpX.
5  *
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef WARPX_SUM_GUARD_CELLS_H_
9 #define WARPX_SUM_GUARD_CELLS_H_
10 
11 #include <AMReX_MultiFab.H>
12 
25 inline void
26 WarpXSumGuardCells(amrex::MultiFab& mf, const amrex::Periodicity& period,
27  const int icomp=0, const int ncomp=1){
28 #ifdef WARPX_USE_PSATD
29  // Update both valid cells and guard cells
30  const amrex::IntVect n_updated_guards = mf.nGrowVect();
31 #else
32  // Update only the valid cells
33  const amrex::IntVect n_updated_guards = amrex::IntVect::TheZeroVector();
34 #endif
35  mf.SumBoundary(icomp, ncomp, n_updated_guards, period);
36 }
37 
53 inline void
54 WarpXSumGuardCells(amrex::MultiFab& dst, amrex::MultiFab& src,
55  const amrex::Periodicity& period,
56  const int icomp=0, const int ncomp=1){
57 #ifdef WARPX_USE_PSATD
58  // Update both valid cells and guard cells
59  const amrex::IntVect n_updated_guards = dst.nGrowVect();
60 #else
61  // Update only the valid cells
62  const amrex::IntVect n_updated_guards = amrex::IntVect::TheZeroVector();
63 #endif
64  src.SumBoundary(0, ncomp, n_updated_guards, period);
65  amrex::Copy( dst, src, 0, icomp, ncomp, n_updated_guards );
66 }
67 
68 #endif // WARPX_SUM_GUARD_CELLS_H_
void WarpXSumGuardCells(amrex::MultiFab &mf, const amrex::Periodicity &period, const int icomp=0, const int ncomp=1)
Sum the values of mf, where the different boxes overlap (i.e. in the guard cells) ...
Definition: WarpXSumGuardCells.H:26