00001 /* _______ __ 00002 / ___/ / ___ __ _ / / ___ 00003 / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00004 \___/_//_/\___/_/_/_/_.__/\___/ 00005 */ 00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of 00007 // California, through Lawrence Berkeley National Laboratory (subject to 00008 // receipt of any required approvals from U.S. Dept. of Energy). All 00009 // rights reserved. 00010 // 00011 // Redistribution and use in source and binary forms, with or without 00012 // modification, are permitted provided that the following conditions are met: 00013 // 00014 // (1) Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // (2) Redistributions in binary form must reproduce the above copyright 00017 // notice, this list of conditions and the following disclaimer in the 00018 // documentation and/or other materials provided with the distribution. 00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S. 00020 // Dept. of Energy nor the names of its contributors may be used to endorse 00021 // or promote products derived from this software without specific prior 00022 // written permission. 00023 // 00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 // 00036 // You are under no obligation whatsoever to provide any bug fixes, 00037 // patches, or upgrades to the features, functionality or performance of 00038 // the source code ("Enhancements") to anyone; however, if you choose to 00039 // make your Enhancements available either publicly, or directly to 00040 // Lawrence Berkeley National Laboratory, without imposing a separate 00041 // written license agreement for such Enhancements, then you hereby grant 00042 // the following license: a non-exclusive, royalty-free perpetual license 00043 // to install, use, modify, prepare derivative works, incorporate into 00044 // other computer software, distribute, and sublicense such Enhancements or 00045 // derivative works thereof, in binary and source code form. 00046 // 00047 // TRADEMARKS. Product and company names mentioned herein may be the 00048 // trademarks of their respective owners. Any rights not expressly granted 00049 // herein are reserved. 00050 // 00051 00052 #ifndef _AMRLEVEL_H_ 00053 #define _AMRLEVEL_H_ 00054 00055 #include "REAL.H" 00056 #include "Box.H" 00057 #include "DisjointBoxLayout.H" 00058 #include "ProblemDomain.H" 00059 #include "DataIterator.H" 00060 00061 class HDF5Handle; 00062 class IntVectSet; 00063 template <class TTYPE> class Vector; 00064 00066 00084 class AMRLevel 00085 { 00086 public: 00088 00091 AMRLevel(); 00092 00094 00097 virtual 00098 ~AMRLevel(); 00099 00101 00114 virtual 00115 void define(AMRLevel* a_coarser_level_ptr, 00116 const Box& a_problem_domain, 00117 int a_level, 00118 int a_ref_ratio); 00119 00121 00134 virtual 00135 void define(AMRLevel* a_coarser_level_ptr, 00136 const ProblemDomain& a_problem_domain, 00137 int a_level, 00138 int a_ref_ratio); 00139 00141 00144 virtual 00145 void finerLevelPtr(AMRLevel* a_finer_level_ptr); 00146 00148 00151 virtual 00152 void dt(Real a_dt); 00153 00155 00159 virtual 00160 void time(Real a_time); 00161 00163 00167 virtual 00168 Real dt() const; 00169 00171 00174 virtual 00175 Real time() const; 00176 00178 00181 virtual 00182 void initialDtMultiplier(Real a_initial_dt_multiplier); 00183 00185 00188 virtual 00189 Real initialDtMultiplier() const; 00190 00192 00196 virtual 00197 const ProblemDomain& problemDomain() const; 00198 00200 00204 virtual 00205 Vector<Box> boxes() const; 00206 00208 00212 bool isDefined() const; 00213 00215 00219 virtual 00220 int refRatio() const; 00221 00223 00227 static 00228 void verbosity(int a_verbosity); 00229 00231 00236 static 00237 int verbosity(); 00238 00240 00248 virtual 00249 Real advance() = 0; 00250 00252 00259 virtual 00260 void postTimeStep() = 0; 00261 00263 00270 virtual 00271 void tagCells(IntVectSet& a_tags) = 0; 00272 00274 00281 virtual 00282 void tagCellsInit(IntVectSet& a_tags) = 0; 00283 00285 00292 virtual 00293 void regrid(const Vector<Box>& a_new_grids) = 0; 00294 00296 00303 virtual 00304 void postRegrid(int a_base_level); 00305 00307 00314 virtual 00315 void initialGrid(const Vector<Box>& a_new_grids) = 0; 00316 00318 00325 virtual 00326 void initialData() = 0; 00327 00329 00336 virtual 00337 void postInitialize() = 0; 00338 00340 00347 virtual 00348 Real computeDt() = 0; 00349 00351 00358 virtual 00359 Real computeInitialDt() = 0; 00360 00361 #ifdef CH_USE_HDF5 00362 00363 00370 virtual 00371 void writeCheckpointHeader (HDF5Handle& a_handle) const = 0; 00372 00374 00381 virtual 00382 void writeCheckpointLevel (HDF5Handle& a_handle) const = 0; 00383 00385 00392 virtual 00393 void readCheckpointHeader (HDF5Handle& a_handle) = 0; 00394 00396 00403 virtual 00404 void readCheckpointLevel (HDF5Handle& a_handle) = 0; 00405 00407 00414 virtual 00415 void writePlotHeader (HDF5Handle& a_handle) const = 0; 00416 00418 00425 virtual 00426 void writePlotLevel (HDF5Handle& a_handle) const = 0; 00427 #endif 00428 00429 protected: 00430 // the problem domain 00431 ProblemDomain m_problem_domain; 00432 00433 // 00434 Vector<Box> m_level_grids; 00435 00436 // the level 00437 int m_level; 00438 00439 // refinement ratio 00440 int m_ref_ratio; 00441 00442 // initial time step multipier 00443 Real m_initial_dt_multiplier; 00444 00445 // time step 00446 Real m_dt; 00447 00448 // time 00449 Real m_time; 00450 00451 // pointer to next coarser level 00452 AMRLevel* m_coarser_level_ptr; 00453 00454 // pointer to next finer level 00455 AMRLevel* m_finer_level_ptr; 00456 00457 // verbosity level 00458 static int s_verbosity; 00459 00460 bool m_isDefined; 00461 }; 00462 00463 #endif