00001 /* _______ __ 00002 / ___/ / ___ __ _ / / ___ 00003 / /__/ _ \/ _ \/ ' \/ _ \/ _ \ 00004 \___/_//_/\___/_/_/_/_.__/\___/ 00005 */ 00006 // 00007 // This software is copyright (C) by the Lawrence Berkeley 00008 // National Laboratory. Permission is granted to reproduce 00009 // this software for non-commercial purposes provided that 00010 // this notice is left intact. 00011 // 00012 // It is acknowledged that the U.S. Government has rights to 00013 // this software under Contract DE-AC03-765F00098 between 00014 // the U.S. Department of Energy and the University of 00015 // California. 00016 // 00017 // This software is provided as a professional and academic 00018 // contribution for joint exchange. Thus it is experimental, 00019 // is provided ``as is'', with no warranties of any kind 00020 // whatsoever, no support, no promise of updates, or printed 00021 // documentation. By using this software, you acknowledge 00022 // that the Lawrence Berkeley National Laboratory and 00023 // Regents of the University of California shall have no 00024 // liability with respect to the infringement of other 00025 // copyrights by any part of this software. 00026 // 00027 00028 #ifndef _AMR_DERIVED_CLASS_H_ 00029 #define _AMR_DERIVED_CLASS_H_ 00030 00031 #include "FArrayBox.H" 00032 #include "LevelData.H" 00033 #include "AMRLevel.H" 00034 #include "CoarseAverage.H" 00035 #include "FineInterp.H" 00036 00037 class Box; 00038 class IntVectSet; 00039 template <class TTYPE> class Vector; 00040 class DisjointBoxLayout; 00041 00042 class AMRDerivedClass : public AMRLevel 00043 { 00044 public: 00045 AMRDerivedClass(); 00046 00047 00048 virtual 00049 ~AMRDerivedClass(); 00050 00051 00052 // define 00053 virtual 00054 void 00055 define(AMRLevel* a_coarser_level_ptr, 00056 const Box& a_problem_domain, 00057 int a_level, 00058 int a_ref_ratio); 00059 00060 // define 00061 virtual 00062 void 00063 define(AMRLevel* a_coarser_level_ptr, 00064 const ProblemDomain& a_problem_domain, 00065 int a_level, 00066 int a_ref_ratio); 00067 00068 00069 // advance by one timestep 00070 virtual 00071 Real 00072 advance(); 00073 00074 // things to do after a timestep 00075 virtual 00076 void 00077 postTimeStep(); 00078 00079 // create tags 00080 virtual 00081 void 00082 tagCells(IntVectSet& a_tags) ; 00083 00084 // create tags at initialization 00085 virtual 00086 void 00087 tagCellsInit(IntVectSet& a_tags) ; 00088 00089 // regrid 00090 virtual 00091 void 00092 regrid(const Vector<Box>& a_new_grids); 00093 00094 // initialize grids 00095 virtual 00096 void 00097 initialGrid(const Vector<Box>& a_new_grids); 00098 00099 // initialize data 00100 virtual 00101 void 00102 initialData(); 00103 00104 // things to do after initialization 00105 virtual 00106 void 00107 postInitialize(); 00108 00109 // set data after regrid 00110 // (regridData should be removed) 00111 virtual 00112 void 00113 regridData(); 00114 00115 #ifdef HDF5 00116 virtual 00117 void 00118 writeCheckpointHeader(HDF5Handle& a_handle) const; 00119 00120 virtual 00121 void 00122 writeCheckpointLevel(HDF5Handle& a_handle) const; 00123 00124 virtual 00125 void 00126 readCheckpointHeader(HDF5Handle& a_handle); 00127 00128 virtual 00129 void 00130 readCheckpointLevel(HDF5Handle& a_handle); 00131 00132 virtual 00133 void 00134 writePlotHeader(HDF5Handle& a_handle) const; 00135 00136 virtual 00137 void 00138 writePlotLevel(HDF5Handle& a_handle) const; 00139 #endif 00140 00141 // compute dt 00142 virtual 00143 Real 00144 computeDt(); 00145 00146 // compute dt with initial data 00147 virtual 00148 Real 00149 computeInitialDt(); 00150 00151 protected: 00152 DisjointBoxLayout 00153 loadBalance(const Vector<Box>& a_grids); 00154 00155 protected: 00156 // state vector at old time 00157 LevelData<FArrayBox> m_state_old; 00158 // state vector at new time 00159 LevelData<FArrayBox> m_state_new; 00160 // number of components of m_state 00161 static const int s_num_comps = 2; 00162 // names of components 00163 static const char* s_state_names[s_num_comps]; 00164 // grid spacing 00165 Real m_dx; 00166 00167 CoarseAverage m_coarse_average; 00168 FineInterp m_fine_interp; 00169 }; 00170 00171 #endif