Chombo + EB  3.0
EBISLayout.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 // ANAG, LBNL
12 
13 #ifndef _EBISLAYOUT_H_
14 #define _EBISLAYOUT_H_
15 
16 #include "REAL.H"
17 #include "IntVect.H"
18 #include "IntVectSet.H"
19 #include "VolIndex.H"
20 #include "FaceIndex.H"
21 #include "IntVectSet.H"
22 #include "EBISBox.H"
23 #include "DisjointBoxLayout.H"
24 #include "LevelData.H"
25 #include "EBGraph.H"
26 
27 #include "NamespaceHeader.H"
28 
29 class EBIndexSpace;
30 class EBISLayoutImplem;
31 
32 ///
33 /**
34  EBISLayout represents the geometric information
35  on a union of rectangles. This is
36  another ref-counted pointer object so copying
37  it is cheap but has the ref-counted pointer semantic.
38 */
40 {
41 public:
42  ///
43  /**
44  Access the {\tt EBISBox} associated with the input DataIndex.
45  Only constant access is permitted.
46  */
47 
48  const EBISBox& operator[](const DataIndex& a_index) const;
49 
50  ///
51  /**
52  Sets the maximum level of refinement that this {\tt EBISLayout}
53  will have to perform. Creates and holds new {\tt EBISLayout}s
54  at intermediate levels of refinement.
55  Default is one (no refinement done).
56  */
57  void setMaxRefinementRatio(const int& a_maxRefine, const EBIndexSpace* const a_ebisPtr);
58 
59  ///
60  /**
61  Sets the maximum level of coarsening that this {\tt EBISLayout}
62  will have to perform. Creates and holds new {\tt EBISLayout}s
63  at intermediate levels of refinement.
64  Default is one (no coarsening done).
65  */
66  void setMaxCoarseningRatio(const int& a_maxCoarsen, const EBIndexSpace* const a_ebisPtr);
67 
68  ///
69  /**
70  Get the nghost used to create this EBISLayout
71  */
72  int getGhost() const
73  {
74  return m_nghost;
75  }
76 
77  ///
78  EBISLayout();
79 
80  ///
81  /**
82  Returns the ghosted layout associated with the ebisl.
83  */
84  const BoxLayout& getGrownLayout() const;
85 
86  ///
87  /**
88  Returns the disjoint layout that was sent in.
89  */
90  const DisjointBoxLayout& getDisjointLayout() const;
91 
92  ///
93  ~EBISLayout();
94 
95  ///
96  /**
97  Returns the index of the VoF corresponding to coarsening
98  the input VoF by the input ratio. It is an error if
99  the ratio is greater than the maximum coarsening ratio
100  or if the vof does not exist at the input data index.
101  */
102  VolIndex coarsen(const VolIndex& a_vof,
103  const int& a_ratio,
104  const DataIndex& a_datInd) const;
105 
106  ///
107  /**
108  Returns the indices of the VoFs corresponding to refining
109  the input VoF by the input ratio. It is an error if
110  the ratio is greater than the maximum refinement ratio
111  or if the vof does not exist at the input data index.
112  */
113  Vector<VolIndex> refine(const VolIndex& a_vof,
114  const int& a_ratio,
115  const DataIndex& a_datInd) const;
116 
117  ///
118  /**
119  Returns the indices of the Faces corresponding to refining
120  the input Face by the input ratio. It is an error if
121  the ratio is greater than the maximum refinement ratio
122  or if the face does not exist at the input data index.
123  */
124  Vector<FaceIndex> refine(const FaceIndex& a_face,
125  const int& a_ratio,
126  const DataIndex& a_datInd) const;
127 
128  ///
129  int getMaxCoarseningRatio() const;
130 
131  ///
132  int getMaxRefinementRatio() const;
133 
134  ///
135  void define(const ProblemDomain& a_domain,
136  const DisjointBoxLayout& a_grids,
137  const int& a_nghost,
138  const LevelData<EBGraph>& a_graph,
139  const LevelData<EBData> & a_data);
140 
141  bool isDefined() const;
142 
143  //multifluid things. tamper not with these unless you REALLY know what you are doing.
144  const EBIndexSpace* getEBIS() const;
145  void setEBIS(const EBIndexSpace* const a_ebisPtr);
146 private:
147  ///
149  int m_nghost;
150 };
151 
152 ///
153 /**
154  EBISLayoutImplem represents the geometric information
155  on a union of rectangles. This is not really part
156  of the public interface. Users should use EBISLayout.
157 */
159 {
160 public:
161 
162  ///
163  const EBISBox& operator[](const DataIndex&) const;
164 
165  ///
167 
168  ///
170 
171  ///
172  const BoxLayout& getGrownLayout() const
173  {
174  return m_blGhostDom;
175  }
176 
178  {
179  return m_dblInputDom;
180  }
181 
182  ///
183  /**
184  Returns the index of the VoF corresponding to coarsening
185  the input VoF by the input ratio. It is an error if
186  the ratio is greater than the maximum coarsening ratio
187  or if the vof does not exist at the input data index.
188  */
189  VolIndex coarsen(const VolIndex& a_vof,
190  const int& a_ratio,
191  const DataIndex& a_datInd) const;
192 
193  ///
194  /**
195  Returns the index of the face corresponding to coarsening
196  the input face by the input ratio. It is an error if
197  the ratio is greater than the maximum coarsening ratio
198  or if the face does not exist at the input data index.
199  */
200  FaceIndex coarsen(const FaceIndex& a_face,
201  const int& a_ratio,
202  const DataIndex& a_datInd) const;
203 
204  ///
205  /**
206  Returns the indices of the VoFs corresponding to refining
207  the input VoF by the input ratio. It is an error if
208  the ratio is greater than the maximum refinement ratio
209  or if the vof does not exist at the input data index.
210  */
211  Vector<VolIndex> refine(const VolIndex& a_vof,
212  const int& a_ratio,
213  const DataIndex& a_datInd) const;
214 
215  ///
216  /**
217  Returns the indices of the Faces corresponding to refining
218  the input Face by the input ratio. It is an error if
219  the ratio is greater than the maximum refinement ratio
220  or if the face does not exist at the input data index.
221  */
222  Vector<FaceIndex> refine(const FaceIndex& a_face,
223  const int& a_ratio,
224  const DataIndex& a_datInd) const;
225 
226  ///
227  /**
228  Sets the maximum level of refinement that this {\tt EBISLayout}
229  will have to perform. Creates and holds new {\tt EBISLayout}s
230  at intermediate levels of refinement.
231  Default is one (no refinement done).
232  */
233  void setMaxRefinementRatio(const int& a_maxRefine, const EBIndexSpace* const a_ebisPtr);
234 
235  ///
236  /**
237  Sets the maximum level of coarsening that this {\tt EBISLayout}
238  will have to perform. Creates and holds new {\tt EBISLayout}s
239  at intermediate levels of refinement.
240  Default is one (no coarsening done).
241  */
242  void setMaxCoarseningRatio(const int& a_maxCoarsen, const EBIndexSpace* const a_ebisPtr);
243 
244  ///
245  int getMaxCoarseningRatio() const;
246 
247  ///
248  int getMaxRefinementRatio() const;
249 
250  ///
251  void define(const ProblemDomain& a_domain,
252  const DisjointBoxLayout& a_grids,
253  const int& a_nghost,
254  const LevelData<EBGraph>& a_graph,
255  const LevelData<EBData> & a_data);
256 
257  ///
258  static void setVerbose(bool a_verbose);
259 
260  bool isDefined() const {return m_defined;}
261 
262  const EBIndexSpace* getEBIS() const
263  {
264  return m_ebisPtr;
265  }
266  void setEBIS(const EBIndexSpace* const a_ebisPtr)
267  {
268  m_ebisPtr = a_ebisPtr;
269  }
270 private:
271 
273  ///
275 
276  ///
278 
279  ///
281 
282  ///
284 
285  ///
286  int m_nghost;
287 
288  ///
290 
291  ///
293 
294  ///
296 
297  ///
299 
300  bool m_defined;
301 
302 private:
303  static bool s_verbose;
304  void operator=(const EBISLayoutImplem& ebiin)
305  {;}
307  {;}
308 
309 };
310 
311 #include "NamespaceFooter.H"
312 #endif
Vector< EBISLayout > m_fineLevels
Definition: EBISLayout.H:280
void setMaxCoarseningRatio(const int &a_maxCoarsen, const EBIndexSpace *const a_ebisPtr)
VolIndex coarsen(const VolIndex &a_vof, const int &a_ratio, const DataIndex &a_datInd) const
BoxLayout m_blGhostDom
Definition: EBISLayout.H:274
void setEBIS(const EBIndexSpace *const a_ebisPtr)
const EBISBox & operator[](const DataIndex &) const
const DisjointBoxLayout & getDisjointLayout() const
Definition: EBISLayout.H:177
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
int m_maxCoarseningRatio
Definition: EBISLayout.H:289
const BoxLayout & getGrownLayout() const
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:146
Definition: FaceIndex.H:28
LayoutData< EBISBox > m_ebisBoxes
Definition: EBISLayout.H:298
int m_maxRefinementRatio
Definition: EBISLayout.H:292
const EBIndexSpace * m_ebisPtr
Definition: EBISLayout.H:272
Definition: EBISBox.H:46
void define(const ProblemDomain &a_domain, const DisjointBoxLayout &a_grids, const int &a_nghost, const LevelData< EBGraph > &a_graph, const LevelData< EBData > &a_data)
VolIndex coarsen(const VolIndex &a_vof, const int &a_ratio, const DataIndex &a_datInd) const
int getMaxCoarseningRatio() const
int getMaxCoarseningRatio() const
const EBISBox & operator[](const DataIndex &a_index) const
int m_nghost
Definition: EBISLayout.H:286
const BoxLayout & getGrownLayout() const
Definition: EBISLayout.H:172
int m_nghost
Definition: EBISLayout.H:149
const EBIndexSpace * getEBIS() const
Definition: EBISLayout.H:262
void setMaxCoarseningRatio(const int &a_maxCoarsen, const EBIndexSpace *const a_ebisPtr)
ProblemDomain m_domain
Definition: EBISLayout.H:295
int getMaxRefinementRatio() const
static bool s_verbose
Definition: EBISLayout.H:303
Definition: EBISLayout.H:158
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
RefCountedPtr< EBISLayoutImplem > m_implem
Definition: EBISLayout.H:148
Vector< EBISLayout > m_coarLevels
Definition: EBISLayout.H:283
Vector< VolIndex > refine(const VolIndex &a_vof, const int &a_ratio, const DataIndex &a_datInd) const
bool isDefined() const
Definition: DataIndex.H:112
int getMaxRefinementRatio() const
void define(const ProblemDomain &a_domain, const DisjointBoxLayout &a_grids, const int &a_nghost, const LevelData< EBGraph > &a_graph, const LevelData< EBData > &a_data)
DisjointBoxLayout m_dblInputDom
Definition: EBISLayout.H:277
bool isDefined() const
Definition: EBISLayout.H:260
void operator=(const EBISLayoutImplem &ebiin)
Definition: EBISLayout.H:304
Volume of Fluid Index.
Definition: VolIndex.H:31
int getGhost() const
Definition: EBISLayout.H:72
const EBIndexSpace * getEBIS() const
Definition: EBISLayout.H:39
void setMaxRefinementRatio(const int &a_maxRefine, const EBIndexSpace *const a_ebisPtr)
bool m_defined
Definition: EBISLayout.H:300
static void setVerbose(bool a_verbose)
void setMaxRefinementRatio(const int &a_maxRefine, const EBIndexSpace *const a_ebisPtr)
const DisjointBoxLayout & getDisjointLayout() const
EBISLayoutImplem(const EBISLayoutImplem &ebiin)
Definition: EBISLayout.H:306
void setEBIS(const EBIndexSpace *const a_ebisPtr)
Definition: EBISLayout.H:266
Vector< VolIndex > refine(const VolIndex &a_vof, const int &a_ratio, const DataIndex &a_datInd) const