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 #ifdef DOXYGEN
00032 #define CH_SPACEDIM 1
00033 #endif
00034
00035
00036
00037
00038 #ifdef ForAllThisCPencil
00039 # undef ForAllThisCPencil
00040 # undef ForAllThisPencil
00041 # undef ForAllXBPencil
00042 # undef ForAllXBNNnoindx
00043 # undef ForAllXBNN
00044 # undef ForAllXCBNN
00045 # undef ForAllThisBNN
00046 # undef ForAllThisCBNN
00047 # undef ForAllThisBNNXC
00048 # undef ForAllThisCBNNXC
00049 # undef ForAllThisBNNXCBN
00050 # undef ForAllThisBNNXCBNYCBN
00051 # undef ForAllRevXBNYCBNNN
00052 # undef EndFor
00053 # undef EndForTX
00054 # undef EndForPencil
00055 #endif
00056
00057 #if CH_SPACEDIM == 1
00058 # define ForAllThisCPencil ForAllThisCPencil1
00059 # define ForAllThisPencil ForAllThisPencil1
00060 # define ForAllXBPencil ForAllXBPencil1
00061 # define ForAllXBNN ForAllXBNN1
00062 # define ForAllXBNNnoindx ForAllXBNNnoindx1
00063 # define ForAllXCBNN ForAllXCBNN1
00064 # define ForAllThisBNN ForAllThisBNN1
00065 # define ForAllThisCBNN ForAllThisCBNN1
00066 # define ForAllThisBNNXC ForAllThisBNNXC1
00067 # define ForAllThisCBNNXC ForAllThisCBNNXC1
00068 # define ForAllThisBNNXCBN ForAllThisBNNXCBN1
00069 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN1
00070 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN1
00071 # define EndFor EndFor1
00072 # define EndForTX EndForTX1
00073 # define EndForPencil EndForPencil1
00074 # define LAST_BASEFABMACROS_H_SPACEDIM 1
00075 #endif
00076 #if CH_SPACEDIM == 2
00077 # define ForAllThisCPencil ForAllThisCPencil2
00078 # define ForAllThisPencil ForAllThisPencil2
00079 # define ForAllXBPencil ForAllXBPencil2
00080 # define ForAllXBNN ForAllXBNN2
00081 # define ForAllXBNNnoindx ForAllXBNNnoindx2
00082 # define ForAllXCBNN ForAllXCBNN2
00083 # define ForAllThisBNN ForAllThisBNN2
00084 # define ForAllThisCBNN ForAllThisCBNN2
00085 # define ForAllThisBNNXC ForAllThisBNNXC2
00086 # define ForAllThisCBNNXC ForAllThisCBNNXC2
00087 # define ForAllThisBNNXCBN ForAllThisBNNXCBN2
00088 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN2
00089 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN2
00090 # define EndFor EndFor2
00091 # define EndForTX EndForTX2
00092 # define EndForPencil EndForPencil2
00093 # define LAST_BASEFABMACROS_H_SPACEDIM 2
00094 #endif
00095 #if CH_SPACEDIM == 3
00096 # define ForAllThisCPencil ForAllThisCPencil3
00097 # define ForAllThisPencil ForAllThisPencil3
00098 # define ForAllXBPencil ForAllXBPencil3
00099 # define ForAllXBNN ForAllXBNN3
00100 # define ForAllXBNNnoindx ForAllXBNNnoindx3
00101 # define ForAllXCBNN ForAllXCBNN3
00102 # define ForAllThisBNN ForAllThisBNN3
00103 # define ForAllThisCBNN ForAllThisCBNN3
00104 # define ForAllThisBNNXC ForAllThisBNNXC3
00105 # define ForAllThisCBNNXC ForAllThisCBNNXC3
00106 # define ForAllThisBNNXCBN ForAllThisBNNXCBN3
00107 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBN3
00108 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNN3
00109 # define EndFor EndFor3
00110 # define EndForTX EndForTX3
00111 # define EndForPencil EndForPencil3
00112 # define LAST_BASEFABMACROS_H_SPACEDIM 3
00113 #endif
00114
00115 #if CH_SPACEDIM > 3
00116 # define ForAllThisCPencil ForAllThisCPencilHiDim
00117 # define ForAllThisPencil ForAllThisPencilHiDim
00118 # define ForAllXBPencil ForAllXBPencilHiDim
00119 # define ForAllXBNN ForAllXBNNHiDim
00120 # define ForAllXBNNnoindx ForAllXBNNnoindxHiDim
00121 # define ForAllXCBNN ForAllXCBNNHiDim
00122 # define ForAllThisBNN ForAllThisBNNHiDim
00123 # define ForAllThisCBNN ForAllThisCBNNHiDim
00124 # define ForAllThisBNNXC ForAllThisBNNXCHiDim
00125 # define ForAllThisCBNNXC ForAllThisCBNNXCHiDim
00126 # define ForAllThisBNNXCBN ForAllThisBNNXCBNHiDim
00127 # define ForAllThisBNNXCBNYCBN ForAllThisBNNXCBNYCBNHiDim
00128 # define ForAllRevXBNYCBNNN ForAllRevXBNYCBNNNHiDim
00129 # define EndFor EndForHiDim
00130 # define EndForTX EndForTXHiDim
00131 # define EndForPencil EndForPencilHiDim
00132 # define LAST_BASEFABMACROS_H_SPACEDIM HiDim
00133 #endif
00134
00135 #if (CH_SPACEDIM == 1)
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 #define ForAllThisPencil1(T,b,ns,nc) \
00184 { \
00185 CH_assert(contains(b)); \
00186 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00187 const int *_th_plo = this->loVect(); \
00188 const IntVect _th_plen = this->size(); \
00189 const int *_b_lo = (b).loVect(); \
00190 const IntVect _b_len = (b).size(); \
00191 T* _th_p = this->m_dptr; \
00192 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00193 { \
00194 const int nR = _n; (int&)nR += 0; \
00195 T *_th_pp = _th_p \
00196 + ((_b_lo[0] - _th_plo[0]) \
00197 + _n * _th_plen[0]); \
00198 T &thisR = * _th_pp; \
00199 const int thisLen = _b_len[0]; \
00200
00201
00202
00203
00204
00205 #define ForAllXBPencil1(T,x,b,ns,nc) \
00206 { \
00207 CH_assert(x.contains(b)); \
00208 CH_assert((ns) >= 0 && (ns) + (nc) <= x.nComp()); \
00209 const int *_th_plo = x.loVect(); \
00210 const IntVect _th_plen = x.size(); \
00211 const int *_b_lo = (b).loVect(); \
00212 const IntVect _b_len = (b).size(); \
00213 T* _th_p = x.dataPtr(); \
00214 for (int nR = (ns); nR < (ns)+(nc); ++nR) \
00215 { \
00216 T * xR = _th_p \
00217 + ((_b_lo[0] - _th_plo[0]) \
00218 + nR * _th_plen[0]); \
00219 const int thisLen = _b_len[0];
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 #define ForAllThisCPencil1(T,b,ns,nc) \
00243 { \
00244 CH_assert(this->contains(b)); \
00245 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00246 const int *_th_plo = this->loVect(); \
00247 const IntVect _th_plen = this->size(); \
00248 const int *_b_lo = (b).loVect(); \
00249 const IntVect _b_len = (b).size(); \
00250 const T* _th_p = this->m_dptr; \
00251 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00252 { \
00253 int nR = _n; nR += 0; \
00254 const T *_th_pp = _th_p \
00255 + ((_b_lo[0] - _th_plo[0]) \
00256 + _n * _th_plen[0]); \
00257 const T &thisR = * _th_pp; \
00258 const int thisLen = _b_len[0];
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 #define ForAllXBNN1(T,x,b,ns,nc) \
00286 { \
00287 CH_assert(x.contains(b)); \
00288 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00289 const int *_x_plo = (x).loVect(); \
00290 const IntVect _x_plen = (x).size(); \
00291 const int *_b_lo = (b).loVect(); \
00292 const IntVect _b_len = (b).size(); \
00293 T* _x_p = (x) .dataPtr(); \
00294 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00295 { \
00296 const int nR = _n; (int&)nR += 0; \
00297 T *_x_pp = _x_p \
00298 + ((_b_lo[0] - _x_plo[0]) \
00299 + _n * _x_plen[0]); \
00300 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \
00301 { \
00302 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00303 T &x##R = * _x_pp;
00304
00305
00306
00307
00308
00309
00310
00311 #define ForAllXBNNnoindx1(T,x,b,ns,nc) \
00312 { \
00313 CH_assert(x.contains(b)); \
00314 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00315 const int *_x_plo = (x).loVect(); \
00316 const IntVect _x_plen = (x).size(); \
00317 const int *_b_lo = (b).loVect(); \
00318 const IntVect _b_len = (b).size(); \
00319 T* _x_p = (x) .dataPtr(); \
00320 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00321 { \
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 { \
00327 T &x##R = * _x_pp;
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350 #define ForAllXCBNN1(T,x,b,ns,nc) \
00351 { \
00352 CH_assert(x.contains(b)); \
00353 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00354 const int *_x_plo = (x).loVect(); \
00355 const IntVect _x_plen = (x).size(); \
00356 const int *_b_lo = (b).loVect(); \
00357 const IntVect _b_len = (b).size(); \
00358 const T* _x_p = (x).dataPtr(); \
00359 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00360 { \
00361 const int nR = _n; (int&)nR += 0; \
00362 const T *_x_pp = _x_p \
00363 + ((_b_lo[0] - _x_plo[0]) \
00364 + _n * _x_plen[0]); \
00365 for (int _i = 0; _i < _b_len[0]; ++_i) \
00366 { \
00367 const int iR = _i + _b_lo[0]; (int&) iR += 0; \
00368 const T & x##R = _x_pp[_i];
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408 #define ForAllThisBNN1(T,b,ns,nc) \
00409 { \
00410 CH_assert(this->contains(b)); \
00411 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00412 const int *_th_plo = this->loVect(); \
00413 const IntVect _th_plen = this->size(); \
00414 const int *_b_lo = (b).loVect(); \
00415 const IntVect _b_len = (b).size(); \
00416 T* _th_p = this->m_dptr; \
00417 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00418 { \
00419 int nR = _n; nR += 0; \
00420 T *_th_pp = _th_p \
00421 + ((_b_lo[0] - _th_plo[0]) \
00422 + _n * _th_plen[0]); \
00423 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) \
00424 { \
00425 int iR = _i + _b_lo[0]; iR += 0; \
00426 T &thisR = * _th_pp;
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449 #define ForAllThisCBNN1(T,b,ns,nc) \
00450 { \
00451 CH_assert(this->contains(b)); \
00452 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00453 const int *_th_plo = this->loVect(); \
00454 const IntVect _th_plen = this->size(); \
00455 const int *_b_lo = (b).loVect(); \
00456 const IntVect _b_len = (b).size(); \
00457 const T* _th_p = this->m_dptr; \
00458 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00459 { \
00460 const int nR = _n; (int&)nR += 0; \
00461 const T *_th_pp = _th_p \
00462 + ((_b_lo[0] - _th_plo[0]) \
00463 + _n * _th_plen[0]); \
00464 for (int _i = 0; _i < _b_len[0]; ++_i) \
00465 { \
00466 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00467 const T &thisR = _th_pp[_i];
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494 #define ForAllThisBNNXC1(T,b,ns,nc,x,nss) \
00495 { \
00496 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00497 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00498 Box _subbox_((x).box()); \
00499 _subbox_ &= this->box(); \
00500 _subbox_ &= b; \
00501 if (!_subbox_.isEmpty()) \
00502 { \
00503 const int *_th_plo = this->loVect(); \
00504 const IntVect _th_plen = this->size(); \
00505 const int *_x_plo = (x).loVect(); \
00506 const IntVect _x_plen = (x).size(); \
00507 const int *_subbox_lo = _subbox_.loVect(); \
00508 const IntVect _subbox_len = _subbox_.size(); \
00509 T* _th_p = dataPtr(ns); \
00510 const T* _x_p = (x).dataPtr(nss); \
00511 for (int _n = 0; _n < (nc); ++_n) \
00512 { \
00513 int nR = _n; nR += 0; \
00514 T *_th_pp = _th_p \
00515 + ((_subbox_lo[0] - _th_plo[0]) \
00516 + _n * _th_plen[0]); \
00517 const T *_x_pp = _x_p \
00518 + ((_subbox_lo[0] - _x_plo[0]) \
00519 + _n * _x_plen[0]); \
00520 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
00521 { \
00522 int iR = _i + _subbox_lo[0]; iR += 0; \
00523 T &thisR = * _th_pp; \
00524 const T & x##R = _x_pp[_i];
00525
00526 #define ForAllThisCBNNXC1(T,b,ns,nc,x,nss) \
00527 { \
00528 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00529 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00530 Box _subbox_((x).box()); \
00531 _subbox_ &= this->box(); \
00532 _subbox_ &= b; \
00533 if (!_subbox_.isEmpty()) \
00534 { \
00535 const int *_th_plo = this->loVect(); \
00536 const IntVect _th_plen = this->size(); \
00537 const int *_x_plo = (x).loVect(); \
00538 const IntVect _x_plen = (x).size(); \
00539 const int *_subbox_lo = _subbox_.loVect(); \
00540 const IntVect _subbox_len = _subbox_.size(); \
00541 const T* _th_p = this->dataPtr(ns); \
00542 const T* _x_p = (x).dataPtr(nss); \
00543 for (int _n = 0; _n < (nc); ++_n) \
00544 { \
00545 int nR = _n; nR += 0; \
00546 const T *_th_pp = _th_p \
00547 + ((_subbox_lo[0] - _th_plo[0]) \
00548 + _n * _th_plen[0]); \
00549 const T *_x_pp = _x_p \
00550 + ((_subbox_lo[0] - _x_plo[0]) \
00551 + _n * _x_plen[0]); \
00552 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
00553 { \
00554 int iR = _i + _subbox_lo[0]; iR += 0; \
00555 const T &thisR = * _th_pp; \
00556 const T & x##R = _x_pp[_i];
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584 #define ForAllThisBNNXCBN1(T,b,ns,nc,x,bx,nss) \
00585 { \
00586 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00587 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00588 CH_assert(bx.sameSize((b))); \
00589 if (!((b).isEmpty())) \
00590 { \
00591 const int *_th_plo = this->loVect(); \
00592 const IntVect _th_plen = this->size(); \
00593 const int *_x_plo = (x).loVect(); \
00594 const IntVect _x_plen = (x).size(); \
00595 const int *_subbox_lo = (b).loVect(); \
00596 const IntVect _subbox_len = (b).size(); \
00597 const int *_bx_lo = (bx).loVect(); \
00598 T* _th_p = this->dataPtr(ns); \
00599 const T* _x_p = (x).dataPtr(nss); \
00600 for (int _n = 0; _n < (nc); ++_n) \
00601 { \
00602 int nR = _n + ns; nR += 0; \
00603 int n##x##R = _n + nss; n##x##R += 0; \
00604 T *_th_pp = _th_p \
00605 + ((_subbox_lo[0] - _th_plo[0]) \
00606 + _n * _th_plen[0]); \
00607 const T *_x_pp = _x_p \
00608 + ((_bx_lo[0] - _x_plo[0]) \
00609 + _n * _x_plen[0]); \
00610 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
00611 { \
00612 int iR = _i + _subbox_lo[0]; iR += 0; \
00613 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00614 T &thisR = * _th_pp; \
00615 const T & x##R = _x_pp[_i];
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646 #define ForAllThisBNNXCBNYCBN1(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00647 { \
00648 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00649 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00650 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00651 Box _subbox_ = this->box(); \
00652 _subbox_ &= b; \
00653 CH_assert((bx).sameSize(_subbox_)); \
00654 CH_assert((by).sameSize(_subbox_)); \
00655 if (!_subbox_.isEmpty()) \
00656 { \
00657 const int *_th_plo = this->loVect(); \
00658 const IntVect _th_plen = this->size(); \
00659 const int *_x_plo = (x).loVect(); \
00660 const IntVect _x_plen = (x).size(); \
00661 const int *_y_plo = (y).loVect(); \
00662 const IntVect _y_plen = (y).size(); \
00663 const int *_subbox_lo = _subbox_.loVect(); \
00664 const IntVect _subbox_len = _subbox_.size(); \
00665 const int *_bx_lo = (bx).loVect(); \
00666 const int *_by_lo = (by).loVect(); \
00667 T* _th_p = this->dataPtr(ns); \
00668 const T* _x_p = (x).dataPtr(nsx); \
00669 const T* _y_p = (y).dataPtr(nsy); \
00670 for (int _n = 0; _n < (nc); ++_n) \
00671 { \
00672 int nR = _n + ns; nR += 0; \
00673 int n##x##R = _n + nsx; n##x##R += 0; \
00674 int n##y##R = _n + nsy; n##y##R += 0; \
00675 T *_th_pp = _th_p \
00676 + ((_subbox_lo[0] - _th_plo[0]) \
00677 + _n * _th_plen[0]); \
00678 const T *_x_pp = _x_p \
00679 + ((_bx_lo[0] - _x_plo[0]) \
00680 + _n * _x_plen[0]); \
00681 const T *_y_pp = _y_p \
00682 + ((_by_lo[0] - _y_plo[0]) \
00683 + _n * _y_plen[0]); \
00684 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
00685 { \
00686 int iR = _i + _subbox_lo[0]; iR += 0; \
00687 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00688 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
00689 T &thisR = * _th_pp; \
00690 const T & x##R = _x_pp[_i]; \
00691 const T & y##R = _y_pp[_i];
00692
00693 #define ForAllRevXBNYCBNNN1(T,x,bx,nsx,y,by,nsy,nc,ri) \
00694 { \
00695 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00696 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00697 CH_assert((x).contains(bx)); \
00698 CH_assert((y).contains(by)); \
00699 CH_assert((bx).sameSize(by)); \
00700 const int *_x_plo = (x).loVect(); \
00701 const IntVect _x_plen = (x).size(); \
00702 const int *_y_plo = (y).loVect(); \
00703 const IntVect _y_plen = (y).size(); \
00704 const IntVect _len = (bx).size(); \
00705 const int *_bx_lo = (bx).loVect(); \
00706 const int *_by_lo = (by).loVect(); \
00707 T* _x_p = (x).dataPtr(nsx); \
00708 const T* _y_p = (y).dataPtr(nsy); \
00709 for (int _n = 0; _n < (nc); ++_n) \
00710 { \
00711 int n##x##R = _n + nsx; n##x##R += 0; \
00712 int n##y##R = _n + nsy; n##y##R += 0; \
00713 int _ix = 0; \
00714 T *_x_pp = _x_p \
00715 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
00716 + _n * _x_plen[0]); \
00717 const T *_y_pp = _y_p \
00718 + ((_by_lo[0] - _y_plo[0]) \
00719 + _n * _y_plen[0]); \
00720 for (int _i = 0; _i < _len[0]; ++_i, --_ix) \
00721 { \
00722 T & x##R = _x_pp[_ix]; \
00723 const T & y##R = _y_pp[_i];
00724
00725
00726
00727
00728
00729 #define EndForTX1 \
00730 } \
00731 } \
00732 } \
00733 }
00734
00735
00736
00737
00738
00739 #define EndFor1 \
00740 } \
00741 } \
00742 }
00743
00744
00745
00746
00747 #define EndForPencil1 \
00748 } \
00749 }
00750
00751 #elif (CH_SPACEDIM == 2)
00752
00753 #define ForAllThisCPencil2(T,b,ns,nc) \
00754 { \
00755 CH_assert(contains(b)); \
00756 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00757 const int *_th_plo = this->loVect(); \
00758 const IntVect _th_plen = this->size(); \
00759 const int *_b_lo = (b).loVect(); \
00760 const IntVect _b_len = (b).size(); \
00761 const T* _th_p = this->m_dptr; \
00762 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00763 { \
00764 int nR = _n; nR += 0; \
00765 for (int _j = 0; _j < _b_len[1]; ++_j) \
00766 { \
00767 const int jR = _j + _b_lo[1]; \
00768 const T *_th_pp = _th_p \
00769 + ((_b_lo[0] - _th_plo[0]) \
00770 + _th_plen[0]*( \
00771 (jR - _th_plo[1]) \
00772 + _n * _th_plen[1])); \
00773 const T &thisR = * _th_pp; \
00774 const int thisLen = _b_len[0];
00775
00776 #define ForAllThisPencil2(T,b,ns,nc) \
00777 { \
00778 CH_assert(this->contains(b)); \
00779 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00780 const int *_th_plo = this->loVect(); \
00781 const IntVect _th_plen = this->size(); \
00782 const int *_b_lo = (b).loVect(); \
00783 const IntVect _b_len = (b).size(); \
00784 T* _th_p = this->m_dptr; \
00785 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00786 { \
00787 const int nR = _n; (int&)nR += 0; \
00788 for (int _j = 0; _j < _b_len[1]; ++_j) \
00789 { \
00790 const int jR = _j + _b_lo[1]; (int&)jR += 0; \
00791 T *_th_pp = _th_p \
00792 + ((_b_lo[0] - _th_plo[0]) \
00793 + _th_plen[0]*( \
00794 (jR - _th_plo[1]) \
00795 + _n * _th_plen[1])); \
00796 T &thisR = * _th_pp; \
00797 const int thisLen = _b_len[0]; \
00798
00799 #define ForAllXBPencil2(T,x,b,ns,nc) \
00800 { \
00801 CH_assert((x).contains(b)); \
00802 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00803 const int *_th_plo = (x).loVect(); \
00804 const IntVect _th_plen =(x).size(); \
00805 const int *_b_lo = (b).loVect(); \
00806 const IntVect _b_len = (b).size(); \
00807 T* _th_p = (x) .dataPtr(); \
00808 for (int nR = (ns); nR < (ns)+(nc); ++nR) \
00809 { \
00810 for (int _j = 0; _j < _b_len[1]; ++_j) \
00811 { \
00812 const int jR = _j + _b_lo[1]; (int&)jR += 0; \
00813 T *xR = _th_p \
00814 + ((_b_lo[0] - _th_plo[0]) \
00815 + _th_plen[0]*( \
00816 (jR - _th_plo[1]) \
00817 + nR * _th_plen[1])); \
00818 const int thisLen = _b_len[0]; \
00819
00820 #define ForAllXBNN2(T,x,b,ns,nc) \
00821 { \
00822 CH_assert((x).contains(b)); \
00823 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00824 const int *_x_plo = (x).loVect(); \
00825 const IntVect _x_plen = (x).size(); \
00826 const int *_b_lo = (b).loVect(); \
00827 const IntVect _b_len = (b).size(); \
00828 T* _x_p = (x) .dataPtr(); \
00829 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00830 { \
00831 const int nR = _n; (int&)nR += 0; \
00832 for (int _j = 0; _j < _b_len[1]; ++_j) \
00833 { \
00834 const int jR = _j + _b_lo[1]; (int&)jR += 0; \
00835 T *_x_pp = _x_p \
00836 + ((_b_lo[0] - _x_plo[0]) \
00837 + _x_plen[0]*( \
00838 (jR - _x_plo[1]) \
00839 + _n * _x_plen[1])); \
00840 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \
00841 { \
00842 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00843 T &x##R = * _x_pp;
00844
00845 #define ForAllXBNNnoindx2(T,x,b,ns,nc) \
00846 { \
00847 CH_assert((x).contains(b)); \
00848 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00849 const int *_x_plo = (x).loVect(); \
00850 const IntVect _x_plen = (x).size(); \
00851 const int *_b_lo = (b).loVect(); \
00852 const IntVect _b_len = (b).size(); \
00853 T* _x_p = (x) .dataPtr(); \
00854 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00855 { \
00856 for (int _j = 0; _j < _b_len[1]; ++_j) \
00857 { \
00858 const int jR = _j + _b_lo[1]; \
00859 T *_x_pp = _x_p \
00860 + ((_b_lo[0] - _x_plo[0]) \
00861 + _x_plen[0]*( \
00862 (jR - _x_plo[1]) \
00863 + _n * _x_plen[1])); \
00864 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \
00865 { \
00866 T &x##R = * _x_pp;
00867
00868 #define ForAllXCBNN2(T,x,b,ns,nc) \
00869 { \
00870 CH_assert(x.contains(b)); \
00871 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00872 const int *_x_plo = (x).loVect(); \
00873 const IntVect _x_plen = (x).size(); \
00874 const int *_b_lo = (b).loVect(); \
00875 const IntVect _b_len = (b).size(); \
00876 const T* _x_p = (x).dataPtr(); \
00877 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00878 { \
00879 const int nR = _n; (int&)nR += 0; \
00880 for (int _j = 0; _j < _b_len[1]; ++_j) \
00881 { \
00882 const int jR = _j + _b_lo[1]; \
00883 const T *_x_pp = _x_p \
00884 + ((_b_lo[0] - _x_plo[0]) \
00885 + _x_plen[0]*( \
00886 (jR - _x_plo[1]) \
00887 + _n * _x_plen[1])); \
00888 for (int _i = 0; _i < _b_len[0]; ++_i) \
00889 { \
00890 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
00891 const T & x##R = _x_pp[_i];
00892
00893 #define ForAllThisBNN2(T,b,ns,nc) \
00894 { \
00895 CH_assert(this->contains(b)); \
00896 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00897 const int *_th_plo = this->loVect(); \
00898 const IntVect _th_plen = this->size(); \
00899 const int *_b_lo = (b).loVect(); \
00900 const IntVect _b_len = (b).size(); \
00901 T* _th_p = this->m_dptr; \
00902 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00903 { \
00904 int nR = _n; nR += 0; \
00905 for (int _j = 0; _j < _b_len[1]; ++_j) \
00906 { \
00907 const int jR = _j + _b_lo[1]; \
00908 T *_th_pp = _th_p \
00909 + ((_b_lo[0] - _th_plo[0]) \
00910 + _th_plen[0]*( \
00911 (jR - _th_plo[1]) \
00912 + _n * _th_plen[1])); \
00913 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) \
00914 { \
00915 int iR = _i + _b_lo[0]; iR += 0; \
00916 T &thisR = * _th_pp;
00917
00918 #define ForAllThisCBNN2(T,b,ns,nc) \
00919 { \
00920 CH_assert(this->contains(b)); \
00921 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00922 const int *_th_plo = this->loVect(); \
00923 const IntVect _th_plen = this->size(); \
00924 const int *_b_lo = (b).loVect(); \
00925 const IntVect _b_len = (b).size(); \
00926 const T* _th_p = this->m_dptr; \
00927 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
00928 { \
00929 const int nR = _n; (int&)nR += 0; \
00930 for (int _j = 0; _j < _b_len[1]; ++_j) \
00931 { \
00932 const int jR = _j + _b_lo[1]; (int&)jR+=0;; \
00933 const T *_th_pp = _th_p \
00934 + ((_b_lo[0] - _th_plo[0]) \
00935 + _th_plen[0]*( \
00936 (_j + _b_lo[1] - _th_plo[1]) \
00937 + _n * _th_plen[1])); \
00938 for (int _i = 0; _i < _b_len[0]; ++_i) \
00939 { \
00940 const int iR = _i + _b_lo[0]; (int&)iR +=0; \
00941 const T &thisR = _th_pp[_i];
00942
00943 #define ForAllThisBNNXC2(T,b,ns,nc,x,nss) \
00944 { \
00945 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00946 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00947 Box _subbox_((x).box()); \
00948 _subbox_ &= this->box(); \
00949 _subbox_ &= b; \
00950 if (!_subbox_.isEmpty()) \
00951 { \
00952 const int *_th_plo = this->loVect(); \
00953 const IntVect _th_plen = this->size(); \
00954 const int *_x_plo = (x).loVect(); \
00955 const IntVect _x_plen = (x).size(); \
00956 const int *_subbox_lo = _subbox_.loVect(); \
00957 const IntVect _subbox_len = _subbox_.size(); \
00958 T* _th_p = this->dataPtr(ns); \
00959 const T* _x_p = (x).dataPtr(nss); \
00960 for (int _n = 0; _n < (nc); ++_n) \
00961 { \
00962 int nR = _n; nR += 0; \
00963 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
00964 { \
00965 const int jR = _j + _subbox_lo[1]; \
00966 T *_th_pp = _th_p \
00967 + ((_subbox_lo[0] - _th_plo[0]) \
00968 + _th_plen[0]*( \
00969 (jR - _th_plo[1]) \
00970 + _n * _th_plen[1])); \
00971 const T *_x_pp = _x_p \
00972 + ((_subbox_lo[0] - _x_plo[0]) \
00973 + _x_plen[0]*( \
00974 (jR - _x_plo[1]) \
00975 + _n * _x_plen[1])); \
00976 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
00977 { \
00978 int iR = _i + _subbox_lo[0]; iR += 0; \
00979 T &thisR = * _th_pp; \
00980 const T & x##R = _x_pp[_i];
00981
00982 #define ForAllThisCBNNXC2(T,b,ns,nc,x,nss) \
00983 { \
00984 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
00985 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00986 Box _subbox_((x).box()); \
00987 _subbox_ &= this->box(); \
00988 _subbox_ &= b; \
00989 if (!_subbox_.isEmpty()) \
00990 { \
00991 const int *_th_plo = this->loVect(); \
00992 const IntVect _th_plen = this->size(); \
00993 const int *_x_plo = (x).loVect(); \
00994 const IntVect _x_plen = (x).size(); \
00995 const int *_subbox_lo = _subbox_.loVect(); \
00996 const IntVect _subbox_len = _subbox_.size(); \
00997 const T* _th_p = this->dataPtr(ns); \
00998 const T* _x_p = (x).dataPtr(nss); \
00999 for (int _n = 0; _n < (nc); ++_n) \
01000 { \
01001 int nR = _n; nR += 0; \
01002 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01003 { \
01004 const int jR = _j + _subbox_lo[1]; \
01005 const T *_th_pp = _th_p \
01006 + ((_subbox_lo[0] - _th_plo[0]) \
01007 + _th_plen[0]*( \
01008 (jR - _th_plo[1]) \
01009 + _n * _th_plen[1])); \
01010 const T *_x_pp = _x_p \
01011 + ((_subbox_lo[0] - _x_plo[0]) \
01012 + _x_plen[0]*( \
01013 (jR - _x_plo[1]) \
01014 + _n * _x_plen[1])); \
01015 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
01016 { \
01017 int iR = _i + _subbox_lo[0]; iR += 0; \
01018 const T &thisR = * _th_pp; \
01019 const T & x##R = _x_pp[_i];
01020
01021 #define ForAllThisBNNXCBN2(T,b,ns,nc,x,bx,nss) \
01022 { \
01023 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01024 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01025 CH_assert(bx.sameSize((b))); \
01026 if (!((b).isEmpty())) \
01027 { \
01028 const int *_th_plo = this->loVect(); \
01029 const IntVect _th_plen = this->size(); \
01030 const int *_x_plo = (x).loVect(); \
01031 const IntVect _x_plen = (x).size(); \
01032 const int *_subbox_lo = (b).loVect(); \
01033 const IntVect _subbox_len = (b).size(); \
01034 const int *_bx_lo = (bx).loVect(); \
01035 T* _th_p = this->dataPtr(ns); \
01036 int nR = ns; int n##x##R = nss; \
01037 const T* _x_p = (x).dataPtr(nss); \
01038 for (int _n = 0; _n < (nc); ++_n, ++nR, ++n##x##R ) \
01039 { \
01040 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01041 { \
01042 const int jR = _j + _subbox_lo[1]; \
01043 const int j##x##R = _j + _bx_lo[1]; \
01044 T *_th_pp = _th_p \
01045 + ((_subbox_lo[0] - _th_plo[0]) \
01046 + _th_plen[0]*( \
01047 (jR - _th_plo[1]) \
01048 + _n * _th_plen[1])); \
01049 const T *_x_pp = _x_p \
01050 + ((_bx_lo[0] - _x_plo[0]) \
01051 + _x_plen[0]*( \
01052 (j##x##R - _x_plo[1]) \
01053 + _n * _x_plen[1])); \
01054 int iR = _subbox_lo[0]; int i##x##R = _bx_lo[0]; \
01055 for (int _i = 0; _i < _subbox_len[0]; \
01056 ++_i, ++_th_pp, ++_x_pp, ++iR, ++i##x##R) \
01057 { \
01058 T &thisR = * _th_pp; \
01059 const T & x##R = * _x_pp;
01060
01061 #define ForAllThisBNNXCBNYCBN2(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01062 { \
01063 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01064 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01065 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01066 Box _subbox_ = this->box(); \
01067 _subbox_ &= b; \
01068 CH_assert((bx).sameSize(_subbox_)); \
01069 CH_assert((by).sameSize(_subbox_)); \
01070 if (!_subbox_.isEmpty()) \
01071 { \
01072 const int *_th_plo = this->loVect(); \
01073 const IntVect _th_plen = this->size(); \
01074 const int *_x_plo = (x).loVect(); \
01075 const IntVect _x_plen = (x).size(); \
01076 const int *_y_plo = (y).loVect(); \
01077 const IntVect _y_plen = (y).size(); \
01078 const int *_subbox_lo = _subbox_.loVect(); \
01079 const IntVect _subbox_len = _subbox_.size(); \
01080 const int *_bx_lo = (bx).loVect(); \
01081 const int *_by_lo = (by).loVect(); \
01082 T* _th_p = this->dataPtr(ns); \
01083 const T* _x_p = (x).dataPtr(nsx); \
01084 const T* _y_p = (y).dataPtr(nsy); \
01085 for (int _n = 0; _n < (nc); ++_n) \
01086 { \
01087 int nR = _n + ns; nR += 0; \
01088 int n##x##R = _n + nsx; n##x##R += 0; \
01089 int n##y##R = _n + nsy; n##y##R += 0; \
01090 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01091 { \
01092 const int jR = _j + _subbox_lo[1]; \
01093 const int j##x##R = _j + _bx_lo[1]; \
01094 const int j##y##R = _j + _by_lo[1]; \
01095 T *_th_pp = _th_p \
01096 + ((_subbox_lo[0] - _th_plo[0]) \
01097 + _th_plen[0]*( \
01098 (jR - _th_plo[1]) \
01099 + _n * _th_plen[1])); \
01100 const T *_x_pp = _x_p \
01101 + ((_bx_lo[0] - _x_plo[0]) \
01102 + _x_plen[0]*( \
01103 (j##x##R - _x_plo[1]) \
01104 + _n * _x_plen[1])); \
01105 const T *_y_pp = _y_p \
01106 + ((_by_lo[0] - _y_plo[0]) \
01107 + _y_plen[0]*( \
01108 (j##y##R - _y_plo[1]) \
01109 + _n * _y_plen[1])); \
01110 for (int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) \
01111 { \
01112 int iR = _i + _subbox_lo[0]; iR += 0; \
01113 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01114 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
01115 T &thisR = * _th_pp; \
01116 const T & x##R = _x_pp[_i]; \
01117 const T & y##R = _y_pp[_i];
01118
01119 #define ForAllRevXBNYCBNNN2(T,x,bx,nsx,y,by,nsy,nc,ir) \
01120 { \
01121 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01122 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01123 CH_assert((ir) >= 0 && (ir) < SpaceDim); \
01124 CH_assert((x).contains(bx)); \
01125 CH_assert((y).contains(by)); \
01126 CH_assert((bx).sameSize(by)); \
01127 const int *_x_plo = (x).loVect(); \
01128 const IntVect _x_plen = (x).size(); \
01129 const int *_y_plo = (y).loVect(); \
01130 const int *_y_plen = (y).size(); \
01131 const int *_bx_lo = (bx).loVect(); \
01132 const int *_by_lo = (by).loVect(); \
01133 const IntVect _len = (bx).size(); \
01134 T* _x_p = (x).dataPtr(nsx); \
01135 const T* _y_p = (y).dataPtr(nsy); \
01136 for (int _n = 0; _n < (nc); ++_n) \
01137 { \
01138 int n##x##R = _n + nsx; n##x##R += 0; \
01139 int n##y##R = _n + nsy; n##y##R += 0; \
01140 for (int _j = 0; _j < _len[1]; ++_j) \
01141 { \
01142 const int j##x##R = _j + _bx_lo[1]; \
01143 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
01144 const int j##y##R = _j + _by_lo[1]; \
01145 T *_x_pp; \
01146 int _ix = 0; \
01147 int _istrd; \
01148 if (ir == 0) \
01149 { \
01150 _x_pp = _x_p \
01151 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
01152 + _x_plen[0]*( \
01153 (j##x##R - _x_plo[1]) \
01154 + _n * _x_plen[1])); \
01155 _istrd = -1; \
01156 } \
01157 else \
01158 { \
01159 _x_pp = _x_p \
01160 + ((_bx_lo[0] - _x_plo[0]) \
01161 + _x_plen[0]*( \
01162 (jrev##x##R - _x_plo[1]) \
01163 + _n * _x_plen[1])); \
01164 _istrd = 1; \
01165 } \
01166 const T *_y_pp = _y_p \
01167 + ((_by_lo[0] - _y_plo[0]) \
01168 + _y_plen[0]*( \
01169 (j##y##R - _y_plo[1]) \
01170 + _n * _y_plen[1])); \
01171 int _x_rev = _len[0]-1; _x_rev += 0; \
01172 for (int _i = 0; _i < _len[0]; ++_i, _ix+=_istrd) \
01173 { \
01174 T & x##R = _x_pp[_ix]; \
01175 const T & y##R = _y_pp[_i];
01176
01177 #define EndFor2 \
01178 } \
01179 } \
01180 } \
01181 }
01182
01183 #define EndForTX2 \
01184 } \
01185 } \
01186 } \
01187 } \
01188 }
01189
01190 #define EndForPencil2 \
01191 } \
01192 } \
01193 }
01194
01195 #elif (CH_SPACEDIM == 3)
01196
01197 #define ForAllThisCPencil3(T,b,ns,nc) \
01198 { \
01199 CH_assert(this->contains(b)); \
01200 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01201 const int *_th_plo = this->loVect(); \
01202 const IntVect _th_plen = this->size(); \
01203 const int *_b_lo = (b).loVect(); \
01204 const IntVect _b_len = (b).size(); \
01205 const T* _th_p = this->m_dptr; \
01206 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01207 { \
01208 int nR = _n; nR += 0; \
01209 for (int _k = 0; _k < _b_len[2]; ++_k) \
01210 { \
01211 const int kR = _k + _b_lo[2]; \
01212 for (int _j = 0; _j < _b_len[1]; ++_j) \
01213 { \
01214 const int jR = _j + _b_lo[1]; \
01215 const T *_th_pp = _th_p \
01216 + ((_b_lo[0] - _th_plo[0]) \
01217 + _th_plen[0]*( \
01218 (jR - _th_plo[1]) \
01219 + _th_plen[1]*( \
01220 (kR - _th_plo[2]) \
01221 + _n * _th_plen[2]))); \
01222 const T &thisR = * _th_pp; \
01223 const int thisLen = _b_len[0];
01224
01225 #define ForAllThisPencil3(T,b,ns,nc) \
01226 { \
01227 CH_assert(this->contains(b)); \
01228 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01229 const int *_th_plo = this->loVect(); \
01230 const IntVect _th_plen = this->size(); \
01231 const int *_b_lo = (b).loVect(); \
01232 const IntVect _b_len = (b).size(); \
01233 T* _th_p = this->m_dptr; \
01234 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01235 { \
01236 const int nR = _n; (int&)nR += 0; \
01237 for (int _k = 0; _k < _b_len[2]; ++_k) \
01238 { \
01239 const int kR = _k + _b_lo[2]; \
01240 for (int _j = 0; _j < _b_len[1]; ++_j) \
01241 { \
01242 const int jR = _j + _b_lo[1]; \
01243 T *_th_pp = _th_p \
01244 + ((_b_lo[0] - _th_plo[0]) \
01245 + _th_plen[0]*( \
01246 (jR - _th_plo[1]) \
01247 + _th_plen[1]*( \
01248 (kR - _th_plo[2]) \
01249 + _n * _th_plen[2]))); \
01250 T &thisR = * _th_pp; \
01251 const int thisLen = _b_len[0]; \
01252
01253 #define ForAllXBPencil3(T,x,b,ns,nc) \
01254 { \
01255 CH_assert((x).contains(b)); \
01256 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01257 const int *_th_plo = (x).loVect(); \
01258 const IntVect _th_plen = (x).size(); \
01259 const int *_b_lo = (b).loVect(); \
01260 const IntVect _b_len = (b).size(); \
01261 T* _th_p = (x) .dataPtr(); \
01262 for (int nR = (ns); nR < (ns)+(nc); ++nR) \
01263 { \
01264 for (int _k = 0; _k < _b_len[2]; ++_k) \
01265 { \
01266 const int kR = _k + _b_lo[2]; \
01267 for (int _j = 0; _j < _b_len[1]; ++_j) \
01268 { \
01269 const int jR = _j + _b_lo[1]; \
01270 T *xR = _th_p \
01271 + ((_b_lo[0] - _th_plo[0]) \
01272 + _th_plen[0]*( \
01273 (jR - _th_plo[1]) \
01274 + _th_plen[1]*( \
01275 (kR - _th_plo[2]) \
01276 + nR * _th_plen[2]))); \
01277 const int thisLen = _b_len[0];
01278
01279 #define ForAllXBNN3(T,x,b,ns,nc) \
01280 { \
01281 CH_assert(x.contains(b)); \
01282 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01283 const int *_x_plo = (x).loVect(); \
01284 const IntVect _x_plen = (x).size(); \
01285 const int *_b_lo = (b).loVect(); \
01286 const IntVect _b_len = (b).size(); \
01287 T* _x_p = (x) .dataPtr(); \
01288 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01289 { \
01290 const int nR = _n; (int&)nR += 0; \
01291 for (int _k = 0; _k < _b_len[2]; ++_k) \
01292 { \
01293 const int kR = _k + _b_lo[2]; \
01294 for (int _j = 0; _j < _b_len[1]; ++_j) \
01295 { \
01296 const int jR = _j + _b_lo[1]; \
01297 T *_x_pp = _x_p \
01298 + ((_b_lo[0] - _x_plo[0]) \
01299 + _x_plen[0]*( \
01300 (jR - _x_plo[1]) \
01301 + _x_plen[1]*( \
01302 (kR - _x_plo[2]) \
01303 + _n * _x_plen[2]))); \
01304 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \
01305 { \
01306 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
01307 T &x##R = * _x_pp;
01308
01309 #define ForAllXBNNnoindx3(T,x,b,ns,nc) \
01310 { \
01311 CH_assert(x.contains(b)); \
01312 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01313 const int *_x_plo = (x).loVect(); \
01314 const IntVect _x_plen = (x).size(); \
01315 const int *_b_lo = (b).loVect(); \
01316 const IntVect _b_len = (b).size(); \
01317 T* _x_p = (x) .dataPtr(); \
01318 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01319 { \
01320 for (int _k = 0; _k < _b_len[2]; ++_k) \
01321 { \
01322 const int kR = _k + _b_lo[2]; \
01323 for (int _j = 0; _j < _b_len[1]; ++_j) \
01324 { \
01325 const int jR = _j + _b_lo[1]; \
01326 T *_x_pp = _x_p \
01327 + ((_b_lo[0] - _x_plo[0]) \
01328 + _x_plen[0]*( \
01329 (jR - _x_plo[1]) \
01330 + _x_plen[1]*( \
01331 (kR - _x_plo[2]) \
01332 + _n * _x_plen[2]))); \
01333 for (int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) \
01334 { \
01335 T &x##R = * _x_pp;
01336
01337 #define ForAllXCBNN3(T,x,b,ns,nc) \
01338 { \
01339 CH_assert(x.contains(b)); \
01340 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01341 const int *_x_plo = (x).loVect(); \
01342 const IntVect _x_plen = (x).size(); \
01343 const int *_b_lo = (b).loVect(); \
01344 const IntVect _b_len = (b).size(); \
01345 const T* _x_p = (x).dataPtr(); \
01346 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01347 { \
01348 const int nR = _n; (int&)nR += 0; \
01349 for (int _k = 0; _k < _b_len[2]; ++_k) \
01350 { \
01351 const int kR = _k + _b_lo[2]; \
01352 for (int _j = 0; _j < _b_len[1]; ++_j) \
01353 { \
01354 const int jR = _j + _b_lo[1]; \
01355 const T *_x_pp = _x_p \
01356 + ((_b_lo[0] - _x_plo[0]) \
01357 + _x_plen[0]*( \
01358 (jR - _x_plo[1]) \
01359 + _x_plen[1]*( \
01360 (kR - _x_plo[2]) \
01361 + _n * _x_plen[2]))); \
01362 for (int _i = 0; _i < _b_len[0]; ++_i) \
01363 { \
01364 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
01365 const T & x##R = _x_pp[_i];
01366
01367 #define ForAllThisBNN3(T,b,ns,nc) \
01368 { \
01369 CH_assert(this->contains(b)); \
01370 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01371 const int *_th_plo = this->loVect(); \
01372 const IntVect _th_plen = this->size(); \
01373 const int *_b_lo = (b).loVect(); \
01374 const IntVect _b_len = (b).size(); \
01375 T* _th_p = this->m_dptr; \
01376 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01377 { \
01378 int nR = _n; nR += 0; \
01379 for (int _k = 0; _k < _b_len[2]; ++_k) \
01380 { \
01381 const int kR = _k + _b_lo[2]; \
01382 for (int _j = 0; _j < _b_len[1]; ++_j) \
01383 { \
01384 const int jR = _j + _b_lo[1]; \
01385 T *_th_pp = _th_p \
01386 + ((_b_lo[0] - _th_plo[0]) \
01387 + _th_plen[0]*( \
01388 (jR - _th_plo[1]) \
01389 + _th_plen[1]*( \
01390 (kR - _th_plo[2]) \
01391 + _n * _th_plen[2]))); \
01392 for (int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) \
01393 { \
01394 int iR = _i + _b_lo[0]; iR += 0; \
01395 T &thisR = * _th_pp;
01396
01397 #define ForAllThisCBNN3(T,b,ns,nc) \
01398 { \
01399 CH_assert(this->contains(b)); \
01400 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01401 const int *_th_plo = this->loVect(); \
01402 const IntVect _th_plen = this->size(); \
01403 const int *_b_lo = (b).loVect(); \
01404 const IntVect _b_len = (b).size(); \
01405 const T* _th_p = this->m_dptr; \
01406 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01407 { \
01408 const int nR = _n; (int&)nR += 0; \
01409 for (int _k = 0; _k < _b_len[2]; ++_k) \
01410 { \
01411 const int kR = _k + _b_lo[2]; \
01412 for (int _j = 0; _j < _b_len[1]; ++_j) \
01413 { \
01414 const int jR = _j + _b_lo[1]; \
01415 const T *_th_pp = _th_p \
01416 + ((_b_lo[0] - _th_plo[0]) \
01417 + _th_plen[0]*( \
01418 (jR - _th_plo[1]) \
01419 + _th_plen[1]*( \
01420 (kR - _th_plo[2]) \
01421 + _n * _th_plen[2]))); \
01422 for (int _i = 0; _i < _b_len[0]; ++_i) \
01423 { \
01424 const int iR = _i + _b_lo[0]; (int&)iR += 0; \
01425 const T &thisR = _th_pp[_i];
01426
01427 #define ForAllThisBNNXC3(T,b,ns,nc,x,nss) \
01428 { \
01429 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01430 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01431 Box _subbox_((x).box()); \
01432 _subbox_ &= this->box(); \
01433 _subbox_ &= b; \
01434 if (!_subbox_.isEmpty()) \
01435 { \
01436 const int *_th_plo = this->loVect(); \
01437 const IntVect _th_plen = this->size(); \
01438 const int *_x_plo = (x).loVect(); \
01439 const IntVect _x_plen = (x).size(); \
01440 const int *_subbox_lo = _subbox_.loVect(); \
01441 const IntVect _subbox_len = _subbox_.size(); \
01442 T* _th_p = this->dataPtr(ns); \
01443 const T* _x_p = (x).dataPtr(nss); \
01444 for (int _n = 0; _n < (nc); ++_n) \
01445 { \
01446 int nR = _n; nR += 0; \
01447 for (int _k = 0; _k < _subbox_len[2]; ++_k) \
01448 { \
01449 const int kR = _k + _subbox_lo[2]; \
01450 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01451 { \
01452 const int jR = _j + _subbox_lo[1]; \
01453 T *_th_pp = _th_p \
01454 + ((_subbox_lo[0] - _th_plo[0]) \
01455 + _th_plen[0]*( \
01456 (jR - _th_plo[1]) \
01457 + _th_plen[1]*( \
01458 (kR - _th_plo[2]) \
01459 + _n * _th_plen[2]))); \
01460 const T *_x_pp = _x_p \
01461 + ((_subbox_lo[0] - _x_plo[0]) \
01462 + _x_plen[0]*( \
01463 (jR - _x_plo[1]) \
01464 + _x_plen[1]*( \
01465 (kR - _x_plo[2]) \
01466 + _n * _x_plen[2]))); \
01467 for (int _i = 0; _i < _subbox_len[0]; \
01468 ++_i, ++_th_pp) \
01469 { \
01470 int iR = _i + _subbox_lo[0]; iR += 0; \
01471 T &thisR = * _th_pp; \
01472 const T & x##R = _x_pp[_i];
01473
01474 #define ForAllThisCBNNXC3(T,b,ns,nc,x,nss) \
01475 { \
01476 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01477 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01478 Box _subbox_((x).box()); \
01479 _subbox_ &= this->box(); \
01480 _subbox_ &= b; \
01481 if (!_subbox_.isEmpty()) \
01482 { \
01483 const int *_th_plo = this->loVect(); \
01484 const IntVect _th_plen = this->size(); \
01485 const int *_x_plo = (x).loVect(); \
01486 const IntVect _x_plen = (x).size(); \
01487 const int *_subbox_lo = _subbox_.loVect(); \
01488 const IntVect _subbox_len = _subbox_.size(); \
01489 const T* _th_p = this->dataPtr(ns); \
01490 const T* _x_p = (x).dataPtr(nss); \
01491 for (int _n = 0; _n < (nc); ++_n) \
01492 { \
01493 int nR = _n; nR += 0; \
01494 for (int _k = 0; _k < _subbox_len[2]; ++_k) \
01495 { \
01496 const int kR = _k + _subbox_lo[2]; \
01497 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01498 { \
01499 const int jR = _j + _subbox_lo[1]; \
01500 const T *_th_pp = _th_p \
01501 + ((_subbox_lo[0] - _th_plo[0]) \
01502 + _th_plen[0]*( \
01503 (jR - _th_plo[1]) \
01504 + _th_plen[1]*( \
01505 (kR - _th_plo[2]) \
01506 + _n * _th_plen[2]))); \
01507 const T *_x_pp = _x_p \
01508 + ((_subbox_lo[0] - _x_plo[0]) \
01509 + _x_plen[0]*( \
01510 (jR - _x_plo[1]) \
01511 + _x_plen[1]*( \
01512 (kR - _x_plo[2]) \
01513 + _n * _x_plen[2]))); \
01514 for (int _i = 0; _i < _subbox_len[0]; \
01515 ++_i, ++_th_pp) \
01516 { \
01517 int iR = _i + _subbox_lo[0]; iR += 0; \
01518 const T &thisR = * _th_pp; \
01519 const T & x##R = _x_pp[_i];
01520
01521 #define ForAllThisBNNXCBN3(T,b,ns,nc,x,bx,nss) \
01522 { \
01523 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01524 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01525 CH_assert((bx).sameSize((b))); \
01526 if (!((b).isEmpty())) \
01527 { \
01528 const int *_th_plo = this->loVect(); \
01529 const IntVect _th_plen = this->size(); \
01530 const int *_x_plo = (x).loVect(); \
01531 const IntVect _x_plen = (x).size(); \
01532 const int *_subbox_lo = (b).loVect(); \
01533 IntVect _subbox_len = (b).size(); \
01534 const int *_bx_lo = (bx).loVect(); \
01535 T* _th_p = this->dataPtr(ns); \
01536 const T* _x_p = (x).dataPtr(nss); \
01537 for (int _n = 0; _n < (nc); ++_n) \
01538 { \
01539 int nR = _n + ns; nR += 0; \
01540 int n##x##R = _n + nss; n##x##R += 0; \
01541 for (int _k = 0; _k < _subbox_len[2]; ++_k) \
01542 { \
01543 const int kR = _k + _subbox_lo[2]; \
01544 const int k##x##R = _k + _bx_lo[2]; \
01545 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01546 { \
01547 const int jR = _j + _subbox_lo[1]; \
01548 const int j##x##R = _j + _bx_lo[1]; \
01549 T *_th_pp = _th_p \
01550 + ((_subbox_lo[0] - _th_plo[0]) \
01551 + _th_plen[0]*( \
01552 (jR - _th_plo[1]) \
01553 + _th_plen[1]*( \
01554 (kR - _th_plo[2]) \
01555 + _n * _th_plen[2]))); \
01556 const T *_x_pp = _x_p \
01557 + ((_bx_lo[0] - _x_plo[0]) \
01558 + _x_plen[0]*( \
01559 (j##x##R - _x_plo[1]) \
01560 + _x_plen[1]*( \
01561 (k##x##R - _x_plo[2]) \
01562 + _n * _x_plen[2]))); \
01563 for (int _i = 0; _i < _subbox_len[0]; \
01564 ++_i, ++_th_pp) \
01565 { \
01566 int iR = _i + _subbox_lo[0]; iR += 0; \
01567 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01568 T &thisR = * _th_pp; \
01569 const T & x##R = _x_pp[_i];
01570
01571 #define ForAllThisBNNXCBNYCBN3(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01572 { \
01573 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01574 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01575 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01576 Box _subbox_(this->box()); \
01577 _subbox_ &= b; \
01578 CH_assert((bx).sameSize(_subbox_)); \
01579 CH_assert((by).sameSize(_subbox_)); \
01580 if (!_subbox_.isEmpty()) \
01581 { \
01582 const int *_th_plo = this->loVect(); \
01583 const IntVect _th_plen = this->size(); \
01584 const int *_x_plo = (x).loVect(); \
01585 const IntVect _x_plen = (x).size(); \
01586 const int *_y_plo = (y).loVect(); \
01587 const IntVect _y_plen = (y).size(); \
01588 const int *_subbox_lo = _subbox_.loVect(); \
01589 const IntVect _subbox_len = _subbox_.size(); \
01590 const int *_bx_lo = (bx).loVect(); \
01591 const int *_by_lo = (by).loVect(); \
01592 T* _th_p = this->dataPtr(ns); \
01593 const T* _x_p = (x).dataPtr(nsx); \
01594 const T* _y_p = (y).dataPtr(nsy); \
01595 for (int _n = 0; _n < (nc); ++_n) \
01596 { \
01597 int nR = _n + ns; nR += 0; \
01598 int n##x##R = _n + nsx; n##x##R += 0; \
01599 int n##y##R = _n + nsy; n##y##R += 0; \
01600 for (int _k = 0; _k < _subbox_len[2]; ++_k) \
01601 { \
01602 const int kR = _k + _subbox_lo[2]; \
01603 const int k##x##R = _k + _bx_lo[2]; \
01604 const int k##y##R = _k + _by_lo[2]; \
01605 for (int _j = 0; _j < _subbox_len[1]; ++_j) \
01606 { \
01607 const int jR = _j + _subbox_lo[1]; \
01608 const int j##x##R = _j + _bx_lo[1]; \
01609 const int j##y##R = _j + _by_lo[1]; \
01610 T *_th_pp = _th_p \
01611 + ((_subbox_lo[0] - _th_plo[0]) \
01612 + _th_plen[0]*( \
01613 (jR - _th_plo[1]) \
01614 + _th_plen[1]*( \
01615 (kR - _th_plo[2]) \
01616 + _n * _th_plen[2]))); \
01617 const T *_x_pp = _x_p \
01618 + ((_bx_lo[0] - _x_plo[0]) \
01619 + _x_plen[0]*( \
01620 (j##x##R - _x_plo[1]) \
01621 + _x_plen[1]*( \
01622 (k##x##R - _x_plo[2]) \
01623 + _n * _x_plen[2]))); \
01624 const T *_y_pp = _y_p \
01625 + ((_by_lo[0] - _y_plo[0]) \
01626 + _y_plen[0]*( \
01627 (j##y##R - _y_plo[1]) \
01628 + _y_plen[1]*( \
01629 (k##y##R - _y_plo[2]) \
01630 + _n * _y_plen[2]))); \
01631 for (int _i = 0; _i < _subbox_len[0]; \
01632 ++_i, ++_th_pp) \
01633 { \
01634 int iR = _i + _subbox_lo[0]; iR += 0; \
01635 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01636 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
01637 T &thisR = * _th_pp; \
01638 const T & x##R = _x_pp[_i]; \
01639 const T & y##R = _y_pp[_i];
01640
01641 #define ForAllRevXBNYCBNNN3(T,x,bx,nsx,y,by,nsy,nc,ir) \
01642 { \
01643 CH_assert((ir) >= 0 && (ir) < SpaceDim); \
01644 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01645 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01646 CH_assert((x).contains(bx)); \
01647 CH_assert((y).contains(by)); \
01648 CH_assert((bx).sameSize(by)); \
01649 const int *_x_plo = (x).loVect(); \
01650 const IntVect _x_plen = (x).size(); \
01651 const int *_y_plo = (y).loVect(); \
01652 intVect _y_plen = (y).size(); \
01653 const int *_bx_lo = (bx).loVect(); \
01654 const int *_by_lo = (by).loVect(); \
01655 const IntVect _len = (bx).size(); \
01656 T* _x_p = (x).dataPtr(nsx); \
01657 const T* _y_p = (y).dataPtr(nsy); \
01658 for (int _n = 0; _n < (nc); ++_n) \
01659 { \
01660 int n##x##R = _n + nsx; n##x##R += 0; \
01661 int n##y##R = _n + nsy; n##y##R += 0; \
01662 for (int _k = 0; _k < _len[2]; ++_k) \
01663 { \
01664 const int k##x##R = _k + _bx_lo[2]; \
01665 const int krev##x##R = _len[2]-1-_k + _bx_lo[2]; \
01666 const int k##y##R = _k + _by_lo[2]; \
01667 for (int _j = 0; _j < _len[1]; ++_j) \
01668 { \
01669 const int j##x##R = _j + _bx_lo[1]; \
01670 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
01671 const int j##y##R = _j + _by_lo[1]; \
01672 T *_x_pp; \
01673 int _ix = 0; \
01674 int _istrd = 1; \
01675 if (ir == 0) \
01676 { \
01677 _x_pp = _x_p \
01678 + ((_bx_lo[0] - _x_plo[0]) + _len[0]-1 \
01679 + _x_plen[0]*( \
01680 (j##x##R - _x_plo[1]) \
01681 + _x_plen[1]*( \
01682 (k##x##R - _x_plo[2]) \
01683 + _n * _x_plen[2]))); \
01684 _istrd = -1; \
01685 } \
01686 else if (ir == 1) \
01687 { \
01688 _x_pp = _x_p \
01689 + ((_bx_lo[0] - _x_plo[0]) \
01690 + _x_plen[0]*( \
01691 (jrev##x##R - _x_plo[1]) \
01692 + _x_plen[1]*( \
01693 (k##x##R - _x_plo[2]) \
01694 + _n * _x_plen[2]))); \
01695 } \
01696 else \
01697 { \
01698 _x_pp = _x_p \
01699 + ((_bx_lo[0] - _x_plo[0]) \
01700 + _x_plen[0]*( \
01701 (j##x##R - _x_plo[1]) \
01702 + _x_plen[1]*( \
01703 (krev##x##R - _x_plo[2]) \
01704 + _n * _x_plen[2]))); \
01705 } \
01706 const T *_y_pp = _y_p \
01707 + ((_by_lo[0] - _y_plo[0]) \
01708 + _y_plen[0]*( \
01709 (j##y##R - _y_plo[1]) \
01710 + _y_plen[1]*( \
01711 (k##y##R - _y_plo[2]) \
01712 + _n * _y_plen[2]))); \
01713 for (int _i = 0; _i < _len[0]; ++_i, _ix += _istrd) \
01714 { \
01715 T & x##R = _x_pp[_ix]; \
01716 const T & y##R = _y_pp[_i];
01717
01718 #define EndFor3 \
01719 } \
01720 } \
01721 } \
01722 } \
01723 }
01724
01725 #define EndForTX3 \
01726 } \
01727 } \
01728 } \
01729 } \
01730 } \
01731 }
01732
01733 #define EndForPencil3 \
01734 } \
01735 } \
01736 } \
01737 }
01738
01739 #elif (CH_SPACEDIM > 3)
01740
01741 #define ForAllThisCPencilHiDim(T,b,ns,nc) \
01742 { \
01743 CH_assert(this->contains(b)); \
01744 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01745 const IntVect _b_len = (b).size(); \
01746 Box _pencil_box(b); \
01747 _pencil_box.setBig(0,b.smallEnd(0)); \
01748 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01749 { \
01750 int nR = _n; nR += 0; \
01751 BoxIterator _bit( _pencil_box ); \
01752 for (_bit.begin(); _bit.ok(); ++_bit) \
01753 { \
01754 IntVect _iv = _bit(); \
01755 const T &thisR = this->operator()(_iv,_n); \
01756 const int thisLen = _b_len[0]; \
01757 int jR = _iv[1]; jR += 0; \
01758 int kR = _iv[2]; kR += 0;
01759
01760 #define ForAllThisPencilHiDim(T,b,ns,nc) \
01761 { \
01762 CH_assert(this->contains(b)); \
01763 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01764 const IntVect _b_len = (b).size(); \
01765 Box _pencil_box(b); \
01766 _pencil_box.setBig(0,b.smallEnd(0)); \
01767 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01768 { \
01769 const int nR = _n; \
01770 BoxIterator _bit( _pencil_box ); \
01771 for (_bit.begin(); _bit.ok(); ++_bit) \
01772 { \
01773 IntVect _iv = _bit(); \
01774 T &thisR = this->operator()(_iv,nR); \
01775 const int thisLen = _b_len[0]; \
01776 int jR = _iv[1]; jR += 0; \
01777 int kR = _iv[2]; kR += 0;
01778
01779 #define ForAllXBPencilHiDim(T,x,b,ns,nc) \
01780 { \
01781 CH_assert((x).contains(b)); \
01782 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01783 const IntVect _b_len = (b).size(); \
01784 Box _pencil_box(b); \
01785 _pencil_box.setBig(0,b.smallEnd(0)); \
01786 for (int nR = (ns); nR < (ns)+(nc); ++nR) \
01787 { \
01788 BoxIterator _bit( _pencil_box ); \
01789 for (_bit.begin(); _bit.ok(); ++_bit) \
01790 { \
01791 IntVect _iv = _bit(); \
01792 T *xR = &(x).operator()(_iv,nR); \
01793 const int thisLen = _b_len[0]; \
01794 int jR = _iv[1]; jR += 0; \
01795 int kR = _iv[2]; kR += 0;
01796
01797 #define ForAllXBNNHiDim(T,x,b,ns,nc) \
01798 { \
01799 CH_assert(x.contains(b)); \
01800 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01801 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01802 { \
01803 const int nR = _n; (int&)nR += 0; \
01804 BoxIterator _bit( (b) ); \
01805 for (_bit.begin(); _bit.ok(); ++_bit) \
01806 { \
01807 IntVect _iv = _bit(); \
01808 T &x##R = (x)(_iv,nR); \
01809 T *_x_pp = &x##R; _x_pp += 0; \
01810 int iR = _iv[0]; iR += 0; \
01811 int jR = _iv[1]; jR += 0; \
01812 int kR = _iv[2]; kR += 0;
01813
01814 #define ForAllXBNNnoindxHiDim(T,x,b,ns,nc) \
01815 { \
01816 CH_assert(x.contains(b)); \
01817 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01818 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01819 { \
01820 BoxIterator _bit( (b) ); \
01821 for (_bit.begin(); _bit.ok(); ++_bit) \
01822 { \
01823 IntVect _iv = _bit(); \
01824 T& x##R = (x)(_iv,_n); \
01825 int iR = _iv[0]; iR += 0; \
01826 int jR = _iv[1]; jR += 0; \
01827 int kR = _iv[2]; kR += 0;
01828
01829 #define ForAllXCBNNHiDim(T,x,b,ns,nc) \
01830 { \
01831 CH_assert(x.contains(b)); \
01832 CH_assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
01833 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01834 { \
01835 const int nR = _n; \
01836 BoxIterator _bit( (b) ); \
01837 for (_bit.begin(); _bit.ok(); ++_bit) \
01838 { \
01839 IntVect _iv = _bit(); \
01840 const T & x##R = (x)(_iv, nR); \
01841 const T *_x_pp = &x##R; _x_pp += 0; \
01842 const int iR = _iv[0]; (int&)iR += 0; \
01843 const int jR = _iv[1]; (int&)jR += 0; \
01844 const int kR = _iv[2]; (int&)kR += 0;
01845
01846 #define ForAllThisBNNHiDim(T,b,ns,nc) \
01847 { \
01848 CH_assert(this->contains(b)); \
01849 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01850 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01851 { \
01852 int nR = _n; nR += 0; \
01853 BoxIterator _bit( (b)); \
01854 for (_bit.begin(); _bit.ok(); ++_bit) \
01855 { \
01856 IntVect _iv = _bit(); \
01857 T &thisR = this->operator()(_iv,nR); \
01858 int iR = _iv[0]; iR += 0; \
01859 int jR = _iv[1]; jR += 0; \
01860 int kR = _iv[2]; kR += 0;
01861
01862 #define ForAllThisCBNNHiDim(T,b,ns,nc) \
01863 { \
01864 CH_assert(this->contains(b)); \
01865 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01866 for (int _n = (ns); _n < (ns)+(nc); ++_n) \
01867 { \
01868 const int nR = _n; \
01869 BoxIterator _bit( (b) ); \
01870 for (_bit.begin(); _bit.ok(); ++_bit) \
01871 { \
01872 IntVect _iv = _bit(); \
01873 const T &thisR = this->operator()(_iv,nR); \
01874 const int iR = _iv[0]; (int&)iR +=0; \
01875 const int jR = _iv[1]; (int&)jR +=0; \
01876 const int kR = _iv[2]; (int&)kR +=0;
01877
01878 #define ForAllThisBNNXCHiDim(T,b,ns,nc,x,nss) \
01879 { \
01880 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01881 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01882 Box _subbox_((x).box()); \
01883 _subbox_ &= this->box(); \
01884 _subbox_ &= b; \
01885 if (!_subbox_.isEmpty()) \
01886 { \
01887 for (int _n = 0; _n < (nc); ++_n) \
01888 { \
01889 int nR = _n; nR += 0; \
01890 BoxIterator _bit(_subbox_); \
01891 for (_bit.begin(); _bit.ok(); ++_bit) \
01892 { \
01893 IntVect _iv = _bit(); \
01894 T &thisR = this->operator()(_iv, ns+nR); \
01895 const T & x##R = (x)(_iv, nss+nR); \
01896 const int iR = _iv[0]; (int&)iR += 0; \
01897 const int jR = _iv[1]; (int&)jR += 0; \
01898 const int kR = _iv[2]; (int&)kR += 0;
01899
01900 #define ForAllThisCBNNXCHiDim(T,b,ns,nc,x,nss) \
01901 { \
01902 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01903 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01904 Box _subbox_((x).box()); \
01905 _subbox_ &= this->box(); \
01906 _subbox_ &= b; \
01907 if (!_subbox_.isEmpty()) \
01908 { \
01909 for (int _n = 0; _n < (nc); ++_n) \
01910 { \
01911 int nR = _n; nR += 0; \
01912 BoxIterator _bit(_subbox_); \
01913 for (_bit.begin(); _bit.ok(); ++_bit) \
01914 { \
01915 IntVect _iv = _bit(); \
01916 const T &thisR = this->operator()(_iv,ns+nR); \
01917 const T & x##R = (x)(_iv,nss+nR); \
01918 const int iR = _iv[0]; (int&)iR += 0; \
01919 const int jR = _iv[1]; (int&)jR += 0; \
01920 const int kR = _iv[2]; (int&)kR += 0;
01921
01922 #define ForAllThisBNNXCBNHiDim(T,b,ns,nc,x,bx,nss) \
01923 { \
01924 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01925 CH_assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01926 CH_assert((bx).sameSize((b))); \
01927 if (!((b).isEmpty())) \
01928 { \
01929 for (int _n = 0; _n < (nc); ++_n) \
01930 { \
01931 int nR = _n + ns; nR += 0; \
01932 int n##x##R = _n + nss; n##x##R += 0; \
01933 BoxIterator this_Bit( (b) ); \
01934 IntVect _bxOffset = bx.smallEnd() - b.smallEnd(); \
01935 for (this_Bit.begin(); this_Bit.ok(); ++this_Bit) \
01936 { \
01937 IntVect _thisIV = this_Bit(); \
01938 IntVect _xIV = _thisIV + _bxOffset; \
01939 T &thisR = this->operator()(_thisIV, nR); \
01940 const T & x##R = (x)(_xIV,n##x##R); \
01941 int iR = _xIV[0]; iR += 0; \
01942 int jR = _xIV[1]; jR += 0; \
01943 int kR = _xIV[2]; kR += 0;
01944
01945 #define ForAllThisBNNXCBNYCBNHiDim(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01946 { \
01947 CH_assert((ns) >= 0 && (ns) + (nc) <= this->nComp()); \
01948 CH_assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01949 CH_assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01950 Box _subbox_(this->box()); \
01951 _subbox_ &= b; \
01952 CH_assert((bx).sameSize(_subbox_)); \
01953 CH_assert((by).sameSize(_subbox_)); \
01954 if (!_subbox_.isEmpty()) \
01955 { \
01956 for (int _n = 0; _n < (nc); ++_n) \
01957 { \
01958 int nR = _n + ns; nR += 0; \
01959 int n##x##R = _n + nsx; n##x##R += 0; \
01960 int n##y##R = _n + nsy; n##y##R += 0; \
01961 BoxIterator _thisBit(_subbox_); \
01962 IntVect _xOffset = bx.smallEnd() - _subbox_.smallEnd(); \
01963 IntVect _yOffset = by.smallEnd() - _subbox_.smallEnd(); \
01964 for (_thisBit.begin(); _thisBit.ok(); ++_thisBit) \
01965 { \
01966 IntVect _thisIV = _thisBit(); \
01967 IntVect _xIV = _thisIV + _xOffset; \
01968 IntVect _yIV = _thisIV + _yOffset; \
01969 T &thisR = this->operator()(_thisIV,nR); \
01970 const T & x##R = (x)(_xIV,n##x##R); \
01971 const T & y##R = (y)(_yIV,n##y##R); \
01972 int iR = _thisIV[0]; iR += 0; \
01973 int jR = _thisIV[1]; jR += 0; \
01974 int kR = _thisIV[2]; kR += 0;
01975
01976 #define EndForHiDim \
01977 } \
01978 } \
01979 }
01980
01981 #define EndForTXHiDim \
01982 } \
01983 } \
01984 } \
01985 }
01986
01987 #define EndForPencilHiDim \
01988 } \
01989 } \
01990 }
01991
01992 #endif
01993
01994
01995
01996
01997
01998 #define ForAllXPencil(T,x) ForAllXBPencil(T,x,((x).box()),0,((x).nComp()))
01999
02000
02001
02002
02003
02004
02005 #define ForAllX(T,x) ForAllXBNN(T,x,((x).box()),0,((x).nComp()))
02006
02007
02008
02009
02010 #define ForAllXC(T,x) ForAllXCBNN(T,x,((x).box()),0,((x).nComp()))
02011
02012
02013
02014
02015
02016 #define ForAllXB(T,x,b) ForAllXBNN(T,x,(b),0,(x).nComp())
02017
02018
02019
02020
02021 #define ForAllXBC(T,x,b) ForAllXCBNN(T,x,(b),0,(x).nComp())
02022
02023
02024
02025
02026
02027
02028 #define ForAllThis(T) ForAllThisBNN(T,this->m_domain,0,this->nComp())
02029
02030
02031
02032
02033 #define ForAllThisC(T) ForAllThisCBNN(T,this->m_domain,0,this->nComp())
02034
02035
02036
02037
02038
02039 #define ForAllThisB(T,b) ForAllThisBNN(T,(b),0,this->nComp())
02040
02041
02042
02043
02044 #define ForAllThisCB(T,b) ForAllThisCBNN(T,(b),0,this->nComp())
02045
02046
02047
02048
02049
02050 #define ForAllThisNN(T,ns,nc) ForAllThisBNN(T,this->m_domain,ns,nc)
02051
02052
02053
02054
02055
02056
02057 #define ForAllThisXC(T,x) ForAllThisBNNXC(T,this->m_domain,0,this->nComp(),x,0)
02058
02059 #ifdef DOXYGEN
02060 #undef CH_SPACEDIM
02061 #endif
02062
02063 #endif // matches CH_SPACEDIM != LAST_BASEFABMACROS_H_SPACEDIM