Chombo + EB  3.0
EBAMRIO.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 // DTGraves, Thurs, Aug 16, 2001
12 
13 #ifndef _EBAMRIO_H_
14 #define _EBAMRIO_H_
15 
16 #include "LevelData.H"
17 #include "REAL.H"
18 #include "Vector.H"
19 #include "EBCellFAB.H"
20 #include "IntVectSet.H"
21 #include "EBISBox.H"
22 #include "EBISLayout.H"
23 #include "EBFaceFAB.H"
24 #include "EBFluxFAB.H"
25 #include <string>
26 #include "NamespaceHeader.H"
27 class EBIndexSpace;
28 
29 using std::string;
30 using std::istream;
31 
32 #ifdef CH_USE_HDF5
33 ///
34 /**
35  Writes hierarchy of levels in HDF5 format. Only available if the
36  preprocessor macro HDF5 is defined at compilation. Writes
37  single-valued data using regular Chombo WriteAMRHierarchyHDF5
38 
39  {\bf Arguments:}\\
40  a_filename : file to output to.\\
41  a_vectGrids : grids at each level.\\
42  a_vectData : data at each level.\\
43  a_vectNames: names of variables.\\
44  a_domain : domain at coarsest level.\\
45  a_dx : grid spacing at coarsest level.\\
46  a_dt : time step at coarsest level.\\
47  a_time : time.\\
48  a_vectRatio : refinement ratio at all level.\\
49  a_numLevels : number of levels to output.\\
50  a_replaceCovered: flag for replacing covered values with a_coveredVal.\\
51  a_coveredVal: sets Covered values to these if a_replaceCovered is true.\\
52  (ith entry is refinement ratio between levels i and i + 1).\\
53  This is blocking.
54 */
55 void
56 writeEBHDF5(const string& filename,
57  const Vector<DisjointBoxLayout>& a_vectGrids,
58  const Vector<LevelData<EBCellFAB>* > & a_vectData,
59  const Vector<string>& a_vectNames,
60  const ProblemDomain& a_domain,
61  const Real& a_dx,
62  const Real& a_dt,
63  const Real& a_time,
64  const Vector<int>& a_vectRatio,
65  const int& a_numLevels,
66  const bool& a_replaceCovered,
67  const Vector<Real>& a_coveredValues,
68  IntVect a_ghostVect= IntVect::Zero);
69 
70 /**
71  Two phases (each a Vector<LevelData<EBCellFAB>>) : most general case.
72 */
73 void
74 writeEBHDF5(const string& filename,
75  const Vector<DisjointBoxLayout>& a_vectGrids,
76  const Vector<LevelData<EBCellFAB>* > * a_phase1,
77  const Vector<LevelData<EBCellFAB>* > * a_phase2,
78  const Vector<LevelData<FArrayBox>* > * a_levelSet,
79  const Vector<string>& a_vectNames,
80  const ProblemDomain& a_domain,
81  const Real& a_dx,
82  const Real& a_dt,
83  const Real& a_time,
84  const Vector<int>& a_vectRatio,
85  const int& a_numLevels,
86  const bool& a_replaceCovered,
87  const Vector<Real>& a_coveredValues,
88  IntVect a_ghostVect= IntVect::Zero);
89 
90 ///
91 /**
92  Write a single LevelData<EBCellFAB>.
93  */
94 void
95 writeEBHDF5(const string& a_filename,
96  const DisjointBoxLayout& a_grids,
97  const LevelData<EBCellFAB>& a_data,
98  const Vector<string>& a_vectNames,
99  const ProblemDomain& a_domain,
100  const Real& a_dx,
101  const Real& a_dt,
102  const Real& a_time,
103  const bool& a_replaceCovered,
104  const Vector<Real>& a_coveredValues,
105  IntVect a_ghostVect= IntVect::Zero);
106 ///
107 /**
108  Write a single EBCellFAB.
109  */
110 void
111 writeEBHDF5(const string& a_filename,
112  const Box& a_grid,
113  const EBCellFAB& a_data,
114  const Vector<string>& a_vectNames,
115  const ProblemDomain& a_domain,
116  const Real& a_dx,
117  const Real& a_dt,
118  const Real& a_time,
119  const bool& a_replaceCovered,
120  const Vector<Real>& a_coveredValues,
121  IntVect a_ghostVect= IntVect::Zero);
122 ///
123 /** Writes a plotfile using the same format as writeEBHDF5, but
124  for a EBCellFAB. This is useful for debugging. *a_dataPtr is written
125  to a file named fab.hdf5
126 */
127 void
128 writeEBFAB(const EBCellFAB* a_dataPtr);
129 
130 ///
131 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
132  and then running ChomboVis with a python script which brings up a data
133  browser by default. The file has the same format as writeEBHDF5,
134  but for a single EBCellFAB. This is useful for debugging.
135 */
136 void
137 viewEBFAB(const EBCellFAB* a_dataPtr);
138 
139 
140 ///
141 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
142  and then running browse with a python script which brings up a data
143  browser by default. The file has the same format as writeEBHDF5,
144  but for a single EBCellFAB. This is useful for debugging.
145 */
146 void
147 browseEBFAB(const EBCellFAB* a_dataPtr);
148 
149 ///
150 /** Writes a plotfile using the same format as writeEBHDF5, but
151  for a EBCellFAB. This is useful for debugging. *a_dataPtr is written
152  to the file given by a_filename.
153 */
154 void
155 writeEBFABname(const EBCellFAB* a_dataPtr,
156  const char* a_filename);
157 
158 ///
159 /** View the face centered, regular data (as cell center data) in *a_dataPtr
160  by writing data on the a_dir face to an HDF5 plotfile (a temporary file).
161  Then, run VisIt with a python script, bringing up a data browser by
162  default. The file has the same format as writeEBHDF5, but the components
163  of the EBFluxFAB are written out successively.
164  This is useful for debugging.
165 */
166 void
167 viewEBFluxLD(const LevelData<EBFluxFAB>* a_dataPtr, int a_dir);
168 
169 ///
170 /** View the faced centered, regular data (as cell center data) in *a_dataPtr
171  by writing it to an HDF5 plotfile (to a temporary file) and then running
172  ChomboVis with a python script which brings up a data browser by default.
173  The file has the same format as writeEBHDF5, but for a single EBFaceFAB.
174  This is useful for debugging.
175 */
176 void
177 viewEBFace(const EBFaceFAB* a_dataPtr);
178 
179 
180 ///
181 /** View the faced centered, regular data (as cell center data) in *a_dataPtr
182  by writing it to an HDF5 plotfile (to a temporary file) and then running
183  chombobrowser with a python script which brings up a data browser by default.
184  The file has the same format as writeEBHDF5, but for a single EBFaceFAB.
185  This is useful for debugging.
186 */
187 void
188 browseEBFace(const EBFaceFAB* a_dataPtr);
189 
190 ///
191 /** Write a plotfile using the same format as writeEBHDF5, but
192  for a single LevelData<EBCellFAB>. Useful for debugging. *a_dataPtr is
193  written to a file named EBLDF.hdf5.
194 */
195 void
196 writeEBLevel(const LevelData<EBCellFAB>* a_dataPtr);
197 
198 ///
199 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
200  and then running ChomboVis with a python script which brings up a data
201  browser by default. The file has the same format as writeEBHDF5,
202  but for a single LevelData<EBCellFAB>. This is useful for debugging.
203 */
204 void
205 viewEBLevel(const LevelData<EBCellFAB>* a_dataPtr);
206 
207 ///
208 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
209  and then running chombobrowser with a python script which brings up a data
210  browser by default. The file has the same format as writeEBHDF5,
211  but for a single LevelData<EBCellFAB>. This is useful for debugging.
212 */
213 void
214 browseEBLevel(const LevelData<EBCellFAB>* a_dataPtr);
215 
216 ///
217 /** Write a plotfile using the same format as writeEBHDF5, but
218  for a single LevelData<EBCellFAB>. Useful for debugging. *a_dataPtr is
219  written to the file given by a_filename.
220 */
221 void
222 writeEBLevelname(const LevelData<EBCellFAB>* a_dataPtr,
223  const char* a_filename);
224 
225 ///
226 /** Write a plotfile using writeEBHDF5. Useful for debugging. *a_dataPtr is
227  written to a file named EBAMR.hdf5.
228 */
229 void
230 writeEBAMR(const Vector<LevelData<EBCellFAB>* >* a_dataPtr);
231 
232 ///
233 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
234  and then running ChomboVis with a python script which brings up a data
235  browser by default. This is useful for debugging.
236 */
237 void
238 viewEBAMR(const Vector<LevelData<EBCellFAB>* >* a_dataPtr);
239 
240 ///
241 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
242  and then running VisIt. This is useful for debugging.
243 */
244 void
245 visEBAMR(const Vector<LevelData<EBCellFAB>* >* a_dataPtr);
246 
247 ///
248 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
249  and then running chombobrowser with a python script which brings up a data
250  browser by default. This is useful for debugging.
251 */
252 void
253 browseEBAMR(const Vector<LevelData<EBCellFAB>* >* a_dataPtr);
254 
255 ///
256 /** Write a plotfile using writeEBHDF5. Useful for debugging. *a_dataPtr is
257  written to the file given by a_filename.
258 */
259 void
260 writeEBAMRname(const Vector<LevelData<EBCellFAB>* >* a_dataPtr,
261  const char* a_filename);
262 
263 
264 ///
265 /** Writes a plotfile using the basic Chombovis format, but
266  for a BaseIVFAB<Real>. This is somewhat limited in functionality,
267  since all it does is copy the BaseIVFAB to a FArrayBox in the appropriate
268  cells, and then call writeFAB. This is useful for debugging.
269  *a_dataPtr is written to a file named ivfab.hdf5
270 
271 */
272 void
273 writeIVFAB(const BaseIVFAB<Real>* a_dataPtr);
274 
275 ///
276 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
277  using writeIVFAB and then running ChomboVis with a python script which
278  brings up a data browser by default. The file has the same format
279  as writeEBHDF5, but for a single EBCellFAB. This is useful for
280  debugging.
281 */
282 void
283 viewIVFAB(const BaseIVFAB<Real>* a_dataPtr);
284 
285 
286 ///
287 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
288  and then running browse with a python script which brings up a data
289  browser by default. The file has the same format as writeEBHDF5,
290  but for a single BaseIVFAB<Real>. This is useful for debugging.
291 */
292 void
293 browseIVFAB(const BaseIVFAB<Real>* a_dataPtr);
294 
295 ///
296 /** Writes a plotfile using the same format as writeEBHDF5, but
297  for a BaseIVFAB<Real>. This is useful for debugging.
298  *a_dataPtr is written to the file given by a_filename.
299 */
300 void
301 writeIVFABname(const BaseIVFAB<Real>* a_dataPtr,
302  const char* a_filename);
303 
304 
305 ///
306 /** Write a plotfile using the same format as writeLevel, but
307  for a single LevelData<BaseIVFAB<Real> >. Useful for debugging.
308  *a_dataPtr is written to a file named IVLDF.hdf5.
309 */
310 void
311 writeIVLevel(const LevelData<BaseIVFAB<Real> >* a_dataPtr);
312 
313 ///
314 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
315  and then running ChomboVis with a python script which brings up a data
316  browser by default. The file has the same format as writeEBHDF5,
317  but for a single LevelData<BaseIVFAB<Real> >. This is useful for
318  debugging.
319 */
320 void
321 viewIVLevel(const LevelData<BaseIVFAB<Real> >* a_dataPtr);
322 
323 ///
324 /** View *a_dataPtr by writing it to an HDF5 plotfile (to a temporary file)
325  and then running chombobrowser with a python script which brings up a data
326  browser by default. The file has the same format as writeEBHDF5,
327  but for a single LevelData<BaseIVFAB<Real> >. This is useful for
328  debugging.
329 */
330 void
331 browseIVLevel(const LevelData<BaseIVFAB<Real> >* a_dataPtr);
332 
333 ///
334 /** Write a plotfile using the same format as writeEBHDF5, but
335  for a single LevelData<BaseIVFAB<Real> >. Useful for debugging.
336  *a_dataPtr is
337  written to the file given by a_filename.
338 */
339 void
340 writeIVLevelname(const LevelData<BaseIVFAB<Real> >* a_dataPtr,
341  const char* a_filename);
342 
343 void
344 createEBFile(HDF5Handle& a_handle,
345  const std::string& a_filename,
346  int a_numLevels,
347  const Vector<int>& a_refRatios,
348  const ProblemDomain& a_coarseDomain,
349  const RealVect& a_coarseDx,
350  const IntVect& a_ghost);
351 
352 void
353 createEBFile(HDF5Handle& a_handle,
354  const std::string& a_filename,
355  int a_numLevels,
356  const Vector<int>& a_refRatios,
357  const ProblemDomain& a_coarseDomain,
358  const RealVect& a_origin,
359  const RealVect& a_coarseDx,
360  const RealVect& a_aspect,
361  const IntVect& a_ghost);
362 
363 void
364 headerEBFile(HDF5Handle& a_handle,
365  int a_numLevels,
366  const Vector<int>& a_refRatios,
367  const ProblemDomain& a_coarseDomain,
368  const RealVect& a_coarseDx,
369  const IntVect& a_ghost);
370 
371 void
372 headerEBFile(HDF5Handle& a_handle,
373  int a_numLevels,
374  const Vector<int>& a_refRatios,
375  const ProblemDomain& a_coarseDomain,
376  const RealVect& a_origin,
377  const RealVect& a_coarseDx,
378  const RealVect& a_aspect,
379  const IntVect& a_ghost);
380 
381 void
383  const Vector<std::string>& a_names);
384 void
386  const Vector<std::string>& a_names);
387 
388 void
389 writeFaceCenteredNames(HDF5Handle& a_handle, int a_direction,
390  const Vector<std::string>& a_names);
391 
392 /// if no CellCenteredNames have been assigned, then dummy values of CC1..CCn are set
393 
394 void
395 writeCellCentered(HDF5Handle& a_handle,
396  int a_level,
397  const LevelData<EBCellFAB>* a_data,
398  Interval interval = Interval());
399 
400 void
401 writeCellCentered(HDF5Handle& a_handle,
402  int a_level,
403  const LevelData<FArrayBox>* a_data,
404  Interval interval = Interval());
405 
406 void
407 writeNodeCentered(HDF5Handle& a_handle,
408  int a_level,
409  const LevelData<FArrayBox>* a_data,
410  Interval interval = Interval());
411 
412 void
413 writeFaceCentered(HDF5Handle& a_handle,
414  int a_level,
415  int a_direction,
416  const LevelData<EBFaceFAB>* a_data,
417  Interval interval = Interval());
418 
419 void
420 readCellCentered(HDF5Handle& a_handle,
421  int a_level,
422  const EBIndexSpace* eb,
423  const int ebghost,
424  LevelData<EBCellFAB>* a_data);
425 
426 void
427 setWhichCellIndex(int a_whichCellIndex);
428 
429 int
431 
432 void
433 setCoveredCellValue(Real a_coveredCellValue);
434 
435 Real
437 
438 void multiFaceValues(const EBFaceFAB* a_face,
439  const int a_side,
440  const int a_iv0,
441  const int a_iv1,
442  const int a_iv2);
443 
444 void multiCellValues(const EBCellFAB* a_face,
445  const int a_iv0,
446  const int a_iv1,
447  const int a_iv2);
448 
449 #endif //CH_USE_HDF5
450 
451 #include "NamespaceFooter.H"
452 #endif
void viewIVFAB(const BaseIVFAB< Real > *a_dataPtr)
Real getCoveredCellValue()
void browseEBFace(const EBFaceFAB *a_dataPtr)
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
void viewEBLevel(const LevelData< EBCellFAB > *a_dataPtr)
void writeIVFAB(const BaseIVFAB< Real > *a_dataPtr)
void writeEBHDF5(const string &filename, const Vector< DisjointBoxLayout > &a_vectGrids, const Vector< LevelData< EBCellFAB > * > &a_vectData, const Vector< string > &a_vectNames, const ProblemDomain &a_domain, const Real &a_dx, const Real &a_dt, const Real &a_time, const Vector< int > &a_vectRatio, const int &a_numLevels, const bool &a_replaceCovered, const Vector< Real > &a_coveredValues, IntVect a_ghostVect=IntVect::Zero)
void visEBAMR(const Vector< LevelData< EBCellFAB > * > *a_dataPtr)
void browseEBFAB(const EBCellFAB *a_dataPtr)
void browseEBLevel(const LevelData< EBCellFAB > *a_dataPtr)
void browseIVFAB(const BaseIVFAB< Real > *a_dataPtr)
void writeEBAMRname(const Vector< LevelData< EBCellFAB > * > *a_dataPtr, const char *a_filename)
void writeIVLevelname(const LevelData< BaseIVFAB< Real > > *a_dataPtr, const char *a_filename)
void writeIVLevel(const LevelData< BaseIVFAB< Real > > *a_dataPtr)
void browseIVLevel(const LevelData< BaseIVFAB< Real > > *a_dataPtr)
void writeEBFAB(const EBCellFAB *a_dataPtr)
void writeEBLevelname(const LevelData< EBCellFAB > *a_dataPtr, const char *a_filename)
Definition: EBFaceFAB.H:28
void writeEBAMR(const Vector< LevelData< EBCellFAB > * > *a_dataPtr)
void viewEBFluxLD(const LevelData< EBFluxFAB > *a_dataPtr, int a_dir)
void viewEBFAB(const EBCellFAB *a_dataPtr)
void writeEBLevel(const LevelData< EBCellFAB > *a_dataPtr)
void multiCellValues(const EBCellFAB *a_face, const int a_iv0, const int a_iv1, const int a_iv2)
Structure for passing component ranges in code.
Definition: Interval.H:23
void writeFaceCenteredNames(HDF5Handle &a_handle, int a_direction, const Vector< std::string > &a_names)
Definition: EBCellFAB.H:29
void writeNodeCenteredNames(HDF5Handle &a_handle, const Vector< std::string > &a_names)
double Real
Definition: REAL.H:33
void readCellCentered(HDF5Handle &a_handle, int a_level, const EBIndexSpace *eb, const int ebghost, LevelData< EBCellFAB > *a_data)
void browseEBAMR(const Vector< LevelData< EBCellFAB > * > *a_dataPtr)
void headerEBFile(HDF5Handle &a_handle, int a_numLevels, const Vector< int > &a_refRatios, const ProblemDomain &a_coarseDomain, const RealVect &a_coarseDx, const IntVect &a_ghost)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
void writeCellCentered(HDF5Handle &a_handle, int a_level, const LevelData< EBCellFAB > *a_data, Interval interval=Interval())
if no CellCenteredNames have been assigned, then dummy values of CC1..CCn are set ...
void writeCellCenteredNames(HDF5Handle &a_handle, const Vector< std::string > &a_names)
void setCoveredCellValue(Real a_coveredCellValue)
static const IntVect Zero
Definition: IntVect.H:627
void setWhichCellIndex(int a_whichCellIndex)
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
void writeIVFABname(const BaseIVFAB< Real > *a_dataPtr, const char *a_filename)
void writeEBFABname(const EBCellFAB *a_dataPtr, const char *a_filename)
void viewEBFace(const EBFaceFAB *a_dataPtr)
Handle to a particular group in an HDF file.
Definition: CH_HDF5.H:267
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void writeNodeCentered(HDF5Handle &a_handle, int a_level, const LevelData< FArrayBox > *a_data, Interval interval=Interval())
void viewEBAMR(const Vector< LevelData< EBCellFAB > * > *a_dataPtr)
void multiFaceValues(const EBFaceFAB *a_face, const int a_side, const int a_iv0, const int a_iv1, const int a_iv2)
void writeFaceCentered(HDF5Handle &a_handle, int a_level, int a_direction, const LevelData< EBFaceFAB > *a_data, Interval interval=Interval())
void createEBFile(HDF5Handle &a_handle, const std::string &a_filename, int a_numLevels, const Vector< int > &a_refRatios, const ProblemDomain &a_coarseDomain, const RealVect &a_coarseDx, const IntVect &a_ghost)
int getWhichCellIndex()
void viewIVLevel(const LevelData< BaseIVFAB< Real > > *a_dataPtr)