Block-Structured AMR Software Framework
AMReX_BoxDomain.H
Go to the documentation of this file.
1 
2 #ifndef BL_BOXDOMAIN_H
3 #define BL_BOXDOMAIN_H
4 #include <AMReX_Config.H>
5 
6 #include <AMReX_IndexType.H>
7 #include <AMReX_Box.H>
8 #include <AMReX_IntVect.H>
9 #include <AMReX_BoxList.H>
10 
11 #include <iosfwd>
12 
13 namespace amrex
14 {
15  class BoxDomain;
16  class BoxArray;
17 
19  BoxDomain complementIn (const Box& b, const BoxDomain& bl);
20 
25  void coarsen (BoxDomain& dest, const BoxDomain& fin, int ratio);
26 
31  void refine (BoxDomain& dest,
32  const BoxDomain& fin,
33  int ratio);
34 
39  void intersect (BoxDomain& dest,
40  const BoxDomain& fin,
41  const Box& b);
42 
47  void accrete (BoxDomain& dest,
48  const BoxDomain& fin,
49  int sz = 1);
50 
51 
53 std::ostream& operator<< (std::ostream& os, const BoxDomain& bd);
54 
55 
64 class BoxDomain
65  :
66  protected BoxList
67 {
68 public:
69  friend class ClusterList;
70 
72 
74  BoxDomain ();
75 
77  BoxDomain (const Box& bx);
78 
80  explicit BoxDomain (IndexType itype);
81 
83  void add (const Box& b);
84 
86  void add (const BoxList& bl);
87 
89  BoxDomain& rmBox (const Box& b);
90 
95  [[nodiscard]] bool ok () const;
96 
98  using BoxList::clear;
99 
101  using BoxList::size;
102 
104  using BoxList::isEmpty;
105 
107  using BoxList::isNotEmpty;
108 
110  using BoxList::minimalBox;
111 
113  using BoxList::ixType;
114 
116  using BoxList::simplify;
117 
119  using BoxList::begin;
120 
122  using BoxList::end;
123 
125  using BoxList::contains;
126 
128  using BoxList::shift;
129 
131  using BoxList::shiftHalf;
132 
134  [[nodiscard]] const BoxList& boxList () const;
135 
137  bool operator== (const BoxDomain& rhs) const;
138 
140  bool operator!= (const BoxDomain& rhs) const;
141 
143  BoxDomain& refine (int ratio);
144 
146  BoxDomain& coarsen (int ratio);
147 
149  BoxDomain& intersect (const Box& b);
150 
152  BoxDomain& accrete (int sz);
153 
155  BoxDomain& complementIn (const Box& b,
156  const BoxDomain& bl);
157 
158 private:
160  explicit BoxDomain (BoxList&& bl);
161 };
162 
163 }
164 
165 #endif /*BL_BOXDOMAIN_H*/
A List of Disjoint Boxes.
Definition: AMReX_BoxDomain.H:67
bool operator==(const BoxDomain &rhs) const
Are the BoxDomains equal?
Definition: AMReX_BoxDomain.cpp:88
BoxDomain & coarsen(int ratio)
Coarsen all Boxes in the domain by the refinement ratio.
Definition: AMReX_BoxDomain.cpp:220
BoxDomain & refine(int ratio)
Refine all Boxes in the domain by the refinement ratio.
Definition: AMReX_BoxDomain.cpp:28
BoxDomain & rmBox(const Box &b)
Remove a box from the domain.
Definition: AMReX_BoxDomain.cpp:159
BoxDomain & accrete(int sz)
Grow each Box by size sz.
Definition: AMReX_BoxDomain.cpp:210
bool operator!=(const BoxDomain &rhs) const
Are the BoxDomains not equal?
Definition: AMReX_BoxDomain.cpp:94
BoxDomain()
Construct an empty BoxDomain of IndexType::TheCellType().
Definition: AMReX_BoxDomain.cpp:99
BoxDomain & complementIn(const Box &b, const BoxDomain &bl)
Creates the complement of BoxDomain bl in Box b.
Definition: AMReX_BoxDomain.cpp:63
BoxDomain & intersect(const Box &b)
Intersect this BoxDomain with Box b.
Definition: AMReX_BoxDomain.cpp:11
BoxList::const_iterator const_iterator
Definition: AMReX_BoxDomain.H:71
const BoxList & boxList() const
Return a const reference to the underlying BoxList of this BoxDomain.
Definition: AMReX_BoxDomain.cpp:82
bool ok() const
Definition: AMReX_BoxDomain.cpp:180
void add(const Box &b)
Add a Box to the domain.
Definition: AMReX_BoxDomain.cpp:121
A class for managing a List of Boxes that share a common IndexType. This class implements operations ...
Definition: AMReX_BoxList.H:52
bool contains(const BoxList &bl) const
True if all Boxes in bl are contained in this BoxList.
void clear()
Remove all Boxes from this BoxList.
IndexType ixType() const noexcept
Returns the IndexType of Boxes in this BoxList.
Definition: AMReX_BoxList.H:194
iterator end() noexcept
Definition: AMReX_BoxList.H:121
bool isEmpty() const noexcept
Is this BoxList empty?
Definition: AMReX_BoxList.H:135
bool isNotEmpty() const noexcept
Is this BoxList not empty?
Definition: AMReX_BoxList.H:137
BoxList & shift(int dir, int nzones)
Applies Box::shift(int,int) to each Box in the BoxList.
int simplify(bool best=false)
Merge adjacent Boxes in this BoxList. Return the number of Boxes merged. If "best" is specified we do...
iterator begin() noexcept
Definition: AMReX_BoxList.H:117
BoxList & shiftHalf(int dir, int num_halfs)
Applies Box::shiftHalf(int,int) to each Box in the BoxList.
Long size() const noexcept
The number of Boxes in this BoxList.
Definition: AMReX_BoxList.H:113
Box minimalBox() const
Returns smallest Box that contains all Boxes in this BoxList.
Vector< Box >::const_iterator const_iterator
Definition: AMReX_BoxList.H:58
A list of Cluster objects.
Definition: AMReX_Cluster.H:141
Definition: AMReX_Amr.cpp:49
void accrete(BoxDomain &dest, const BoxDomain &fin, int sz)
Grow each Box in BoxDomain fin by size sz and place the result into BoxDomain dest.
Definition: AMReX_BoxDomain.cpp:45
BoxND< AMREX_SPACEDIM > Box
Definition: AMReX_BaseFwd.H:27
BoxArray intersect(const BoxArray &ba, const Box &b, int ng=0)
Make a BoxArray from the intersection of Box b and BoxArray(+ghostcells).
BoxArray complementIn(const Box &b, const BoxArray &ba)
Make a BoxArray from the complement of BoxArray ba in Box b.
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Definition: AMReX_Box.H:1342
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition: AMReX_Box.H:1304
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition: AMReX_AmrMesh.cpp:1236