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 #ifndef _EXTRAPFILLPATCH_H_ 00012 #define _EXTRAPFILLPATCH_H_ 00013 00014 #include "Interval.H" 00015 #include "SPACE.H" 00016 #include "FArrayBox.H" 00017 #include "LayoutData.H" 00018 #include "LevelData.H" 00019 #include "ProblemDomain.H" 00020 #include "IntVectSet.H" 00021 #include "NamespaceHeader.H" 00022 class Box; 00023 00024 // 00025 /// fills outer ghost cells by copying from inner ghost cells. 00026 /** 00027 The picture below shows existing ghost cell data in a border around 00028 the valid region (including corners). These values are 00029 extrapolated to the ghost cells in the outer "flaps." The 00030 coordinate direction of extrapolation is a parameter (in this 00031 example, it is 0). 00032 00033 <PRE> 00034 +-----+---------------------------------+-----+ 00035 | | +-----------------------------+ | | 00036 | | | | | | 00037 | | | | | | 00038 | | | | | | 00039 | | | InteriorBox | | | 00040 | | | |%| x | 00041 | | | | |/ | 00042 | x |%| | / | 00043 | / | | |/| | 00044 |/ | | / | | 00045 / | | -----------/| | | 00046 /| | | / | | | 00047 / | | | / | | | 00048 / | | | / | | | 00049 / | | +-------------/---------------+x| | 00050 / +-----+--------------/----------------/-+-----+ 00051 / / / 00052 / / / 00053 / / / 00054 / / / 00055 ------/------------------------ / / 00056 | Ghost cells in outer flaps |/ / 00057 | (locations x) are filled by | / 00058 | extrapolating from existing | ------------/------------------------ 00059 | ghost cells (location %). | | Border of exisiting ghost cells. | 00060 |-----------------------------| | Assumed to be filled correctly | 00061 | on input. | 00062 |-----------------------------------| 00063 </PRE> 00064 00065 Limitation on grid configuration 00066 00067 The picture below shows the ghost cells of grid 1 for extrapolation in 00068 direction 0. The cells marked X were filled before extrapolation. 00069 The cells marked > are extrapolated to from the first X to their 00070 right. The cells marked ? want to be filled from an X to the right, 00071 but there isn't any. This algorithm is not defined for such a grid 00072 configuration, in which the outline of the level has a "step" of width 00073 (in this case 2) less than the extrapolation radius (in this case 4). 00074 Using this algorithm with grids that violate this condition may result 00075 in undefined behavior. 00076 00077 <PRE> 00078 + - - - - - - - - - - - + 00079 > > > X X X X X X < < < 00080 | +-------+ | 00081 > > > X| |X < < < 00082 | | | | 00083 > > > X| |X < < < 00084 | | grid 1| | 00085 > > > X| |X < < < 00086 | | | | 00087 > > > X| |X < < < 00088 | +---+-------+ | 00089 ? ?|^ ^ ^ ^ ^ ^|X < < < 00090 + - - - - - - - - - - - + 00091 | | 00092 | | 00093 | grid 0 | 00094 | | 00095 | | 00096 +-----------+ 00097 </PRE> 00098 */ 00099 class ExtrapFillPatch 00100 { 00101 public: 00102 00103 /// 00104 /** 00105 Default constructor. User must subsequently call define(). 00106 */ 00107 ExtrapFillPatch(); 00108 00109 /// 00110 /** 00111 Destructor. 00112 */ 00113 ~ExtrapFillPatch(); 00114 00115 /// 00116 /** 00117 Defining constructor. Constructs a valid ExtrapFillPatch object. 00118 Equivalent to default construction followed by define(). It is a 00119 fatal error if any grid in a_level_domain has any dimension less 00120 than a_extrap_interval.end(). 00121 00122 There is also a restriction on grids with "jagged steps" which is 00123 described in "Limitation on grid configuration" in the class 00124 documentation above (with the ASCII art). It is not checked 00125 whether the input domain complies with this restriction. Using 00126 this algorithm with grids that violate this condition may result in 00127 undefined behavior. 00128 00129 {\bf Arguments:}\\ 00130 a_level_domain (not modified): domain of the level. \\ 00131 a_problem_domain (not modified): problem domain at this level. \\ 00132 a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\ 00133 00134 */ 00135 ExtrapFillPatch( 00136 const DisjointBoxLayout& a_level_domain, 00137 const Box& a_problem_domain, 00138 const Interval& a_extrap_interval 00139 ); 00140 00141 /// 00142 /** 00143 Defining constructor. Constructs a valid ExtrapFillPatch object. 00144 Equivalent to default construction followed by define(). It is a 00145 fatal error if any grid in a_level_domain has any dimension less 00146 than a_extrap_interval.end(). 00147 00148 There is also a restriction on grids with "jagged steps" which is 00149 described in "Limitation on grid configuration" in the class 00150 documentation above (with the ASCII art). It is not checked 00151 whether the input domain complies with this restriction. Using 00152 this algorithm with grids that violate this condition may result in 00153 undefined behavior. 00154 00155 {\bf Arguments:}\\ 00156 a_level_domain (not modified): domain of the level. \\ 00157 a_problem_domain (not modified): problem domain at this level. \\ 00158 a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\ 00159 00160 */ 00161 ExtrapFillPatch( 00162 const DisjointBoxLayout& a_level_domain, 00163 const ProblemDomain& a_problem_domain, 00164 const Interval& a_extrap_interval 00165 ); 00166 00167 /// 00168 /** 00169 Defines this ExtrapFillPatch. Existing definition is overridden. 00170 The user may call define() once and call fillInterp() multiple 00171 times with different valid data sets. 00172 00173 It is a fatal error if any grid in a_level_domain has any dimension 00174 less than a_extrap_interval.end(). 00175 00176 There is also a restriction on grids with "jagged steps" which is 00177 described in "Limitation on grid configuration" in the class 00178 documentation above (with the ASCII art). It is not checked 00179 whether the input domain complies with this restriction. Using 00180 this algorithm with grids that violate this condition may result in 00181 undefined behavior. 00182 00183 {\bf Arguments:}\\ 00184 a_level_domain (not modified): domain of the level. \\ 00185 a_problem_domain (not modified): problem domain at this level. \\ 00186 a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\ 00187 00188 {\bf This:}\\ 00189 ---This object is modified.--- 00190 */ 00191 void 00192 define( 00193 const DisjointBoxLayout& a_level_domain, 00194 const Box& a_problem_domain, 00195 const Interval& a_extrap_interval 00196 ); 00197 00198 /// 00199 /** 00200 Defines this ExtrapFillPatch. Existing definition is overridden. 00201 The user may call define() once and call fillInterp() multiple 00202 times with different valid data sets. 00203 00204 It is a fatal error if any grid in a_level_domain has any dimension 00205 less than a_extrap_interval.end(). 00206 00207 There is also a restriction on grids with "jagged steps" which is 00208 described in "Limitation on grid configuration" in the class 00209 documentation above (with the ASCII art). It is not checked 00210 whether the input domain complies with this restriction. Using 00211 this algorithm with grids that violate this condition may result in 00212 undefined behavior. 00213 00214 {\bf Arguments:}\\ 00215 a_level_domain (not modified): domain of the level. \\ 00216 a_problem_domain (not modified): problem domain at this level. \\ 00217 a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\ 00218 00219 {\bf This:}\\ 00220 ---This object is modified.--- 00221 */ 00222 void 00223 define( 00224 const DisjointBoxLayout& a_level_domain, 00225 const ProblemDomain& a_problem_domain, 00226 const Interval& a_extrap_interval 00227 ); 00228 00229 /// 00230 /** 00231 Returns true if this object was created with the defining 00232 constructor or if define() has called. 00233 00234 {\bf This:}\\ 00235 This object is not modified. 00236 */ 00237 bool 00238 isDefined() const; 00239 00240 /// 00241 /** 00242 Fills ghost cells in the outer flaps, by interpolation from data in 00243 the inner ghost cells. It is an error to call if not this->isDefined().\\ 00244 00245 {\bf Arguments:}\\ 00246 a_data (modified): data at this level, both the source and destination for extrapolation. \\ 00247 a_dir (not modified): zero-based coordinate direction of extrapolation. \\ 00248 a_dest_comp (not modified): the first component for extrapolation. \\ 00249 a_num_comp (not modified): the number of components to 00250 extrapolate. \\ 00251 00252 {\bf This:}\\ 00253 This object is not modified. 00254 00255 */ 00256 void 00257 fillExtrap( 00258 LevelData<FArrayBox>& a_data, 00259 int a_dir, 00260 int a_dest_comp, 00261 int a_num_comp 00262 ); 00263 00264 // void 00265 // printIntVectSets() const; 00266 00267 protected: 00268 bool m_is_defined; 00269 // locations of ghost cells on the low side of the grid to extrapolate to. 00270 LayoutData<IntVectSet> m_lo_extrap[SpaceDim]; 00271 // locations of ghost cells on the high side of the grid to extrapolate to. 00272 LayoutData<IntVectSet> m_hi_extrap[SpaceDim]; 00273 // interval of ghost cells to extrapolate, where 0 are the ghost cells 00274 // directly adjacent to the valid domain, and increasing outwards. 00275 Interval m_extrap_interval; 00276 }; 00277 00278 #include "NamespaceFooter.H" 00279 #endif