ARTEMIS
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 
14 
15 #include <AMReX_MultiFab.H>
16 
29 inline void
31  const amrex::IntVect& src_ngrow,
32  const int icomp=0, const int ncomp=1)
33 {
34  amrex::IntVect n_updated_guards;
35 
36  // Update both valid cells and guard cells
38  n_updated_guards = mf.nGrowVect();
39  else // Update only the valid cells
40  n_updated_guards = amrex::IntVect::TheZeroVector();
41  ablastr::utils::communication::SumBoundary(mf, icomp, ncomp, src_ngrow, n_updated_guards, WarpX::do_single_precision_comms, period);
42 }
43 
59 inline void
61  const amrex::Periodicity& period,
62  const amrex::IntVect& src_ngrow,
63  const int icomp=0, const int ncomp=1)
64 {
65  amrex::IntVect n_updated_guards;
66 
67  // Update both valid cells and guard cells
69  n_updated_guards = dst.nGrowVect();
70  else // Update only the valid cells
71  n_updated_guards = amrex::IntVect::TheZeroVector();
72 
73  dst.setVal(0., icomp, ncomp, n_updated_guards);
74 // ablastr::utils::communication::ParallelAdd(dst, src, 0, icomp, ncomp, src_ngrow, n_updated_guards, period);
75  dst.ParallelAdd(src, 0, icomp, ncomp, src_ngrow, n_updated_guards, period);
76 }
77 
78 #endif // WARPX_SUM_GUARD_CELLS_H_
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:30
static bool do_single_precision_comms
perform field communications in single precision
Definition: WarpX.H:358
static short electromagnetic_solver_id
Integer that corresponds to the type of Maxwell solver (Yee, CKC, PSATD, ECT)
Definition: WarpX.H:288
IntVect nGrowVect() const noexcept
void ParallelAdd(const FabArray< FAB > &src, const Periodicity &period=Periodicity::NonPeriodic())
void setVal(value_type val)
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE constexpr IntVectND< dim > TheZeroVector() noexcept
void SumBoundary(amrex::MultiFab &mf, bool do_single_precision_comms, const amrex::Periodicity &period)
Definition: Communication.cpp:142
@ PSATD
Definition: WarpXAlgorithmSelection.H:66