Go to the documentation of this file. 19 #ifndef LAST_BASEFABMACROS_H_SPACEDIM 20 #define LAST_BASEFABMACROS_H_SPACEDIM 0 22 #if CH_SPACEDIM != LAST_BASEFABMACROS_H_SPACEDIM 23 #undef LAST_BASEFABMACROS_H_SPACEDIM 39 #ifdef ForAllThisCPencil 40 # undef ForAllThisCPencil 41 # undef ForAllThisPencil 42 # undef ForAllXBPencil 43 # undef ForAllXBNNnoindx 47 # undef ForAllThisCBNN 48 # undef ForAllThisBNNXC 49 # undef ForAllThisCBNNXC 50 # undef ForAllThisBNNXCBN 51 # undef ForAllThisBNNXCBNYCBN 52 # undef ForAllRevXBNYCBNNN 59 # define ForAllThisCPencil ForAllThisCPencil1 60 # define ForAllThisPencil ForAllThisPencil1 61 # define ForAllXBPencil ForAllXBPencil1 62 # define ForAllXBNN ForAllXBNN1 63 # define ForAllXBNNnoindx ForAllXBNNnoindx1 64 # define ForAllXCBNN ForAllXCBNN1 65 # define ForAllThisBNN ForAllThisBNN1 66 # define ForAllThisCBNN ForAllThisCBNN1 67 # define ForAllThisBNNXC ForAllThisBNNXC1 68 # define ForAllThisCBNNXC ForAllThisCBNNXC1 69 # define ForAllThisBNNXCBN ForAllThisBNNXCBN1 70 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN1 71 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN1 72 # define EndFor EndFor1 73 # define EndForTX EndForTX1 74 # define EndForPencil EndForPencil1 75 # define LAST_BASEFABMACROS_H_SPACEDIM 1 78 # define ForAllThisCPencil ForAllThisCPencil2 79 # define ForAllThisPencil ForAllThisPencil2 80 # define ForAllXBPencil ForAllXBPencil2 81 # define ForAllXBNN ForAllXBNN2 82 # define ForAllXBNNnoindx ForAllXBNNnoindx2 83 # define ForAllXCBNN ForAllXCBNN2 84 # define ForAllThisBNN ForAllThisBNN2 85 # define ForAllThisCBNN ForAllThisCBNN2 86 # define ForAllThisBNNXC ForAllThisBNNXC2 87 # define ForAllThisCBNNXC ForAllThisCBNNXC2 88 # define ForAllThisBNNXCBN ForAllThisBNNXCBN2 89 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN2 90 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN2 91 # define EndFor EndFor2 92 # define EndForTX EndForTX2 93 # define EndForPencil EndForPencil2 94 # define LAST_BASEFABMACROS_H_SPACEDIM 2 97 # define ForAllThisCPencil ForAllThisCPencil3 98 # define ForAllThisPencil ForAllThisPencil3 99 # define ForAllXBPencil ForAllXBPencil3 100 # define ForAllXBNN ForAllXBNN3 101 # define ForAllXBNNnoindx ForAllXBNNnoindx3 102 # define ForAllXCBNN ForAllXCBNN3 103 # define ForAllThisBNN ForAllThisBNN3 104 # define ForAllThisCBNN ForAllThisCBNN3 105 # define ForAllThisBNNXC ForAllThisBNNXC3 106 # define ForAllThisCBNNXC ForAllThisCBNNXC3 107 # define ForAllThisBNNXCBN ForAllThisBNNXCBN3 108 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN3 109 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN3 110 # define EndFor EndFor3 111 # define EndForTX EndForTX3 112 # define EndForPencil EndForPencil3 113 # define LAST_BASEFABMACROS_H_SPACEDIM 3 117 # define ForAllThisCPencil ForAllThisCPencilHiDim 118 # define ForAllThisPencil ForAllThisPencilHiDim 119 # define ForAllXBPencil ForAllXBPencilHiDim 120 # define ForAllXBNN ForAllXBNNHiDim 121 # define ForAllXBNNnoindx ForAllXBNNnoindxHiDim 122 # define ForAllXCBNN ForAllXCBNNHiDim 123 # define ForAllThisBNN ForAllThisBNNHiDim 124 # define ForAllThisCBNN ForAllThisCBNNHiDim 125 # define ForAllThisBNNXC ForAllThisBNNXCHiDim 126 # define ForAllThisCBNNXC ForAllThisCBNNXCHiDim 127 # define ForAllThisBNNXCBN ForAllThisBNNXCBNHiDim 128 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBNHiDim 129 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNNHiDim 130 # define EndFor EndForHiDim 131 # define EndForTX EndForTXHiDim 132 # define EndForPencil EndForPencilHiDim 133 # define LAST_BASEFABMACROS_H_SPACEDIM HiDim 136 #if (CH_SPACEDIM == 1) 184 #define ForAllThisPencil1(T,b,ns,nc) \ 186 CH_assert(contains(b)); \ 187 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 188 const int *_th_plo = this->loVect(); \ 189 const IntVect _th_plen = this->size(); \ 190 const int *_b_lo = (b).loVect(); \ 191 const IntVect _b_len = (b).size(); \ 192 T* _th_p = this->m_dptr; \ 193 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 195 const int nR = _n; (int&)nR += 0; \ 197 + ((_b_lo[0] - _th_plo[0]) \ 198 + _n * _th_plen[0]); \ 199 T &thisR = * _th_pp; \ 200 const int thisLen = _b_len[0]; \ 206 #define ForAllXBPencil1(T,x,b,ns,nc) \ 208 CH_assert(x.contains(b)); \ 209 CH_assert((ns) >= 0 && (ns) + (nc) <= x.nComp()); \ 210 const int *_th_plo = x.loVect(); \ 211 const IntVect _th_plen = x.size(); \ 212 const int *_b_lo = (b).loVect(); \ 213 const IntVect _b_len = (b).size(); \ 214 T* _th_p = x.dataPtr(); \ 215 for (int nR = (ns); nR < (ns)+(nc); ++nR) \ 218 + ((_b_lo[0] - _th_plo[0]) \ 219 + nR * _th_plen[0]); \ 220 const int thisLen = _b_len[0]; 243 #define ForAllThisCPencil1(T,b,ns,nc) \ 245 CH_assert(this->contains(b)); \ 246 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 247 const int *_th_plo = this->loVect(); \ 248 const IntVect _th_plen = this->size(); \ 249 const int *_b_lo = (b).loVect(); \ 250 const IntVect _b_len = (b).size(); \ 251 const T* _th_p = this->m_dptr; \ 252 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 254 int nR = _n; nR += 0; \ 255 const T *_th_pp = _th_p \ 256 + ((_b_lo[0] - _th_plo[0]) \ 257 + _n * _th_plen[0]); \ 258 const T &thisR = * _th_pp; \ 259 const int thisLen = _b_len[0]; 286 #define ForAllXBNN1(T,x,b,ns,nc) \ 288 CH_assert(x.contains(b)); \ 289 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 290 const int *_x_plo = (x).loVect(); \ 291 const IntVect _x_plen = (x).size(); \ 292 const int *_b_lo = (b).loVect(); \ 293 const IntVect _b_len = (b).size(); \ 294 T* _x_p = (x) .dataPtr(); \ 295 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 297 const int nR = _n; (int&)nR += 0; \ 299 + ((_b_lo[0] - _x_plo[0]) \ 300 + _n * _x_plen[0]); \ 301 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \ 303 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 312 #define ForAllXBNNnoindx1(T,x,b,ns,nc) \ 314 CH_assert(x.contains(b)); \ 315 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 316 const int *_x_plo = (x).loVect(); \ 317 const IntVect _x_plen = (x).size(); \ 318 const int *_b_lo = (b).loVect(); \ 319 const IntVect _b_len = (b).size(); \ 320 T* _x_p = (x) .dataPtr(); \ 321 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 324 + ((_b_lo[0] - _x_plo[0]) \ 325 + _n * _x_plen[0]); \ 326 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \ 351 #define ForAllXCBNN1(T,x,b,ns,nc) \ 353 CH_assert(x.contains(b)); \ 354 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 355 const int *_x_plo = (x).loVect(); \ 356 const IntVect _x_plen = (x).size(); \ 357 const int *_b_lo = (b).loVect(); \ 358 const IntVect _b_len = (b).size(); \ 359 const T* _x_p = (x).dataPtr(); \ 360 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 362 const int nR = _n; (int&)nR += 0; \ 363 const T *_x_pp = _x_p \ 364 + ((_b_lo[0] - _x_plo[0]) \ 365 + _n * _x_plen[0]); \ 366 for (int _i = 0; _i < _b_len[0]; ++_i) \ 368 const int iR = _i + _b_lo[0]; (int&) iR += 0; \ 369 const T & x##R = _x_pp[_i]; 409 #define ForAllThisBNN1(T,b,ns,nc) \ 411 CH_assert(this->contains(b)); \ 412 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 413 const int *_th_plo = this->loVect(); \ 414 const IntVect _th_plen = this->size(); \ 415 const int *_b_lo = (b).loVect(); \ 416 const IntVect _b_len = (b).size(); \ 417 T* _th_p = this->m_dptr; \ 418 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 420 int nR = _n; nR += 0; \ 422 + ((_b_lo[0] - _th_plo[0]) \ 423 + _n * _th_plen[0]); \ 424 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) \ 426 int iR = _i + _b_lo[0]; iR += 0; \ 450 #define ForAllThisCBNN1(T,b,ns,nc) \ 452 CH_assert(this->contains(b)); \ 453 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 454 const int *_th_plo = this->loVect(); \ 455 const IntVect _th_plen = this->size(); \ 456 const int *_b_lo = (b).loVect(); \ 457 const IntVect _b_len = (b).size(); \ 458 const T* _th_p = this->m_dptr; \ 459 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 461 const int nR = _n; (int&)nR += 0; \ 462 const T *_th_pp = _th_p \ 463 + ((_b_lo[0] - _th_plo[0]) \ 464 + _n * _th_plen[0]); \ 465 for (int _i = 0; _i < _b_len[0]; ++_i) \ 467 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 468 const T &thisR = _th_pp[_i]; 495 #define ForAllThisBNNXC1(T,b,ns,nc,x,nss) \ 497 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 498 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 499 Box _subbox_((x).box()); \ 500 _subbox_ &= this->box(); \ 502 if (!_subbox_.isEmpty()) \ 504 const int *_th_plo = this->loVect(); \ 505 const IntVect _th_plen = this->size(); \ 506 const int *_x_plo = (x).loVect(); \ 507 const IntVect _x_plen = (x).size(); \ 508 const int *_subbox_lo = _subbox_.loVect(); \ 509 const IntVect _subbox_len = _subbox_.size(); \ 510 T* _th_p = dataPtr(ns); \ 511 const T* _x_p = (x).dataPtr(nss); \ 512 for (int _n = 0; _n < (nc); ++_n) \ 514 int nR = _n; nR += 0; \ 516 + ((_subbox_lo[0] - _th_plo[0]) \ 517 + _n * _th_plen[0]); \ 518 const T *_x_pp = _x_p \ 519 + ((_subbox_lo[0] - _x_plo[0]) \ 520 + _n * _x_plen[0]); \ 521 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 523 int iR = _i + _subbox_lo[0]; iR += 0; \ 524 T &thisR = * _th_pp; \ 525 const T & x##R = _x_pp[_i]; 527 #define ForAllThisCBNNXC1(T,b,ns,nc,x,nss) \ 529 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 530 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 531 Box _subbox_((x).box()); \ 532 _subbox_ &= this->box(); \ 534 if (!_subbox_.isEmpty()) \ 536 const int *_th_plo = this->loVect(); \ 537 const IntVect _th_plen = this->size(); \ 538 const int *_x_plo = (x).loVect(); \ 539 const IntVect _x_plen = (x).size(); \ 540 const int *_subbox_lo = _subbox_.loVect(); \ 541 const IntVect _subbox_len = _subbox_.size(); \ 542 const T* _th_p = this->dataPtr(ns); \ 543 const T* _x_p = (x).dataPtr(nss); \ 544 for (int _n = 0; _n < (nc); ++_n) \ 546 int nR = _n; nR += 0; \ 547 const T *_th_pp = _th_p \ 548 + ((_subbox_lo[0] - _th_plo[0]) \ 549 + _n * _th_plen[0]); \ 550 const T *_x_pp = _x_p \ 551 + ((_subbox_lo[0] - _x_plo[0]) \ 552 + _n * _x_plen[0]); \ 553 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 555 int iR = _i + _subbox_lo[0]; iR += 0; \ 556 const T &thisR = * _th_pp; \ 557 const T & x##R = _x_pp[_i]; 585 #define ForAllThisBNNXCBN1(T,b,ns,nc,x,bx,nss) \ 587 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 588 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 589 CH_assert(bx.sameSize((b))); \ 590 if (!((b).isEmpty())) \ 592 const int *_th_plo = this->loVect(); \ 593 const IntVect _th_plen = this->size(); \ 594 const int *_x_plo = (x).loVect(); \ 595 const IntVect _x_plen = (x).size(); \ 596 const int *_subbox_lo = (b).loVect(); \ 597 const IntVect _subbox_len = (b).size(); \ 598 const int *_bx_lo = (bx).loVect(); \ 599 T* _th_p = this->dataPtr(ns); \ 600 const T* _x_p = (x).dataPtr(nss); \ 601 for (int _n = 0; _n < (nc); ++_n) \ 603 int nR = _n + ns; nR += 0; \ 604 int n##x##R = _n + nss; n##x##R += 0; \ 606 + ((_subbox_lo[0] - _th_plo[0]) \ 607 + _n * _th_plen[0]); \ 608 const T *_x_pp = _x_p \ 609 + ((_bx_lo[0] - _x_plo[0]) \ 610 + _n * _x_plen[0]); \ 611 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 613 int iR = _i + _subbox_lo[0]; iR += 0; \ 614 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \ 615 T &thisR = * _th_pp; \ 616 const T & x##R = _x_pp[_i]; 647 #define ForAllThisBNNXCBNYCBN1(T,b,ns,nc,x,bx,nsx,y,by,nsy) \ 649 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 650 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 651 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 652 Box _subbox_ = this->box(); \ 654 CH_assert((bx).sameSize(_subbox_)); \ 655 CH_assert((by).sameSize(_subbox_)); \ 656 if (!_subbox_.isEmpty()) \ 658 const int *_th_plo = this->loVect(); \ 659 const IntVect _th_plen = this->size(); \ 660 const int *_x_plo = (x).loVect(); \ 661 const IntVect _x_plen = (x).size(); \ 662 const int *_y_plo = (y).loVect(); \ 663 const IntVect _y_plen = (y).size(); \ 664 const int *_subbox_lo = _subbox_.loVect(); \ 665 const IntVect _subbox_len = _subbox_.size(); \ 666 const int *_bx_lo = (bx).loVect(); \ 667 const int *_by_lo = (by).loVect(); \ 668 T* _th_p = this->dataPtr(ns); \ 669 const T* _x_p = (x).dataPtr(nsx); \ 670 const T* _y_p = (y).dataPtr(nsy); \ 671 for (int _n = 0; _n < (nc); ++_n) \ 673 int nR = _n + ns; nR += 0; \ 674 int n##x##R = _n + nsx; n##x##R += 0; \ 675 int n##y##R = _n + nsy; n##y##R += 0; \ 677 + ((_subbox_lo[0] - _th_plo[0]) \ 678 + _n * _th_plen[0]); \ 679 const T *_x_pp = _x_p \ 680 + ((_bx_lo[0] - _x_plo[0]) \ 681 + _n * _x_plen[0]); \ 682 const T *_y_pp = _y_p \ 683 + ((_by_lo[0] - _y_plo[0]) \ 684 + _n * _y_plen[0]); \ 685 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 687 int iR = _i + _subbox_lo[0]; iR += 0; \ 688 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \ 689 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \ 690 T &thisR = * _th_pp; \ 691 const T & x##R = _x_pp[_i]; \ 692 const T & y##R = _y_pp[_i]; 694 #define ForAllRevXBNYCBNNN1(T,x,bx,nsx,y,by,nsy,nc,ri) \ 696 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 697 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 698 CH_assert((x).contains(bx)); \ 699 CH_assert((y).contains(by)); \ 700 CH_assert((bx).sameSize(by)); \ 701 const int *_x_plo = (x).loVect(); \ 702 const IntVect _x_plen = (x).size(); \ 703 const int *_y_plo = (y).loVect(); \ 704 const IntVect _y_plen = (y).size(); \ 705 const IntVect _len = (bx).size(); \ 706 const int *_bx_lo = (bx).loVect(); \ 707 const int *_by_lo = (by).loVect(); \ 708 T* _x_p = (x).dataPtr(nsx); \ 709 const T* _y_p = (y).dataPtr(nsy); \ 710 for (int _n = 0; _n < (nc); ++_n) \ 712 int n##x##R = _n + nsx; n##x##R += 0; \ 713 int n##y##R = _n + nsy; n##y##R += 0; \ 716 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \ 717 + _n * _x_plen[0]); \ 718 const T *_y_pp = _y_p \ 719 + ((_by_lo[0] - _y_plo[0]) \ 720 + _n * _y_plen[0]); \ 721 for (int _i = 0; _i < _len[0]; ++_i, --_ix) \ 723 T & x##R = _x_pp[_ix]; \ 724 const T & y##R = _y_pp[_i]; 748 #define EndForPencil1 \ 752 #elif (CH_SPACEDIM == 2) 754 #define ForAllThisCPencil2(T,b,ns,nc) \ 756 CH_assert(contains(b)); \ 757 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 758 const int *_th_plo = this->loVect(); \ 759 const IntVect _th_plen = this->size(); \ 760 const int *_b_lo = (b).loVect(); \ 761 const IntVect _b_len = (b).size(); \ 762 const T* _th_p = this->m_dptr; \ 763 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 765 int nR = _n; nR += 0; \ 766 for (int _j = 0; _j < _b_len[1]; ++_j) \ 768 const int jR = _j + _b_lo[1]; \ 769 const T *_th_pp = _th_p \ 770 + ((_b_lo[0] - _th_plo[0]) \ 773 + _n * _th_plen[1])); \ 774 const T &thisR = * _th_pp; \ 775 const int thisLen = _b_len[0]; 777 #define ForAllThisPencil2(T,b,ns,nc) \ 779 CH_assert(this->contains(b)); \ 780 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 781 const int *_th_plo = this->loVect(); \ 782 const IntVect _th_plen = this->size(); \ 783 const int *_b_lo = (b).loVect(); \ 784 const IntVect _b_len = (b).size(); \ 785 T* _th_p = this->m_dptr; \ 786 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 788 const int nR = _n; (int&)nR += 0; \ 789 for (int _j = 0; _j < _b_len[1]; ++_j) \ 791 const int jR = _j + _b_lo[1]; (int&)jR += 0; \ 793 + ((_b_lo[0] - _th_plo[0]) \ 796 + _n * _th_plen[1])); \ 797 T &thisR = * _th_pp; \ 798 const int thisLen = _b_len[0]; \ 800 #define ForAllXBPencil2(T,x,b,ns,nc) \ 802 CH_assert((x).contains(b)); \ 803 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 804 const int *_th_plo = (x).loVect(); \ 805 const IntVect _th_plen =(x).size(); \ 806 const int *_b_lo = (b).loVect(); \ 807 const IntVect _b_len = (b).size(); \ 808 T* _th_p = (x) .dataPtr(); \ 809 for (int nR = (ns); nR < (ns)+(nc); ++nR) \ 811 for (int _j = 0; _j < _b_len[1]; ++_j) \ 813 const int jR = _j + _b_lo[1]; (int&)jR += 0; \ 815 + ((_b_lo[0] - _th_plo[0]) \ 818 + nR * _th_plen[1])); \ 819 const int thisLen = _b_len[0]; \ 821 #define ForAllXBNN2(T,x,b,ns,nc) \ 823 CH_assert((x).contains(b)); \ 824 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 825 const int *_x_plo = (x).loVect(); \ 826 const IntVect _x_plen = (x).size(); \ 827 const int *_b_lo = (b).loVect(); \ 828 const IntVect _b_len = (b).size(); \ 829 T* _x_p = (x) .dataPtr(); \ 830 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 832 const int nR = _n; (int&)nR += 0; \ 833 for (int _j = 0; _j < _b_len[1]; ++_j) \ 835 const int jR = _j + _b_lo[1]; (int&)jR += 0; \ 837 + ((_b_lo[0] - _x_plo[0]) \ 840 + _n * _x_plen[1])); \ 841 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \ 843 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 846 #define ForAllXBNNnoindx2(T,x,b,ns,nc) \ 848 CH_assert((x).contains(b)); \ 849 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 850 const int *_x_plo = (x).loVect(); \ 851 const IntVect _x_plen = (x).size(); \ 852 const int *_b_lo = (b).loVect(); \ 853 const IntVect _b_len = (b).size(); \ 854 T* _x_p = (x) .dataPtr(); \ 855 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 857 for (int _j = 0; _j < _b_len[1]; ++_j) \ 859 const int jR = _j + _b_lo[1]; \ 861 + ((_b_lo[0] - _x_plo[0]) \ 864 + _n * _x_plen[1])); \ 865 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \ 869 #define ForAllXCBNN2(T,x,b,ns,nc) \ 871 CH_assert(x.contains(b)); \ 872 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 873 const int *_x_plo = (x).loVect(); \ 874 const IntVect _x_plen = (x).size(); \ 875 const int *_b_lo = (b).loVect(); \ 876 const IntVect _b_len = (b).size(); \ 877 const T* _x_p = (x).dataPtr(); \ 878 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 880 const int nR = _n; (int&)nR += 0; \ 881 for (int _j = 0; _j < _b_len[1]; ++_j) \ 883 const int jR = _j + _b_lo[1]; \ 884 const T *_x_pp = _x_p \ 885 + ((_b_lo[0] - _x_plo[0]) \ 888 + _n * _x_plen[1])); \ 889 for (int _i = 0; _i < _b_len[0]; ++_i) \ 891 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 892 const T & x##R = _x_pp[_i]; 894 #define ForAllThisBNN2(T,b,ns,nc) \ 896 CH_assert(this->contains(b)); \ 897 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 898 const int *_th_plo = this->loVect(); \ 899 const IntVect _th_plen = this->size(); \ 900 const int *_b_lo = (b).loVect(); \ 901 const IntVect _b_len = (b).size(); \ 902 T* _th_p = this->m_dptr; \ 903 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 905 int nR = _n; nR += 0; \ 906 for (int _j = 0; _j < _b_len[1]; ++_j) \ 908 const int jR = _j + _b_lo[1]; \ 910 + ((_b_lo[0] - _th_plo[0]) \ 913 + _n * _th_plen[1])); \ 914 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) \ 916 int iR = _i + _b_lo[0]; iR += 0; \ 919 #define ForAllThisCBNN2(T,b,ns,nc) \ 921 CH_assert(this->contains(b)); \ 922 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 923 const int *_th_plo = this->loVect(); \ 924 const IntVect _th_plen = this->size(); \ 925 const int *_b_lo = (b).loVect(); \ 926 const IntVect _b_len = (b).size(); \ 927 const T* _th_p = this->m_dptr; \ 928 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 930 const int nR = _n; (int&)nR += 0; \ 931 for (int _j = 0; _j < _b_len[1]; ++_j) \ 933 const int jR = _j + _b_lo[1]; (int&)jR+=0;; \ 934 const T *_th_pp = _th_p \ 935 + ((_b_lo[0] - _th_plo[0]) \ 937 (_j + _b_lo[1] - _th_plo[1]) \ 938 + _n * _th_plen[1])); \ 939 for (int _i = 0; _i < _b_len[0]; ++_i) \ 941 const int iR = _i + _b_lo[0]; (int&)iR +=0; \ 942 const T &thisR = _th_pp[_i]; 944 #define ForAllThisBNNXC2(T,b,ns,nc,x,nss) \ 946 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 947 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 948 Box _subbox_((x).box()); \ 949 _subbox_ &= this->box(); \ 951 if (!_subbox_.isEmpty()) \ 953 const int *_th_plo = this->loVect(); \ 954 const IntVect _th_plen = this->size(); \ 955 const int *_x_plo = (x).loVect(); \ 956 const IntVect _x_plen = (x).size(); \ 957 const int *_subbox_lo = _subbox_.loVect(); \ 958 const IntVect _subbox_len = _subbox_.size(); \ 959 T* _th_p = this->dataPtr(ns); \ 960 const T* _x_p = (x).dataPtr(nss); \ 961 for (int _n = 0; _n < (nc); ++_n) \ 963 int nR = _n; nR += 0; \ 964 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 966 const int jR = _j + _subbox_lo[1]; \ 968 + ((_subbox_lo[0] - _th_plo[0]) \ 971 + _n * _th_plen[1])); \ 972 const T *_x_pp = _x_p \ 973 + ((_subbox_lo[0] - _x_plo[0]) \ 976 + _n * _x_plen[1])); \ 977 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 979 int iR = _i + _subbox_lo[0]; iR += 0; \ 980 T &thisR = * _th_pp; \ 981 const T & x##R = _x_pp[_i]; 983 #define ForAllThisCBNNXC2(T,b,ns,nc,x,nss) \ 985 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 986 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 987 Box _subbox_((x).box()); \ 988 _subbox_ &= this->box(); \ 990 if (!_subbox_.isEmpty()) \ 992 const int *_th_plo = this->loVect(); \ 993 const IntVect _th_plen = this->size(); \ 994 const int *_x_plo = (x).loVect(); \ 995 const IntVect _x_plen = (x).size(); \ 996 const int *_subbox_lo = _subbox_.loVect(); \ 997 const IntVect _subbox_len = _subbox_.size(); \ 998 const T* _th_p = this->dataPtr(ns); \ 999 const T* _x_p = (x).dataPtr(nss); \ 1000 for (int _n = 0; _n < (nc); ++_n) \ 1002 int nR = _n; nR += 0; \ 1003 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1005 const int jR = _j + _subbox_lo[1]; \ 1006 const T *_th_pp = _th_p \ 1007 + ((_subbox_lo[0] - _th_plo[0]) \ 1010 + _n * _th_plen[1])); \ 1011 const T *_x_pp = _x_p \ 1012 + ((_subbox_lo[0] - _x_plo[0]) \ 1015 + _n * _x_plen[1])); \ 1016 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 1018 int iR = _i + _subbox_lo[0]; iR += 0; \ 1019 const T &thisR = * _th_pp; \ 1020 const T & x##R = _x_pp[_i]; 1022 #define ForAllThisBNNXCBN2(T,b,ns,nc,x,bx,nss) \ 1024 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1025 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1026 CH_assert(bx.sameSize((b))); \ 1027 if (!((b).isEmpty())) \ 1029 const int *_th_plo = this->loVect(); \ 1030 const IntVect _th_plen = this->size(); \ 1031 const int *_x_plo = (x).loVect(); \ 1032 const IntVect _x_plen = (x).size(); \ 1033 const int *_subbox_lo = (b).loVect(); \ 1034 const IntVect _subbox_len = (b).size(); \ 1035 const int *_bx_lo = (bx).loVect(); \ 1036 T* _th_p = this->dataPtr(ns); \ 1037 int nR = ns; int n##x##R = nss; \ 1038 const T* _x_p = (x).dataPtr(nss); \ 1039 for (int _n = 0; _n < (nc); ++_n, ++nR, ++n##x##R ) \ 1041 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1043 const int jR = _j + _subbox_lo[1]; \ 1044 const int j##x##R = _j + _bx_lo[1]; \ 1046 + ((_subbox_lo[0] - _th_plo[0]) \ 1049 + _n * _th_plen[1])); \ 1050 const T *_x_pp = _x_p \ 1051 + ((_bx_lo[0] - _x_plo[0]) \ 1053 (j##x##R - _x_plo[1]) \ 1054 + _n * _x_plen[1])); \ 1055 int iR = _subbox_lo[0]; int i##x##R = _bx_lo[0]; \ 1056 for (int _i = 0; _i < _subbox_len[0]; \ 1057 ++_i, ++_th_pp, ++_x_pp, ++iR, ++i##x##R) \ 1059 T &thisR = * _th_pp; \ 1060 const T & x##R = * _x_pp; 1062 #define ForAllThisBNNXCBNYCBN2(T,b,ns,nc,x,bx,nsx,y,by,nsy) \ 1064 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1065 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 1066 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 1067 Box _subbox_ = this->box(); \ 1069 CH_assert((bx).sameSize(_subbox_)); \ 1070 CH_assert((by).sameSize(_subbox_)); \ 1071 if (!_subbox_.isEmpty()) \ 1073 const int *_th_plo = this->loVect(); \ 1074 const IntVect _th_plen = this->size(); \ 1075 const int *_x_plo = (x).loVect(); \ 1076 const IntVect _x_plen = (x).size(); \ 1077 const int *_y_plo = (y).loVect(); \ 1078 const IntVect _y_plen = (y).size(); \ 1079 const int *_subbox_lo = _subbox_.loVect(); \ 1080 const IntVect _subbox_len = _subbox_.size(); \ 1081 const int *_bx_lo = (bx).loVect(); \ 1082 const int *_by_lo = (by).loVect(); \ 1083 T* _th_p = this->dataPtr(ns); \ 1084 const T* _x_p = (x).dataPtr(nsx); \ 1085 const T* _y_p = (y).dataPtr(nsy); \ 1086 for (int _n = 0; _n < (nc); ++_n) \ 1088 int nR = _n + ns; nR += 0; \ 1089 int n##x##R = _n + nsx; n##x##R += 0; \ 1090 int n##y##R = _n + nsy; n##y##R += 0; \ 1091 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1093 const int jR = _j + _subbox_lo[1]; \ 1094 const int j##x##R = _j + _bx_lo[1]; \ 1095 const int j##y##R = _j + _by_lo[1]; \ 1097 + ((_subbox_lo[0] - _th_plo[0]) \ 1100 + _n * _th_plen[1])); \ 1101 const T *_x_pp = _x_p \ 1102 + ((_bx_lo[0] - _x_plo[0]) \ 1104 (j##x##R - _x_plo[1]) \ 1105 + _n * _x_plen[1])); \ 1106 const T *_y_pp = _y_p \ 1107 + ((_by_lo[0] - _y_plo[0]) \ 1109 (j##y##R - _y_plo[1]) \ 1110 + _n * _y_plen[1])); \ 1111 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \ 1113 int iR = _i + _subbox_lo[0]; iR += 0; \ 1114 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \ 1115 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \ 1116 T &thisR = * _th_pp; \ 1117 const T & x##R = _x_pp[_i]; \ 1118 const T & y##R = _y_pp[_i]; 1120 #define ForAllRevXBNYCBNNN2(T,x,bx,nsx,y,by,nsy,nc,ir) \ 1122 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 1123 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 1124 CH_assert((ir) >= 0 && (ir) < SpaceDim); \ 1125 CH_assert((x).contains(bx)); \ 1126 CH_assert((y).contains(by)); \ 1127 CH_assert((bx).sameSize(by)); \ 1128 const int *_x_plo = (x).loVect(); \ 1129 const IntVect _x_plen = (x).size(); \ 1130 const int *_y_plo = (y).loVect(); \ 1131 const int *_y_plen = (y).size(); \ 1132 const int *_bx_lo = (bx).loVect(); \ 1133 const int *_by_lo = (by).loVect(); \ 1134 const IntVect _len = (bx).size(); \ 1135 T* _x_p = (x).dataPtr(nsx); \ 1136 const T* _y_p = (y).dataPtr(nsy); \ 1137 for (int _n = 0; _n < (nc); ++_n) \ 1139 int n##x##R = _n + nsx; n##x##R += 0; \ 1140 int n##y##R = _n + nsy; n##y##R += 0; \ 1141 for (int _j = 0; _j < _len[1]; ++_j) \ 1143 const int j##x##R = _j + _bx_lo[1]; \ 1144 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \ 1145 const int j##y##R = _j + _by_lo[1]; \ 1152 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \ 1154 (j##x##R - _x_plo[1]) \ 1155 + _n * _x_plen[1])); \ 1161 + ((_bx_lo[0] - _x_plo[0]) \ 1163 (jrev##x##R - _x_plo[1]) \ 1164 + _n * _x_plen[1])); \ 1167 const T *_y_pp = _y_p \ 1168 + ((_by_lo[0] - _y_plo[0]) \ 1170 (j##y##R - _y_plo[1]) \ 1171 + _n * _y_plen[1])); \ 1172 int _x_rev = _len[0]-1; _x_rev += 0; \ 1173 for (int _i = 0; _i < _len[0]; ++_i, _ix+=_istrd) \ 1175 T & x##R = _x_pp[_ix]; \ 1176 const T & y##R = _y_pp[_i]; 1191 #define EndForPencil2 \ 1196 #elif (CH_SPACEDIM == 3) 1198 #define ForAllThisCPencil3(T,b,ns,nc) \ 1200 CH_assert(this->contains(b)); \ 1201 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1202 const int *_th_plo = this->loVect(); \ 1203 const IntVect _th_plen = this->size(); \ 1204 const int *_b_lo = (b).loVect(); \ 1205 const IntVect _b_len = (b).size(); \ 1206 const T* _th_p = this->m_dptr; \ 1207 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1209 int nR = _n; nR += 0; \ 1210 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1212 const int kR = _k + _b_lo[2]; \ 1213 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1215 const int jR = _j + _b_lo[1]; \ 1216 const T *_th_pp = _th_p \ 1217 + ((_b_lo[0] - _th_plo[0]) \ 1222 + _n * _th_plen[2]))); \ 1223 const T &thisR = * _th_pp; \ 1224 const int thisLen = _b_len[0]; 1226 #define ForAllThisPencil3(T,b,ns,nc) \ 1228 CH_assert(this->contains(b)); \ 1229 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1230 const int *_th_plo = this->loVect(); \ 1231 const IntVect _th_plen = this->size(); \ 1232 const int *_b_lo = (b).loVect(); \ 1233 const IntVect _b_len = (b).size(); \ 1234 T* _th_p = this->m_dptr; \ 1235 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1237 const int nR = _n; (int&)nR += 0; \ 1238 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1240 const int kR = _k + _b_lo[2]; \ 1241 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1243 const int jR = _j + _b_lo[1]; \ 1245 + ((_b_lo[0] - _th_plo[0]) \ 1250 + _n * _th_plen[2]))); \ 1251 T &thisR = * _th_pp; \ 1252 const int thisLen = _b_len[0]; \ 1254 #define ForAllXBPencil3(T,x,b,ns,nc) \ 1256 CH_assert((x).contains(b)); \ 1257 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1258 const int *_th_plo = (x).loVect(); \ 1259 const IntVect _th_plen = (x).size(); \ 1260 const int *_b_lo = (b).loVect(); \ 1261 const IntVect _b_len = (b).size(); \ 1262 T* _th_p = (x) .dataPtr(); \ 1263 for (int nR = (ns); nR < (ns)+(nc); ++nR) \ 1265 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1267 const int kR = _k + _b_lo[2]; \ 1268 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1270 const int jR = _j + _b_lo[1]; \ 1272 + ((_b_lo[0] - _th_plo[0]) \ 1277 + nR * _th_plen[2]))); \ 1278 const int thisLen = _b_len[0]; 1280 #define ForAllXBNN3(T,x,b,ns,nc) \ 1282 CH_assert(x.contains(b)); \ 1283 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1284 const int *_x_plo = (x).loVect(); \ 1285 const IntVect _x_plen = (x).size(); \ 1286 const int *_b_lo = (b).loVect(); \ 1287 const IntVect _b_len = (b).size(); \ 1288 T* _x_p = (x) .dataPtr(); \ 1289 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1291 const int nR = _n; (int&)nR += 0; \ 1292 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1294 const int kR = _k + _b_lo[2]; \ 1295 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1297 const int jR = _j + _b_lo[1]; \ 1299 + ((_b_lo[0] - _x_plo[0]) \ 1304 + _n * _x_plen[2]))); \ 1305 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \ 1307 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 1310 #define ForAllXBNNnoindx3(T,x,b,ns,nc) \ 1312 CH_assert(x.contains(b)); \ 1313 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1314 const int *_x_plo = (x).loVect(); \ 1315 const IntVect _x_plen = (x).size(); \ 1316 const int *_b_lo = (b).loVect(); \ 1317 const IntVect _b_len = (b).size(); \ 1318 T* _x_p = (x) .dataPtr(); \ 1319 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1321 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1323 const int kR = _k + _b_lo[2]; \ 1324 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1326 const int jR = _j + _b_lo[1]; \ 1328 + ((_b_lo[0] - _x_plo[0]) \ 1333 + _n * _x_plen[2]))); \ 1334 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \ 1338 #define ForAllXCBNN3(T,x,b,ns,nc) \ 1340 CH_assert(x.contains(b)); \ 1341 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1342 const int *_x_plo = (x).loVect(); \ 1343 const IntVect _x_plen = (x).size(); \ 1344 const int *_b_lo = (b).loVect(); \ 1345 const IntVect _b_len = (b).size(); \ 1346 const T* _x_p = (x).dataPtr(); \ 1347 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1349 const int nR = _n; (int&)nR += 0; \ 1350 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1352 const int kR = _k + _b_lo[2]; \ 1353 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1355 const int jR = _j + _b_lo[1]; \ 1356 const T *_x_pp = _x_p \ 1357 + ((_b_lo[0] - _x_plo[0]) \ 1362 + _n * _x_plen[2]))); \ 1363 for (int _i = 0; _i < _b_len[0]; ++_i) \ 1365 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 1366 const T & x##R = _x_pp[_i]; 1368 #define ForAllThisBNN3(T,b,ns,nc) \ 1370 CH_assert(this->contains(b)); \ 1371 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1372 const int *_th_plo = this->loVect(); \ 1373 const IntVect _th_plen = this->size(); \ 1374 const int *_b_lo = (b).loVect(); \ 1375 const IntVect _b_len = (b).size(); \ 1376 T* _th_p = this->m_dptr; \ 1377 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1379 int nR = _n; nR += 0; \ 1380 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1382 const int kR = _k + _b_lo[2]; \ 1383 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1385 const int jR = _j + _b_lo[1]; \ 1387 + ((_b_lo[0] - _th_plo[0]) \ 1392 + _n * _th_plen[2]))); \ 1393 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) \ 1395 int iR = _i + _b_lo[0]; iR += 0; \ 1396 T &thisR = * _th_pp; 1398 #define ForAllThisCBNN3(T,b,ns,nc) \ 1400 CH_assert(this->contains(b)); \ 1401 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1402 const int *_th_plo = this->loVect(); \ 1403 const IntVect _th_plen = this->size(); \ 1404 const int *_b_lo = (b).loVect(); \ 1405 const IntVect _b_len = (b).size(); \ 1406 const T* _th_p = this->m_dptr; \ 1407 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1409 const int nR = _n; (int&)nR += 0; \ 1410 for (int _k = 0; _k < _b_len[2]; ++_k) \ 1412 const int kR = _k + _b_lo[2]; \ 1413 for (int _j = 0; _j < _b_len[1]; ++_j) \ 1415 const int jR = _j + _b_lo[1]; \ 1416 const T *_th_pp = _th_p \ 1417 + ((_b_lo[0] - _th_plo[0]) \ 1422 + _n * _th_plen[2]))); \ 1423 for (int _i = 0; _i < _b_len[0]; ++_i) \ 1425 const int iR = _i + _b_lo[0]; (int&)iR += 0; \ 1426 const T &thisR = _th_pp[_i]; 1428 #define ForAllThisBNNXC3(T,b,ns,nc,x,nss) \ 1430 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1431 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1432 Box _subbox_((x).box()); \ 1433 _subbox_ &= this->box(); \ 1435 if (!_subbox_.isEmpty()) \ 1437 const int *_th_plo = this->loVect(); \ 1438 const IntVect _th_plen = this->size(); \ 1439 const int *_x_plo = (x).loVect(); \ 1440 const IntVect _x_plen = (x).size(); \ 1441 const int *_subbox_lo = _subbox_.loVect(); \ 1442 const IntVect _subbox_len = _subbox_.size(); \ 1443 T* _th_p = this->dataPtr(ns); \ 1444 const T* _x_p = (x).dataPtr(nss); \ 1445 for (int _n = 0; _n < (nc); ++_n) \ 1447 int nR = _n; nR += 0; \ 1448 for (int _k = 0; _k < _subbox_len[2]; ++_k) \ 1450 const int kR = _k + _subbox_lo[2]; \ 1451 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1453 const int jR = _j + _subbox_lo[1]; \ 1455 + ((_subbox_lo[0] - _th_plo[0]) \ 1460 + _n * _th_plen[2]))); \ 1461 const T *_x_pp = _x_p \ 1462 + ((_subbox_lo[0] - _x_plo[0]) \ 1467 + _n * _x_plen[2]))); \ 1468 for (int _i = 0; _i < _subbox_len[0]; \ 1471 int iR = _i + _subbox_lo[0]; iR += 0; \ 1472 T &thisR = * _th_pp; \ 1473 const T & x##R = _x_pp[_i]; 1475 #define ForAllThisCBNNXC3(T,b,ns,nc,x,nss) \ 1477 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1478 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1479 Box _subbox_((x).box()); \ 1480 _subbox_ &= this->box(); \ 1482 if (!_subbox_.isEmpty()) \ 1484 const int *_th_plo = this->loVect(); \ 1485 const IntVect _th_plen = this->size(); \ 1486 const int *_x_plo = (x).loVect(); \ 1487 const IntVect _x_plen = (x).size(); \ 1488 const int *_subbox_lo = _subbox_.loVect(); \ 1489 const IntVect _subbox_len = _subbox_.size(); \ 1490 const T* _th_p = this->dataPtr(ns); \ 1491 const T* _x_p = (x).dataPtr(nss); \ 1492 for (int _n = 0; _n < (nc); ++_n) \ 1494 int nR = _n; nR += 0; \ 1495 for (int _k = 0; _k < _subbox_len[2]; ++_k) \ 1497 const int kR = _k + _subbox_lo[2]; \ 1498 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1500 const int jR = _j + _subbox_lo[1]; \ 1501 const T *_th_pp = _th_p \ 1502 + ((_subbox_lo[0] - _th_plo[0]) \ 1507 + _n * _th_plen[2]))); \ 1508 const T *_x_pp = _x_p \ 1509 + ((_subbox_lo[0] - _x_plo[0]) \ 1514 + _n * _x_plen[2]))); \ 1515 for (int _i = 0; _i < _subbox_len[0]; \ 1518 int iR = _i + _subbox_lo[0]; iR += 0; \ 1519 const T &thisR = * _th_pp; \ 1520 const T & x##R = _x_pp[_i]; 1522 #define ForAllThisBNNXCBN3(T,b,ns,nc,x,bx,nss) \ 1524 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1525 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1526 CH_assert((bx).sameSize((b))); \ 1527 if (!((b).isEmpty())) \ 1529 const int *_th_plo = this->loVect(); \ 1530 const IntVect _th_plen = this->size(); \ 1531 const int *_x_plo = (x).loVect(); \ 1532 const IntVect _x_plen = (x).size(); \ 1533 const int *_subbox_lo = (b).loVect(); \ 1534 IntVect _subbox_len = (b).size(); \ 1535 const int *_bx_lo = (bx).loVect(); \ 1536 T* _th_p = this->dataPtr(ns); \ 1537 const T* _x_p = (x).dataPtr(nss); \ 1538 for (int _n = 0; _n < (nc); ++_n) \ 1540 int nR = _n + ns; nR += 0; \ 1541 int n##x##R = _n + nss; n##x##R += 0; \ 1542 for (int _k = 0; _k < _subbox_len[2]; ++_k) \ 1544 const int kR = _k + _subbox_lo[2]; \ 1545 const int k##x##R = _k + _bx_lo[2]; \ 1546 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1548 const int jR = _j + _subbox_lo[1]; \ 1549 const int j##x##R = _j + _bx_lo[1]; \ 1551 + ((_subbox_lo[0] - _th_plo[0]) \ 1556 + _n * _th_plen[2]))); \ 1557 const T *_x_pp = _x_p \ 1558 + ((_bx_lo[0] - _x_plo[0]) \ 1560 (j##x##R - _x_plo[1]) \ 1562 (k##x##R - _x_plo[2]) \ 1563 + _n * _x_plen[2]))); \ 1564 for (int _i = 0; _i < _subbox_len[0]; \ 1567 int iR = _i + _subbox_lo[0]; iR += 0; \ 1568 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \ 1569 T &thisR = * _th_pp; \ 1570 const T & x##R = _x_pp[_i]; 1572 #define ForAllThisBNNXCBNYCBN3(T,b,ns,nc,x,bx,nsx,y,by,nsy) \ 1574 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1575 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 1576 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 1577 Box _subbox_(this->box()); \ 1579 CH_assert((bx).sameSize(_subbox_)); \ 1580 CH_assert((by).sameSize(_subbox_)); \ 1581 if (!_subbox_.isEmpty()) \ 1583 const int *_th_plo = this->loVect(); \ 1584 const IntVect _th_plen = this->size(); \ 1585 const int *_x_plo = (x).loVect(); \ 1586 const IntVect _x_plen = (x).size(); \ 1587 const int *_y_plo = (y).loVect(); \ 1588 const IntVect _y_plen = (y).size(); \ 1589 const int *_subbox_lo = _subbox_.loVect(); \ 1590 const IntVect _subbox_len = _subbox_.size(); \ 1591 const int *_bx_lo = (bx).loVect(); \ 1592 const int *_by_lo = (by).loVect(); \ 1593 T* _th_p = this->dataPtr(ns); \ 1594 const T* _x_p = (x).dataPtr(nsx); \ 1595 const T* _y_p = (y).dataPtr(nsy); \ 1596 for (int _n = 0; _n < (nc); ++_n) \ 1598 int nR = _n + ns; nR += 0; \ 1599 int n##x##R = _n + nsx; n##x##R += 0; \ 1600 int n##y##R = _n + nsy; n##y##R += 0; \ 1601 for (int _k = 0; _k < _subbox_len[2]; ++_k) \ 1603 const int kR = _k + _subbox_lo[2]; \ 1604 const int k##x##R = _k + _bx_lo[2]; \ 1605 const int k##y##R = _k + _by_lo[2]; \ 1606 for (int _j = 0; _j < _subbox_len[1]; ++_j) \ 1608 const int jR = _j + _subbox_lo[1]; \ 1609 const int j##x##R = _j + _bx_lo[1]; \ 1610 const int j##y##R = _j + _by_lo[1]; \ 1612 + ((_subbox_lo[0] - _th_plo[0]) \ 1617 + _n * _th_plen[2]))); \ 1618 const T *_x_pp = _x_p \ 1619 + ((_bx_lo[0] - _x_plo[0]) \ 1621 (j##x##R - _x_plo[1]) \ 1623 (k##x##R - _x_plo[2]) \ 1624 + _n * _x_plen[2]))); \ 1625 const T *_y_pp = _y_p \ 1626 + ((_by_lo[0] - _y_plo[0]) \ 1628 (j##y##R - _y_plo[1]) \ 1630 (k##y##R - _y_plo[2]) \ 1631 + _n * _y_plen[2]))); \ 1632 for (int _i = 0; _i < _subbox_len[0]; \ 1635 int iR = _i + _subbox_lo[0]; iR += 0; \ 1636 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \ 1637 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \ 1638 T &thisR = * _th_pp; \ 1639 const T & x##R = _x_pp[_i]; \ 1640 const T & y##R = _y_pp[_i]; 1642 #define ForAllRevXBNYCBNNN3(T,x,bx,nsx,y,by,nsy,nc,ir) \ 1644 CH_assert((ir) >= 0 && (ir) < SpaceDim); \ 1645 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 1646 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 1647 CH_assert((x).contains(bx)); \ 1648 CH_assert((y).contains(by)); \ 1649 CH_assert((bx).sameSize(by)); \ 1650 const int *_x_plo = (x).loVect(); \ 1651 const IntVect _x_plen = (x).size(); \ 1652 const int *_y_plo = (y).loVect(); \ 1653 intVect _y_plen = (y).size(); \ 1654 const int *_bx_lo = (bx).loVect(); \ 1655 const int *_by_lo = (by).loVect(); \ 1656 const IntVect _len = (bx).size(); \ 1657 T* _x_p = (x).dataPtr(nsx); \ 1658 const T* _y_p = (y).dataPtr(nsy); \ 1659 for (int _n = 0; _n < (nc); ++_n) \ 1661 int n##x##R = _n + nsx; n##x##R += 0; \ 1662 int n##y##R = _n + nsy; n##y##R += 0; \ 1663 for (int _k = 0; _k < _len[2]; ++_k) \ 1665 const int k##x##R = _k + _bx_lo[2]; \ 1666 const int krev##x##R = _len[2]-1-_k + _bx_lo[2]; \ 1667 const int k##y##R = _k + _by_lo[2]; \ 1668 for (int _j = 0; _j < _len[1]; ++_j) \ 1670 const int j##x##R = _j + _bx_lo[1]; \ 1671 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \ 1672 const int j##y##R = _j + _by_lo[1]; \ 1679 + ((_bx_lo[0] - _x_plo[0]) + _len[0]-1 \ 1681 (j##x##R - _x_plo[1]) \ 1683 (k##x##R - _x_plo[2]) \ 1684 + _n * _x_plen[2]))); \ 1690 + ((_bx_lo[0] - _x_plo[0]) \ 1692 (jrev##x##R - _x_plo[1]) \ 1694 (k##x##R - _x_plo[2]) \ 1695 + _n * _x_plen[2]))); \ 1700 + ((_bx_lo[0] - _x_plo[0]) \ 1702 (j##x##R - _x_plo[1]) \ 1704 (krev##x##R - _x_plo[2]) \ 1705 + _n * _x_plen[2]))); \ 1707 const T *_y_pp = _y_p \ 1708 + ((_by_lo[0] - _y_plo[0]) \ 1710 (j##y##R - _y_plo[1]) \ 1712 (k##y##R - _y_plo[2]) \ 1713 + _n * _y_plen[2]))); \ 1714 for (int _i = 0; _i < _len[0]; ++_i, _ix += _istrd) \ 1716 T & x##R = _x_pp[_ix]; \ 1717 const T & y##R = _y_pp[_i]; 1734 #define EndForPencil3 \ 1740 #elif (CH_SPACEDIM > 3) 1742 #define ForAllThisCPencilHiDim(T,b,ns,nc) \ 1744 CH_assert(this->contains(b)); \ 1745 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1746 const IntVect _b_len = (b).size(); \ 1747 Box _pencil_box(b); \ 1748 _pencil_box.setBig(0,b.smallEnd(0)); \ 1749 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1751 int nR = _n; nR += 0; \ 1752 BoxIterator _bit( _pencil_box ); \ 1753 for (_bit.begin(); _bit.ok(); ++_bit) \ 1755 IntVect _iv = _bit(); \ 1756 const T &thisR = this->operator()(_iv,_n); \ 1757 const int thisLen = _b_len[0]; \ 1758 int jR = _iv[1]; jR += 0; \ 1759 int kR = _iv[2]; kR += 0; 1761 #define ForAllThisPencilHiDim(T,b,ns,nc) \ 1763 CH_assert(this->contains(b)); \ 1764 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1765 const IntVect _b_len = (b).size(); \ 1766 Box _pencil_box(b); \ 1767 _pencil_box.setBig(0,b.smallEnd(0)); \ 1768 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1770 const int nR = _n; \ 1771 BoxIterator _bit( _pencil_box ); \ 1772 for (_bit.begin(); _bit.ok(); ++_bit) \ 1774 IntVect _iv = _bit(); \ 1775 T &thisR = this->operator()(_iv,nR); \ 1776 const int thisLen = _b_len[0]; \ 1777 int jR = _iv[1]; jR += 0; \ 1778 int kR = _iv[2]; kR += 0; 1780 #define ForAllXBPencilHiDim(T,x,b,ns,nc) \ 1782 CH_assert((x).contains(b)); \ 1783 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1784 const IntVect _b_len = (b).size(); \ 1785 Box _pencil_box(b); \ 1786 _pencil_box.setBig(0,b.smallEnd(0)); \ 1787 for (int nR = (ns); nR < (ns)+(nc); ++nR) \ 1789 BoxIterator _bit( _pencil_box ); \ 1790 for (_bit.begin(); _bit.ok(); ++_bit) \ 1792 IntVect _iv = _bit(); \ 1793 T *xR = &(x).operator()(_iv,nR); \ 1794 const int thisLen = _b_len[0]; \ 1795 int jR = _iv[1]; jR += 0; \ 1796 int kR = _iv[2]; kR += 0; 1798 #define ForAllXBNNHiDim(T,x,b,ns,nc) \ 1800 CH_assert(x.contains(b)); \ 1801 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1802 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1804 const int nR = _n; (int&)nR += 0; \ 1805 BoxIterator _bit( (b) ); \ 1806 for (_bit.begin(); _bit.ok(); ++_bit) \ 1808 IntVect _iv = _bit(); \ 1809 T &x##R = (x)(_iv,nR); \ 1810 T *_x_pp = &x##R; _x_pp += 0; \ 1811 int iR = _iv[0]; iR += 0; \ 1812 int jR = _iv[1]; jR += 0; \ 1813 int kR = _iv[2]; kR += 0; 1816 #define ForAllXBNNnoindxHiDim(T,x,b,ns,nc) \ 1818 CH_assert(x.contains(b)); \ 1819 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1820 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1822 BoxIterator _bit( (b) ); \ 1823 for (_bit.begin(); _bit.ok(); ++_bit) \ 1825 IntVect _iv = _bit(); \ 1826 T& x##R = (x)(_iv,_n); \ 1827 int iR = _iv[0]; iR += 0; \ 1828 int jR = _iv[1]; jR += 0; \ 1829 int kR = _iv[2]; kR += 0; 1831 #define ForAllXCBNNHiDim(T,x,b,ns,nc) \ 1833 CH_assert(x.contains(b)); \ 1834 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \ 1835 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1837 const int nR = _n; \ 1838 BoxIterator _bit( (b) ); \ 1839 for (_bit.begin(); _bit.ok(); ++_bit) \ 1841 IntVect _iv = _bit(); \ 1842 const T & x##R = (x)(_iv, nR); \ 1843 const T *_x_pp = &x##R; _x_pp += 0; \ 1844 const int iR = _iv[0]; (int&)iR += 0; \ 1845 const int jR = _iv[1]; (int&)jR += 0; \ 1846 const int kR = _iv[2]; (int&)kR += 0; 1849 #define ForAllThisBNNHiDim(T,b,ns,nc) \ 1851 CH_assert(this->contains(b)); \ 1852 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1853 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1855 int nR = _n; nR += 0; \ 1856 BoxIterator _bit( (b)); \ 1857 for (_bit.begin(); _bit.ok(); ++_bit) \ 1859 IntVect _iv = _bit(); \ 1860 T &thisR = this->operator()(_iv,nR); \ 1861 int iR = _iv[0]; iR += 0; \ 1862 int jR = _iv[1]; jR += 0; \ 1863 int kR = _iv[2]; kR += 0; 1866 #define ForAllThisCBNNHiDim(T,b,ns,nc) \ 1868 CH_assert(this->contains(b)); \ 1869 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1870 for (int _n = (ns); _n < (ns)+(nc); ++_n) \ 1872 const int nR = _n; \ 1873 BoxIterator _bit( (b) ); \ 1874 for (_bit.begin(); _bit.ok(); ++_bit) \ 1876 IntVect _iv = _bit(); \ 1877 const T &thisR = this->operator()(_iv,nR); \ 1878 const int iR = _iv[0]; (int&)iR +=0; \ 1879 const int jR = _iv[1]; (int&)jR +=0; \ 1880 const int kR = _iv[2]; (int&)kR +=0; 1882 #define ForAllThisBNNXCHiDim(T,b,ns,nc,x,nss) \ 1884 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1885 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1886 Box _subbox_((x).box()); \ 1887 _subbox_ &= this->box(); \ 1889 if (!_subbox_.isEmpty()) \ 1891 for (int _n = 0; _n < (nc); ++_n) \ 1893 int nR = _n; nR += 0; \ 1894 BoxIterator _bit(_subbox_); \ 1895 for (_bit.begin(); _bit.ok(); ++_bit) \ 1897 IntVect _iv = _bit(); \ 1898 T &thisR = this->operator()(_iv, ns+nR); \ 1899 const T & x##R = (x)(_iv, nss+nR); \ 1900 const int iR = _iv[0]; (int&)iR += 0; \ 1901 const int jR = _iv[1]; (int&)jR += 0; \ 1902 const int kR = _iv[2]; (int&)kR += 0; 1904 #define ForAllThisCBNNXCHiDim(T,b,ns,nc,x,nss) \ 1906 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1907 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1908 Box _subbox_((x).box()); \ 1909 _subbox_ &= this->box(); \ 1911 if (!_subbox_.isEmpty()) \ 1913 for (int _n = 0; _n < (nc); ++_n) \ 1915 int nR = _n; nR += 0; \ 1916 BoxIterator _bit(_subbox_); \ 1917 for (_bit.begin(); _bit.ok(); ++_bit) \ 1919 IntVect _iv = _bit(); \ 1920 const T &thisR = this->operator()(_iv,ns+nR); \ 1921 const T & x##R = (x)(_iv,nss+nR); \ 1922 const int iR = _iv[0]; (int&)iR += 0; \ 1923 const int jR = _iv[1]; (int&)jR += 0; \ 1924 const int kR = _iv[2]; (int&)kR += 0; 1926 #define ForAllThisBNNXCBNHiDim(T,b,ns,nc,x,bx,nss) \ 1928 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1929 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \ 1930 CH_assert((bx).sameSize((b))); \ 1931 if (!((b).isEmpty())) \ 1933 for (int _n = 0; _n < (nc); ++_n) \ 1935 int nR = _n + ns; nR += 0; \ 1936 int n##x##R = _n + nss; n##x##R += 0; \ 1937 BoxIterator this_Bit( (b) ); \ 1938 IntVect _bxOffset = bx.smallEnd() - b.smallEnd(); \ 1939 for (this_Bit.begin(); this_Bit.ok(); ++this_Bit) \ 1941 IntVect _thisIV = this_Bit(); \ 1942 IntVect _xIV = _thisIV + _bxOffset; \ 1943 T &thisR = this->operator()(_thisIV, nR); \ 1944 const T & x##R = (x)(_xIV,n##x##R); \ 1945 int iR = _xIV[0]; iR += 0; \ 1946 int jR = _xIV[1]; jR += 0; \ 1947 int kR = _xIV[2]; kR += 0; 1950 #define ForAllThisBNNXCBNYCBNHiDim(T,b,ns,nc,x,bx,nsx,y,by,nsy) \ 1952 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \ 1953 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \ 1954 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \ 1955 Box _subbox_(this->box()); \ 1957 CH_assert((bx).sameSize(_subbox_)); \ 1958 CH_assert((by).sameSize(_subbox_)); \ 1959 if (!_subbox_.isEmpty()) \ 1961 for (int _n = 0; _n < (nc); ++_n) \ 1963 int nR = _n + ns; nR += 0; \ 1964 int n##x##R = _n + nsx; n##x##R += 0; \ 1965 int n##y##R = _n + nsy; n##y##R += 0; \ 1966 BoxIterator _thisBit(_subbox_); \ 1967 IntVect _xOffset = bx.smallEnd() - _subbox_.smallEnd(); \ 1968 IntVect _yOffset = by.smallEnd() - _subbox_.smallEnd(); \ 1969 for (_thisBit.begin(); _thisBit.ok(); ++_thisBit) \ 1971 IntVect _thisIV = _thisBit(); \ 1972 IntVect _xIV = _thisIV + _xOffset; \ 1973 IntVect _yIV = _thisIV + _yOffset; \ 1974 T &thisR = this->operator()(_thisIV,nR); \ 1975 const T & x##R = (x)(_xIV,n##x##R); \ 1976 const T & y##R = (y)(_yIV,n##y##R); \ 1977 int iR = _thisIV[0]; iR += 0; \ 1978 int jR = _thisIV[1]; jR += 0; \ 1979 int kR = _thisIV[2]; kR += 0; 1982 #define EndForHiDim \ 1987 #define EndForTXHiDim \ 1993 #define EndForPencilHiDim \ 2004 #define ForAllXPencil(T,x) ForAllXBPencil(T,x,((x).box()),0,((x).nComp())) 2011 #define ForAllX(T,x) ForAllXBNN(T,x,((x).box()),0,((x).nComp())) 2016 #define ForAllXC(T,x) ForAllXCBNN(T,x,((x).box()),0,((x).nComp())) 2022 #define ForAllXB(T,x,b) ForAllXBNN(T,x,(b),0,(x).nComp()) 2027 #define ForAllXBC(T,x,b) ForAllXCBNN(T,x,(b),0,(x).nComp()) 2034 #define ForAllThis(T) ForAllThisBNN(T,this->m_domain,0,this->nComp()) 2039 #define ForAllThisC(T) ForAllThisCBNN(T,this->m_domain,0,this->nComp()) 2045 #define ForAllThisB(T,b) ForAllThisBNN(T,(b),0,this->nComp()) 2050 #define ForAllThisCB(T,b) ForAllThisCBNN(T,(b),0,this->nComp()) 2056 #define ForAllThisNN(T,ns,nc) ForAllThisBNN(T,this->m_domain,ns,nc) 2063 #define ForAllThisXC(T,x) ForAllThisBNNXC(T,this->m_domain,0,this->nComp(),x,0) 2069 #endif // matches CH_SPACEDIM != LAST_BASEFABMACROS_H_SPACEDIM