00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LAST_BASEFABMACROS_H_SPACEDIM
00020 #define LAST_BASEFABMACROS_H_SPACEDIM 0
00021 #endif
00022 #if CH_SPACEDIM != LAST_BASEFABMACROS_H_SPACEDIM
00023 #undef LAST_BASEFABMACROS_H_SPACEDIM
00024
00025
00026 #include "SPACE.H"
00027 #if CH_SPACEDIM > 3
00028 #include "BoxIterator.H"
00029 #endif
00030
00031
00032 #ifdef DOXYGEN
00033 #define CH_SPACEDIM 1
00034 #endif
00035
00036
00037
00038
00039 #ifdef ForAllThisCPencil
00040 # undef ForAllThisCPencil
00041 # undef ForAllThisPencil
00042 # undef ForAllXBPencil
00043 # undef ForAllXBNNPencil
00044 # undef ForAllXBNNnoindx
00045 # undef ForAllXBNN
00046 # undef ForAllXCBNN
00047 # undef ForAllThisBNN
00048 # undef ForAllThisCBNN
00049 # undef ForAllThisBNNXC
00050 # undef ForAllThisCBNNXC
00051 # undef ForAllThisBNNXCBN
00052 # undef ForAllThisBNNXCBNYCBN
00053 # undef ForAllRevXBNYCBNNN
00054 # undef EndFor
00055 # undef EndForTX
00056 # undef EndForPencil
00057 #endif
00058
00059 #if CH_SPACEDIM == 1
00060 # define ForAllThisCPencil ForAllThisCPencil1
00061 # define ForAllThisPencil ForAllThisPencil1
00062 # define ForAllXBPencil ForAllXBPencil1
00063 # define ForAllXBNN ForAllXBNN1
00064 # define ForAllXBNNPencil ForAllXBNNPencil1
00065 # define ForAllXBNNnoindx ForAllXBNNnoindx1
00066 # define ForAllXCBNN ForAllXCBNN1
00067 # define ForAllThisBNN ForAllThisBNN1
00068 # define ForAllThisCBNN ForAllThisCBNN1
00069 # define ForAllThisBNNXC ForAllThisBNNXC1
00070 # define ForAllThisCBNNXC ForAllThisCBNNXC1
00071 # define ForAllThisBNNXCBN ForAllThisBNNXCBN1
00072 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN1
00073 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN1
00074 # define EndFor EndFor1
00075 # define EndForTX EndForTX1
00076 # define EndForPencil EndForPencil1
00077 # define LAST_BASEFABMACROS_H_SPACEDIM 1
00078 #endif
00079 #if CH_SPACEDIM == 2
00080 # define ForAllThisCPencil ForAllThisCPencil2
00081 # define ForAllThisPencil ForAllThisPencil2
00082 # define ForAllXBPencil ForAllXBPencil2
00083 # define ForAllXBNN ForAllXBNN2
00084 # define ForAllXBNNPencil ForAllXBNNPencil2
00085 # define ForAllXBNNnoindx ForAllXBNNnoindx2
00086 # define ForAllXCBNN ForAllXCBNN2
00087 # define ForAllThisBNN ForAllThisBNN2
00088 # define ForAllThisCBNN ForAllThisCBNN2
00089 # define ForAllThisBNNXC ForAllThisBNNXC2
00090 # define ForAllThisCBNNXC ForAllThisCBNNXC2
00091 # define ForAllThisBNNXCBN ForAllThisBNNXCBN2
00092 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN2
00093 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN2
00094 # define EndFor EndFor2
00095 # define EndForTX EndForTX2
00096 # define EndForPencil EndForPencil2
00097 # define LAST_BASEFABMACROS_H_SPACEDIM 2
00098 #endif
00099 #if CH_SPACEDIM == 3
00100 # define ForAllThisCPencil ForAllThisCPencil3
00101 # define ForAllThisPencil ForAllThisPencil3
00102 # define ForAllXBPencil ForAllXBPencil3
00103 # define ForAllXBNN ForAllXBNN3
00104 # define ForAllXBNNPencil ForAllXBNNPencil3
00105 # define ForAllXBNNnoindx ForAllXBNNnoindx3
00106 # define ForAllXCBNN ForAllXCBNN3
00107 # define ForAllThisBNN ForAllThisBNN3
00108 # define ForAllThisCBNN ForAllThisCBNN3
00109 # define ForAllThisBNNXC ForAllThisBNNXC3
00110 # define ForAllThisCBNNXC ForAllThisCBNNXC3
00111 # define ForAllThisBNNXCBN ForAllThisBNNXCBN3
00112 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN3
00113 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN3
00114 # define EndFor EndFor3
00115 # define EndForTX EndForTX3
00116 # define EndForPencil EndForPencil3
00117 # define LAST_BASEFABMACROS_H_SPACEDIM 3
00118 #endif
00119
00120 #if CH_SPACEDIM > 3
00121 # define ForAllThisCPencil ForAllThisCPencilHiDim
00122 # define ForAllThisPencil ForAllThisPencilHiDim
00123 # define ForAllXBPencil ForAllXBPencilHiDim
00124 # define ForAllXBNN ForAllXBNNHiDim
00125 # define ForAllXBNNPencil ForAllXBNNPencilHiDim
00126 # define ForAllXBNNnoindx ForAllXBNNnoindxHiDim
00127 # define ForAllXCBNN ForAllXCBNNHiDim
00128 # define ForAllThisBNN ForAllThisBNNHiDim
00129 # define ForAllThisCBNN ForAllThisCBNNHiDim
00130 # define ForAllThisBNNXC ForAllThisBNNXCHiDim
00131 # define ForAllThisCBNNXC ForAllThisCBNNXCHiDim
00132 # define ForAllThisBNNXCBN ForAllThisBNNXCBNHiDim
00133 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBNHiDim
00134 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNNHiDim
00135 # define EndFor EndForHiDim
00136 # define EndForTX EndForTXHiDim
00137 # define EndForPencil EndForPencilHiDim
00138 # define LAST_BASEFABMACROS_H_SPACEDIM HiDim
00139 #endif
00140
00141 #if (CH_SPACEDIM == 1)
00142
00189 #define ForAllThisPencil1(T,b,ns,nc) \
00190 { \
00191 CH_assert(contains(b)); \
00192 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00193 const int *_th_plo = this->loVect(); \
00194 IntVect _th_plen = this->size(); \
00195 const int *_b_lo = (b).loVect(); \
00196 IntVect _b_len = (b).size(); \
00197 T* _th_p = this->m_dptr; \
00198 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00199 const int nR = _n; (int&)nR += 0; \
00200 T *_th_pp = _th_p \
00201 + ((_b_lo[0] - _th_plo[0]) \
00202 + _n * _th_plen[0]); \
00203 T &thisR = * _th_pp; \
00204 const int thisLen = _b_len[0]; \
00205
00206
00210 #define ForAllXBPencil1(T,x,b,ns,nc) \
00211 { \
00212 CH_assert(x.contains(b)); \
00213 CH_assert((ns) >= 0 && (ns) + (nc) <= x.nComp()); \
00214 const int *_th_plo = x.loVect(); \
00215 IntVect _th_plen = x.size(); \
00216 const int *_b_lo = (b).loVect(); \
00217 IntVect _b_len = (b).size(); \
00218 T* _th_p = x.dataPtr(); \
00219 for (int nR = (ns); nR < (ns)+(nc); ++nR) { \
00220 T * xR = _th_p \
00221 + ((_b_lo[0] - _th_plo[0]) \
00222 + nR * _th_plen[0]); \
00223 const int thisLen = _b_len[0];
00224
00246 #define ForAllThisCPencil1(T,b,ns,nc) \
00247 { \
00248 CH_assert(this->contains(b)); \
00249 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00250 const int *_th_plo = this->loVect(); \
00251 IntVect _th_plen = this->size(); \
00252 const int *_b_lo = (b).loVect(); \
00253 IntVect _b_len = (b).size(); \
00254 const T* _th_p = this->m_dptr; \
00255 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00256 int nR = _n; nR += 0; \
00257 const T *_th_pp = _th_p \
00258 + ((_b_lo[0] - _th_plo[0]) \
00259 + _n * _th_plen[0]); \
00260 const T &thisR = * _th_pp; \
00261 const int thisLen = _b_len[0];
00262
00288 #define ForAllXBNN1(T,x,b,ns,nc) \
00289 { \
00290 CH_assert(x.contains(b)); \
00291 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00292 const int *_x_plo = (x).loVect(); \
00293 IntVect _x_plen = (x).size(); \
00294 const int *_b_lo = (b).loVect(); \
00295 IntVect _b_len = (b).size(); \
00296 T* _x_p = (x) .dataPtr(); \
00297 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00298 const int nR = _n; (int&)nR += 0; \
00299 T *_x_pp = _x_p \
00300 + ((_b_lo[0] - _x_plo[0]) \
00301 + _n * _x_plen[0]); \
00302 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00303 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00304 T &x##R = * _x_pp;
00305
00306
00307
00308
00309
00310
00311
00312 #define ForAllXBNNnoindx1(T,x,b,ns,nc) \
00313 { \
00314 CH_assert(x.contains(b)); \
00315 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00316 const int *_x_plo = (x).loVect(); \
00317 IntVect _x_plen = (x).size(); \
00318 const int *_b_lo = (b).loVect(); \
00319 IntVect _b_len = (b).size(); \
00320 T* _x_p = (x) .dataPtr(); \
00321 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00322 T *_x_pp = _x_p \
00323 + ((_b_lo[0] - _x_plo[0]) \
00324 + _n * _x_plen[0]); \
00325 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00326 T &x##R = * _x_pp;
00327
00349 #define ForAllXCBNN1(T,x,b,ns,nc) \
00350 { \
00351 CH_assert(x.contains(b)); \
00352 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00353 const int *_x_plo = (x).loVect(); \
00354 IntVect _x_plen = (x).size(); \
00355 const int *_b_lo = (b).loVect(); \
00356 IntVect _b_len = (b).size(); \
00357 const T* _x_p = (x).dataPtr(); \
00358 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00359 const int nR = _n; (int&)nR += 0; \
00360 const T *_x_pp = _x_p \
00361 + ((_b_lo[0] - _x_plo[0]) \
00362 + _n * _x_plen[0]); \
00363 for (int _i = 0; _i < _b_len[0]; ++_i) { \
00364 const int iR = _i + _b_lo[0]; (int&) iR += 0; \
00365 const T & x##R = _x_pp[_i];
00366
00405 #define ForAllThisBNN1(T,b,ns,nc) \
00406 { \
00407 CH_assert(this->contains(b)); \
00408 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00409 const int *_th_plo = this->loVect(); \
00410 IntVect _th_plen = this->size(); \
00411 const int *_b_lo = (b).loVect(); \
00412 IntVect _b_len = (b).size(); \
00413 T* _th_p = this->m_dptr; \
00414 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00415 int nR = _n; nR += 0; \
00416 T *_th_pp = _th_p \
00417 + ((_b_lo[0] - _th_plo[0]) \
00418 + _n * _th_plen[0]); \
00419 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00420 int iR = _i + _b_lo[0]; iR += 0; \
00421 T &thisR = * _th_pp;
00422
00444 #define ForAllThisCBNN1(T,b,ns,nc) \
00445 { \
00446 CH_assert(this->contains(b)); \
00447 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00448 const int *_th_plo = this->loVect(); \
00449 IntVect _th_plen = this->size(); \
00450 const int *_b_lo = (b).loVect(); \
00451 IntVect _b_len = (b).size(); \
00452 const T* _th_p = this->m_dptr; \
00453 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00454 const int nR = _n; (int&)nR += 0; \
00455 const T *_th_pp = _th_p \
00456 + ((_b_lo[0] - _th_plo[0]) \
00457 + _n * _th_plen[0]); \
00458 for (int _i = 0; _i < _b_len[0]; ++_i) { \
00459 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00460 const T &thisR = _th_pp[_i];
00461
00487 #define ForAllThisBNNXC1(T,b,ns,nc,x,nss) \
00488 { \
00489 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00490 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00491 Box _subbox_((x).box()); \
00492 _subbox_ &= this->box(); \
00493 _subbox_ &= b; \
00494 if (!_subbox_.isEmpty()) { \
00495 const int *_th_plo = this->loVect(); \
00496 IntVect _th_plen = this->size(); \
00497 const int *_x_plo = (x).loVect(); \
00498 IntVect _x_plen = (x).size(); \
00499 const int *_subbox_lo = _subbox_.loVect(); \
00500 IntVect _subbox_len = _subbox_.size(); \
00501 T* _th_p = dataPtr(ns); \
00502 const T* _x_p = (x).dataPtr(nss); \
00503 for (int _n = 0; _n < (nc); ++_n) { \
00504 int nR = _n; nR += 0; \
00505 T *_th_pp = _th_p \
00506 + ((_subbox_lo[0] - _th_plo[0]) \
00507 + _n * _th_plen[0]); \
00508 const T *_x_pp = _x_p \
00509 + ((_subbox_lo[0] - _x_plo[0]) \
00510 + _n * _x_plen[0]); \
00511 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00512 int iR = _i + _subbox_lo[0]; iR += 0; \
00513 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00514
00515 #define ForAllThisCBNNXC1(T,b,ns,nc,x,nss) \
00516 { \
00517 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00518 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00519 Box _subbox_((x).box()); \
00520 _subbox_ &= this->box(); \
00521 _subbox_ &= b; \
00522 if (!_subbox_.isEmpty()) { \
00523 const int *_th_plo = this->loVect(); \
00524 IntVect _th_plen = this->size(); \
00525 const int *_x_plo = (x).loVect(); \
00526 IntVect _x_plen = (x).size(); \
00527 const int *_subbox_lo = _subbox_.loVect(); \
00528 IntVect _subbox_len = _subbox_.size(); \
00529 const T* _th_p = this->dataPtr(ns); \
00530 const T* _x_p = (x).dataPtr(nss); \
00531 for (int _n = 0; _n < (nc); ++_n) { \
00532 int nR = _n; nR += 0; \
00533 const T *_th_pp = _th_p \
00534 + ((_subbox_lo[0] - _th_plo[0]) \
00535 + _n * _th_plen[0]); \
00536 const T *_x_pp = _x_p \
00537 + ((_subbox_lo[0] - _x_plo[0]) \
00538 + _n * _x_plen[0]); \
00539 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00540 int iR = _i + _subbox_lo[0]; iR += 0; \
00541 const T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00542
00569 #define ForAllThisBNNXCBN1(T,b,ns,nc,x,bx,nss) \
00570 { \
00571 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00572 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00573 CH_assert(bx.sameSize((b))); \
00574 if (!((b).isEmpty())) { \
00575 const int *_th_plo = this->loVect(); \
00576 IntVect _th_plen = this->size(); \
00577 const int *_x_plo = (x).loVect(); \
00578 IntVect _x_plen = (x).size(); \
00579 const int *_subbox_lo = (b).loVect(); \
00580 IntVect _subbox_len = (b).size(); \
00581 const int *_bx_lo = (bx).loVect(); \
00582 T* _th_p = this->dataPtr(ns); \
00583 const T* _x_p = (x).dataPtr(nss); \
00584 for (int _n = 0; _n < (nc); ++_n) { \
00585 int nR = _n + ns; nR += 0; \
00586 int n##x##R = _n + nss; n##x##R += 0; \
00587 T *_th_pp = _th_p \
00588 + ((_subbox_lo[0] - _th_plo[0]) \
00589 + _n * _th_plen[0]); \
00590 const T *_x_pp = _x_p \
00591 + ((_bx_lo[0] - _x_plo[0]) \
00592 + _n * _x_plen[0]); \
00593 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00594 int iR = _i + _subbox_lo[0]; iR += 0; \
00595 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00596 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00597
00627 #define ForAllThisBNNXCBNYCBN1(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00628 { \
00629 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00630 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00631 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00632 Box _subbox_ = this->box(); \
00633 _subbox_ &= b; \
00634 CH_assert((bx).sameSize(_subbox_)); \
00635 CH_assert((by).sameSize(_subbox_)); \
00636 if (!_subbox_.isEmpty()) { \
00637 const int *_th_plo = this->loVect(); \
00638 IntVect _th_plen = this->size(); \
00639 const int *_x_plo = (x).loVect(); \
00640 IntVect _x_plen = (x).size(); \
00641 const int *_y_plo = (y).loVect(); \
00642 IntVect _y_plen = (y).size(); \
00643 const int *_subbox_lo = _subbox_.loVect(); \
00644 IntVect _subbox_len = _subbox_.size(); \
00645 const int *_bx_lo = (bx).loVect(); \
00646 const int *_by_lo = (by).loVect(); \
00647 T* _th_p = this->dataPtr(ns); \
00648 const T* _x_p = (x).dataPtr(nsx); \
00649 const T* _y_p = (y).dataPtr(nsy); \
00650 for (int _n = 0; _n < (nc); ++_n) { \
00651 int nR = _n + ns; nR += 0; \
00652 int n##x##R = _n + nsx; n##x##R += 0; \
00653 int n##y##R = _n + nsy; n##y##R += 0; \
00654 T *_th_pp = _th_p \
00655 + ((_subbox_lo[0] - _th_plo[0]) \
00656 + _n * _th_plen[0]); \
00657 const T *_x_pp = _x_p \
00658 + ((_bx_lo[0] - _x_plo[0]) \
00659 + _n * _x_plen[0]); \
00660 const T *_y_pp = _y_p \
00661 + ((_by_lo[0] - _y_plo[0]) \
00662 + _n * _y_plen[0]); \
00663 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00664 int iR = _i + _subbox_lo[0]; iR += 0; \
00665 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00666 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
00667 T &thisR = * _th_pp; \
00668 const T & x##R = _x_pp[_i]; \
00669 const T & y##R = _y_pp[_i];
00670
00671 #define ForAllRevXBNYCBNNN1(T,x,bx,nsx,y,by,nsy,nc,ri) \
00672 { \
00673 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00674 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00675 CH_assert((x).contains(bx)); \
00676 CH_assert((y).contains(by)); \
00677 CH_assert((bx).sameSize(by)); \
00678 const int *_x_plo = (x).loVect(); \
00679 IntVect _x_plen = (x).size(); \
00680 const int *_y_plo = (y).loVect(); \
00681 IntVect _y_plen = (y).size(); \
00682 IntVect _len = (bx).size(); \
00683 const int *_bx_lo = (bx).loVect(); \
00684 const int *_by_lo = (by).loVect(); \
00685 T* _x_p = (x).dataPtr(nsx); \
00686 const T* _y_p = (y).dataPtr(nsy); \
00687 for (int _n = 0; _n < (nc); ++_n) { \
00688 int n##x##R = _n + nsx; n##x##R += 0; \
00689 int n##y##R = _n + nsy; n##y##R += 0; \
00690 int _ix = 0; \
00691 T *_x_pp = _x_p \
00692 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
00693 + _n * _x_plen[0]); \
00694 const T *_y_pp = _y_p \
00695 + ((_by_lo[0] - _y_plo[0]) \
00696 + _n * _y_plen[0]); \
00697 for (int _i = 0; _i < _len[0]; ++_i, --_ix) { \
00698 T & x##R = _x_pp[_ix]; \
00699 const T & y##R = _y_pp[_i];
00700
00705 #define EndForTX1 }}}}
00706
00711 #define EndFor1 }}}
00712
00716 #define EndForPencil1 }}
00717
00718 #elif (CH_SPACEDIM == 2)
00719
00720 #define ForAllThisCPencil2(T,b,ns,nc) \
00721 { \
00722 CH_assert(contains(b)); \
00723 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00724 const int *_th_plo = this->loVect(); \
00725 IntVect _th_plen = this->size(); \
00726 const int *_b_lo = (b).loVect(); \
00727 IntVect _b_len = (b).size(); \
00728 const T* _th_p = this->m_dptr; \
00729 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00730 int nR = _n; nR += 0; \
00731 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00732 const int jR = _j + _b_lo[1]; \
00733 const T *_th_pp = _th_p \
00734 + ((_b_lo[0] - _th_plo[0]) \
00735 + _th_plen[0]*( \
00736 (jR - _th_plo[1]) \
00737 + _n * _th_plen[1])); \
00738 const T &thisR = * _th_pp; \
00739 const int thisLen = _b_len[0];
00740
00741 #define ForAllThisPencil2(T,b,ns,nc) \
00742 { \
00743 CH_assert(this->contains(b)); \
00744 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00745 const int *_th_plo = this->loVect(); \
00746 IntVect _th_plen = this->size(); \
00747 const int *_b_lo = (b).loVect(); \
00748 IntVect _b_len = (b).size(); \
00749 T* _th_p = this->m_dptr; \
00750 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00751 const int nR = _n; (int&)nR += 0; \
00752 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00753 const int jR = _j + _b_lo[1]; (int&)jR += 0; \
00754 T *_th_pp = _th_p \
00755 + ((_b_lo[0] - _th_plo[0]) \
00756 + _th_plen[0]*( \
00757 (jR - _th_plo[1]) \
00758 + _n * _th_plen[1])); \
00759 T &thisR = * _th_pp; \
00760 const int thisLen = _b_len[0]; \
00761
00762 #define ForAllXBPencil2(T,x,b,ns,nc) \
00763 { \
00764 CH_assert((x).contains(b)); \
00765 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00766 const int *_th_plo = (x).loVect(); \
00767 const int *_th_plen =(x).size(); \
00768 const int *_b_lo = (b).loVect(); \
00769 IntVect _b_len = (b).size(); \
00770 T* _th_p = (x) .dataPtr(); \
00771 for (int nR = (ns); nR < (ns)+(nc); ++nR) { \
00772 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00773 const int jR = _j + _b_lo[1]; (int&)jR += 0; \
00774 T *xR = _th_p \
00775 + ((_b_lo[0] - _th_plo[0]) \
00776 + _th_plen[0]*( \
00777 (jR - _th_plo[1]) \
00778 + nR * _th_plen[1])); \
00779 const int thisLen = _b_len[0]; \
00780
00781 #define ForAllXBNN2(T,x,b,ns,nc) \
00782 { \
00783 CH_assert((x).contains(b)); \
00784 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00785 const int *_x_plo = (x).loVect(); \
00786 IntVect _x_plen = (x).size(); \
00787 const int *_b_lo = (b).loVect(); \
00788 IntVect _b_len = (b).size(); \
00789 T* _x_p = (x) .dataPtr(); \
00790 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00791 const int nR = _n; (int&)nR += 0; \
00792 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00793 const int jR = _j + _b_lo[1]; (int&)jR += 0; \
00794 T *_x_pp = _x_p \
00795 + ((_b_lo[0] - _x_plo[0]) \
00796 + _x_plen[0]*( \
00797 (jR - _x_plo[1]) \
00798 + _n * _x_plen[1])); \
00799 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00800 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00801 T &x##R = * _x_pp;
00802
00803 #define ForAllXBNNnoindx2(T,x,b,ns,nc) \
00804 { \
00805 CH_assert((x).contains(b)); \
00806 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00807 const int *_x_plo = (x).loVect(); \
00808 IntVect _x_plen = (x).size(); \
00809 const int *_b_lo = (b).loVect(); \
00810 IntVect _b_len = (b).size(); \
00811 T* _x_p = (x) .dataPtr(); \
00812 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00813 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00814 const int jR = _j + _b_lo[1]; \
00815 T *_x_pp = _x_p \
00816 + ((_b_lo[0] - _x_plo[0]) \
00817 + _x_plen[0]*( \
00818 (jR - _x_plo[1]) \
00819 + _n * _x_plen[1])); \
00820 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00821 T &x##R = * _x_pp;
00822
00823 #define ForAllXCBNN2(T,x,b,ns,nc) \
00824 { \
00825 CH_assert(x.contains(b)); \
00826 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00827 const int *_x_plo = (x).loVect(); \
00828 IntVect _x_plen = (x).size(); \
00829 const int *_b_lo = (b).loVect(); \
00830 IntVect _b_len = (b).size(); \
00831 const T* _x_p = (x).dataPtr(); \
00832 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00833 const int nR = _n; (int&)nR += 0; \
00834 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00835 const int jR = _j + _b_lo[1]; \
00836 const T *_x_pp = _x_p \
00837 + ((_b_lo[0] - _x_plo[0]) \
00838 + _x_plen[0]*( \
00839 (jR - _x_plo[1]) \
00840 + _n * _x_plen[1])); \
00841 for (int _i = 0; _i < _b_len[0]; ++_i) { \
00842 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00843 const T & x##R = _x_pp[_i];
00844
00845 #define ForAllThisBNN2(T,b,ns,nc) \
00846 { \
00847 CH_assert(this->contains(b)); \
00848 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00849 const int *_th_plo = this->loVect(); \
00850 IntVect _th_plen = this->size(); \
00851 const int *_b_lo = (b).loVect(); \
00852 IntVect _b_len = (b).size(); \
00853 T* _th_p = this->m_dptr; \
00854 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00855 int nR = _n; nR += 0; \
00856 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00857 const int jR = _j + _b_lo[1]; \
00858 T *_th_pp = _th_p \
00859 + ((_b_lo[0] - _th_plo[0]) \
00860 + _th_plen[0]*( \
00861 (jR - _th_plo[1]) \
00862 + _n * _th_plen[1])); \
00863 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00864 int iR = _i + _b_lo[0]; iR += 0; \
00865 T &thisR = * _th_pp;
00866
00867 #define ForAllThisCBNN2(T,b,ns,nc) \
00868 { \
00869 CH_assert(this->contains(b)); \
00870 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00871 const int *_th_plo = this->loVect(); \
00872 IntVect _th_plen = this->size(); \
00873 const int *_b_lo = (b).loVect(); \
00874 IntVect _b_len = (b).size(); \
00875 const T* _th_p = this->m_dptr; \
00876 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
00877 const int nR = _n; (int&)nR += 0; \
00878 for (int _j = 0; _j < _b_len[1]; ++_j) { \
00879 const int jR = _j + _b_lo[1]; (int&)jR+=0;; \
00880 const T *_th_pp = _th_p \
00881 + ((_b_lo[0] - _th_plo[0]) \
00882 + _th_plen[0]*( \
00883 (_j + _b_lo[1] - _th_plo[1]) \
00884 + _n * _th_plen[1])); \
00885 for (int _i = 0; _i < _b_len[0]; ++_i) { \
00886 const int iR = _i + _b_lo[0]; (int&)iR +=0; \
00887 const T &thisR = _th_pp[_i];
00888
00889 #define ForAllThisBNNXC2(T,b,ns,nc,x,nss) \
00890 { \
00891 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00892 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00893 Box _subbox_((x).box()); \
00894 _subbox_ &= this->box(); \
00895 _subbox_ &= b; \
00896 if (!_subbox_.isEmpty()) { \
00897 const int *_th_plo = this->loVect(); \
00898 IntVect _th_plen = this->size(); \
00899 const int *_x_plo = (x).loVect(); \
00900 IntVect _x_plen = (x).size(); \
00901 const int *_subbox_lo = _subbox_.loVect(); \
00902 IntVect _subbox_len = _subbox_.size(); \
00903 T* _th_p = this->dataPtr(ns); \
00904 const T* _x_p = (x).dataPtr(nss); \
00905 for (int _n = 0; _n < (nc); ++_n) { \
00906 int nR = _n; nR += 0; \
00907 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
00908 const int jR = _j + _subbox_lo[1]; \
00909 T *_th_pp = _th_p \
00910 + ((_subbox_lo[0] - _th_plo[0]) \
00911 + _th_plen[0]*( \
00912 (jR - _th_plo[1]) \
00913 + _n * _th_plen[1])); \
00914 const T *_x_pp = _x_p \
00915 + ((_subbox_lo[0] - _x_plo[0]) \
00916 + _x_plen[0]*( \
00917 (jR - _x_plo[1]) \
00918 + _n * _x_plen[1])); \
00919 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00920 int iR = _i + _subbox_lo[0]; iR += 0; \
00921 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00922
00923 #define ForAllThisCBNNXC2(T,b,ns,nc,x,nss) \
00924 { \
00925 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00926 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00927 Box _subbox_((x).box()); \
00928 _subbox_ &= this->box(); \
00929 _subbox_ &= b; \
00930 if (!_subbox_.isEmpty()) { \
00931 const int *_th_plo = this->loVect(); \
00932 IntVect _th_plen = this->size(); \
00933 const int *_x_plo = (x).loVect(); \
00934 IntVect _x_plen = (x).size(); \
00935 const int *_subbox_lo = _subbox_.loVect(); \
00936 IntVect _subbox_len = _subbox_.size(); \
00937 const T* _th_p = this->dataPtr(ns); \
00938 const T* _x_p = (x).dataPtr(nss); \
00939 for (int _n = 0; _n < (nc); ++_n) { \
00940 int nR = _n; nR += 0; \
00941 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
00942 const int jR = _j + _subbox_lo[1]; \
00943 const T *_th_pp = _th_p \
00944 + ((_subbox_lo[0] - _th_plo[0]) \
00945 + _th_plen[0]*( \
00946 (jR - _th_plo[1]) \
00947 + _n * _th_plen[1])); \
00948 const T *_x_pp = _x_p \
00949 + ((_subbox_lo[0] - _x_plo[0]) \
00950 + _x_plen[0]*( \
00951 (jR - _x_plo[1]) \
00952 + _n * _x_plen[1])); \
00953 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00954 int iR = _i + _subbox_lo[0]; iR += 0; \
00955 const T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00956
00957 #define ForAllThisBNNXCBN2(T,b,ns,nc,x,bx,nss) \
00958 { \
00959 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00960 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00961 CH_assert(bx.sameSize((b))); \
00962 if (!((b).isEmpty())) { \
00963 const int *_th_plo = this->loVect(); \
00964 IntVect _th_plen = this->size(); \
00965 const int *_x_plo = (x).loVect(); \
00966 IntVect _x_plen = (x).size(); \
00967 const int *_subbox_lo = (b).loVect(); \
00968 const int *_subbox_len = (b).size().getVect(); \
00969 const int *_bx_lo = (bx).loVect(); \
00970 T* _th_p = this->dataPtr(ns); \
00971 int nR = ns; int n##x##R = nss; \
00972 const T* _x_p = (x).dataPtr(nss); \
00973 for (int _n = 0; _n < (nc); ++_n, ++nR, ++n##x##R ) { \
00974 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
00975 const int jR = _j + _subbox_lo[1]; \
00976 const int j##x##R = _j + _bx_lo[1]; \
00977 T *_th_pp = _th_p \
00978 + ((_subbox_lo[0] - _th_plo[0]) \
00979 + _th_plen[0]*( \
00980 (jR - _th_plo[1]) \
00981 + _n * _th_plen[1])); \
00982 const T *_x_pp = _x_p \
00983 + ((_bx_lo[0] - _x_plo[0]) \
00984 + _x_plen[0]*( \
00985 (j##x##R - _x_plo[1]) \
00986 + _n * _x_plen[1])); \
00987 int iR = _subbox_lo[0]; int i##x##R = _bx_lo[0]; \
00988 for (int _i = 0; _i < _subbox_len[0]; \
00989 ++_i, ++_th_pp, ++_x_pp, ++iR, ++i##x##R) { \
00990 T &thisR = * _th_pp; const T & x##R = * _x_pp;
00991
00992 #define ForAllThisBNNXCBNYCBN2(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00993 { \
00994 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00995 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00996 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00997 Box _subbox_ = this->box(); \
00998 _subbox_ &= b; \
00999 CH_assert((bx).sameSize(_subbox_)); \
01000 CH_assert((by).sameSize(_subbox_)); \
01001 if (!_subbox_.isEmpty()) { \
01002 const int *_th_plo = this->loVect(); \
01003 IntVect _th_plen = this->size(); \
01004 const int *_x_plo = (x).loVect(); \
01005 IntVect _x_plen = (x).size(); \
01006 const int *_y_plo = (y).loVect(); \
01007 const int *_y_plen = (y).size(); \
01008 const int *_subbox_lo = _subbox_.loVect(); \
01009 const int *_subbox_len = _subbox_.size().getVect(); \
01010 const int *_bx_lo = (bx).loVect(); \
01011 const int *_by_lo = (by).loVect(); \
01012 T* _th_p = this->dataPtr(ns); \
01013 const T* _x_p = (x).dataPtr(nsx); \
01014 const T* _y_p = (y).dataPtr(nsy); \
01015 for (int _n = 0; _n < (nc); ++_n) { \
01016 int nR = _n + ns; nR += 0; \
01017 int n##x##R = _n + nsx; n##x##R += 0; \
01018 int n##y##R = _n + nsy; n##y##R += 0; \
01019 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
01020 const int jR = _j + _subbox_lo[1]; \
01021 const int j##x##R = _j + _bx_lo[1]; \
01022 const int j##y##R = _j + _by_lo[1]; \
01023 T *_th_pp = _th_p \
01024 + ((_subbox_lo[0] - _th_plo[0]) \
01025 + _th_plen[0]*( \
01026 (jR - _th_plo[1]) \
01027 + _n * _th_plen[1])); \
01028 const T *_x_pp = _x_p \
01029 + ((_bx_lo[0] - _x_plo[0]) \
01030 + _x_plen[0]*( \
01031 (j##x##R - _x_plo[1]) \
01032 + _n * _x_plen[1])); \
01033 const T *_y_pp = _y_p \
01034 + ((_by_lo[0] - _y_plo[0]) \
01035 + _y_plen[0]*( \
01036 (j##y##R - _y_plo[1]) \
01037 + _n * _y_plen[1])); \
01038 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01039 int iR = _i + _subbox_lo[0]; iR += 0; \
01040 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01041 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
01042 T &thisR = * _th_pp; \
01043 const T & x##R = _x_pp[_i]; \
01044 const T & y##R = _y_pp[_i];
01045
01046 #define ForAllRevXBNYCBNNN2(T,x,bx,nsx,y,by,nsy,nc,ir) \
01047 { \
01048 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01049 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01050 CH_assert((ir) >= 0 && (ir) < SpaceDim); \
01051 CH_assert((x).contains(bx)); \
01052 CH_assert((y).contains(by)); \
01053 CH_assert((bx).sameSize(by)); \
01054 const int *_x_plo = (x).loVect(); \
01055 IntVect _x_plen = (x).size(); \
01056 const int *_y_plo = (y).loVect(); \
01057 const int *_y_plen = (y).size(); \
01058 const int *_bx_lo = (bx).loVect(); \
01059 const int *_by_lo = (by).loVect(); \
01060 const int *_len = (bx).size().getVect(); \
01061 T* _x_p = (x).dataPtr(nsx); \
01062 const T* _y_p = (y).dataPtr(nsy); \
01063 for (int _n = 0; _n < (nc); ++_n) { \
01064 int n##x##R = _n + nsx; n##x##R += 0; \
01065 int n##y##R = _n + nsy; n##y##R += 0; \
01066 for (int _j = 0; _j < _len[1]; ++_j) { \
01067 const int j##x##R = _j + _bx_lo[1]; \
01068 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
01069 const int j##y##R = _j + _by_lo[1]; \
01070 T *_x_pp; \
01071 int _ix = 0; \
01072 int _istrd; \
01073 if (ir == 0) { \
01074 _x_pp = _x_p \
01075 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
01076 + _x_plen[0]*( \
01077 (j##x##R - _x_plo[1]) \
01078 + _n * _x_plen[1])); \
01079 _istrd = -1; \
01080 } else { \
01081 _x_pp = _x_p \
01082 + ((_bx_lo[0] - _x_plo[0]) \
01083 + _x_plen[0]*( \
01084 (jrev##x##R - _x_plo[1]) \
01085 + _n * _x_plen[1])); \
01086 _istrd = 1; \
01087 } \
01088 const T *_y_pp = _y_p \
01089 + ((_by_lo[0] - _y_plo[0]) \
01090 + _y_plen[0]*( \
01091 (j##y##R - _y_plo[1]) \
01092 + _n * _y_plen[1])); \
01093 int _x_rev = _len[0]-1; _x_rev += 0; \
01094 for (int _i = 0; _i < _len[0]; ++_i, _ix+=_istrd) { \
01095 T & x##R = _x_pp[_ix]; \
01096 const T & y##R = _y_pp[_i];
01097
01098 #define EndFor2 }}}}
01099 #define EndForTX2 }}}}}
01100 #define EndForPencil2 }}}
01101
01102 #elif (CH_SPACEDIM == 3)
01103
01104 #define ForAllThisCPencil3(T,b,ns,nc) \
01105 { \
01106 CH_assert(this->contains(b)); \
01107 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01108 const int *_th_plo = this->loVect(); \
01109 IntVect _th_plen = this->size(); \
01110 const int *_b_lo = (b).loVect(); \
01111 IntVect _b_len = (b).size(); \
01112 const T* _th_p = this->m_dptr; \
01113 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01114 int nR = _n; nR += 0; \
01115 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01116 const int kR = _k + _b_lo[2]; \
01117 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01118 const int jR = _j + _b_lo[1]; \
01119 const T *_th_pp = _th_p \
01120 + ((_b_lo[0] - _th_plo[0]) \
01121 + _th_plen[0]*( \
01122 (jR - _th_plo[1]) \
01123 + _th_plen[1]*( \
01124 (kR - _th_plo[2]) \
01125 + _n * _th_plen[2]))); \
01126 const T &thisR = * _th_pp; \
01127 const int thisLen = _b_len[0];
01128
01129 #define ForAllThisPencil3(T,b,ns,nc) \
01130 { \
01131 CH_assert(this->contains(b)); \
01132 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01133 const int *_th_plo = this->loVect(); \
01134 IntVect _th_plen = this->size(); \
01135 const int *_b_lo = (b).loVect(); \
01136 IntVect _b_len = (b).size(); \
01137 T* _th_p = this->m_dptr; \
01138 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01139 const int nR = _n; (int&)nR += 0; \
01140 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01141 const int kR = _k + _b_lo[2]; \
01142 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01143 const int jR = _j + _b_lo[1]; \
01144 T *_th_pp = _th_p \
01145 + ((_b_lo[0] - _th_plo[0]) \
01146 + _th_plen[0]*( \
01147 (jR - _th_plo[1]) \
01148 + _th_plen[1]*( \
01149 (kR - _th_plo[2]) \
01150 + _n * _th_plen[2]))); \
01151 T &thisR = * _th_pp; \
01152 const int thisLen = _b_len[0]; \
01153
01154 #define ForAllXBPencil3(T,x,b,ns,nc) \
01155 { \
01156 CH_assert((x).contains(b)); \
01157 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01158 const int *_th_plo = (x).loVect(); \
01159 const int *_th_plen = (x).size(); \
01160 const int *_b_lo = (b).loVect(); \
01161 IntVect _b_len = (b).size(); \
01162 T* _th_p = (x) .dataPtr(); \
01163 for (int nR = (ns); nR < (ns)+(nc); ++nR) { \
01164 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01165 const int kR = _k + _b_lo[2]; \
01166 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01167 const int jR = _j + _b_lo[1]; \
01168 T *xR = _th_p \
01169 + ((_b_lo[0] - _th_plo[0]) \
01170 + _th_plen[0]*( \
01171 (jR - _th_plo[1]) \
01172 + _th_plen[1]*( \
01173 (kR - _th_plo[2]) \
01174 + nR * _th_plen[2]))); \
01175 const int thisLen = _b_len[0];
01176
01177 #define ForAllXBNN3(T,x,b,ns,nc) \
01178 { \
01179 CH_assert(x.contains(b)); \
01180 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01181 const int *_x_plo = (x).loVect(); \
01182 IntVect _x_plen = (x).size(); \
01183 const int *_b_lo = (b).loVect(); \
01184 IntVect _b_len = (b).size(); \
01185 T* _x_p = (x) .dataPtr(); \
01186 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01187 const int nR = _n; (int&)nR += 0; \
01188 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01189 const int kR = _k + _b_lo[2]; \
01190 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01191 const int jR = _j + _b_lo[1]; \
01192 T *_x_pp = _x_p \
01193 + ((_b_lo[0] - _x_plo[0]) \
01194 + _x_plen[0]*( \
01195 (jR - _x_plo[1]) \
01196 + _x_plen[1]*( \
01197 (kR - _x_plo[2]) \
01198 + _n * _x_plen[2]))); \
01199 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
01200 const int iR = _i + _b_lo[0]; \
01201 T &x##R = * _x_pp;
01202
01203 #define ForAllXBNNnoindx3(T,x,b,ns,nc) \
01204 { \
01205 CH_assert(x.contains(b)); \
01206 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01207 const int *_x_plo = (x).loVect(); \
01208 IntVect _x_plen = (x).size(); \
01209 const int *_b_lo = (b).loVect(); \
01210 IntVect _b_len = (b).size(); \
01211 T* _x_p = (x) .dataPtr(); \
01212 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01213 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01214 const int kR = _k + _b_lo[2]; \
01215 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01216 const int jR = _j + _b_lo[1]; \
01217 T *_x_pp = _x_p \
01218 + ((_b_lo[0] - _x_plo[0]) \
01219 + _x_plen[0]*( \
01220 (jR - _x_plo[1]) \
01221 + _x_plen[1]*( \
01222 (kR - _x_plo[2]) \
01223 + _n * _x_plen[2]))); \
01224 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
01225 T &x##R = * _x_pp;
01226
01227 #define ForAllXCBNN3(T,x,b,ns,nc) \
01228 { \
01229 CH_assert(x.contains(b)); \
01230 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01231 const int *_x_plo = (x).loVect(); \
01232 IntVect _x_plen = (x).size(); \
01233 const int *_b_lo = (b).loVect(); \
01234 IntVect _b_len = (b).size(); \
01235 const T* _x_p = (x).dataPtr(); \
01236 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01237 const int nR = _n; (int&)nR += 0; \
01238 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01239 const int kR = _k + _b_lo[2]; \
01240 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01241 const int jR = _j + _b_lo[1]; \
01242 const T *_x_pp = _x_p \
01243 + ((_b_lo[0] - _x_plo[0]) \
01244 + _x_plen[0]*( \
01245 (jR - _x_plo[1]) \
01246 + _x_plen[1]*( \
01247 (kR - _x_plo[2]) \
01248 + _n * _x_plen[2]))); \
01249 for (int _i = 0; _i < _b_len[0]; ++_i) { \
01250 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
01251 const T & x##R = _x_pp[_i];
01252
01253 #define ForAllThisBNN3(T,b,ns,nc) \
01254 { \
01255 CH_assert(this->contains(b)); \
01256 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01257 const int *_th_plo = this->loVect(); \
01258 IntVect _th_plen = this->size(); \
01259 const int *_b_lo = (b).loVect(); \
01260 IntVect _b_len = (b).size(); \
01261 T* _th_p = this->m_dptr; \
01262 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01263 int nR = _n; nR += 0; \
01264 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01265 const int kR = _k + _b_lo[2]; \
01266 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01267 const int jR = _j + _b_lo[1]; \
01268 T *_th_pp = _th_p \
01269 + ((_b_lo[0] - _th_plo[0]) \
01270 + _th_plen[0]*( \
01271 (jR - _th_plo[1]) \
01272 + _th_plen[1]*( \
01273 (kR - _th_plo[2]) \
01274 + _n * _th_plen[2]))); \
01275 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
01276 int iR = _i + _b_lo[0]; iR += 0; \
01277 T &thisR = * _th_pp;
01278
01279 #define ForAllThisCBNN3(T,b,ns,nc) \
01280 { \
01281 CH_assert(this->contains(b)); \
01282 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01283 const int *_th_plo = this->loVect(); \
01284 IntVect _th_plen = this->size(); \
01285 const int *_b_lo = (b).loVect(); \
01286 IntVect _b_len = (b).size(); \
01287 const T* _th_p = this->m_dptr; \
01288 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01289 const int nR = _n; (int&)nR += 0; \
01290 for (int _k = 0; _k < _b_len[2]; ++_k) { \
01291 const int kR = _k + _b_lo[2]; \
01292 for (int _j = 0; _j < _b_len[1]; ++_j) { \
01293 const int jR = _j + _b_lo[1]; \
01294 const T *_th_pp = _th_p \
01295 + ((_b_lo[0] - _th_plo[0]) \
01296 + _th_plen[0]*( \
01297 (jR - _th_plo[1]) \
01298 + _th_plen[1]*( \
01299 (kR - _th_plo[2]) \
01300 + _n * _th_plen[2]))); \
01301 for (int _i = 0; _i < _b_len[0]; ++_i) { \
01302 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
01303 const T &thisR = _th_pp[_i];
01304
01305 #define ForAllThisBNNXC3(T,b,ns,nc,x,nss) \
01306 { \
01307 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01308 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01309 Box _subbox_((x).box()); \
01310 _subbox_ &= this->box(); \
01311 _subbox_ &= b; \
01312 if (!_subbox_.isEmpty()) { \
01313 const int *_th_plo = this->loVect(); \
01314 IntVect _th_plen = this->size(); \
01315 const int *_x_plo = (x).loVect(); \
01316 IntVect _x_plen = (x).size(); \
01317 const int *_subbox_lo = _subbox_.loVect(); \
01318 const int *_subbox_len = _subbox_.size().getVect(); \
01319 T* _th_p = this->dataPtr(ns); \
01320 const T* _x_p = (x).dataPtr(nss); \
01321 for (int _n = 0; _n < (nc); ++_n) { \
01322 int nR = _n; nR += 0; \
01323 for (int _k = 0; _k < _subbox_len[2]; ++_k) { \
01324 const int kR = _k + _subbox_lo[2]; \
01325 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
01326 const int jR = _j + _subbox_lo[1]; \
01327 T *_th_pp = _th_p \
01328 + ((_subbox_lo[0] - _th_plo[0]) \
01329 + _th_plen[0]*( \
01330 (jR - _th_plo[1]) \
01331 + _th_plen[1]*( \
01332 (kR - _th_plo[2]) \
01333 + _n * _th_plen[2]))); \
01334 const T *_x_pp = _x_p \
01335 + ((_subbox_lo[0] - _x_plo[0]) \
01336 + _x_plen[0]*( \
01337 (jR - _x_plo[1]) \
01338 + _x_plen[1]*( \
01339 (kR - _x_plo[2]) \
01340 + _n * _x_plen[2]))); \
01341 for (int _i = 0; _i < _subbox_len[0]; \
01342 ++_i, ++_th_pp) { \
01343 int iR = _i + _subbox_lo[0]; iR += 0; \
01344 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01345
01346 #define ForAllThisCBNNXC3(T,b,ns,nc,x,nss) \
01347 { \
01348 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01349 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01350 Box _subbox_((x).box()); \
01351 _subbox_ &= this->box(); \
01352 _subbox_ &= b; \
01353 if (!_subbox_.isEmpty()) { \
01354 const int *_th_plo = this->loVect(); \
01355 IntVect _th_plen = this->size(); \
01356 const int *_x_plo = (x).loVect(); \
01357 IntVect _x_plen = (x).size(); \
01358 const int *_subbox_lo = _subbox_.loVect(); \
01359 const int *_subbox_len = _subbox_.size().getVect(); \
01360 const T* _th_p = this->dataPtr(ns); \
01361 const T* _x_p = (x).dataPtr(nss); \
01362 for (int _n = 0; _n < (nc); ++_n) { \
01363 int nR = _n; nR += 0; \
01364 for (int _k = 0; _k < _subbox_len[2]; ++_k) { \
01365 const int kR = _k + _subbox_lo[2]; \
01366 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
01367 const int jR = _j + _subbox_lo[1]; \
01368 const T *_th_pp = _th_p \
01369 + ((_subbox_lo[0] - _th_plo[0]) \
01370 + _th_plen[0]*( \
01371 (jR - _th_plo[1]) \
01372 + _th_plen[1]*( \
01373 (kR - _th_plo[2]) \
01374 + _n * _th_plen[2]))); \
01375 const T *_x_pp = _x_p \
01376 + ((_subbox_lo[0] - _x_plo[0]) \
01377 + _x_plen[0]*( \
01378 (jR - _x_plo[1]) \
01379 + _x_plen[1]*( \
01380 (kR - _x_plo[2]) \
01381 + _n * _x_plen[2]))); \
01382 for (int _i = 0; _i < _subbox_len[0]; \
01383 ++_i, ++_th_pp) { \
01384 int iR = _i + _subbox_lo[0]; iR += 0; \
01385 const T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01386
01387 #define ForAllThisBNNXCBN3(T,b,ns,nc,x,bx,nss) \
01388 { \
01389 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01390 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01391 CH_assert((bx).sameSize((b))); \
01392 if (!((b).isEmpty())) { \
01393 const int *_th_plo = this->loVect(); \
01394 IntVect _th_plen = this->size(); \
01395 const int *_x_plo = (x).loVect(); \
01396 IntVect _x_plen = (x).size(); \
01397 const int *_subbox_lo = (b).loVect(); \
01398 IntVect _subbox_len = (b).size(); \
01399 const int *_bx_lo = (bx).loVect(); \
01400 T* _th_p = this->dataPtr(ns); \
01401 const T* _x_p = (x).dataPtr(nss); \
01402 for (int _n = 0; _n < (nc); ++_n) { \
01403 int nR = _n + ns; nR += 0; \
01404 int n##x##R = _n + nss; n##x##R += 0; \
01405 for (int _k = 0; _k < _subbox_len[2]; ++_k) { \
01406 const int kR = _k + _subbox_lo[2]; \
01407 const int k##x##R = _k + _bx_lo[2]; \
01408 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
01409 const int jR = _j + _subbox_lo[1]; \
01410 const int j##x##R = _j + _bx_lo[1]; \
01411 T *_th_pp = _th_p \
01412 + ((_subbox_lo[0] - _th_plo[0]) \
01413 + _th_plen[0]*( \
01414 (jR - _th_plo[1]) \
01415 + _th_plen[1]*( \
01416 (kR - _th_plo[2]) \
01417 + _n * _th_plen[2]))); \
01418 const T *_x_pp = _x_p \
01419 + ((_bx_lo[0] - _x_plo[0]) \
01420 + _x_plen[0]*( \
01421 (j##x##R - _x_plo[1]) \
01422 + _x_plen[1]*( \
01423 (k##x##R - _x_plo[2]) \
01424 + _n * _x_plen[2]))); \
01425 for (int _i = 0; _i < _subbox_len[0]; \
01426 ++_i, ++_th_pp) { \
01427 int iR = _i + _subbox_lo[0]; iR += 0; \
01428 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01429 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01430
01431 #define ForAllThisBNNXCBNYCBN3(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01432 { \
01433 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01434 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01435 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01436 Box _subbox_(this->box()); \
01437 _subbox_ &= b; \
01438 CH_assert((bx).sameSize(_subbox_)); \
01439 CH_assert((by).sameSize(_subbox_)); \
01440 if (!_subbox_.isEmpty()) { \
01441 const int *_th_plo = this->loVect(); \
01442 IntVect _th_plen = this->size(); \
01443 const int *_x_plo = (x).loVect(); \
01444 IntVect _x_plen = (x).size(); \
01445 const int *_y_plo = (y).loVect(); \
01446 IntVect _y_plen = (y).size(); \
01447 const int *_subbox_lo = _subbox_.loVect(); \
01448 IntVect _subbox_len = _subbox_.size(); \
01449 const int *_bx_lo = (bx).loVect(); \
01450 const int *_by_lo = (by).loVect(); \
01451 T* _th_p = this->dataPtr(ns); \
01452 const T* _x_p = (x).dataPtr(nsx); \
01453 const T* _y_p = (y).dataPtr(nsy); \
01454 for (int _n = 0; _n < (nc); ++_n) { \
01455 int nR = _n + ns; nR += 0; \
01456 int n##x##R = _n + nsx; n##x##R += 0; \
01457 int n##y##R = _n + nsy; n##y##R += 0; \
01458 for (int _k = 0; _k < _subbox_len[2]; ++_k) { \
01459 const int kR = _k + _subbox_lo[2]; \
01460 const int k##x##R = _k + _bx_lo[2]; \
01461 const int k##y##R = _k + _by_lo[2]; \
01462 for (int _j = 0; _j < _subbox_len[1]; ++_j) { \
01463 const int jR = _j + _subbox_lo[1]; \
01464 const int j##x##R = _j + _bx_lo[1]; \
01465 const int j##y##R = _j + _by_lo[1]; \
01466 T *_th_pp = _th_p \
01467 + ((_subbox_lo[0] - _th_plo[0]) \
01468 + _th_plen[0]*( \
01469 (jR - _th_plo[1]) \
01470 + _th_plen[1]*( \
01471 (kR - _th_plo[2]) \
01472 + _n * _th_plen[2]))); \
01473 const T *_x_pp = _x_p \
01474 + ((_bx_lo[0] - _x_plo[0]) \
01475 + _x_plen[0]*( \
01476 (j##x##R - _x_plo[1]) \
01477 + _x_plen[1]*( \
01478 (k##x##R - _x_plo[2]) \
01479 + _n * _x_plen[2]))); \
01480 const T *_y_pp = _y_p \
01481 + ((_by_lo[0] - _y_plo[0]) \
01482 + _y_plen[0]*( \
01483 (j##y##R - _y_plo[1]) \
01484 + _y_plen[1]*( \
01485 (k##y##R - _y_plo[2]) \
01486 + _n * _y_plen[2]))); \
01487 for (int _i = 0; _i < _subbox_len[0]; \
01488 ++_i, ++_th_pp) { \
01489 int iR = _i + _subbox_lo[0]; iR += 0; \
01490 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01491 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
01492 T &thisR = * _th_pp; \
01493 const T & x##R = _x_pp[_i]; \
01494 const T & y##R = _y_pp[_i];
01495
01496 #define ForAllRevXBNYCBNNN3(T,x,bx,nsx,y,by,nsy,nc,ir) \
01497 { \
01498 CH_assert((ir) >= 0 && (ir) < SpaceDim); \
01499 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01500 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01501 CH_assert((x).contains(bx)); \
01502 CH_assert((y).contains(by)); \
01503 CH_assert((bx).sameSize(by)); \
01504 const int *_x_plo = (x).loVect(); \
01505 IntVect _x_plen = (x).size(); \
01506 const int *_y_plo = (y).loVect(); \
01507 intVect _y_plen = (y).size(); \
01508 const int *_bx_lo = (bx).loVect(); \
01509 const int *_by_lo = (by).loVect(); \
01510 IntVect _len = (bx).size(); \
01511 T* _x_p = (x).dataPtr(nsx); \
01512 const T* _y_p = (y).dataPtr(nsy); \
01513 for (int _n = 0; _n < (nc); ++_n) { \
01514 int n##x##R = _n + nsx; n##x##R += 0; \
01515 int n##y##R = _n + nsy; n##y##R += 0; \
01516 for (int _k = 0; _k < _len[2]; ++_k) { \
01517 const int k##x##R = _k + _bx_lo[2]; \
01518 const int krev##x##R = _len[2]-1-_k + _bx_lo[2]; \
01519 const int k##y##R = _k + _by_lo[2]; \
01520 for (int _j = 0; _j < _len[1]; ++_j) { \
01521 const int j##x##R = _j + _bx_lo[1]; \
01522 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
01523 const int j##y##R = _j + _by_lo[1]; \
01524 T *_x_pp; \
01525 int _ix = 0; \
01526 int _istrd = 1; \
01527 if (ir == 0) { \
01528 _x_pp = _x_p \
01529 + ((_bx_lo[0] - _x_plo[0]) + _len[0]-1 \
01530 + _x_plen[0]*( \
01531 (j##x##R - _x_plo[1]) \
01532 + _x_plen[1]*( \
01533 (k##x##R - _x_plo[2]) \
01534 + _n * _x_plen[2]))); \
01535 _istrd = -1; \
01536 } else if (ir == 1) { \
01537 _x_pp = _x_p \
01538 + ((_bx_lo[0] - _x_plo[0]) \
01539 + _x_plen[0]*( \
01540 (jrev##x##R - _x_plo[1]) \
01541 + _x_plen[1]*( \
01542 (k##x##R - _x_plo[2]) \
01543 + _n * _x_plen[2]))); \
01544 } else { \
01545 _x_pp = _x_p \
01546 + ((_bx_lo[0] - _x_plo[0]) \
01547 + _x_plen[0]*( \
01548 (j##x##R - _x_plo[1]) \
01549 + _x_plen[1]*( \
01550 (krev##x##R - _x_plo[2]) \
01551 + _n * _x_plen[2]))); \
01552 } \
01553 const T *_y_pp = _y_p \
01554 + ((_by_lo[0] - _y_plo[0]) \
01555 + _y_plen[0]*( \
01556 (j##y##R - _y_plo[1]) \
01557 + _y_plen[1]*( \
01558 (k##y##R - _y_plo[2]) \
01559 + _n * _y_plen[2]))); \
01560 for (int _i = 0; _i < _len[0]; ++_i, _ix += _istrd) { \
01561 T & x##R = _x_pp[_ix]; \
01562 const T & y##R = _y_pp[_i];
01563
01564 #define EndFor3 }}}}}
01565 #define EndForTX3 }}}}}}
01566 #define EndForPencil3 }}}}
01567
01568 #elif (CH_SPACEDIM > 3)
01569
01570 #define ForAllThisCPencilHiDim(T,b,ns,nc) \
01571 { \
01572 CH_assert(this->contains(b)); \
01573 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01574 IntVect _b_len = (b).size(); \
01575 Box _pencil_box(b); \
01576 _pencil_box.setBig(0,b.smallEnd(0)); \
01577 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01578 int nR = _n; nR += 0; \
01579 BoxIterator _bit( _pencil_box ); \
01580 for (_bit.begin(); _bit.ok(); ++_bit) { \
01581 IntVect _iv = _bit(); \
01582 const T &thisR = this->operator()(_iv,_n); \
01583 const int thisLen = _b_len[0]; \
01584 int jR = _iv[1]; jR += 0; \
01585 int kR = _iv[2]; kR += 0;
01586
01587
01588
01589
01590 #define ForAllThisPencilHiDim(T,b,ns,nc) \
01591 { \
01592 CH_assert(this->contains(b)); \
01593 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01594 IntVect _b_len = (b).size(); \
01595 Box _pencil_box(b); \
01596 _pencil_box.setBig(0,b.smallEnd(0)); \
01597 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01598 const int nR = _n; \
01599 BoxIterator _bit( _pencil_box ); \
01600 for (_bit.begin(); _bit.ok(); ++_bit) { \
01601 IntVect _iv = _bit(); \
01602 T &thisR = this->operator()(_iv,nR); \
01603 const int thisLen = _b_len[0]; \
01604 int jR = _iv[1]; jR += 0; \
01605 int kR = _iv[2]; kR += 0;
01606
01607 #define ForAllXBPencilHiDim(T,x,b,ns,nc) \
01608 { \
01609 CH_assert((x).contains(b)); \
01610 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01611 IntVect _b_len = (b).size(); \
01612 Box _pencil_box(b); \
01613 _pencil_box.setBig(0,b.smallEnd(0)); \
01614 for (int nR = (ns); nR < (ns)+(nc); ++nR) { \
01615 BoxIterator _bit( _pencil_box ); \
01616 for (_bit.begin(); _bit.ok(); ++_bit) { \
01617 IntVect _iv = _bit(); \
01618 T *xR = &(x).operator()(_iv,nR); \
01619 const int thisLen = _b_len[0]; \
01620 int jR = _iv[1]; jR += 0; \
01621 int kR = _iv[2]; kR += 0;
01622
01623 #define ForAllXBNNHiDim(T,x,b,ns,nc) \
01624 { \
01625 CH_assert(x.contains(b)); \
01626 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01627 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01628 const int nR = _n; nR += 0; \
01629 BoxIterator _bit( (b) ); \
01630 for (_bit.begin(); _bit.ok(); ++_bit) { \
01631 IntVect _iv = _bit(); \
01632 T &x##R = (x)(_iv,nR); \
01633 T *_x_pp = &x##R; \
01634 int iR = _iv[0]; iR += 0; \
01635 int jR = _iv[1]; jR += 0; \
01636 int kR = _iv[2]; kR += 0;
01637
01638
01639 #define ForAllXBNNnoindxHiDim(T,x,b,ns,nc) \
01640 { \
01641 CH_assert(x.contains(b)); \
01642 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01643 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01644 BoxIterator _bit( (b) ); \
01645 for (_bit.begin(); _bit.ok(); ++_bit) { \
01646 IntVect _iv = _bit(); \
01647 T& x##R = (x)(_iv,_n); \
01648 int iR = _iv[0]; iR += 0; \
01649 int jR = _iv[1]; jR += 0; \
01650 int kR = _iv[2]; kR += 0;
01651
01652 #define ForAllXCBNNHiDim(T,x,b,ns,nc) \
01653 { \
01654 CH_assert(x.contains(b)); \
01655 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01656 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01657 const int nR = _n; \
01658 BoxIterator _bit( (b) ); \
01659 for (_bit.begin(); _bit.ok(); ++_bit) { \
01660 IntVect _iv = _bit(); \
01661 const T & x##R = (x)(_iv, nR); \
01662 const T *_x_pp = &x##R; \
01663 const int iR = _iv[0]; (int&)iR += 0; \
01664 const int jR = _iv[1]; (int&)jR += 0; \
01665 const int kR = _iv[2]; (int&)kR += 0;
01666
01667
01668 #define ForAllThisBNNHiDim(T,b,ns,nc) \
01669 { \
01670 CH_assert(this->contains(b)); \
01671 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01672 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01673 int nR = _n; nR += 0; \
01674 BoxIterator _bit( (b)); \
01675 for (_bit.begin(); _bit.ok(); ++_bit) { \
01676 IntVect _iv = _bit(); \
01677 T &thisR = this->operator()(_iv,nR); \
01678 int iR = _iv[0]; iR += 0; \
01679 int jR = _iv[1]; jR += 0; \
01680 int kR = _iv[2]; kR += 0;
01681
01682
01683 #define ForAllThisCBNNHiDim(T,b,ns,nc) \
01684 { \
01685 CH_assert(this->contains(b)); \
01686 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01687 for (int _n = (ns); _n < (ns)+(nc); ++_n) { \
01688 const int nR = _n; \
01689 BoxIterator _bit( (b) ); \
01690 for (_bit.begin(); _bit.ok(); ++_bit) { \
01691 IntVect _iv = _bit(); \
01692 const T &thisR = this->operator()(_iv,nR); \
01693 const int iR = _iv[0]; (int&)iR +=0; \
01694 const int jR = _iv[1]; (int&)jR +=0; \
01695 const int kR = _iv[2]; (int&)kR +=0;
01696
01697 #define ForAllThisBNNXCHiDim(T,b,ns,nc,x,nss) \
01698 { \
01699 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01700 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01701 Box _subbox_((x).box()); \
01702 _subbox_ &= this->box(); \
01703 _subbox_ &= b; \
01704 if (!_subbox_.isEmpty()) { \
01705 for (int _n = 0; _n < (nc); ++_n) { \
01706 int nR = _n; nR += 0; \
01707 BoxIterator _bit(_subbox_); \
01708 for (_bit.begin(); _bit.ok(); ++_bit) { \
01709 IntVect _iv = _bit(); \
01710 T &thisR = this->operator()(_iv, ns+nR); \
01711 const T & x##R = (x)(_iv, nss+nR); \
01712 const int iR = _iv[0]; (int&)iR += 0; \
01713 const int jR = _iv[1]; (int&)jR += 0; \
01714 const int kR = _iv[2]; (int&)kR += 0;
01715
01716 #define ForAllThisCBNNXCHiDim(T,b,ns,nc,x,nss) \
01717 { \
01718 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01719 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01720 Box _subbox_((x).box()); \
01721 _subbox_ &= this->box(); \
01722 _subbox_ &= b; \
01723 if (!_subbox_.isEmpty()) { \
01724 for (int _n = 0; _n < (nc); ++_n) { \
01725 int nR = _n; nR += 0; \
01726 BoxIterator _bit(_subbox_); \
01727 for (_bit.begin(); _bit.ok(); ++_bit) { \
01728 IntVect _iv = _bit(); \
01729 const T &thisR = this->operator()(_iv,ns+nR); \
01730 const T & x##R = (x)(_iv,nss+nR); \
01731 const int iR = _iv[0]; (int&)iR += 0; \
01732 const int jR = _iv[1]; (int&)jR += 0; \
01733 const int kR = _iv[2]; (int&)kR += 0;
01734
01735 #define ForAllThisBNNXCBNHiDim(T,b,ns,nc,x,bx,nss) \
01736 { \
01737 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01738 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01739 CH_assert((bx).sameSize((b))); \
01740 if (!((b).isEmpty())) { \
01741 for (int _n = 0; _n < (nc); ++_n) { \
01742 int nR = _n + ns; nR += 0; \
01743 int n##x##R = _n + nss; n##x##R += 0; \
01744 BoxIterator this_Bit( (b) ); \
01745 IntVect _bxOffset = bx.smallEnd() - b.smallEnd(); \
01746 for (this_Bit.begin(); this_Bit.ok(); ++this_Bit) { \
01747 IntVect _thisIV = this_Bit(); \
01748 IntVect _xIV = _thisIV + _bxOffset; \
01749 T &thisR = this->operator()(_thisIV, nR); \
01750 const T & x##R = (x)(_xIV,n##x##R); \
01751 int iR = _xIV[0]; iR += 0; \
01752 int jR = _xIV[1]; jR += 0; \
01753 int kR = _xIV[2]; kR += 0;
01754
01755
01756 #define ForAllThisBNNXCBNYCBNHiDim(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01757 { \
01758 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01759 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01760 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01761 Box _subbox_(this->box()); \
01762 _subbox_ &= b; \
01763 CH_assert((bx).sameSize(_subbox_)); \
01764 CH_assert((by).sameSize(_subbox_)); \
01765 if (!_subbox_.isEmpty()) { \
01766 for (int _n = 0; _n < (nc); ++_n) { \
01767 int nR = _n + ns; nR += 0; \
01768 int n##x##R = _n + nsx; n##x##R += 0; \
01769 int n##y##R = _n + nsy; n##y##R += 0; \
01770 BoxIterator _thisBit(_subbox_); \
01771 IntVect _xOffset = bx.smallEnd() - _subbox_.smallEnd(); \
01772 IntVect _yOffset = by.smallEnd() - _subbox_.smallEnd(); \
01773 for (_thisBit.begin(); _thisBit.ok(); ++_thisBit) { \
01774 IntVect _thisIV = _thisBit(); \
01775 IntVect _xIV = _thisIV + _xOffset; \
01776 IntVect _yIV = _thisIV + _yOffset; \
01777 T &thisR = this->operator()(_thisIV,nR); \
01778 const T & x##R = (x)(_xIV,n##x##R); \
01779 const T & y##R = (y)(_yIV,n##y##R); \
01780 int iR = _iv[0]; iR += 0; \
01781 int jR = _iv[1]; jR += 0; \
01782 int kR = _iv[2]; kR += 0;
01783
01784
01785 #define EndForHiDim }}}
01786 #define EndForTXHiDim }}}}
01787 #define EndForPencilHiDim }}}
01788
01789 #endif
01790
01795 #define ForAllXPencil(T,x) ForAllXBPencil(T,x,((x).box()),0,((x).nComp()))
01796
01802 #define ForAllX(T,x) ForAllXBNN(T,x,((x).box()),0,((x).nComp()))
01803
01807 #define ForAllXC(T,x) ForAllXCBNN(T,x,((x).box()),0,((x).nComp()))
01808
01813 #define ForAllXB(T,x,b) ForAllXBNN(T,x,(b),0,(x).nComp())
01814
01818 #define ForAllXBC(T,x,b) ForAllXCBNN(T,x,(b),0,(x).nComp())
01819
01825 #define ForAllThis(T) ForAllThisBNN(T,this->m_domain,0,this->nComp())
01826
01830 #define ForAllThisC(T) ForAllThisCBNN(T,this->m_domain,0,this->nComp())
01831
01836 #define ForAllThisB(T,b) ForAllThisBNN(T,(b),0,this->nComp())
01837
01841 #define ForAllThisCB(T,b) ForAllThisCBNN(T,(b),0,this->nComp())
01842
01847 #define ForAllThisNN(T,ns,nc) ForAllThisBNN(T,this->m_domain,ns,nc)
01848
01854 #define ForAllThisXC(T,x) ForAllThisBNNXC(T,this->m_domain,0,this->nComp(),x,0)
01855
01856 #ifdef DOXYGEN
01857 #undef CH_SPACEDIM
01858 #endif
01859
01860 #endif // matches CH_SPACEDIM != LAST_BASEFABMACROS_H_SPACEDIM