Chombo + EB + MF  3.2
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 
147  int refCount() const { return m_implem.refCount();}
148 
149  ///
150  const ProblemDomain& getDomain() const ;
151 private:
152  ///
154  int m_nghost;
155 };
156 
157 ///
158 /**
159  EBISLayoutImplem represents the geometric information
160  on a union of rectangles. This is not really part
161  of the public interface. Users should use EBISLayout.
162 */
164 {
165 public:
166 
167  ///
168  const EBISBox& operator[](const DataIndex&) const;
169 
170  ///
172 
173  ///
174  ~EBISLayoutImplem();
175 
176  ///
177  const BoxLayout& getGrownLayout() const
178  {
179  return m_blGhostDom;
180  }
181 
183  {
184  return m_dblInputDom;
185  }
186 
187  ///
188  /**
189  Returns the index of the VoF corresponding to coarsening
190  the input VoF by the input ratio. It is an error if
191  the ratio is greater than the maximum coarsening ratio
192  or if the vof does not exist at the input data index.
193  */
194  VolIndex coarsen(const VolIndex& a_vof,
195  const int& a_ratio,
196  const DataIndex& a_datInd) const;
197 
198  ///
199  /**
200  Returns the index of the face corresponding to coarsening
201  the input face by the input ratio. It is an error if
202  the ratio is greater than the maximum coarsening ratio
203  or if the face does not exist at the input data index.
204  */
205  FaceIndex coarsen(const FaceIndex& a_face,
206  const int& a_ratio,
207  const DataIndex& a_datInd) const;
208 
209  ///
210  /**
211  Returns the indices of the VoFs corresponding to refining
212  the input VoF by the input ratio. It is an error if
213  the ratio is greater than the maximum refinement ratio
214  or if the vof does not exist at the input data index.
215  */
216  Vector<VolIndex> refine(const VolIndex& a_vof,
217  const int& a_ratio,
218  const DataIndex& a_datInd) const;
219 
220  ///
221  /**
222  Returns the indices of the Faces corresponding to refining
223  the input Face by the input ratio. It is an error if
224  the ratio is greater than the maximum refinement ratio
225  or if the face does not exist at the input data index.
226  */
227  Vector<FaceIndex> refine(const FaceIndex& a_face,
228  const int& a_ratio,
229  const DataIndex& a_datInd) const;
230 
231  ///
232  /**
233  Sets the maximum level of refinement that this {\tt EBISLayout}
234  will have to perform. Creates and holds new {\tt EBISLayout}s
235  at intermediate levels of refinement.
236  Default is one (no refinement done).
237  */
238  void setMaxRefinementRatio(const int& a_maxRefine, const EBIndexSpace* const a_ebisPtr);
239 
240  ///
241  /**
242  Sets the maximum level of coarsening that this {\tt EBISLayout}
243  will have to perform. Creates and holds new {\tt EBISLayout}s
244  at intermediate levels of refinement.
245  Default is one (no coarsening done).
246  */
247  void setMaxCoarseningRatio(const int& a_maxCoarsen, const EBIndexSpace* const a_ebisPtr);
248 
249  ///
250  int getMaxCoarseningRatio() const;
251 
252  ///
253  int getMaxRefinementRatio() const;
254 
255  ///
256  void define(const ProblemDomain& a_domain,
257  const DisjointBoxLayout& a_grids,
258  const int& a_nghost,
259  const LevelData<EBGraph>& a_graph,
260  const LevelData<EBData> & a_data);
261 
262  ///
263  static void setVerbose(bool a_verbose);
264 
265  bool isDefined() const {return m_defined;}
266 
267  const EBIndexSpace* getEBIS() const
268  {
269  return m_ebisPtr;
270  }
271  void setEBIS(const EBIndexSpace* const a_ebisPtr)
272  {
273  m_ebisPtr = a_ebisPtr;
274  }
275 
276  const ProblemDomain& getDomain() const
277  {
278  return m_domain;
279  }
280 private:
281 
283  ///
285 
286  ///
288 
289  ///
291 
292  ///
294 
295  ///
296  int m_nghost;
297 
298  ///
300 
301  ///
303 
304  ///
306 
307  ///
309 
310  bool m_defined;
311 
312 private:
313  static bool s_verbose;
314  void operator=(const EBISLayoutImplem& ebiin)
315  {;}
317  {;}
318 
319 };
320 
321 #include "NamespaceFooter.H"
322 #endif
Vector< EBISLayout > m_fineLevels
Definition: EBISLayout.H:290
bool isDefined() const
Definition: EBISLayout.H:265
void setMaxCoarseningRatio(const int &a_maxCoarsen, const EBIndexSpace *const a_ebisPtr)
BoxLayout m_blGhostDom
Definition: EBISLayout.H:284
void setEBIS(const EBIndexSpace *const a_ebisPtr)
int refCount() const
Definition: EBISLayout.H:147
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: EBIndexSpace.H:50
int m_maxCoarseningRatio
Definition: EBISLayout.H:299
int getGhost() const
Definition: EBISLayout.H:72
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
Definition: FaceIndex.H:28
LayoutData< EBISBox > m_ebisBoxes
Definition: EBISLayout.H:308
int m_maxRefinementRatio
Definition: EBISLayout.H:302
const EBIndexSpace * m_ebisPtr
Definition: EBISLayout.H:282
Definition: EBISBox.H:46
Vector< VolIndex > refine(const VolIndex &a_vof, const int &a_ratio, const DataIndex &a_datInd) 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)
const EBISBox & operator[](const DataIndex &a_index) const
const EBIndexSpace * getEBIS() const
Definition: EBISLayout.H:267
const EBIndexSpace * getEBIS() const
int m_nghost
Definition: EBISLayout.H:296
const BoxLayout & getGrownLayout() const
int m_nghost
Definition: EBISLayout.H:154
VolIndex coarsen(const VolIndex &a_vof, const int &a_ratio, const DataIndex &a_datInd) const
ProblemDomain m_domain
Definition: EBISLayout.H:305
const DisjointBoxLayout & getDisjointLayout() const
Definition: EBISLayout.H:182
static bool s_verbose
Definition: EBISLayout.H:313
Definition: EBISLayout.H:163
int getMaxCoarseningRatio() const
const DisjointBoxLayout & getDisjointLayout() const
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
const ProblemDomain & getDomain() const
Definition: EBISLayout.H:276
RefCountedPtr< EBISLayoutImplem > m_implem
Definition: EBISLayout.H:153
Vector< EBISLayout > m_coarLevels
Definition: EBISLayout.H:293
int getMaxRefinementRatio() const
Definition: DataIndex.H:114
bool isDefined() const
DisjointBoxLayout m_dblInputDom
Definition: EBISLayout.H:287
void operator=(const EBISLayoutImplem &ebiin)
Definition: EBISLayout.H:314
Volume of Fluid Index.
Definition: VolIndex.H:31
Definition: EBISLayout.H:39
int refCount() const
Definition: RefCountedPtr.H:613
void setMaxRefinementRatio(const int &a_maxRefine, const EBIndexSpace *const a_ebisPtr)
bool m_defined
Definition: EBISLayout.H:310
const BoxLayout & getGrownLayout() const
Definition: EBISLayout.H:177
const ProblemDomain & getDomain() const
EBISLayoutImplem(const EBISLayoutImplem &ebiin)
Definition: EBISLayout.H:316
void setEBIS(const EBIndexSpace *const a_ebisPtr)
Definition: EBISLayout.H:271