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 
12 
13 #include <AMReX_MultiFab.H>
14 
27 inline void
28 WarpXSumGuardCells(amrex::MultiFab& mf, const amrex::Periodicity& period,
29  const amrex::IntVect& src_ngrow,
30  const int icomp=0, const int ncomp=1)
31 {
32  amrex::IntVect n_updated_guards;
33 
34  // Update both valid cells and guard cells
36  n_updated_guards = mf.nGrowVect();
37  else // Update only the valid cells
38  n_updated_guards = amrex::IntVect::TheZeroVector();
39  mf.SumBoundary(icomp, ncomp, src_ngrow, n_updated_guards, period);
40 }
41 
57 inline void
58 WarpXSumGuardCells(amrex::MultiFab& dst, amrex::MultiFab& src,
59  const amrex::Periodicity& period,
60  const amrex::IntVect& src_ngrow,
61  const int icomp=0, const int ncomp=1)
62 {
63  amrex::IntVect n_updated_guards;
64 
65  // Update both valid cells and guard cells
67  n_updated_guards = dst.nGrowVect();
68  else // Update only the valid cells
69  n_updated_guards = amrex::IntVect::TheZeroVector();
70 
71  dst.setVal(0., icomp, ncomp, n_updated_guards);
72  dst.ParallelAdd(src, 0, icomp, ncomp, src_ngrow, n_updated_guards, period);
73 }
74 
75 #endif // WARPX_SUM_GUARD_CELLS_H_
Definition: WarpXAlgorithmSelection.H:43
static int maxwell_solver_id
Definition: WarpX.H:144
void WarpXSumGuardCells(amrex::MultiFab &mf, const amrex::Periodicity &period, const amrex::IntVect &src_ngrow, 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:28