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