Block-Structured AMR Software Framework
AMReX_AuxBoundaryData.H
Go to the documentation of this file.
1 
2 #ifndef AMREX_AuxBoundaryData_H_
3 #define AMREX_AuxBoundaryData_H_
4 #include <AMReX_Config.H>
5 
6 #include <AMReX_Geometry.H>
7 #include <AMReX_MultiFab.H>
8 
9 namespace amrex {
10 // \cond CODEGEN
11 class AuxBoundaryData
12 {
13 public:
14 
15  AuxBoundaryData () noexcept = default;
16 
17  AuxBoundaryData (const BoxArray& ba,
18  int n_grow,
19  int n_comp,
20  const Geometry& geom);
21 
22  ~AuxBoundaryData () = default;
23 
24  AuxBoundaryData (AuxBoundaryData&& rhs) = default;
25  AuxBoundaryData& operator= (AuxBoundaryData&& rhs) = default;
26 
27  AuxBoundaryData (const AuxBoundaryData& rhs);
28  AuxBoundaryData& operator= (const AuxBoundaryData& rhs) = delete;
29 
30  void copyTo (MultiFab& destmf,
31  int src_comp,
32  int dst_comp,
33  int num_comp) const;
34 
35  void copyFrom (const MultiFab& srcmf,
36  int src_comp,
37  int dst_comp,
38  int num_comp,
39  int src_ng = 0);
40 
41  size_t size () const noexcept
42  {
43  BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs.size();
44  }
45 
46  void copy (const AuxBoundaryData& src,
47  int src_comp,
48  int dst_comp,
49  int num_comp);
50 
51  void initialize (const BoxArray& ba,
52  int n_grow,
53  int n_comp,
54  const Geometry& geom);
55 
56  const BoxArray& equivBoxArray () const noexcept
57  {
58  BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs.boxArray();
59  }
60 
61  void setVal (Real r) { BL_ASSERT(m_initialized); if (!m_empty) { m_fabs.setVal(r); } }
62 
63  const DistributionMapping& DistributionMap () const noexcept
64  {
65  BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs.DistributionMap();
66  }
67 
68  FArrayBox& operator[] (const MFIter& mfi) noexcept
69  {
70  BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs[mfi];
71  }
72  const FArrayBox& operator[] (const MFIter& mfi) const noexcept
73  {
74  BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs[mfi];
75  }
76 
77  int nGrow () const noexcept { BL_ASSERT(m_initialized); return m_ngrow; }
78 
79  int nComp () const noexcept
80  {
81  BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs.nComp();
82  }
83 
84  bool isEmpty () const noexcept { return m_empty; }
85 
86 private:
87 
88  MultiFab m_fabs;
89  int m_ngrow{0};
90  bool m_empty{false};
91  bool m_initialized{false};
92 };
93 // \endcond
94 
95 }
96 
97 #endif
#define BL_ASSERT(EX)
Definition: AMReX_BLassert.H:39
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
void copy(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous st...
Definition: AMReX_GpuContainers.H:121
Definition: AMReX_Amr.cpp:49
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
int nComp(FabArrayBase const &fa)
bool isEmpty(T n) noexcept
Definition: AMReX_GpuRange.H:14
void setVal(MF &dst, typename MF::value_type val)
dst = val
Definition: AMReX_FabArrayUtility.H:1607