Blockstructured Adaptive Mesh Refinement in object-oriented C++
00001 #ifndef _included_GridDataOpsRel_3_h 00002 #define _included_GridDataOpsRel_3_h 00003 00009 /****************************** == ***************************************/ 00010 00011 template <class Type> 00012 BBox GridData(3)<Type>::is_eq (Type const &val, BBox const &where) 00013 { 00014 BBox intersection = _bbox * where; 00015 if (!intersection.empty()) 00016 { 00017 Coords max_step = _step.getmax(where.stepsize()); 00018 BBox to(intersection); to.setstepsize(_step); 00019 BBox from(intersection); from.setstepsize(where.stepsize()); 00020 BBox bb(3,max_step); 00021 gd_OperateRegion(is_eq)(val, to, from, max_step, bb); 00022 return (bb); 00023 } 00024 else 00025 { BBox bb(3,1); return (bb); } 00026 } 00027 00028 template <class Type> 00029 BBox GridData(3)<Type>::is_eq (GridData(3)<Type> const &gd, BBox const &to, 00030 BBox const &from) 00031 { 00032 const Coords toshift = from.lower() - to.lower(); 00033 BBox newfrom = gd._bbox * from * shiftabs(_bbox * to, toshift); 00034 if (!newfrom.empty()) 00035 { 00036 BBox newto = shiftabs(newfrom, -toshift); 00037 Coords max_step = _step.getmax(gd._step); 00038 newto.setstepsize(_step); 00039 newfrom.setstepsize(gd._step); 00040 BBox bb(3,max_step); 00041 gd_OperateRegion(is_eq)(gd, newto, newfrom, max_step, bb); 00042 return (bb); 00043 } 00044 else 00045 { BBox bb(3,1); return (bb); } 00046 } 00047 00048 template <class Type> 00049 void GridData(3)<Type>::gd_OperateRegion(is_eq) (Type const &val, 00050 BBox const &to, BBox const &from, Coords const &step, 00051 BBox &bb) 00052 { 00053 GridData(3)<Type> &dst = *this; 00054 00055 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00056 00057 for_3(i, j, k, to, step) 00058 if (FastIndex3(dst,i,j,k) == val) bb += Coords(3,i,j,k); 00059 end_for 00060 00061 EndFastIndex3(dst); 00062 } 00063 00064 template <class Type> 00065 void GridData(3)<Type>::gd_OperateRegion(is_eq) (GridData(3)<Type> const &src, 00066 BBox const &to, BBox const &from, Coords const &step, 00067 BBox &bb) 00068 { 00069 GridData(3)<Type> &dst = *this; 00070 const int di = from.lower(0)-to.lower(0); 00071 const int dj = from.lower(1)-to.lower(1); 00072 const int dk = from.lower(2)-to.lower(2); 00073 00074 BeginFastIndex3(src, src._bbox, src._data, const Type); 00075 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00076 00077 for_3(i, j, k, to, step) 00078 if (FastIndex3(dst,i,j,k) == FastIndex3(src,i+di,j+dj,k+dk)) 00079 bb += Coords(3,i,j,k); 00080 end_for 00081 00082 EndFastIndex3(dst); 00083 EndFastIndex3(src); 00084 } 00085 00086 /************************************************************************/ 00087 00088 /****************************** != ***************************************/ 00089 00090 template <class Type> 00091 BBox GridData(3)<Type>::is_neq (Type const &val, BBox const &where) 00092 { 00093 BBox intersection = _bbox * where; 00094 if (!intersection.empty()) 00095 { 00096 Coords max_step = _step.getmax(where.stepsize()); 00097 BBox to(intersection); to.setstepsize(_step); 00098 BBox from(intersection); from.setstepsize(where.stepsize()); 00099 BBox bb(3,max_step); 00100 gd_OperateRegion(is_neq)(val, to, from, max_step, bb); 00101 return (bb); 00102 } 00103 else 00104 { BBox bb(3,1); return (bb); } 00105 } 00106 00107 template <class Type> 00108 BBox GridData(3)<Type>::is_neq (GridData(3)<Type> const &gd, BBox const &to, 00109 BBox const &from) 00110 { 00111 const Coords toshift = from.lower() - to.lower(); 00112 BBox newfrom = gd._bbox * from * shiftabs(_bbox * to, toshift); 00113 if (!newfrom.empty()) 00114 { 00115 BBox newto = shiftabs(newfrom, -toshift); 00116 Coords max_step = _step.getmax(gd._step); 00117 newto.setstepsize(_step); 00118 newfrom.setstepsize(gd._step); 00119 BBox bb(3,max_step); 00120 gd_OperateRegion(is_neq)(gd, newto, newfrom, max_step, bb); 00121 return (bb); 00122 } 00123 else 00124 { BBox bb(3,1); return (bb); } 00125 } 00126 00127 template <class Type> 00128 void GridData(3)<Type>::gd_OperateRegion(is_neq) (Type const &val, 00129 BBox const &to, BBox const &from, Coords const &step, 00130 BBox &bb) 00131 { 00132 GridData(3)<Type> &dst = *this; 00133 00134 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00135 00136 for_3(i, j, k, to, step) 00137 if (FastIndex3(dst,i,j,k) != val) bb += Coords(3,i,j,k); 00138 end_for 00139 00140 EndFastIndex3(dst); 00141 } 00142 00143 template <class Type> 00144 void GridData(3)<Type>::gd_OperateRegion(is_neq) (GridData(3)<Type> const &src, 00145 BBox const &to, BBox const &from, Coords const &step, 00146 BBox &bb) 00147 { 00148 GridData(3)<Type> &dst = *this; 00149 const int di = from.lower(0)-to.lower(0); 00150 const int dj = from.lower(1)-to.lower(1); 00151 const int dk = from.lower(2)-to.lower(2); 00152 00153 BeginFastIndex3(src, src._bbox, src._data, const Type); 00154 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00155 00156 for_3(i, j, k, to, step) 00157 if (FastIndex3(dst,i,j,k) != FastIndex3(src,i+di,j+dj,k+dk)) 00158 bb += Coords(3,i,j,k); 00159 end_for 00160 00161 EndFastIndex3(dst); 00162 EndFastIndex3(src); 00163 } 00164 00165 /************************************************************************/ 00166 00167 /****************************** > ***************************************/ 00168 00169 template <class Type> 00170 BBox GridData(3)<Type>::is_gt (Type const &val, BBox const &where) 00171 { 00172 BBox intersection = _bbox * where; 00173 if (!intersection.empty()) 00174 { 00175 Coords max_step = _step.getmax(where.stepsize()); 00176 BBox to(intersection); to.setstepsize(_step); 00177 BBox from(intersection); from.setstepsize(where.stepsize()); 00178 BBox bb(3,max_step); 00179 gd_OperateRegion(is_gt)(val, to, from, max_step, bb); 00180 return (bb); 00181 } 00182 else 00183 { BBox bb(3,1); return (bb); } 00184 } 00185 00186 template <class Type> 00187 BBox GridData(3)<Type>::is_gt (GridData(3)<Type> const &gd, BBox const &to, 00188 BBox const &from) 00189 { 00190 const Coords toshift = from.lower() - to.lower(); 00191 BBox newfrom = gd._bbox * from * shiftabs(_bbox * to, toshift); 00192 if (!newfrom.empty()) 00193 { 00194 BBox newto = shiftabs(newfrom, -toshift); 00195 Coords max_step = _step.getmax(gd._step); 00196 newto.setstepsize(_step); 00197 newfrom.setstepsize(gd._step); 00198 BBox bb(3,max_step); 00199 gd_OperateRegion(is_gt)(gd, newto, newfrom, max_step, bb); 00200 return (bb); 00201 } 00202 else 00203 { BBox bb(3,1); return (bb); } 00204 } 00205 00206 template <class Type> 00207 void GridData(3)<Type>::gd_OperateRegion(is_gt) (Type const &val, 00208 BBox const &to, BBox const &from, Coords const &step, 00209 BBox &bb) 00210 { 00211 GridData(3)<Type> &dst = *this; 00212 00213 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00214 00215 for_3(i, j, k, to, step) 00216 if (FastIndex3(dst,i,j,k) > val) bb += Coords(3,i,j,k); 00217 end_for 00218 00219 EndFastIndex3(dst); 00220 } 00221 00222 template <class Type> 00223 void GridData(3)<Type>::gd_OperateRegion(is_gt) (GridData(3)<Type> const &src, 00224 BBox const &to, BBox const &from, Coords const &step, 00225 BBox &bb) 00226 { 00227 GridData(3)<Type> &dst = *this; 00228 const int di = from.lower(0)-to.lower(0); 00229 const int dj = from.lower(1)-to.lower(1); 00230 const int dk = from.lower(2)-to.lower(2); 00231 00232 BeginFastIndex3(src, src._bbox, src._data, const Type); 00233 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00234 00235 for_3(i, j, k, to, step) 00236 if (FastIndex3(dst,i,j,k) > FastIndex3(src,i+di,j+dj,k+dk)) 00237 bb += Coords(3,i,j,k); 00238 end_for 00239 00240 EndFastIndex3(dst); 00241 EndFastIndex3(src); 00242 } 00243 00244 /************************************************************************/ 00245 00246 /****************************** >= ***************************************/ 00247 00248 template <class Type> 00249 BBox GridData(3)<Type>::is_ge (Type const &val, BBox const &where) 00250 { 00251 BBox intersection = _bbox * where; 00252 if (!intersection.empty()) 00253 { 00254 Coords max_step = _step.getmax(where.stepsize()); 00255 BBox to(intersection); to.setstepsize(_step); 00256 BBox from(intersection); from.setstepsize(where.stepsize()); 00257 BBox bb(3,max_step); 00258 gd_OperateRegion(is_ge)(val, to, from, max_step, bb); 00259 return (bb); 00260 } 00261 else 00262 { BBox bb(3,1); return (bb); } 00263 } 00264 00265 template <class Type> 00266 BBox GridData(3)<Type>::is_ge (GridData(3)<Type> const &gd, BBox const &to, 00267 BBox const &from) 00268 { 00269 const Coords toshift = from.lower() - to.lower(); 00270 BBox newfrom = gd._bbox * from * shiftabs(_bbox * to, toshift); 00271 if (!newfrom.empty()) 00272 { 00273 BBox newto = shiftabs(newfrom, -toshift); 00274 Coords max_step = _step.getmax(gd._step); 00275 newto.setstepsize(_step); 00276 newfrom.setstepsize(gd._step); 00277 BBox bb(3,max_step); 00278 gd_OperateRegion(is_ge)(gd, newto, newfrom, max_step, bb); 00279 return (bb); 00280 } 00281 else 00282 { BBox bb(3,1); return (bb); } 00283 } 00284 00285 template <class Type> 00286 void GridData(3)<Type>::gd_OperateRegion(is_ge) (Type const &val, 00287 BBox const &to, BBox const &from, Coords const &step, 00288 BBox &bb) 00289 { 00290 GridData(3)<Type> &dst = *this; 00291 00292 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00293 00294 for_3(i, j, k, to, step) 00295 if (FastIndex3(dst,i,j,k) >= val) bb += Coords(3,i,j,k); 00296 end_for 00297 00298 EndFastIndex3(dst); 00299 } 00300 00301 template <class Type> 00302 void GridData(3)<Type>::gd_OperateRegion(is_ge) (GridData(3)<Type> const &src, 00303 BBox const &to, BBox const &from, Coords const &step, 00304 BBox &bb) 00305 { 00306 GridData(3)<Type> &dst = *this; 00307 const int di = from.lower(0)-to.lower(0); 00308 const int dj = from.lower(1)-to.lower(1); 00309 const int dk = from.lower(2)-to.lower(2); 00310 00311 BeginFastIndex3(src, src._bbox, src._data, const Type); 00312 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00313 00314 for_3(i, j, k, to, step) 00315 if (FastIndex3(dst,i,j,k) >= FastIndex3(src,i+di,j+dj,k+dk)) 00316 bb += Coords(3,i,j,k); 00317 end_for 00318 00319 EndFastIndex3(dst); 00320 EndFastIndex3(src); 00321 } 00322 00323 /************************************************************************/ 00324 00325 /****************************** < ***************************************/ 00326 00327 template <class Type> 00328 BBox GridData(3)<Type>::is_lt (Type const &val, BBox const &where) 00329 { 00330 BBox intersection = _bbox * where; 00331 if (!intersection.empty()) 00332 { 00333 Coords max_step = _step.getmax(where.stepsize()); 00334 BBox to(intersection); to.setstepsize(_step); 00335 BBox from(intersection); from.setstepsize(where.stepsize()); 00336 BBox bb(3,max_step); 00337 gd_OperateRegion(is_lt)(val, to, from, max_step, bb); 00338 return (bb); 00339 } 00340 else 00341 { BBox bb(3,1); return (bb); } 00342 } 00343 00344 template <class Type> 00345 BBox GridData(3)<Type>::is_lt (GridData(3)<Type> const &gd, BBox const &to, 00346 BBox const &from) 00347 { 00348 const Coords toshift = from.lower() - to.lower(); 00349 BBox newfrom = gd._bbox * from * shiftabs(_bbox * to, toshift); 00350 if (!newfrom.empty()) 00351 { 00352 BBox newto = shiftabs(newfrom, -toshift); 00353 Coords max_step = _step.getmax(gd._step); 00354 newto.setstepsize(_step); 00355 newfrom.setstepsize(gd._step); 00356 BBox bb(3,max_step); 00357 gd_OperateRegion(is_lt)(gd, newto, newfrom, max_step, bb); 00358 return (bb); 00359 } 00360 else 00361 { BBox bb(3,1); return (bb); } 00362 } 00363 00364 template <class Type> 00365 void GridData(3)<Type>::gd_OperateRegion(is_lt) (Type const &val, 00366 BBox const &to, BBox const &from, Coords const &step, 00367 BBox &bb) 00368 { 00369 GridData(3)<Type> &dst = *this; 00370 00371 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00372 00373 for_3(i, j, k, to, step) 00374 if (FastIndex3(dst,i,j,k) < val) bb += Coords(3,i,j,k); 00375 end_for 00376 00377 EndFastIndex3(dst); 00378 } 00379 00380 template <class Type> 00381 void GridData(3)<Type>::gd_OperateRegion(is_lt) (GridData(3)<Type> const &src, 00382 BBox const &to, BBox const &from, Coords const &step, 00383 BBox &bb) 00384 { 00385 GridData(3)<Type> &dst = *this; 00386 const int di = from.lower(0)-to.lower(0); 00387 const int dj = from.lower(1)-to.lower(1); 00388 const int dk = from.lower(2)-to.lower(2); 00389 00390 BeginFastIndex3(src, src._bbox, src._data, const Type); 00391 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00392 00393 for_3(i, j, k, to, step) 00394 if (FastIndex3(dst,i,j,k) < FastIndex3(src,i+di,j+dj,k+dk)) 00395 bb += Coords(3,i,j,k); 00396 end_for 00397 00398 EndFastIndex3(dst); 00399 EndFastIndex3(src); 00400 } 00401 00402 /************************************************************************/ 00403 00404 /****************************** <= ***************************************/ 00405 00406 template <class Type> 00407 BBox GridData(3)<Type>::is_le (Type const &val, BBox const &where) 00408 { 00409 BBox intersection = _bbox * where; 00410 if (!intersection.empty()) 00411 { 00412 Coords max_step = _step.getmax(where.stepsize()); 00413 BBox to(intersection); to.setstepsize(_step); 00414 BBox from(intersection); from.setstepsize(where.stepsize()); 00415 BBox bb(3,max_step); 00416 gd_OperateRegion(is_le)(val, to, from, max_step, bb); 00417 return (bb); 00418 } 00419 else 00420 { BBox bb(3,1); return (bb); } 00421 } 00422 00423 template <class Type> 00424 BBox GridData(3)<Type>::is_le (GridData(3)<Type> const &gd, BBox const &to, 00425 BBox const &from) 00426 { 00427 const Coords toshift = from.lower() - to.lower(); 00428 BBox newfrom = gd._bbox * from * shiftabs(_bbox * to, toshift); 00429 if (!newfrom.empty()) 00430 { 00431 BBox newto = shiftabs(newfrom, -toshift); 00432 Coords max_step = _step.getmax(gd._step); 00433 newto.setstepsize(_step); 00434 newfrom.setstepsize(gd._step); 00435 BBox bb(3,max_step); 00436 gd_OperateRegion(is_le)(gd, newto, newfrom, max_step, bb); 00437 return (bb); 00438 } 00439 else 00440 { BBox bb(3,1); return (bb); } 00441 } 00442 00443 template <class Type> 00444 void GridData(3)<Type>::gd_OperateRegion(is_le) (Type const &val, 00445 BBox const &to, BBox const &from, Coords const &step, 00446 BBox &bb) 00447 { 00448 GridData(3)<Type> &dst = *this; 00449 00450 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00451 00452 for_3(i, j, k, to, step) 00453 if (FastIndex3(dst,i,j,k) <= val) bb += Coords(3,i,j,k); 00454 end_for 00455 00456 EndFastIndex3(dst); 00457 } 00458 00459 template <class Type> 00460 void GridData(3)<Type>::gd_OperateRegion(is_le) (GridData(3)<Type> const &src, 00461 BBox const &to, BBox const &from, Coords const &step, 00462 BBox &bb) 00463 { 00464 GridData(3)<Type> &dst = *this; 00465 const int di = from.lower(0)-to.lower(0); 00466 const int dj = from.lower(1)-to.lower(1); 00467 const int dk = from.lower(2)-to.lower(2); 00468 00469 BeginFastIndex3(src, src._bbox, src._data, const Type); 00470 BeginFastIndex3(dst, dst._bbox, dst._data, Type); 00471 00472 for_3(i, j, k, to, step) 00473 if (FastIndex3(dst,i,j,k) <= FastIndex3(src,i+di,j+dj,k+dk)) 00474 bb += Coords(3,i,j,k); 00475 end_for 00476 00477 EndFastIndex3(dst); 00478 EndFastIndex3(src); 00479 } 00480 00481 /************************************************************************/ 00482 00483 #endif
Quickstart Users Guide Programmers Reference Installation Examples Download
AMROC Main Home Contactlast update: 06/01/04