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