00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 // NodeAMRIO.H 00012 // petermc, 4 March 2003 00013 // adapted from AMRIO by DTGraves, Fri, Dec 3, 1999 00014 00015 #ifndef _NODEAMRIO_H_ 00016 #define _NODEAMRIO_H_ 00017 #include "REAL.H" 00018 00019 #include "LevelData.H" 00020 #include "RealVect.H" 00021 #include "Vector.H" 00022 #include "NodeFArrayBox.H" 00023 #include <string> 00024 00025 #include "IntVect.H" 00026 #include "NamespaceHeader.H" 00027 using std::string; 00028 using std::istream; 00029 00030 /// 00031 /** 00032 Writes hierarchy of levels in HDF5 format. Only available if the 00033 preprocessor macro HDF5 is defined at compilation. 00034 00035 This is blocking. 00036 */ 00037 void 00038 WriteAMRHierarchyHDF5(/// file to send output to 00039 const string& filename, 00040 /// grids at each level 00041 const Vector<DisjointBoxLayout>& a_vectGrids, 00042 /// data indexed by level 00043 const Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00044 /// names of variables in <i>a_vectData</i> 00045 const Vector<string>& a_vectNames, 00046 /// domain at coarsest level 00047 const Box& a_domain, 00048 /// grid spacing at coarsest level 00049 const Real& a_dx, 00050 /// time step at coarsest level 00051 const Real& a_dt, 00052 /// time 00053 const Real& a_time, 00054 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00055 const Vector<int>& a_vectRatio, 00056 /// number of levels to write out 00057 const int& a_numLevels, 00058 /// physical coordinates of lower corner of cell at IntVect 0 00059 const RealVect& a_origin = RealVect::Zero, 00060 /// Interval of components to be written 00061 const Interval& a_comps = Interval() ); 00062 00063 /** 00064 Writes hierarchy of levels in HDF5 format. Only available if the 00065 preprocessor macro HDF5 is defined at compilation. 00066 00067 This is blocking. 00068 */ 00069 void 00070 WriteAnisotropicAMRHierarchyHDF5(/// file to send output to 00071 const string& filename, 00072 /// grids at each level 00073 const Vector<DisjointBoxLayout>& a_vectGrids, 00074 /// data indexed by level 00075 const Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00076 /// names of variables in <i>a_vectData</i> 00077 const Vector<string>& a_vectNames, 00078 /// domain at coarsest level 00079 const Box& a_domain, 00080 /// grid spacing in each direction at coarsest level 00081 const RealVect& a_dx, 00082 /// time step at coarsest level 00083 const Real& a_dt, 00084 /// time 00085 const Real& a_time, 00086 /// refinement ratios in each direction between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00087 const Vector<IntVect>& a_vectRatios, 00088 /// number of levels to write out 00089 const int& a_numLevels, 00090 /// physical coordinates of lower corner of cell at IntVect 0 00091 const RealVect& a_origin = RealVect::Zero, 00092 /// Interval of components to be written 00093 const Interval& a_comps = Interval() ); 00094 /// 00095 /** 00096 Writes hierarchy of levels in HDF5 format. Only available if the 00097 preprocessor macro HDF5 is defined at compilation. 00098 00099 This function differs from the previous one in that 00100 <i>a_vectData</i>[<i>ind</i>][<i>lev</i>] 00101 indexes a LevelData<NodeFArrayBox>* (which may have several components) 00102 at level <i>lev</i>. 00103 00104 This is blocking. 00105 */ 00106 void 00107 WriteAMRHierarchyHDF5(/// file to send output to 00108 const string& filename, 00109 /// grids at each level 00110 const Vector<DisjointBoxLayout>& a_vectGrids, 00111 /// data indexed by set and then by level 00112 const Vector<Vector<LevelData<NodeFArrayBox>* > >& a_vectData, 00113 /// names of variables in <i>a_vectData</i>: first the names of the components of <i>a_vectData</i>[0], then the names of the components of <i>a_vectData[1]</i>, etc. 00114 const Vector<string>& a_vectNames, 00115 /// domain at coarsest level 00116 const Box& a_domain, 00117 /// grid spacing at coarsest level 00118 const Real& a_dx, 00119 /// time step at coarsest level 00120 const Real& a_dt, 00121 /// time 00122 const Real& a_time, 00123 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00124 const Vector<int>& a_vectRatio, 00125 /// number of levels to write out 00126 const int& a_numLevels); 00127 00128 /// 00129 /** 00130 Writes hierarchy of levels in HDF5 format. Only available if the 00131 preprocessor macro HDF5 is defined at compilation. 00132 00133 This is not blocking. 00134 */ 00135 void 00136 WriteAMRHierarchyHDF5(/// handle to send output to 00137 HDF5Handle& handle, 00138 /// grids at each level 00139 const Vector<DisjointBoxLayout>& a_vectGrids, 00140 /// data indexed by level 00141 const Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00142 /// names of variables in <i>a_vectData</i> 00143 const Vector<string>& a_vectNames, 00144 /// domain at coarsest level 00145 const Box& a_domain, 00146 /// grid spacing at coarsest level 00147 const Real& a_dx, 00148 /// time step at coarsest level 00149 const Real& a_dt, 00150 /// time 00151 const Real& a_time, 00152 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00153 const Vector<int>& a_vectRatio, 00154 /// number of levels to write out 00155 const int& a_numLevels, 00156 /// physical coordinates of lower corner of cell at IntVect 0 00157 const RealVect& a_origin = RealVect::Zero, 00158 /// Interval of components to be written 00159 const Interval& a_comps = Interval() ); 00160 00161 /// 00162 /** 00163 Writes hierarchy of levels in HDF5 format. Only available if the 00164 preprocessor macro HDF5 is defined at compilation. 00165 00166 This is not blocking. 00167 */ 00168 void 00169 WriteAnisotropicAMRHierarchyHDF5(/// handle to send output to 00170 HDF5Handle& handle, 00171 /// grids at each level 00172 const Vector<DisjointBoxLayout>& a_vectGrids, 00173 /// data indexed by level 00174 const Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00175 /// names of variables in <i>a_vectData</i> 00176 const Vector<string>& a_vectNames, 00177 /// domain at coarsest level 00178 const Box& a_domain, 00179 /// grid spacing at coarsest level 00180 const RealVect& a_dx, 00181 /// time step at coarsest level 00182 const Real& a_dt, 00183 /// time 00184 const Real& a_time, 00185 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00186 const Vector<IntVect>& a_vectRatios, 00187 /// number of levels to write out 00188 const int& a_numLevels, 00189 /// physical coordinates of lower corner of cell at IntVect 0 00190 const RealVect& a_origin = RealVect::Zero, 00191 /// Interval of components to be written 00192 const Interval& a_comps = Interval() ); 00193 00194 /// 00195 /** 00196 Writes hierarchy of levels in HDF5 format. Only available if the 00197 preprocessor macro HDF5 is defined at compilation. 00198 00199 This is blocking. 00200 */ 00201 void 00202 WriteAMRHierarchyHDF5(/// file to send output to 00203 const string& filename, 00204 /// grids at each level 00205 const Vector<DisjointBoxLayout>& a_vectGrids, 00206 /// data indexed by level 00207 const Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00208 /// domain at coarsest level 00209 const Box& a_domain, 00210 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00211 const Vector<int>& a_vectRatio, 00212 /// number of levels to write out 00213 const int& a_numLevels); 00214 00215 /// 00216 /** 00217 Writes hierarchy of levels in HDF5 format. Only available if the 00218 preprocessor macro HDF5 is defined at compilation. 00219 00220 This is not blocking. 00221 */ 00222 void 00223 WriteAMRHierarchyHDF5(/// handle to send output to 00224 HDF5Handle& handle, 00225 /// grids at each level 00226 const Vector<DisjointBoxLayout>& a_vectGrids, 00227 /// data indexed by level 00228 const Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00229 /// domain at coarsest level 00230 const Box& a_domain, 00231 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00232 const Vector<int>& a_vectRatio, 00233 /// number of levels to write out 00234 const int& a_numLevels); 00235 00236 /// 00237 /** 00238 Reads hierarchy of levels in HDF5 format. Only available if the 00239 preprocessor macro HDF5 is defined at compilation. Returns 0 on success. 00240 00241 Returns status code with values: 00242 - 0: success 00243 - -1: bogus number of levels 00244 - -2: bogus number of components 00245 - -3: error in readlevel 00246 - -4: file open failed 00247 00248 This is blocking. 00249 */ 00250 int 00251 ReadAMRHierarchyHDF5(/// file to read input from 00252 const string& filename, 00253 /// grids at each level 00254 Vector<DisjointBoxLayout>& a_vectGrids, 00255 /// data indexed by level 00256 Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00257 /// names of variables in <i>a_vectData</i> 00258 Vector<string>& a_vectNames, 00259 /// domain at coarsest level 00260 Box& a_domain, 00261 /// grid spacing at coarsest level 00262 Real& a_dx, 00263 /// time step at coarsest level 00264 Real& a_dt, 00265 /// time 00266 Real& a_time, 00267 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00268 Vector<int>& a_refRatio, 00269 /// number of levels to read in 00270 int& a_numLevels, 00271 bool a_setGhost = false); 00272 00273 /// 00274 /** 00275 Reads hierarchy of levels in HDF5 format. Only available if the 00276 preprocessor macro HDF5 is defined at compilation. Returns 0 on success. 00277 00278 Returns status code with values: 00279 - 0: success 00280 - -1: bogus number of levels 00281 - -2: bogus number of components 00282 - -3: error in readlevel 00283 - -4: file open failed 00284 00285 This is not blocking. 00286 */ 00287 int 00288 ReadAMRHierarchyHDF5(/// handle to read input from 00289 HDF5Handle& handle, 00290 /// grids at each level 00291 Vector<DisjointBoxLayout>& a_vectGrids, 00292 /// data indexed by level 00293 Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00294 /// names of variables in <i>a_vectData</i> 00295 Vector<string>& a_vectNames, 00296 /// domain at coarsest level 00297 Box& a_domain, 00298 /// grid spacing at coarsest level 00299 Real& a_dx, 00300 /// time step at coarsest level 00301 Real& a_dt, 00302 /// time 00303 Real& a_time, 00304 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00305 Vector<int>& a_refRatio, 00306 /// number of levels to read in 00307 int& a_numLevels, 00308 bool a_setGhost = false); 00309 00310 /// 00311 /** 00312 Reads hierarchy of levels in HDF5 format. Only available if the 00313 preprocessor macro HDF5 is defined at compilation. Returns 0 on success. 00314 00315 Returns status code with values: 00316 - 0: success 00317 - -1: bogus number of levels 00318 - -2: bogus number of components 00319 - -3: error in readlevel 00320 - -4: file open failed 00321 00322 This is blocking. 00323 */ 00324 int 00325 ReadAMRHierarchyHDF5(/// file to read input from 00326 const string& filename, 00327 /// grids at each level 00328 Vector<DisjointBoxLayout>& a_vectGrids, 00329 /// data indexed by level 00330 Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00331 /// domain at coarsest level 00332 Box& a_domain, 00333 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00334 Vector<int>& a_refRatio, 00335 /// number of levels to read in 00336 int& a_numLevels, 00337 bool a_setGhost = false); 00338 00339 /// 00340 /** 00341 Reads hierarchy of levels in HDF5 format. Only available if the 00342 preprocessor macro HDF5 is defined at compilation. Returns 0 on success. 00343 00344 Returns status code with values: 00345 - 0: success 00346 - -1: bogus number of levels 00347 - -2: bogus number of components 00348 - -3: error in readlevel 00349 - -4: file open failed 00350 00351 This is not blocking. 00352 */ 00353 int 00354 ReadAMRHierarchyHDF5(/// handle to input from 00355 HDF5Handle& handle, 00356 /// grids at each level 00357 Vector<DisjointBoxLayout>& a_vectGrids, 00358 /// data indexed by level 00359 Vector<LevelData<NodeFArrayBox>* > & a_vectData, 00360 /// domain at coarsest level 00361 Box& a_domain, 00362 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00363 Vector<int>& a_refRatio, 00364 /// number of levels to read in 00365 int& a_numLevels, 00366 bool a_setGhost = false); 00367 00368 /// 00369 /** 00370 Writes a plotfile using the same format as WriteAMRHierarchyHDF5, but 00371 for a NodeFArrayBox. This is useful for debugging. 00372 *<i>a_dataPtr</i> is written to a file named nfab.hdf5 00373 */ 00374 void 00375 writeNFAB(const NodeFArrayBox* a_dataPtr); 00376 00377 /// 00378 /** 00379 View *<i>a_dataPtr</i> by writing it to an HDF5 plotfile (to a 00380 temporary file) and then running ChomboVis with a python script 00381 which brings up a data browser by default. The file has the same 00382 format as WriteAMRHierarchyHDF5, but for a single NodeFArrayBox. 00383 This is useful for debugging. 00384 */ 00385 void 00386 viewNFAB(const NodeFArrayBox* a_dataPtr); 00387 00388 /// 00389 /** 00390 Writes a plotfile using the same format as WriteAMRHierarchyHDF5, but 00391 for a NodeFArrayBox. This is useful for debugging. 00392 *<i>a_dataPtr</i> is written to the file given by a_filename. 00393 */ 00394 void 00395 writeNFABname(const NodeFArrayBox* a_dataPtr, 00396 const char* a_filename); 00397 00398 /// 00399 /** 00400 Write a plotfile using the same format as WriteAMRHierarchyHDF5, but 00401 for a single LevelData<NodeFArrayBox>. Useful for debugging. 00402 *<i>a_dataPtr</i> is written to a file named LDF.hdf5. 00403 */ 00404 void 00405 writeNodeLevel(const LevelData<NodeFArrayBox>* a_dataPtr); 00406 00407 /// 00408 /** 00409 View *<i>a_dataPtr</i> by writing it to an HDF5 plotfile (to a 00410 temporary file) and then running ChomboVis with a python script 00411 which brings up a data browser by default. The file has the same 00412 format as WriteAMRHierarchyHDF5, but for a single 00413 LevelData<NodeFArrayBox>. This is useful for debugging. 00414 */ 00415 void 00416 viewNodeLevel(const LevelData<NodeFArrayBox>* a_dataPtr); 00417 00418 /// 00419 /** 00420 Write a plotfile using the same format as WriteAMRHierarchyHDF5, but 00421 for a single LevelData<FArrayBox>. Useful for debugging. 00422 *<i>a_dataPtr</i> is written to the file given by <i>a_filename</i>. 00423 */ 00424 void 00425 writeNodeLevelname(const LevelData<NodeFArrayBox>* a_dataPtr, 00426 const char* a_filename); 00427 00428 /// 00429 /** 00430 Write a plotfile with levels that don't necessarily begin with 00431 0 (will translate things so that base level comes out as level 0, etc.). 00432 Levels in Vector arguments should correspond with actual levels, 00433 and so should be defined for <i>a_levels</i>.begin() through 00434 <i>a_levels</i>.end(). 00435 00436 This is blocking. 00437 */ 00438 void 00439 WritePartialAMRHierarchyHDF5(/// file to send output to 00440 const string& filename, 00441 /// grids at each level 00442 const Vector<DisjointBoxLayout>& a_vectGrids, 00443 /// data indexed by level 00444 const Vector<LevelData<FArrayBox>* > & a_vectData, 00445 /// names of variables in <i>a_vectData</i> 00446 const Vector<string>& a_vectNames, 00447 /// domain at base level given by <i>a_levels</i>.begin() 00448 const Box& a_baseDomain, 00449 /// grid spacing at base level 00450 const Real& a_baseDx, 00451 /// time step at base level 00452 const Real& a_dt, 00453 /// time 00454 const Real& a_time, 00455 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00456 const Vector<int>& a_vectRatio, 00457 /// indices of levels to write out 00458 const Interval& a_levels); 00459 00460 /// 00461 /** 00462 Write a plotfile with levels that don't necessarily begin with 00463 0 (will translate things so that base level comes out as level 0, etc.). 00464 Levels in Vector arguments should correspond with actual levels, 00465 and so should be defined for <i>a_levels</i>.begin() through 00466 <i>a_levels</i>.end(). 00467 00468 This function differs from the previous one in that 00469 <i>a_vectData</i>[<i>ind</i>][<i>lev</i>] 00470 indexes a LevelData<NodeFArrayBox>* (which may have several components) 00471 at level <i>lev</i>. 00472 00473 This is blocking. 00474 */ 00475 void 00476 WritePartialAMRHierarchyHDF5(/// file to send output to 00477 const string& filename, 00478 /// grids at each level 00479 const Vector<DisjointBoxLayout>& a_vectGrids, 00480 /// data indexed by set and then by level 00481 const Vector<Vector<LevelData<NodeFArrayBox>* > >& a_vectData, 00482 /// names of variables in <i>a_vectData</i> 00483 const Vector<string>& a_vectNames, 00484 /// domain at base level given by <i>a_levels</i>.begin() 00485 const Box& a_baseDomain, 00486 /// grid spacing at base level 00487 const Real& a_baseDx, 00488 /// time step at base level 00489 const Real& a_dt, 00490 /// time 00491 const Real& a_time, 00492 /// refinement ratios between adjacent levels, starting with <i>a_refRatio</i>[0], the refinement ratio between levels 0 and 1; Vector length at least <i>a_numLevels</i>-1 00493 const Vector<int>& a_vectRatio, 00494 /// indices of levels to write out 00495 const Interval& a_levels); 00496 00497 #include "NamespaceFooter.H" 00498 #endif // include guard