00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _CH_LAME_MACROS_H
00029 #define _CH_LAME_MACROS_H
00030
00031 #include "SPACE.H"
00032
00033 #ifdef DOXYGEN
00034 #define CH_SPACEDIM 1
00035 #endif
00036
00037 #if (CH_SPACEDIM == 1)
00038
00085 #define ForAllThisPencil(T,b,ns,nc) \
00086 { \
00087 assert(contains(b)); \
00088 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00089 const int *_th_plo = loVect(); \
00090 const int *_th_plen = size(); \
00091 const int *_b_lo = (b).loVect(); \
00092 const int *_b_len = (b).size(); \
00093 T* _th_p = dptr; \
00094 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00095 const int nR = _n; \
00096 T *_th_pp = _th_p \
00097 + ((_b_lo[0] - _th_plo[0]) \
00098 + _n * _th_plen[0]); \
00099 T &thisR = * _th_pp; \
00100 const int thisLen = _b_len[0]; \
00101
00102
00106 #define ForAllXBPencil(T,x,b,ns,nc) \
00107 { \
00108 assert(x.contains(b)); \
00109 assert((ns) >= 0 && (ns) + (nc) <= x.nComp()); \
00110 const int *_th_plo = x.loVect(); \
00111 const int *_th_plen = x.size(); \
00112 const int *_b_lo = (b).loVect(); \
00113 const int *_b_len = (b).size(); \
00114 T* _th_p = x.dataPtr(); \
00115 for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
00116 T * xR = _th_p \
00117 + ((_b_lo[0] - _th_plo[0]) \
00118 + nR * _th_plen[0]); \
00119 const int thisLen = _b_len[0];
00120
00142 #define ForAllThisCPencil(T,b,ns,nc) \
00143 { \
00144 assert(contains(b)); \
00145 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00146 const int *_th_plo = loVect(); \
00147 const int *_th_plen = size(); \
00148 const int *_b_lo = (b).loVect(); \
00149 const int *_b_len = (b).size(); \
00150 const T* _th_p = dptr; \
00151 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00152 int nR = _n; nR += 0; \
00153 const T *_th_pp = _th_p \
00154 + ((_b_lo[0] - _th_plo[0]) \
00155 + _n * _th_plen[0]); \
00156 const T &thisR = * _th_pp; \
00157 const int thisLen = _b_len[0];
00158
00184 #define ForAllXBNN(T,x,b,ns,nc) \
00185 { \
00186 assert(x.contains(b)); \
00187 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00188 const int *_x_plo = (x).loVect(); \
00189 const int *_x_plen = (x).size(); \
00190 const int *_b_lo = (b).loVect(); \
00191 const int *_b_len = (b).size(); \
00192 T* _x_p = (x) .dataPtr(); \
00193 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00194 const int nR = _n; \
00195 T *_x_pp = _x_p \
00196 + ((_b_lo[0] - _x_plo[0]) \
00197 + _n * _x_plen[0]); \
00198 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00199 const int iR = _i + _b_lo[0]; \
00200 T &x##R = * _x_pp;
00201
00202
00203
00204
00205
00206
00207
00208 #define ForAllXBNNnoindx(T,x,b,ns,nc) \
00209 { \
00210 assert(x.contains(b)); \
00211 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00212 const int *_x_plo = (x).loVect(); \
00213 const int *_x_plen = (x).size(); \
00214 const int *_b_lo = (b).loVect(); \
00215 const int *_b_len = (b).size(); \
00216 T* _x_p = (x) .dataPtr(); \
00217 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00218 T *_x_pp = _x_p \
00219 + ((_b_lo[0] - _x_plo[0]) \
00220 + _n * _x_plen[0]); \
00221 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00222 T &x##R = * _x_pp;
00223
00224
00225
00247 #define ForAllXCBNN(T,x,b,ns,nc) \
00248 { \
00249 assert(x.contains(b)); \
00250 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00251 const int *_x_plo = (x).loVect(); \
00252 const int *_x_plen = (x).size(); \
00253 const int *_b_lo = (b).loVect(); \
00254 const int *_b_len = (b).size().getVect(); \
00255 const T* _x_p = (x).dataPtr(); \
00256 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00257 const int nR = _n; \
00258 const T *_x_pp = _x_p \
00259 + ((_b_lo[0] - _x_plo[0]) \
00260 + _n * _x_plen[0]); \
00261 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00262 const int iR = _i + _b_lo[0]; \
00263 const T & x##R = _x_pp[_i];
00264
00303 #define ForAllThisBNN(T,b,ns,nc) \
00304 { \
00305 assert(contains(b)); \
00306 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00307 const int *_th_plo = loVect(); \
00308 const int *_th_plen = size(); \
00309 const int *_b_lo = (b).loVect(); \
00310 const int *_b_len = (b).size().getVect(); \
00311 T* _th_p = dptr; \
00312 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00313 int nR = _n; nR += 0; \
00314 T *_th_pp = _th_p \
00315 + ((_b_lo[0] - _th_plo[0]) \
00316 + _n * _th_plen[0]); \
00317 for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00318 int iR = _i + _b_lo[0]; iR += 0; \
00319 T &thisR = * _th_pp;
00320
00342 #define ForAllThisCBNN(T,b,ns,nc) \
00343 { \
00344 assert(contains(b)); \
00345 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00346 const int *_th_plo = loVect(); \
00347 const int *_th_plen = size(); \
00348 const int *_b_lo = (b).loVect(); \
00349 const int *_b_len = (b).size().getVect(); \
00350 const T* _th_p = dptr; \
00351 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00352 const int nR = _n; \
00353 const T *_th_pp = _th_p \
00354 + ((_b_lo[0] - _th_plo[0]) \
00355 + _n * _th_plen[0]); \
00356 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00357 const int iR = _i + _b_lo[0]; \
00358 const T &thisR = _th_pp[_i];
00359
00385 #define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
00386 { \
00387 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00388 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00389 Box _subbox_((x).box()); \
00390 _subbox_ &= box(); \
00391 _subbox_ &= b; \
00392 if(!_subbox_.isEmpty()) { \
00393 const int *_th_plo = loVect(); \
00394 const int *_th_plen = size(); \
00395 const int *_x_plo = (x).loVect(); \
00396 const int *_x_plen = (x).size(); \
00397 const int *_subbox_lo = _subbox_.loVect(); \
00398 const int *_subbox_len = _subbox_.size().getVect(); \
00399 T* _th_p = dataPtr(ns); \
00400 const T* _x_p = (x).dataPtr(nss); \
00401 for(int _n = 0; _n < (nc); ++_n) { \
00402 int nR = _n; nR += 0; \
00403 T *_th_pp = _th_p \
00404 + ((_subbox_lo[0] - _th_plo[0]) \
00405 + _n * _th_plen[0]); \
00406 const T *_x_pp = _x_p \
00407 + ((_subbox_lo[0] - _x_plo[0]) \
00408 + _n * _x_plen[0]); \
00409 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00410 int iR = _i + _subbox_lo[0]; iR += 0; \
00411 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00412
00413 #define ForAllThisCBNNXC(T,b,ns,nc,x,nss) \
00414 { \
00415 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00416 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00417 Box _subbox_((x).box()); \
00418 _subbox_ &= box(); \
00419 _subbox_ &= b; \
00420 if(!_subbox_.isEmpty()) { \
00421 const int *_th_plo = loVect(); \
00422 const int *_th_plen = size(); \
00423 const int *_x_plo = (x).loVect(); \
00424 const int *_x_plen = (x).size(); \
00425 const int *_subbox_lo = _subbox_.loVect(); \
00426 const int *_subbox_len = _subbox_.size().getVect(); \
00427 const T* _th_p = dataPtr(ns); \
00428 const T* _x_p = (x).dataPtr(nss); \
00429 for(int _n = 0; _n < (nc); ++_n) { \
00430 int nR = _n; nR += 0; \
00431 const T *_th_pp = _th_p \
00432 + ((_subbox_lo[0] - _th_plo[0]) \
00433 + _n * _th_plen[0]); \
00434 const T *_x_pp = _x_p \
00435 + ((_subbox_lo[0] - _x_plo[0]) \
00436 + _n * _x_plen[0]); \
00437 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00438 int iR = _i + _subbox_lo[0]; iR += 0; \
00439 const T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00440
00466 #define ForAllThisBNNXCBN(T,b,ns,nc,x,bx,nss) \
00467 { \
00468 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00469 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00470 assert(bx.sameSize((b))); \
00471 if(!((b).isEmpty())) { \
00472 const int *_th_plo = loVect(); \
00473 const int *_th_plen = size(); \
00474 const int *_x_plo = (x).loVect(); \
00475 const int *_x_plen = (x).size(); \
00476 const int *_subbox_lo = (b).loVect(); \
00477 const int *_subbox_len = (b).size().getVect(); \
00478 const int *_bx_lo = (bx).loVect(); \
00479 T* _th_p = dataPtr(ns); \
00480 const T* _x_p = (x).dataPtr(nss); \
00481 for(int _n = 0; _n < (nc); ++_n) { \
00482 int nR = _n + ns; nR += 0; \
00483 int n##x##R = _n + nss; n##x##R += 0; \
00484 T *_th_pp = _th_p \
00485 + ((_subbox_lo[0] - _th_plo[0]) \
00486 + _n * _th_plen[0]); \
00487 const T *_x_pp = _x_p \
00488 + ((_bx_lo[0] - _x_plo[0]) \
00489 + _n * _x_plen[0]); \
00490 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00491 int iR = _i + _subbox_lo[0]; iR += 0; \
00492 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00493 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00494
00524 #define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00525 { \
00526 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00527 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00528 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00529 Box _subbox_ = box(); \
00530 _subbox_ &= b; \
00531 assert((bx).sameSize(_subbox_)); \
00532 assert((by).sameSize(_subbox_)); \
00533 if(!_subbox_.isEmpty()) { \
00534 const int *_th_plo = loVect(); \
00535 const int *_th_plen = size(); \
00536 const int *_x_plo = (x).loVect(); \
00537 const int *_x_plen = (x).size(); \
00538 const int *_y_plo = (y).loVect(); \
00539 const int *_y_plen = (y).size(); \
00540 const int *_subbox_lo = _subbox_.loVect(); \
00541 const int *_subbox_len = _subbox_.size().getVect(); \
00542 const int *_bx_lo = (bx).loVect(); \
00543 const int *_by_lo = (by).loVect(); \
00544 T* _th_p = dataPtr(ns); \
00545 const T* _x_p = (x).dataPtr(nsx); \
00546 const T* _y_p = (y).dataPtr(nsy); \
00547 for(int _n = 0; _n < (nc); ++_n) { \
00548 int nR = _n + ns; nR += 0; \
00549 int n##x##R = _n + nsx; n##x##R += 0; \
00550 int n##y##R = _n + nsy; n##y##R += 0; \
00551 T *_th_pp = _th_p \
00552 + ((_subbox_lo[0] - _th_plo[0]) \
00553 + _n * _th_plen[0]); \
00554 const T *_x_pp = _x_p \
00555 + ((_bx_lo[0] - _x_plo[0]) \
00556 + _n * _x_plen[0]); \
00557 const T *_y_pp = _y_p \
00558 + ((_by_lo[0] - _y_plo[0]) \
00559 + _n * _y_plen[0]); \
00560 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00561 int iR = _i + _subbox_lo[0]; iR += 0; \
00562 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00563 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
00564 T &thisR = * _th_pp; \
00565 const T & x##R = _x_pp[_i]; \
00566 const T & y##R = _y_pp[_i];
00567
00568 #define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ri) \
00569 { \
00570 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00571 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00572 assert((x).contains(bx)); \
00573 assert((y).contains(by)); \
00574 assert((bx).sameSize(by)); \
00575 const int *_x_plo = (x).loVect(); \
00576 const int *_x_plen = (x).size(); \
00577 const int *_y_plo = (y).loVect(); \
00578 const int *_y_plen = (y).size(); \
00579 const int *_len = (bx).size().getVect(); \
00580 const int *_bx_lo = (bx).loVect(); \
00581 const int *_by_lo = (by).loVect(); \
00582 T* _x_p = (x).dataPtr(nsx); \
00583 const T* _y_p = (y).dataPtr(nsy); \
00584 for(int _n = 0; _n < (nc); ++_n) { \
00585 int n##x##R = _n + nsx; n##x##R += 0; \
00586 int n##y##R = _n + nsy; n##y##R += 0; \
00587 int _ix = 0; \
00588 T *_x_pp = _x_p \
00589 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
00590 + _n * _x_plen[0]); \
00591 const T *_y_pp = _y_p \
00592 + ((_by_lo[0] - _y_plo[0]) \
00593 + _n * _y_plen[0]); \
00594 for(int _i = 0; _i < _len[0]; ++_i, --_ix) { \
00595 T & x##R = _x_pp[_ix]; \
00596 const T & y##R = _y_pp[_i];
00597
00602 #define EndForTX }}}}
00603
00608 #define EndFor }}}
00609
00613 #define EndForPencil }}
00614
00615 #elif (CH_SPACEDIM == 2)
00616
00617 #define ForAllThisCPencil(T,b,ns,nc) \
00618 { \
00619 assert(contains(b)); \
00620 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00621 const int *_th_plo = loVect(); \
00622 const int *_th_plen = size(); \
00623 const int *_b_lo = (b).loVect(); \
00624 const int *_b_len = (b).size().getVect(); \
00625 const T* _th_p = dptr; \
00626 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00627 int nR = _n; nR += 0; \
00628 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00629 const int jR = _j + _b_lo[1]; \
00630 const T *_th_pp = _th_p \
00631 + ((_b_lo[0] - _th_plo[0]) \
00632 + _th_plen[0]*( \
00633 (jR - _th_plo[1]) \
00634 + _n * _th_plen[1])); \
00635 const T &thisR = * _th_pp; \
00636 const int thisLen = _b_len[0];
00637
00638 #define ForAllThisPencil(T,b,ns,nc) \
00639 { \
00640 assert(contains(b)); \
00641 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00642 const int *_th_plo = loVect(); \
00643 const int *_th_plen = size(); \
00644 const int *_b_lo = (b).loVect(); \
00645 const int *_b_len = (b).size().getVect(); \
00646 T* _th_p = dptr; \
00647 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00648 const int nR = _n; \
00649 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00650 const int jR = _j + _b_lo[1]; \
00651 T *_th_pp = _th_p \
00652 + ((_b_lo[0] - _th_plo[0]) \
00653 + _th_plen[0]*( \
00654 (jR - _th_plo[1]) \
00655 + _n * _th_plen[1])); \
00656 T &thisR = * _th_pp; \
00657 const int thisLen = _b_len[0]; \
00658
00659 #define ForAllXBPencil(T,x,b,ns,nc) \
00660 { \
00661 assert((x).contains(b)); \
00662 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00663 const int *_th_plo = (x).loVect(); \
00664 const int *_th_plen =(x).size(); \
00665 const int *_b_lo = (b).loVect(); \
00666 const int *_b_len = (b).size().getVect(); \
00667 T* _th_p = (x) .dataPtr(); \
00668 for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
00669 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00670 const int jR = _j + _b_lo[1]; \
00671 T *xR = _th_p \
00672 + ((_b_lo[0] - _th_plo[0]) \
00673 + _th_plen[0]*( \
00674 (jR - _th_plo[1]) \
00675 + nR * _th_plen[1])); \
00676 const int thisLen = _b_len[0]; \
00677
00678 #define ForAllXBNN(T,x,b,ns,nc) \
00679 { \
00680 assert((x).contains(b)); \
00681 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00682 const int *_x_plo = (x).loVect(); \
00683 const int *_x_plen = (x).size(); \
00684 const int *_b_lo = (b).loVect(); \
00685 const int *_b_len = (b).size().getVect(); \
00686 T* _x_p = (x) .dataPtr(); \
00687 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00688 const int nR = _n; \
00689 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00690 const int jR = _j + _b_lo[1]; \
00691 T *_x_pp = _x_p \
00692 + ((_b_lo[0] - _x_plo[0]) \
00693 + _x_plen[0]*( \
00694 (jR - _x_plo[1]) \
00695 + _n * _x_plen[1])); \
00696 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00697 const int iR = _i + _b_lo[0]; \
00698 T &x##R = * _x_pp;
00699
00700 #define ForAllXBNNnoindx(T,x,b,ns,nc) \
00701 { \
00702 assert((x).contains(b)); \
00703 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00704 const int *_x_plo = (x).loVect(); \
00705 const int *_x_plen = (x).size(); \
00706 const int *_b_lo = (b).loVect(); \
00707 const int *_b_len = (b).size().getVect(); \
00708 T* _x_p = (x) .dataPtr(); \
00709 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00710 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00711 const int jR = _j + _b_lo[1]; \
00712 T *_x_pp = _x_p \
00713 + ((_b_lo[0] - _x_plo[0]) \
00714 + _x_plen[0]*( \
00715 (jR - _x_plo[1]) \
00716 + _n * _x_plen[1])); \
00717 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00718 T &x##R = * _x_pp;
00719
00720 #define ForAllXCBNN(T,x,b,ns,nc) \
00721 { \
00722 assert(x.contains(b)); \
00723 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00724 const int *_x_plo = (x).loVect(); \
00725 const int *_x_plen = (x).size(); \
00726 const int *_b_lo = (b).loVect(); \
00727 const int *_b_len = (b).size().getVect(); \
00728 const T* _x_p = (x).dataPtr(); \
00729 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00730 const int nR = _n; \
00731 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00732 const int jR = _j + _b_lo[1]; \
00733 const T *_x_pp = _x_p \
00734 + ((_b_lo[0] - _x_plo[0]) \
00735 + _x_plen[0]*( \
00736 (jR - _x_plo[1]) \
00737 + _n * _x_plen[1])); \
00738 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00739 const int iR = _i + _b_lo[0]; \
00740 const T & x##R = _x_pp[_i];
00741
00742
00743 #define ForAllThisBNN(T,b,ns,nc) \
00744 { \
00745 assert(contains(b)); \
00746 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00747 const int *_th_plo = loVect(); \
00748 const int *_th_plen = size(); \
00749 const int *_b_lo = (b).loVect(); \
00750 const int *_b_len = (b).size().getVect(); \
00751 T* _th_p = dptr; \
00752 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00753 int nR = _n; nR += 0; \
00754 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00755 const int jR = _j + _b_lo[1]; \
00756 T *_th_pp = _th_p \
00757 + ((_b_lo[0] - _th_plo[0]) \
00758 + _th_plen[0]*( \
00759 (jR - _th_plo[1]) \
00760 + _n * _th_plen[1])); \
00761 for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00762 int iR = _i + _b_lo[0]; iR += 0; \
00763 T &thisR = * _th_pp;
00764
00765 #define ForAllThisCBNN(T,b,ns,nc) \
00766 { \
00767 assert(contains(b)); \
00768 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00769 const int *_th_plo = loVect(); \
00770 const int *_th_plen = size(); \
00771 const int *_b_lo = (b).loVect(); \
00772 const int *_b_len = (b).size().getVect(); \
00773 const T* _th_p = dptr; \
00774 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00775 const int nR = _n; \
00776 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00777 const int jR = _j + _b_lo[1]; \
00778 const T *_th_pp = _th_p \
00779 + ((_b_lo[0] - _th_plo[0]) \
00780 + _th_plen[0]*( \
00781 (_j + _b_lo[1] - _th_plo[1]) \
00782 + _n * _th_plen[1])); \
00783 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00784 const int iR = _i + _b_lo[0]; \
00785 const T &thisR = _th_pp[_i];
00786
00787 #define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
00788 { \
00789 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00790 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00791 Box _subbox_((x).box()); \
00792 _subbox_ &= box(); \
00793 _subbox_ &= b; \
00794 if(!_subbox_.isEmpty()) { \
00795 const int *_th_plo = loVect(); \
00796 const int *_th_plen = size(); \
00797 const int *_x_plo = (x).loVect(); \
00798 const int *_x_plen = (x).size(); \
00799 const int *_subbox_lo = _subbox_.loVect(); \
00800 const int *_subbox_len = _subbox_.size().getVect(); \
00801 T* _th_p = dataPtr(ns); \
00802 const T* _x_p = (x).dataPtr(nss); \
00803 for(int _n = 0; _n < (nc); ++_n) { \
00804 int nR = _n; nR += 0; \
00805 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00806 const int jR = _j + _subbox_lo[1]; \
00807 T *_th_pp = _th_p \
00808 + ((_subbox_lo[0] - _th_plo[0]) \
00809 + _th_plen[0]*( \
00810 (jR - _th_plo[1]) \
00811 + _n * _th_plen[1])); \
00812 const T *_x_pp = _x_p \
00813 + ((_subbox_lo[0] - _x_plo[0]) \
00814 + _x_plen[0]*( \
00815 (jR - _x_plo[1]) \
00816 + _n * _x_plen[1])); \
00817 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00818 int iR = _i + _subbox_lo[0]; iR += 0; \
00819 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00820
00821 #define ForAllThisCBNNXC(T,b,ns,nc,x,nss) \
00822 { \
00823 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00824 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00825 Box _subbox_((x).box()); \
00826 _subbox_ &= box(); \
00827 _subbox_ &= b; \
00828 if(!_subbox_.isEmpty()) { \
00829 const int *_th_plo = loVect(); \
00830 const int *_th_plen = size(); \
00831 const int *_x_plo = (x).loVect(); \
00832 const int *_x_plen = (x).size(); \
00833 const int *_subbox_lo = _subbox_.loVect(); \
00834 const int *_subbox_len = _subbox_.size().getVect(); \
00835 const T* _th_p = dataPtr(ns); \
00836 const T* _x_p = (x).dataPtr(nss); \
00837 for(int _n = 0; _n < (nc); ++_n) { \
00838 int nR = _n; nR += 0; \
00839 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00840 const int jR = _j + _subbox_lo[1]; \
00841 const T *_th_pp = _th_p \
00842 + ((_subbox_lo[0] - _th_plo[0]) \
00843 + _th_plen[0]*( \
00844 (jR - _th_plo[1]) \
00845 + _n * _th_plen[1])); \
00846 const T *_x_pp = _x_p \
00847 + ((_subbox_lo[0] - _x_plo[0]) \
00848 + _x_plen[0]*( \
00849 (jR - _x_plo[1]) \
00850 + _n * _x_plen[1])); \
00851 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00852 int iR = _i + _subbox_lo[0]; iR += 0; \
00853 const T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00854
00855 #define ForAllThisBNNXCBN(T,b,ns,nc,x,bx,nss) \
00856 { \
00857 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00858 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00859 assert(bx.sameSize((b))); \
00860 if(!((b).isEmpty())) { \
00861 const int *_th_plo = loVect(); \
00862 const int *_th_plen = size(); \
00863 const int *_x_plo = (x).loVect(); \
00864 const int *_x_plen = (x).size(); \
00865 const int *_subbox_lo = (b).loVect(); \
00866 const int *_subbox_len = (b).size().getVect(); \
00867 const int *_bx_lo = (bx).loVect(); \
00868 T* _th_p = dataPtr(ns); \
00869 int nR = ns; int n##x##R = nss; \
00870 const T* _x_p = (x).dataPtr(nss); \
00871 for(int _n = 0; _n < (nc); ++_n, ++nR, ++n##x##R ) { \
00872 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00873 const int jR = _j + _subbox_lo[1]; \
00874 const int j##x##R = _j + _bx_lo[1]; \
00875 T *_th_pp = _th_p \
00876 + ((_subbox_lo[0] - _th_plo[0]) \
00877 + _th_plen[0]*( \
00878 (jR - _th_plo[1]) \
00879 + _n * _th_plen[1])); \
00880 const T *_x_pp = _x_p \
00881 + ((_bx_lo[0] - _x_plo[0]) \
00882 + _x_plen[0]*( \
00883 (j##x##R - _x_plo[1]) \
00884 + _n * _x_plen[1])); \
00885 int iR = _subbox_lo[0]; int i##x##R = _bx_lo[0]; \
00886 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp, ++_x_pp, ++iR, ++i##x##R) { \
00887 T &thisR = * _th_pp; const T & x##R = * _x_pp;
00888
00889 #define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00890 { \
00891 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00892 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00893 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00894 Box _subbox_ = box(); \
00895 _subbox_ &= b; \
00896 assert((bx).sameSize(_subbox_)); \
00897 assert((by).sameSize(_subbox_)); \
00898 if(!_subbox_.isEmpty()) { \
00899 const int *_th_plo = loVect(); \
00900 const int *_th_plen = size(); \
00901 const int *_x_plo = (x).loVect(); \
00902 const int *_x_plen = (x).size(); \
00903 const int *_y_plo = (y).loVect(); \
00904 const int *_y_plen = (y).size(); \
00905 const int *_subbox_lo = _subbox_.loVect(); \
00906 const int *_subbox_len = _subbox_.size().getVect(); \
00907 const int *_bx_lo = (bx).loVect(); \
00908 const int *_by_lo = (by).loVect(); \
00909 T* _th_p = dataPtr(ns); \
00910 const T* _x_p = (x).dataPtr(nsx); \
00911 const T* _y_p = (y).dataPtr(nsy); \
00912 for(int _n = 0; _n < (nc); ++_n) { \
00913 int nR = _n + ns; nR += 0; \
00914 int n##x##R = _n + nsx; n##x##R += 0; \
00915 int n##y##R = _n + nsy; n##y##R += 0; \
00916 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00917 const int jR = _j + _subbox_lo[1]; \
00918 const int j##x##R = _j + _bx_lo[1]; \
00919 const int j##y##R = _j + _by_lo[1]; \
00920 T *_th_pp = _th_p \
00921 + ((_subbox_lo[0] - _th_plo[0]) \
00922 + _th_plen[0]*( \
00923 (jR - _th_plo[1]) \
00924 + _n * _th_plen[1])); \
00925 const T *_x_pp = _x_p \
00926 + ((_bx_lo[0] - _x_plo[0]) \
00927 + _x_plen[0]*( \
00928 (j##x##R - _x_plo[1]) \
00929 + _n * _x_plen[1])); \
00930 const T *_y_pp = _y_p \
00931 + ((_by_lo[0] - _y_plo[0]) \
00932 + _y_plen[0]*( \
00933 (j##y##R - _y_plo[1]) \
00934 + _n * _y_plen[1])); \
00935 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00936 int iR = _i + _subbox_lo[0]; iR += 0; \
00937 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00938 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
00939 T &thisR = * _th_pp; \
00940 const T & x##R = _x_pp[_i]; \
00941 const T & y##R = _y_pp[_i];
00942
00943 #define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ir) \
00944 { \
00945 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00946 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00947 assert((ir) >= 0 && (ir) < SpaceDim); \
00948 assert((x).contains(bx)); \
00949 assert((y).contains(by)); \
00950 assert((bx).sameSize(by)); \
00951 const int *_x_plo = (x).loVect(); \
00952 const int *_x_plen = (x).size(); \
00953 const int *_y_plo = (y).loVect(); \
00954 const int *_y_plen = (y).size(); \
00955 const int *_bx_lo = (bx).loVect(); \
00956 const int *_by_lo = (by).loVect(); \
00957 const int *_len = (bx).size().getVect(); \
00958 T* _x_p = (x).dataPtr(nsx); \
00959 const T* _y_p = (y).dataPtr(nsy); \
00960 for(int _n = 0; _n < (nc); ++_n) { \
00961 int n##x##R = _n + nsx; n##x##R += 0; \
00962 int n##y##R = _n + nsy; n##y##R += 0; \
00963 for(int _j = 0; _j < _len[1]; ++_j) { \
00964 const int j##x##R = _j + _bx_lo[1]; \
00965 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
00966 const int j##y##R = _j + _by_lo[1]; \
00967 T *_x_pp; \
00968 int _ix = 0; \
00969 int _istrd; \
00970 if (ir == 0) { \
00971 _x_pp = _x_p \
00972 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
00973 + _x_plen[0]*( \
00974 (j##x##R - _x_plo[1]) \
00975 + _n * _x_plen[1])); \
00976 _istrd = -1; \
00977 } else { \
00978 _x_pp = _x_p \
00979 + ((_bx_lo[0] - _x_plo[0]) \
00980 + _x_plen[0]*( \
00981 (jrev##x##R - _x_plo[1]) \
00982 + _n * _x_plen[1])); \
00983 _istrd = 1; \
00984 } \
00985 const T *_y_pp = _y_p \
00986 + ((_by_lo[0] - _y_plo[0]) \
00987 + _y_plen[0]*( \
00988 (j##y##R - _y_plo[1]) \
00989 + _n * _y_plen[1])); \
00990 int _x_rev = _len[0]-1; _x_rev += 0; \
00991 for(int _i = 0; _i < _len[0]; ++_i, _ix+=_istrd) { \
00992 T & x##R = _x_pp[_ix]; \
00993 const T & y##R = _y_pp[_i];
00994
00995
00996 #define EndFor }}}}
00997 #define EndForTX }}}}}
00998 #define EndForPencil }}}
00999
01000 #elif (CH_SPACEDIM == 3)
01001
01002 #define ForAllThisCPencil(T,b,ns,nc) \
01003 { \
01004 assert(contains(b)); \
01005 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01006 const int *_th_plo = loVect(); \
01007 const int *_th_plen = size(); \
01008 const int *_b_lo = (b).loVect(); \
01009 const int *_b_len = (b).size().getVect(); \
01010 const T* _th_p = dptr; \
01011 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01012 int nR = _n; nR += 0; \
01013 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01014 const int kR = _k + _b_lo[2]; \
01015 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01016 const int jR = _j + _b_lo[1]; \
01017 const T *_th_pp = _th_p \
01018 + ((_b_lo[0] - _th_plo[0]) \
01019 + _th_plen[0]*( \
01020 (jR - _th_plo[1]) \
01021 + _th_plen[1]*( \
01022 (kR - _th_plo[2]) \
01023 + _n * _th_plen[2]))); \
01024 const T &thisR = * _th_pp; \
01025 const int thisLen = _b_len[0];
01026
01027 #define ForAllThisPencil(T,b,ns,nc) \
01028 { \
01029 assert(contains(b)); \
01030 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01031 const int *_th_plo = loVect(); \
01032 const int *_th_plen = size(); \
01033 const int *_b_lo = (b).loVect(); \
01034 const int *_b_len = (b).size().getVect(); \
01035 T* _th_p = dptr; \
01036 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01037 const int nR = _n; \
01038 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01039 const int kR = _k + _b_lo[2]; \
01040 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01041 const int jR = _j + _b_lo[1]; \
01042 T *_th_pp = _th_p \
01043 + ((_b_lo[0] - _th_plo[0]) \
01044 + _th_plen[0]*( \
01045 (jR - _th_plo[1]) \
01046 + _th_plen[1]*( \
01047 (kR - _th_plo[2]) \
01048 + _n * _th_plen[2]))); \
01049 T &thisR = * _th_pp; \
01050 const int thisLen = _b_len[0]; \
01051
01052 #define ForAllXBPencil(T,x,b,ns,nc) \
01053 { \
01054 assert((x).contains(b)); \
01055 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01056 const int *_th_plo = (x).loVect(); \
01057 const int *_th_plen = (x).size(); \
01058 const int *_b_lo = (b).loVect(); \
01059 const int *_b_len = (b).size().getVect(); \
01060 T* _th_p = (x) .dataPtr(); \
01061 for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
01062 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01063 const int kR = _k + _b_lo[2]; \
01064 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01065 const int jR = _j + _b_lo[1]; \
01066 T *xR = _th_p \
01067 + ((_b_lo[0] - _th_plo[0]) \
01068 + _th_plen[0]*( \
01069 (jR - _th_plo[1]) \
01070 + _th_plen[1]*( \
01071 (kR - _th_plo[2]) \
01072 + nR * _th_plen[2]))); \
01073 const int thisLen = _b_len[0];
01074
01075
01076 #define ForAllXBNN(T,x,b,ns,nc) \
01077 { \
01078 assert(x.contains(b)); \
01079 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01080 const int *_x_plo = (x).loVect(); \
01081 const int *_x_plen = (x).size(); \
01082 const int *_b_lo = (b).loVect(); \
01083 const int *_b_len = (b).size().getVect(); \
01084 T* _x_p = (x) .dataPtr(); \
01085 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01086 const int nR = _n; \
01087 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01088 const int kR = _k + _b_lo[2]; \
01089 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01090 const int jR = _j + _b_lo[1]; \
01091 T *_x_pp = _x_p \
01092 + ((_b_lo[0] - _x_plo[0]) \
01093 + _x_plen[0]*( \
01094 (jR - _x_plo[1]) \
01095 + _x_plen[1]*( \
01096 (kR - _x_plo[2]) \
01097 + _n * _x_plen[2]))); \
01098 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
01099 const int iR = _i + _b_lo[0]; \
01100 T &x##R = * _x_pp;
01101
01102 #define ForAllXBNNnoindx(T,x,b,ns,nc) \
01103 { \
01104 assert(x.contains(b)); \
01105 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01106 const int *_x_plo = (x).loVect(); \
01107 const int *_x_plen = (x).size(); \
01108 const int *_b_lo = (b).loVect(); \
01109 const int *_b_len = (b).size().getVect(); \
01110 T* _x_p = (x) .dataPtr(); \
01111 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01112 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01113 const int kR = _k + _b_lo[2]; \
01114 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01115 const int jR = _j + _b_lo[1]; \
01116 T *_x_pp = _x_p \
01117 + ((_b_lo[0] - _x_plo[0]) \
01118 + _x_plen[0]*( \
01119 (jR - _x_plo[1]) \
01120 + _x_plen[1]*( \
01121 (kR - _x_plo[2]) \
01122 + _n * _x_plen[2]))); \
01123 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
01124 T &x##R = * _x_pp;
01125
01126 #define ForAllXCBNN(T,x,b,ns,nc) \
01127 { \
01128 assert(x.contains(b)); \
01129 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01130 const int *_x_plo = (x).loVect(); \
01131 const int *_x_plen = (x).size(); \
01132 const int *_b_lo = (b).loVect(); \
01133 const int *_b_len = (b).size().getVect(); \
01134 const T* _x_p = (x).dataPtr(); \
01135 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01136 const int nR = _n; \
01137 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01138 const int kR = _k + _b_lo[2]; \
01139 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01140 const int jR = _j + _b_lo[1]; \
01141 const T *_x_pp = _x_p \
01142 + ((_b_lo[0] - _x_plo[0]) \
01143 + _x_plen[0]*( \
01144 (jR - _x_plo[1]) \
01145 + _x_plen[1]*( \
01146 (kR - _x_plo[2]) \
01147 + _n * _x_plen[2]))); \
01148 for(int _i = 0; _i < _b_len[0]; ++_i) { \
01149 const int iR = _i + _b_lo[0]; \
01150 const T & x##R = _x_pp[_i];
01151
01152
01153 #define ForAllThisBNN(T,b,ns,nc) \
01154 { \
01155 assert(contains(b)); \
01156 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01157 const int *_th_plo = loVect(); \
01158 const int *_th_plen = size(); \
01159 const int *_b_lo = (b).loVect(); \
01160 const int *_b_len = (b).size().getVect(); \
01161 T* _th_p = dptr; \
01162 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01163 int nR = _n; nR += 0; \
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 *_th_pp = _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 + _n * _th_plen[2]))); \
01175 for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
01176 int iR = _i + _b_lo[0]; iR += 0; \
01177 T &thisR = * _th_pp;
01178
01179 #define ForAllThisCBNN(T,b,ns,nc) \
01180 { \
01181 assert(contains(b)); \
01182 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01183 const int *_th_plo = loVect(); \
01184 const int *_th_plen = size(); \
01185 const int *_b_lo = (b).loVect(); \
01186 const int *_b_len = (b).size().getVect(); \
01187 const T* _th_p = dptr; \
01188 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01189 const int nR = _n; \
01190 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01191 const int kR = _k + _b_lo[2]; \
01192 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01193 const int jR = _j + _b_lo[1]; \
01194 const T *_th_pp = _th_p \
01195 + ((_b_lo[0] - _th_plo[0]) \
01196 + _th_plen[0]*( \
01197 (jR - _th_plo[1]) \
01198 + _th_plen[1]*( \
01199 (kR - _th_plo[2]) \
01200 + _n * _th_plen[2]))); \
01201 for(int _i = 0; _i < _b_len[0]; ++_i) { \
01202 const int iR = _i + _b_lo[0]; \
01203 const T &thisR = _th_pp[_i];
01204
01205 #define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
01206 { \
01207 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01208 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01209 Box _subbox_((x).box()); \
01210 _subbox_ &= box(); \
01211 _subbox_ &= b; \
01212 if(!_subbox_.isEmpty()) { \
01213 const int *_th_plo = loVect(); \
01214 const int *_th_plen = size(); \
01215 const int *_x_plo = (x).loVect(); \
01216 const int *_x_plen = (x).size(); \
01217 const int *_subbox_lo = _subbox_.loVect(); \
01218 const int *_subbox_len = _subbox_.size().getVect(); \
01219 T* _th_p = dataPtr(ns); \
01220 const T* _x_p = (x).dataPtr(nss); \
01221 for(int _n = 0; _n < (nc); ++_n) { \
01222 int nR = _n; nR += 0; \
01223 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01224 const int kR = _k + _subbox_lo[2]; \
01225 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01226 const int jR = _j + _subbox_lo[1]; \
01227 T *_th_pp = _th_p \
01228 + ((_subbox_lo[0] - _th_plo[0]) \
01229 + _th_plen[0]*( \
01230 (jR - _th_plo[1]) \
01231 + _th_plen[1]*( \
01232 (kR - _th_plo[2]) \
01233 + _n * _th_plen[2]))); \
01234 const T *_x_pp = _x_p \
01235 + ((_subbox_lo[0] - _x_plo[0]) \
01236 + _x_plen[0]*( \
01237 (jR - _x_plo[1]) \
01238 + _x_plen[1]*( \
01239 (kR - _x_plo[2]) \
01240 + _n * _x_plen[2]))); \
01241 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01242 int iR = _i + _subbox_lo[0]; iR += 0; \
01243 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01244
01245 #define ForAllThisCBNNXC(T,b,ns,nc,x,nss) \
01246 { \
01247 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01248 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01249 Box _subbox_((x).box()); \
01250 _subbox_ &= box(); \
01251 _subbox_ &= b; \
01252 if(!_subbox_.isEmpty()) { \
01253 const int *_th_plo = loVect(); \
01254 const int *_th_plen = size(); \
01255 const int *_x_plo = (x).loVect(); \
01256 const int *_x_plen = (x).size(); \
01257 const int *_subbox_lo = _subbox_.loVect(); \
01258 const int *_subbox_len = _subbox_.size().getVect(); \
01259 const T* _th_p = dataPtr(ns); \
01260 const T* _x_p = (x).dataPtr(nss); \
01261 for(int _n = 0; _n < (nc); ++_n) { \
01262 int nR = _n; nR += 0; \
01263 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01264 const int kR = _k + _subbox_lo[2]; \
01265 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01266 const int jR = _j + _subbox_lo[1]; \
01267 const T *_th_pp = _th_p \
01268 + ((_subbox_lo[0] - _th_plo[0]) \
01269 + _th_plen[0]*( \
01270 (jR - _th_plo[1]) \
01271 + _th_plen[1]*( \
01272 (kR - _th_plo[2]) \
01273 + _n * _th_plen[2]))); \
01274 const T *_x_pp = _x_p \
01275 + ((_subbox_lo[0] - _x_plo[0]) \
01276 + _x_plen[0]*( \
01277 (jR - _x_plo[1]) \
01278 + _x_plen[1]*( \
01279 (kR - _x_plo[2]) \
01280 + _n * _x_plen[2]))); \
01281 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01282 int iR = _i + _subbox_lo[0]; iR += 0; \
01283 const T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01284
01285 #define ForAllThisBNNXCBN(T,b,ns,nc,x,bx,nss) \
01286 { \
01287 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01288 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01289 assert((bx).sameSize((b))); \
01290 if(!((b).isEmpty())) { \
01291 const int *_th_plo = loVect(); \
01292 const int *_th_plen = size(); \
01293 const int *_x_plo = (x).loVect(); \
01294 const int *_x_plen = (x).size(); \
01295 const int *_subbox_lo = (b).loVect(); \
01296 const int *_subbox_len = (b).size().getVect(); \
01297 const int *_bx_lo = (bx).loVect(); \
01298 T* _th_p = dataPtr(ns); \
01299 const T* _x_p = (x).dataPtr(nss); \
01300 for(int _n = 0; _n < (nc); ++_n) { \
01301 int nR = _n + ns; nR += 0; \
01302 int n##x##R = _n + nss; n##x##R += 0; \
01303 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01304 const int kR = _k + _subbox_lo[2]; \
01305 const int k##x##R = _k + _bx_lo[2]; \
01306 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01307 const int jR = _j + _subbox_lo[1]; \
01308 const int j##x##R = _j + _bx_lo[1]; \
01309 T *_th_pp = _th_p \
01310 + ((_subbox_lo[0] - _th_plo[0]) \
01311 + _th_plen[0]*( \
01312 (jR - _th_plo[1]) \
01313 + _th_plen[1]*( \
01314 (kR - _th_plo[2]) \
01315 + _n * _th_plen[2]))); \
01316 const T *_x_pp = _x_p \
01317 + ((_bx_lo[0] - _x_plo[0]) \
01318 + _x_plen[0]*( \
01319 (j##x##R - _x_plo[1]) \
01320 + _x_plen[1]*( \
01321 (k##x##R - _x_plo[2]) \
01322 + _n * _x_plen[2]))); \
01323 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01324 int iR = _i + _subbox_lo[0]; iR += 0; \
01325 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01326 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01327
01328 #define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01329 { \
01330 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01331 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01332 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01333 Box _subbox_(box()); \
01334 _subbox_ &= b; \
01335 assert((bx).sameSize(_subbox_)); \
01336 assert((by).sameSize(_subbox_)); \
01337 if(!_subbox_.isEmpty()) { \
01338 const int *_th_plo = loVect(); \
01339 const int *_th_plen = size(); \
01340 const int *_x_plo = (x).loVect(); \
01341 const int *_x_plen = (x).size(); \
01342 const int *_y_plo = (y).loVect(); \
01343 const int *_y_plen = (y).size(); \
01344 const int *_subbox_lo = _subbox_.loVect(); \
01345 const int *_subbox_len = _subbox_.size().getVect(); \
01346 const int *_bx_lo = (bx).loVect(); \
01347 const int *_by_lo = (by).loVect(); \
01348 T* _th_p = dataPtr(ns); \
01349 const T* _x_p = (x).dataPtr(nsx); \
01350 const T* _y_p = (y).dataPtr(nsy); \
01351 for(int _n = 0; _n < (nc); ++_n) { \
01352 int nR = _n + ns; nR += 0; \
01353 int n##x##R = _n + nsx; n##x##R += 0; \
01354 int n##y##R = _n + nsy; n##y##R += 0; \
01355 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01356 const int kR = _k + _subbox_lo[2]; \
01357 const int k##x##R = _k + _bx_lo[2]; \
01358 const int k##y##R = _k + _by_lo[2]; \
01359 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01360 const int jR = _j + _subbox_lo[1]; \
01361 const int j##x##R = _j + _bx_lo[1]; \
01362 const int j##y##R = _j + _by_lo[1]; \
01363 T *_th_pp = _th_p \
01364 + ((_subbox_lo[0] - _th_plo[0]) \
01365 + _th_plen[0]*( \
01366 (jR - _th_plo[1]) \
01367 + _th_plen[1]*( \
01368 (kR - _th_plo[2]) \
01369 + _n * _th_plen[2]))); \
01370 const T *_x_pp = _x_p \
01371 + ((_bx_lo[0] - _x_plo[0]) \
01372 + _x_plen[0]*( \
01373 (j##x##R - _x_plo[1]) \
01374 + _x_plen[1]*( \
01375 (k##x##R - _x_plo[2]) \
01376 + _n * _x_plen[2]))); \
01377 const T *_y_pp = _y_p \
01378 + ((_by_lo[0] - _y_plo[0]) \
01379 + _y_plen[0]*( \
01380 (j##y##R - _y_plo[1]) \
01381 + _y_plen[1]*( \
01382 (k##y##R - _y_plo[2]) \
01383 + _n * _y_plen[2]))); \
01384 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01385 int iR = _i + _subbox_lo[0]; iR += 0; \
01386 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01387 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
01388 T &thisR = * _th_pp; \
01389 const T & x##R = _x_pp[_i]; \
01390 const T & y##R = _y_pp[_i];
01391
01392 #define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ir) \
01393 { \
01394 assert((ir) >= 0 && (ir) < SpaceDim); \
01395 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01396 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01397 assert((x).contains(bx)); \
01398 assert((y).contains(by)); \
01399 assert((bx).sameSize(by)); \
01400 const int *_x_plo = (x).loVect(); \
01401 const int *_x_plen = (x).size(); \
01402 const int *_y_plo = (y).loVect(); \
01403 const int *_y_plen = (y).size(); \
01404 const int *_bx_lo = (bx).loVect(); \
01405 const int *_by_lo = (by).loVect(); \
01406 const int *_len = (bx).size().getVect(); \
01407 T* _x_p = (x).dataPtr(nsx); \
01408 const T* _y_p = (y).dataPtr(nsy); \
01409 for(int _n = 0; _n < (nc); ++_n) { \
01410 int n##x##R = _n + nsx; n##x##R += 0; \
01411 int n##y##R = _n + nsy; n##y##R += 0; \
01412 for(int _k = 0; _k < _len[2]; ++_k) { \
01413 const int k##x##R = _k + _bx_lo[2]; \
01414 const int krev##x##R = _len[2]-1-_k + _bx_lo[2]; \
01415 const int k##y##R = _k + _by_lo[2]; \
01416 for(int _j = 0; _j < _len[1]; ++_j) { \
01417 const int j##x##R = _j + _bx_lo[1]; \
01418 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
01419 const int j##y##R = _j + _by_lo[1]; \
01420 T *_x_pp; \
01421 int _ix = 0; \
01422 int _istrd = 1; \
01423 if (ir == 0) { \
01424 _x_pp = _x_p \
01425 + ((_bx_lo[0] - _x_plo[0]) + _len[0]-1 \
01426 + _x_plen[0]*( \
01427 (j##x##R - _x_plo[1]) \
01428 + _x_plen[1]*( \
01429 (k##x##R - _x_plo[2]) \
01430 + _n * _x_plen[2]))); \
01431 _istrd = -1; \
01432 } else if (ir == 1) { \
01433 _x_pp = _x_p \
01434 + ((_bx_lo[0] - _x_plo[0]) \
01435 + _x_plen[0]*( \
01436 (jrev##x##R - _x_plo[1]) \
01437 + _x_plen[1]*( \
01438 (k##x##R - _x_plo[2]) \
01439 + _n * _x_plen[2]))); \
01440 } else { \
01441 _x_pp = _x_p \
01442 + ((_bx_lo[0] - _x_plo[0]) \
01443 + _x_plen[0]*( \
01444 (j##x##R - _x_plo[1]) \
01445 + _x_plen[1]*( \
01446 (krev##x##R - _x_plo[2]) \
01447 + _n * _x_plen[2]))); \
01448 } \
01449 const T *_y_pp = _y_p \
01450 + ((_by_lo[0] - _y_plo[0]) \
01451 + _y_plen[0]*( \
01452 (j##y##R - _y_plo[1]) \
01453 + _y_plen[1]*( \
01454 (k##y##R - _y_plo[2]) \
01455 + _n * _y_plen[2]))); \
01456 for(int _i = 0; _i < _len[0]; ++_i, _ix += _istrd) { \
01457 T & x##R = _x_pp[_ix]; \
01458 const T & y##R = _y_pp[_i];
01459
01460 #define EndFor }}}}}
01461 #define EndForTX }}}}}}
01462 #define EndForPencil }}}}
01463
01464 #endif
01465
01470 #define ForAllXPencil(T,x) ForAllXBPencil(T,x,((x).box()),0,((x).nComp()))
01471
01477 #define ForAllX(T,x) ForAllXBNN(T,x,((x).box()),0,((x).nComp()))
01478
01482 #define ForAllXC(T,x) ForAllXCBNN(T,x,((x).box()),0,((x).nComp()))
01483
01488 #define ForAllXB(T,x,b) ForAllXBNN(T,x,(b),0,(x).nComp())
01489
01493 #define ForAllXBC(T,x,b) ForAllXCBNN(T,x,(b),0,(x).nComp())
01494
01500 #define ForAllThis(T) ForAllThisBNN(T,domain,0,nComp())
01501
01505 #define ForAllThisC(T) ForAllThisCBNN(T,domain,0,nComp())
01506
01511 #define ForAllThisB(T,b) ForAllThisBNN(T,(b),0,nComp())
01512
01516 #define ForAllThisCB(T,b) ForAllThisCBNN(T,(b),0,nComp())
01517
01522 #define ForAllThisNN(T,ns,nc) ForAllThisBNN(T,domain,ns,nc)
01523
01529 #define ForAllThisXC(T,x) ForAllThisBNNXC(T,domain,0,nComp(),x,0)
01530
01531 #ifdef DOXYGEN
01532 #undef CH_SPACEDIM
01533 #endif
01534
01535 #endif
01536