2 #ifndef AMREX_BNDRYREGISTER_H_
3 #define AMREX_BNDRYREGISTER_H_
4 #include <AMReX_Config.H>
39 template <
typename MF>
52 int in_rad,
int out_rad,
int extent_rad,
int ncomp);
64 int in_rad,
int out_rad,
int extent_rad,
int ncomp);
68 int in_rad,
int out_rad,
int extent_rad,
int ncomp,
94 int src_comp,
int dest_comp,
int num_comp,
99 int src_comp,
int dest_comp,
int num_comp,
105 int dest_comp,
int num_comp,
int n_ghost = 0);
114 void write (
const std::string& name, std::ostream& os)
const;
117 void read (
const std::string& name, std::istream& is);
129 template <
typename MF>
132 int in_rad,
int out_rad,
133 int extent_rad,
int ncomp)
145 template <
typename MF>
149 int in_rad,
int out_rad,
150 int extent_rad,
int ncomp)
159 template <
typename MF>
163 for (
auto & i : bndry) {
169 template <
typename MF>
172 int _out_rad,
int _extent_rad,
int _ncomp,
181 fabs.
define(fsBA,dmap,_ncomp);
188 fabs.
setVal(std::numeric_limits<value_type>::quiet_NaN());
191 template <
typename MF>
203 for (
auto const& k : bndry) {
209 template <
typename MF>
214 bndry[face()].setVal(v);
218 template <
typename MF>
224 const auto f = face();
225 const int ncomp = bndry[
f].nComp();
227 #pragma omp parallel if (Gpu::notInLaunchRegion())
230 const Box& bx = bfsi.validbox();
231 auto const sfab = rhs[
f].array(bfsi);
232 auto dfab = bndry[
f].array(bfsi);
235 dfab(i,j,k,n) += sfab(i,j,k,n);
242 template <
typename MF>
246 return operator+=(rhs);
249 template <
typename MF>
253 int dest_comp,
int num_comp,
int n_ghost)
257 bndry[face()].linComb(a, mfa, a_comp,
259 dest_comp, num_comp, n_ghost);
264 template <
typename MF>
267 int src_comp,
int dest_comp,
int num_comp,
272 bndry[face()].copyFrom(src,nghost,src_comp,dest_comp,num_comp,period);
277 template <
typename MF>
280 int src_comp,
int dest_comp,
int num_comp,
285 bndry[face()].plusFrom(src,nghost,src_comp,dest_comp,num_comp,period);
290 template <
typename MF>
307 const int i = face();
312 bndry[face()].write(facename);
316 template <
typename MF>
325 amrex::Abort(
"BndryRegisterT<MF>::read: grids do not match");
335 const int i = face();
340 bndry[face()].read(facename);
345 template <
typename MF>
#define BL_ASSERT(EX)
Definition: AMReX_BLassert.H:39
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D(...)
Definition: AMReX_GpuLaunch.nolint.H:55
A BndryRegister organizes FabSets bounding each grid in a BoxArray. A FabSet is maintained for each b...
Definition: AMReX_BndryRegister.H:41
void setVal(value_type v)
Set all boundary FABs to given value.
Definition: AMReX_BndryRegister.H:210
const DistributionMapping & DistributionMap() const noexcept
Returns constant reference to associated DistributionMapping.
Definition: AMReX_BndryRegister.H:111
int size() const noexcept
Return the number of grids in this domain.
Definition: AMReX_BndryRegister.H:77
void write(const std::string &name, std::ostream &os) const
Write (used for writing to checkpoint)
Definition: AMReX_BndryRegister.H:292
BndryRegisterT< MF > & copyFrom(const MF &src, int nghost, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic())
Fill the boundary FABs on intersection with given MF.
Definition: AMReX_BndryRegister.H:266
BndryRegisterT< MF > & operator+=(const BndryRegisterT< MF > &rhs)
register += rhs
Definition: AMReX_BndryRegister.H:220
void setBoxes(const BoxArray &grids)
Set box domain, if not set previously.
Definition: AMReX_BndryRegister.H:193
BoxArray grids
Definition: AMReX_BndryRegister.H:126
const BoxArray & boxes() const noexcept
Get box domain (as an array of boxes).
Definition: AMReX_BndryRegister.H:74
BndryRegisterT< MF > & plus(const BndryRegisterT< MF > &rhs)
Definition: AMReX_BndryRegister.H:244
BndryRegisterT< MF > & plusFrom(const MF &src, int nghost, int src_comp, int dest_comp, int num_comp, const Periodicity &period=Periodicity::NonPeriodic())
Increment the boundary FABs on intersect with given MF.
Definition: AMReX_BndryRegister.H:279
void clear()
Definition: AMReX_BndryRegister.H:161
static void Copy(BndryRegisterT< MF > &dst, const BndryRegisterT< MF > &src)
Local copy function.
Definition: AMReX_BndryRegister.H:347
FabSetT< MF > bndry[2 *AMREX_SPACEDIM]
The data.
Definition: AMReX_BndryRegister.H:125
const FabSetT< MF > & operator[](Orientation face) const noexcept
Return const set of FABs bounding the domain grid boxes on a given orientation.
Definition: AMReX_BndryRegister.H:80
void define(const BoxArray &grids_, const DistributionMapping &dmap, int in_rad, int out_rad, int extent_rad, int ncomp)
Definition: AMReX_BndryRegister.H:147
typename MF::value_type value_type
Definition: AMReX_BndryRegister.H:44
void read(const std::string &name, std::istream &is)
Read (used for reading from checkpoint)
Definition: AMReX_BndryRegister.H:318
BndryRegisterT< MF > & linComb(value_type a, const MF &mfa, int a_comp, value_type b, const MF &mfb, int b_comp, int dest_comp, int num_comp, int n_ghost=0)
Linear combination: this := a*mfa + b*mfb on intersection of MFs with the boundary FABs.
Definition: AMReX_BndryRegister.H:251
BndryRegisterT() noexcept=default
The default constructor.
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:530
int readFrom(std::istream &is)
Initialize the BoxArray from the supplied istream. It is an error if the BoxArray has already been in...
Definition: AMReX_BoxArray.cpp:458
Long size() const noexcept
Return the number of boxes in the BoxArray.
Definition: AMReX_BoxArray.H:577
bool empty() const noexcept
Return whether the BoxArray is empty.
Definition: AMReX_BoxArray.H:583
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
Definition: AMReX_FabSet.H:149
A FabSet is a group of FArrayBox's. The grouping is designed specifically to represent regions along ...
Definition: AMReX_FabSet.H:46
static void Copy(FabSetT< MF > &dst, const FabSetT< MF > &src)
Definition: AMReX_FabSet.H:389
void setVal(value_type val)
Definition: AMReX_FabSet.H:254
int size() const noexcept
Definition: AMReX_FabSet.H:90
void define(const BoxArray &grids, const DistributionMapping &dmap, int ncomp)
Define a FabSetT<MF> constructed via default constructor.
Definition: AMReX_FabSet.H:163
AMREX_GPU_HOST_DEVICE static constexpr AMREX_FORCE_INLINE IndexTypeND< dim > TheCellType() noexcept
This static member function returns an IndexTypeND object of value IndexTypeND::CELL....
Definition: AMReX_IndexType.H:149
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition: AMReX_MFIter.H:141
An Iterator over the Orientation of Faces of a Box.
Definition: AMReX_Orientation.H:135
Encapsulation of the Orientation of the Faces of a Box.
Definition: AMReX_Orientation.H:29
This provides length of period for periodic domains. 0 means it is not periodic in that direction....
Definition: AMReX_Periodicity.H:17
static const Periodicity & NonPeriodic() noexcept
Definition: AMReX_Periodicity.cpp:52
bool IOProcessor() noexcept
Is this CPU the I/O Processor? To get the rank number, call IOProcessorNumber()
Definition: AMReX_ParallelDescriptor.H:275
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
Definition: AMReX_Amr.cpp:49
std::string Concatenate(const std::string &root, int num, int mindigits)
Returns rootNNNN where NNNN == num.
Definition: AMReX_String.cpp:34
bool match(const BoxArray &x, const BoxArray &y)
Note that two BoxArrays that match are not necessarily equal.
Definition: AMReX_BoxArray.cpp:1877
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition: AMReX.H:111
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:221