00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _CH_LAME_MACROS_H
00029 #define _CH_LAME_MACROS_H
00030
00031 #if (CH_SPACEDIM == 1)
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #define ForAllThisPencil(T,b,ns,nc) \
00072 { \
00073 assert(contains(b)); \
00074 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00075 const int *_th_plo = loVect(); \
00076 const int *_th_plen = size(); \
00077 const int *_b_lo = (b).loVect(); \
00078 const int *_b_len = (b).size(); \
00079 T* _th_p = dptr; \
00080 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00081 const int nR = _n; \
00082 T *_th_pp = _th_p \
00083 + ((_b_lo[0] - _th_plo[0]) \
00084 + _n * _th_plen[0]); \
00085 T &thisR = * _th_pp; \
00086 const int thisLen = _b_len[0]; \
00087
00088
00089
00090
00091
00092 #define ForAllXBPencil(T,x,b,ns,nc) \
00093 { \
00094 assert(x.contains(b)); \
00095 assert((ns) >= 0 && (ns) + (nc) <= x.nComp()); \
00096 const int *_th_plo = x.loVect(); \
00097 const int *_th_plen = x.size(); \
00098 const int *_b_lo = (b).loVect(); \
00099 const int *_b_len = (b).size(); \
00100 T* _th_p = x.dataPtr(); \
00101 for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
00102 T * xR = _th_p \
00103 + ((_b_lo[0] - _th_plo[0]) \
00104 + nR * _th_plen[0]); \
00105 const int thisLen = _b_len[0];
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 #define ForAllThisCPencil(T,b,ns,nc) \
00125 { \
00126 assert(contains(b)); \
00127 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00128 const int *_th_plo = loVect(); \
00129 const int *_th_plen = size(); \
00130 const int *_b_lo = (b).loVect(); \
00131 const int *_b_len = (b).size(); \
00132 const T* _th_p = dptr; \
00133 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00134 int nR = _n; nR += 0; \
00135 const T *_th_pp = _th_p \
00136 + ((_b_lo[0] - _th_plo[0]) \
00137 + _n * _th_plen[0]); \
00138 const T &thisR = * _th_pp; \
00139 const int thisLen = _b_len[0];
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 #define ForAllXBNN(T,x,b,ns,nc) \
00163 { \
00164 assert(x.contains(b)); \
00165 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00166 const int *_x_plo = (x).loVect(); \
00167 const int *_x_plen = (x).size(); \
00168 const int *_b_lo = (b).loVect(); \
00169 const int *_b_len = (b).size(); \
00170 T* _x_p = (x) .dataPtr(); \
00171 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00172 const int nR = _n; \
00173 T *_x_pp = _x_p \
00174 + ((_b_lo[0] - _x_plo[0]) \
00175 + _n * _x_plen[0]); \
00176 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00177 const int iR = _i + _b_lo[0]; \
00178 T &x##R = * _x_pp;
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 #define ForAllXCBNN(T,x,b,ns,nc) \
00198 { \
00199 assert(x.contains(b)); \
00200 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00201 const int *_x_plo = (x).loVect(); \
00202 const int *_x_plen = (x).size(); \
00203 const int *_b_lo = (b).loVect(); \
00204 const int *_b_len = (b).size().getVect(); \
00205 const T* _x_p = (x).dataPtr(); \
00206 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00207 const int nR = _n; \
00208 const T *_x_pp = _x_p \
00209 + ((_b_lo[0] - _x_plo[0]) \
00210 + _n * _x_plen[0]); \
00211 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00212 const int iR = _i + _b_lo[0]; \
00213 const T & x##R = _x_pp[_i];
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 #define ForAllThisBNN(T,b,ns,nc) \
00249 { \
00250 assert(contains(b)); \
00251 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00252 const int *_th_plo = loVect(); \
00253 const int *_th_plen = size(); \
00254 const int *_b_lo = (b).loVect(); \
00255 const int *_b_len = (b).size().getVect(); \
00256 T* _th_p = dptr; \
00257 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00258 int nR = _n; nR += 0; \
00259 T *_th_pp = _th_p \
00260 + ((_b_lo[0] - _th_plo[0]) \
00261 + _n * _th_plen[0]); \
00262 for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00263 int iR = _i + _b_lo[0]; iR += 0; \
00264 T &thisR = * _th_pp;
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283 #define ForAllThisCBNN(T,b,ns,nc) \
00284 { \
00285 assert(contains(b)); \
00286 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00287 const int *_th_plo = loVect(); \
00288 const int *_th_plen = size(); \
00289 const int *_b_lo = (b).loVect(); \
00290 const int *_b_len = (b).size().getVect(); \
00291 const T* _th_p = dptr; \
00292 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00293 const int nR = _n; \
00294 const T *_th_pp = _th_p \
00295 + ((_b_lo[0] - _th_plo[0]) \
00296 + _n * _th_plen[0]); \
00297 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00298 const int iR = _i + _b_lo[0]; \
00299 const T &thisR = _th_pp[_i];
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322 #define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
00323 { \
00324 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00325 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00326 Box _subbox_((x).box()); \
00327 _subbox_ &= box(); \
00328 _subbox_ &= b; \
00329 if(!_subbox_.isEmpty()) { \
00330 const int *_th_plo = loVect(); \
00331 const int *_th_plen = size(); \
00332 const int *_x_plo = (x).loVect(); \
00333 const int *_x_plen = (x).size(); \
00334 const int *_subbox_lo = _subbox_.loVect(); \
00335 const int *_subbox_len = _subbox_.size().getVect(); \
00336 T* _th_p = dataPtr(ns); \
00337 const T* _x_p = (x).dataPtr(nss); \
00338 for(int _n = 0; _n < (nc); ++_n) { \
00339 int nR = _n; nR += 0; \
00340 T *_th_pp = _th_p \
00341 + ((_subbox_lo[0] - _th_plo[0]) \
00342 + _n * _th_plen[0]); \
00343 const T *_x_pp = _x_p \
00344 + ((_subbox_lo[0] - _x_plo[0]) \
00345 + _n * _x_plen[0]); \
00346 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00347 int iR = _i + _subbox_lo[0]; iR += 0; \
00348 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371 #define ForAllThisBNNXCBN(T,b,ns,nc,x,bx,nss) \
00372 { \
00373 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00374 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00375 assert(bx.sameSize((b))); \
00376 if(!((b).isEmpty())) { \
00377 const int *_th_plo = loVect(); \
00378 const int *_th_plen = size(); \
00379 const int *_x_plo = (x).loVect(); \
00380 const int *_x_plen = (x).size(); \
00381 const int *_subbox_lo = (b).loVect(); \
00382 const int *_subbox_len = (b).size().getVect(); \
00383 const int *_bx_lo = (bx).loVect(); \
00384 T* _th_p = dataPtr(ns); \
00385 const T* _x_p = (x).dataPtr(nss); \
00386 for(int _n = 0; _n < (nc); ++_n) { \
00387 int nR = _n + ns; nR += 0; \
00388 int n##x##R = _n + nss; n##x##R += 0; \
00389 T *_th_pp = _th_p \
00390 + ((_subbox_lo[0] - _th_plo[0]) \
00391 + _n * _th_plen[0]); \
00392 const T *_x_pp = _x_p \
00393 + ((_bx_lo[0] - _x_plo[0]) \
00394 + _n * _x_plen[0]); \
00395 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00396 int iR = _i + _subbox_lo[0]; iR += 0; \
00397 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00398 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425 #define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00426 { \
00427 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00428 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00429 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00430 Box _subbox_ = box(); \
00431 _subbox_ &= b; \
00432 assert((bx).sameSize(_subbox_)); \
00433 assert((by).sameSize(_subbox_)); \
00434 if(!_subbox_.isEmpty()) { \
00435 const int *_th_plo = loVect(); \
00436 const int *_th_plen = size(); \
00437 const int *_x_plo = (x).loVect(); \
00438 const int *_x_plen = (x).size(); \
00439 const int *_y_plo = (y).loVect(); \
00440 const int *_y_plen = (y).size(); \
00441 const int *_subbox_lo = _subbox_.loVect(); \
00442 const int *_subbox_len = _subbox_.size().getVect(); \
00443 const int *_bx_lo = (bx).loVect(); \
00444 const int *_by_lo = (by).loVect(); \
00445 T* _th_p = dataPtr(ns); \
00446 const T* _x_p = (x).dataPtr(nsx); \
00447 const T* _y_p = (y).dataPtr(nsy); \
00448 for(int _n = 0; _n < (nc); ++_n) { \
00449 int nR = _n + ns; nR += 0; \
00450 int n##x##R = _n + nsx; n##x##R += 0; \
00451 int n##y##R = _n + nsy; n##y##R += 0; \
00452 T *_th_pp = _th_p \
00453 + ((_subbox_lo[0] - _th_plo[0]) \
00454 + _n * _th_plen[0]); \
00455 const T *_x_pp = _x_p \
00456 + ((_bx_lo[0] - _x_plo[0]) \
00457 + _n * _x_plen[0]); \
00458 const T *_y_pp = _y_p \
00459 + ((_by_lo[0] - _y_plo[0]) \
00460 + _n * _y_plen[0]); \
00461 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00462 int iR = _i + _subbox_lo[0]; iR += 0; \
00463 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00464 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
00465 T &thisR = * _th_pp; \
00466 const T & x##R = _x_pp[_i]; \
00467 const T & y##R = _y_pp[_i];
00468
00469 #define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ri) \
00470 { \
00471 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00472 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00473 assert((x).contains(bx)); \
00474 assert((y).contains(by)); \
00475 assert((bx).sameSize(by)); \
00476 const int *_x_plo = (x).loVect(); \
00477 const int *_x_plen = (x).size(); \
00478 const int *_y_plo = (y).loVect(); \
00479 const int *_y_plen = (y).size(); \
00480 const int *_len = (bx).size().getVect(); \
00481 const int *_bx_lo = (bx).loVect(); \
00482 const int *_by_lo = (by).loVect(); \
00483 T* _x_p = (x).dataPtr(nsx); \
00484 const T* _y_p = (y).dataPtr(nsy); \
00485 for(int _n = 0; _n < (nc); ++_n) { \
00486 int n##x##R = _n + nsx; n##x##R += 0; \
00487 int n##y##R = _n + nsy; n##y##R += 0; \
00488 int _ix = 0; \
00489 T *_x_pp = _x_p \
00490 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
00491 + _n * _x_plen[0]); \
00492 const T *_y_pp = _y_p \
00493 + ((_by_lo[0] - _y_plo[0]) \
00494 + _n * _y_plen[0]); \
00495 for(int _i = 0; _i < _len[0]; ++_i, --_ix) { \
00496 T & x##R = _x_pp[_ix]; \
00497 const T & y##R = _y_pp[_i];
00498
00499
00500
00501
00502
00503 #define EndForTX }}}}
00504
00505
00506
00507
00508
00509 #define EndFor }}}
00510
00511
00512
00513
00514 #define EndForPencil }}
00515
00516 #elif (CH_SPACEDIM == 2)
00517
00518 #define ForAllThisCPencil(T,b,ns,nc) \
00519 { \
00520 assert(contains(b)); \
00521 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00522 const int *_th_plo = loVect(); \
00523 const int *_th_plen = size(); \
00524 const int *_b_lo = (b).loVect(); \
00525 const int *_b_len = (b).size().getVect(); \
00526 const T* _th_p = dptr; \
00527 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00528 int nR = _n; nR += 0; \
00529 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00530 const int jR = _j + _b_lo[1]; \
00531 const T *_th_pp = _th_p \
00532 + ((_b_lo[0] - _th_plo[0]) \
00533 + _th_plen[0]*( \
00534 (jR - _th_plo[1]) \
00535 + _n * _th_plen[1])); \
00536 const T &thisR = * _th_pp; \
00537 const int thisLen = _b_len[0];
00538
00539 #define ForAllThisPencil(T,b,ns,nc) \
00540 { \
00541 assert(contains(b)); \
00542 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00543 const int *_th_plo = loVect(); \
00544 const int *_th_plen = size(); \
00545 const int *_b_lo = (b).loVect(); \
00546 const int *_b_len = (b).size().getVect(); \
00547 T* _th_p = dptr; \
00548 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00549 const int nR = _n; \
00550 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00551 const int jR = _j + _b_lo[1]; \
00552 T *_th_pp = _th_p \
00553 + ((_b_lo[0] - _th_plo[0]) \
00554 + _th_plen[0]*( \
00555 (jR - _th_plo[1]) \
00556 + _n * _th_plen[1])); \
00557 T &thisR = * _th_pp; \
00558 const int thisLen = _b_len[0]; \
00559
00560 #define ForAllXBPencil(T,x,b,ns,nc) \
00561 { \
00562 assert((x).contains(b)); \
00563 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00564 const int *_th_plo = (x).loVect(); \
00565 const int *_th_plen =(x).size(); \
00566 const int *_b_lo = (b).loVect(); \
00567 const int *_b_len = (b).size().getVect(); \
00568 T* _th_p = (x) .dataPtr(); \
00569 for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
00570 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00571 const int jR = _j + _b_lo[1]; \
00572 T *xR = _th_p \
00573 + ((_b_lo[0] - _th_plo[0]) \
00574 + _th_plen[0]*( \
00575 (jR - _th_plo[1]) \
00576 + nR * _th_plen[1])); \
00577 const int thisLen = _b_len[0]; \
00578
00579 #define ForAllXBNN(T,x,b,ns,nc) \
00580 { \
00581 assert((x).contains(b)); \
00582 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00583 const int *_x_plo = (x).loVect(); \
00584 const int *_x_plen = (x).size(); \
00585 const int *_b_lo = (b).loVect(); \
00586 const int *_b_len = (b).size().getVect(); \
00587 T* _x_p = (x) .dataPtr(); \
00588 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00589 const int nR = _n; \
00590 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00591 const int jR = _j + _b_lo[1]; \
00592 T *_x_pp = _x_p \
00593 + ((_b_lo[0] - _x_plo[0]) \
00594 + _x_plen[0]*( \
00595 (jR - _x_plo[1]) \
00596 + _n * _x_plen[1])); \
00597 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00598 const int iR = _i + _b_lo[0]; \
00599 T &x##R = * _x_pp;
00600
00601 #define ForAllXCBNN(T,x,b,ns,nc) \
00602 { \
00603 assert(x.contains(b)); \
00604 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00605 const int *_x_plo = (x).loVect(); \
00606 const int *_x_plen = (x).size(); \
00607 const int *_b_lo = (b).loVect(); \
00608 const int *_b_len = (b).size().getVect(); \
00609 const T* _x_p = (x).dataPtr(); \
00610 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00611 const int nR = _n; \
00612 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00613 const int jR = _j + _b_lo[1]; \
00614 const T *_x_pp = _x_p \
00615 + ((_b_lo[0] - _x_plo[0]) \
00616 + _x_plen[0]*( \
00617 (jR - _x_plo[1]) \
00618 + _n * _x_plen[1])); \
00619 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00620 const int iR = _i + _b_lo[0]; \
00621 const T & x##R = _x_pp[_i];
00622
00623
00624 #define ForAllThisBNN(T,b,ns,nc) \
00625 { \
00626 assert(contains(b)); \
00627 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00628 const int *_th_plo = loVect(); \
00629 const int *_th_plen = size(); \
00630 const int *_b_lo = (b).loVect(); \
00631 const int *_b_len = (b).size().getVect(); \
00632 T* _th_p = dptr; \
00633 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00634 int nR = _n; nR += 0; \
00635 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00636 const int jR = _j + _b_lo[1]; \
00637 T *_th_pp = _th_p \
00638 + ((_b_lo[0] - _th_plo[0]) \
00639 + _th_plen[0]*( \
00640 (jR - _th_plo[1]) \
00641 + _n * _th_plen[1])); \
00642 for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00643 int iR = _i + _b_lo[0]; iR += 0; \
00644 T &thisR = * _th_pp;
00645
00646 #define ForAllThisCBNN(T,b,ns,nc) \
00647 { \
00648 assert(contains(b)); \
00649 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00650 const int *_th_plo = loVect(); \
00651 const int *_th_plen = size(); \
00652 const int *_b_lo = (b).loVect(); \
00653 const int *_b_len = (b).size().getVect(); \
00654 const T* _th_p = dptr; \
00655 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00656 const int nR = _n; \
00657 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00658 const int jR = _j + _b_lo[1]; \
00659 const T *_th_pp = _th_p \
00660 + ((_b_lo[0] - _th_plo[0]) \
00661 + _th_plen[0]*( \
00662 (_j + _b_lo[1] - _th_plo[1]) \
00663 + _n * _th_plen[1])); \
00664 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00665 const int iR = _i + _b_lo[0]; \
00666 const T &thisR = _th_pp[_i];
00667
00668 #define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
00669 { \
00670 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00671 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00672 Box _subbox_((x).box()); \
00673 _subbox_ &= box(); \
00674 _subbox_ &= b; \
00675 if(!_subbox_.isEmpty()) { \
00676 const int *_th_plo = loVect(); \
00677 const int *_th_plen = size(); \
00678 const int *_x_plo = (x).loVect(); \
00679 const int *_x_plen = (x).size(); \
00680 const int *_subbox_lo = _subbox_.loVect(); \
00681 const int *_subbox_len = _subbox_.size().getVect(); \
00682 T* _th_p = dataPtr(ns); \
00683 const T* _x_p = (x).dataPtr(nss); \
00684 for(int _n = 0; _n < (nc); ++_n) { \
00685 int nR = _n; nR += 0; \
00686 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00687 const int jR = _j + _subbox_lo[1]; \
00688 T *_th_pp = _th_p \
00689 + ((_subbox_lo[0] - _th_plo[0]) \
00690 + _th_plen[0]*( \
00691 (jR - _th_plo[1]) \
00692 + _n * _th_plen[1])); \
00693 const T *_x_pp = _x_p \
00694 + ((_subbox_lo[0] - _x_plo[0]) \
00695 + _x_plen[0]*( \
00696 (jR - _x_plo[1]) \
00697 + _n * _x_plen[1])); \
00698 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00699 int iR = _i + _subbox_lo[0]; iR += 0; \
00700 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
00701
00702 #define ForAllThisBNNXCBN(T,b,ns,nc,x,bx,nss) \
00703 { \
00704 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00705 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
00706 assert(bx.sameSize((b))); \
00707 if(!((b).isEmpty())) { \
00708 const int *_th_plo = loVect(); \
00709 const int *_th_plen = size(); \
00710 const int *_x_plo = (x).loVect(); \
00711 const int *_x_plen = (x).size(); \
00712 const int *_subbox_lo = (b).loVect(); \
00713 const int *_subbox_len = (b).size().getVect(); \
00714 const int *_bx_lo = (bx).loVect(); \
00715 T* _th_p = dataPtr(ns); \
00716 int nR = ns; int n##x##R = nss; \
00717 const T* _x_p = (x).dataPtr(nss); \
00718 for(int _n = 0; _n < (nc); ++_n, ++nR, ++n##x##R ) { \
00719 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00720 const int jR = _j + _subbox_lo[1]; \
00721 const int j##x##R = _j + _bx_lo[1]; \
00722 T *_th_pp = _th_p \
00723 + ((_subbox_lo[0] - _th_plo[0]) \
00724 + _th_plen[0]*( \
00725 (jR - _th_plo[1]) \
00726 + _n * _th_plen[1])); \
00727 const T *_x_pp = _x_p \
00728 + ((_bx_lo[0] - _x_plo[0]) \
00729 + _x_plen[0]*( \
00730 (j##x##R - _x_plo[1]) \
00731 + _n * _x_plen[1])); \
00732 int iR = _subbox_lo[0]; int i##x##R = _bx_lo[0]; \
00733 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp, ++_x_pp, ++iR, ++i##x##R) { \
00734 T &thisR = * _th_pp; const T & x##R = * _x_pp;
00735
00736 #define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
00737 { \
00738 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00739 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00740 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00741 Box _subbox_ = box(); \
00742 _subbox_ &= b; \
00743 assert((bx).sameSize(_subbox_)); \
00744 assert((by).sameSize(_subbox_)); \
00745 if(!_subbox_.isEmpty()) { \
00746 const int *_th_plo = loVect(); \
00747 const int *_th_plen = size(); \
00748 const int *_x_plo = (x).loVect(); \
00749 const int *_x_plen = (x).size(); \
00750 const int *_y_plo = (y).loVect(); \
00751 const int *_y_plen = (y).size(); \
00752 const int *_subbox_lo = _subbox_.loVect(); \
00753 const int *_subbox_len = _subbox_.size().getVect(); \
00754 const int *_bx_lo = (bx).loVect(); \
00755 const int *_by_lo = (by).loVect(); \
00756 T* _th_p = dataPtr(ns); \
00757 const T* _x_p = (x).dataPtr(nsx); \
00758 const T* _y_p = (y).dataPtr(nsy); \
00759 for(int _n = 0; _n < (nc); ++_n) { \
00760 int nR = _n + ns; nR += 0; \
00761 int n##x##R = _n + nsx; n##x##R += 0; \
00762 int n##y##R = _n + nsy; n##y##R += 0; \
00763 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
00764 const int jR = _j + _subbox_lo[1]; \
00765 const int j##x##R = _j + _bx_lo[1]; \
00766 const int j##y##R = _j + _by_lo[1]; \
00767 T *_th_pp = _th_p \
00768 + ((_subbox_lo[0] - _th_plo[0]) \
00769 + _th_plen[0]*( \
00770 (jR - _th_plo[1]) \
00771 + _n * _th_plen[1])); \
00772 const T *_x_pp = _x_p \
00773 + ((_bx_lo[0] - _x_plo[0]) \
00774 + _x_plen[0]*( \
00775 (j##x##R - _x_plo[1]) \
00776 + _n * _x_plen[1])); \
00777 const T *_y_pp = _y_p \
00778 + ((_by_lo[0] - _y_plo[0]) \
00779 + _y_plen[0]*( \
00780 (j##y##R - _y_plo[1]) \
00781 + _n * _y_plen[1])); \
00782 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
00783 int iR = _i + _subbox_lo[0]; iR += 0; \
00784 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
00785 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
00786 T &thisR = * _th_pp; \
00787 const T & x##R = _x_pp[_i]; \
00788 const T & y##R = _y_pp[_i];
00789
00790 #define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ir) \
00791 { \
00792 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
00793 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
00794 assert((ir) >= 0 && (ir) < SpaceDim); \
00795 assert((x).contains(bx)); \
00796 assert((y).contains(by)); \
00797 assert((bx).sameSize(by)); \
00798 const int *_x_plo = (x).loVect(); \
00799 const int *_x_plen = (x).size(); \
00800 const int *_y_plo = (y).loVect(); \
00801 const int *_y_plen = (y).size(); \
00802 const int *_bx_lo = (bx).loVect(); \
00803 const int *_by_lo = (by).loVect(); \
00804 const int *_len = (bx).size().getVect(); \
00805 T* _x_p = (x).dataPtr(nsx); \
00806 const T* _y_p = (y).dataPtr(nsy); \
00807 for(int _n = 0; _n < (nc); ++_n) { \
00808 int n##x##R = _n + nsx; n##x##R += 0; \
00809 int n##y##R = _n + nsy; n##y##R += 0; \
00810 for(int _j = 0; _j < _len[1]; ++_j) { \
00811 const int j##x##R = _j + _bx_lo[1]; \
00812 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
00813 const int j##y##R = _j + _by_lo[1]; \
00814 T *_x_pp; \
00815 int _ix = 0; \
00816 int _istrd; \
00817 if (ir == 0) { \
00818 _x_pp = _x_p \
00819 + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1 \
00820 + _x_plen[0]*( \
00821 (j##x##R - _x_plo[1]) \
00822 + _n * _x_plen[1])); \
00823 _istrd = -1; \
00824 } else { \
00825 _x_pp = _x_p \
00826 + ((_bx_lo[0] - _x_plo[0]) \
00827 + _x_plen[0]*( \
00828 (jrev##x##R - _x_plo[1]) \
00829 + _n * _x_plen[1])); \
00830 _istrd = 1; \
00831 } \
00832 const T *_y_pp = _y_p \
00833 + ((_by_lo[0] - _y_plo[0]) \
00834 + _y_plen[0]*( \
00835 (j##y##R - _y_plo[1]) \
00836 + _n * _y_plen[1])); \
00837 int _x_rev = _len[0]-1; _x_rev += 0; \
00838 for(int _i = 0; _i < _len[0]; ++_i, _ix+=_istrd) { \
00839 T & x##R = _x_pp[_ix]; \
00840 const T & y##R = _y_pp[_i];
00841
00842
00843 #define EndFor }}}}
00844 #define EndForTX }}}}}
00845 #define EndForPencil }}}
00846
00847 #elif (CH_SPACEDIM == 3)
00848
00849 #define ForAllThisCPencil(T,b,ns,nc) \
00850 { \
00851 assert(contains(b)); \
00852 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00853 const int *_th_plo = loVect(); \
00854 const int *_th_plen = size(); \
00855 const int *_b_lo = (b).loVect(); \
00856 const int *_b_len = (b).size().getVect(); \
00857 const T* _th_p = dptr; \
00858 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00859 int nR = _n; nR += 0; \
00860 for(int _k = 0; _k < _b_len[2]; ++_k) { \
00861 const int kR = _k + _b_lo[2]; \
00862 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00863 const int jR = _j + _b_lo[1]; \
00864 const T *_th_pp = _th_p \
00865 + ((_b_lo[0] - _th_plo[0]) \
00866 + _th_plen[0]*( \
00867 (jR - _th_plo[1]) \
00868 + _th_plen[1]*( \
00869 (kR - _th_plo[2]) \
00870 + _n * _th_plen[2]))); \
00871 const T &thisR = * _th_pp; \
00872 const int thisLen = _b_len[0];
00873
00874 #define ForAllThisPencil(T,b,ns,nc) \
00875 { \
00876 assert(contains(b)); \
00877 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00878 const int *_th_plo = loVect(); \
00879 const int *_th_plen = size(); \
00880 const int *_b_lo = (b).loVect(); \
00881 const int *_b_len = (b).size().getVect(); \
00882 T* _th_p = dptr; \
00883 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00884 const int nR = _n; \
00885 for(int _k = 0; _k < _b_len[2]; ++_k) { \
00886 const int kR = _k + _b_lo[2]; \
00887 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00888 const int jR = _j + _b_lo[1]; \
00889 T *_th_pp = _th_p \
00890 + ((_b_lo[0] - _th_plo[0]) \
00891 + _th_plen[0]*( \
00892 (jR - _th_plo[1]) \
00893 + _th_plen[1]*( \
00894 (kR - _th_plo[2]) \
00895 + _n * _th_plen[2]))); \
00896 T &thisR = * _th_pp; \
00897 const int thisLen = _b_len[0]; \
00898
00899 #define ForAllXBPencil(T,x,b,ns,nc) \
00900 { \
00901 assert((x).contains(b)); \
00902 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00903 const int *_th_plo = (x).loVect(); \
00904 const int *_th_plen = (x).size(); \
00905 const int *_b_lo = (b).loVect(); \
00906 const int *_b_len = (b).size().getVect(); \
00907 T* _th_p = (x) .dataPtr(); \
00908 for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
00909 for(int _k = 0; _k < _b_len[2]; ++_k) { \
00910 const int kR = _k + _b_lo[2]; \
00911 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00912 const int jR = _j + _b_lo[1]; \
00913 T *xR = _th_p \
00914 + ((_b_lo[0] - _th_plo[0]) \
00915 + _th_plen[0]*( \
00916 (jR - _th_plo[1]) \
00917 + _th_plen[1]*( \
00918 (kR - _th_plo[2]) \
00919 + nR * _th_plen[2]))); \
00920 const int thisLen = _b_len[0];
00921
00922
00923 #define ForAllXBNN(T,x,b,ns,nc) \
00924 { \
00925 assert(x.contains(b)); \
00926 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00927 const int *_x_plo = (x).loVect(); \
00928 const int *_x_plen = (x).size(); \
00929 const int *_b_lo = (b).loVect(); \
00930 const int *_b_len = (b).size().getVect(); \
00931 T* _x_p = (x) .dataPtr(); \
00932 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00933 const int nR = _n; \
00934 for(int _k = 0; _k < _b_len[2]; ++_k) { \
00935 const int kR = _k + _b_lo[2]; \
00936 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00937 const int jR = _j + _b_lo[1]; \
00938 T *_x_pp = _x_p \
00939 + ((_b_lo[0] - _x_plo[0]) \
00940 + _x_plen[0]*( \
00941 (jR - _x_plo[1]) \
00942 + _x_plen[1]*( \
00943 (kR - _x_plo[2]) \
00944 + _n * _x_plen[2]))); \
00945 for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
00946 const int iR = _i + _b_lo[0]; \
00947 T &x##R = * _x_pp;
00948
00949 #define ForAllXCBNN(T,x,b,ns,nc) \
00950 { \
00951 assert(x.contains(b)); \
00952 assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
00953 const int *_x_plo = (x).loVect(); \
00954 const int *_x_plen = (x).size(); \
00955 const int *_b_lo = (b).loVect(); \
00956 const int *_b_len = (b).size().getVect(); \
00957 const T* _x_p = (x).dataPtr(); \
00958 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00959 const int nR = _n; \
00960 for(int _k = 0; _k < _b_len[2]; ++_k) { \
00961 const int kR = _k + _b_lo[2]; \
00962 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00963 const int jR = _j + _b_lo[1]; \
00964 const T *_x_pp = _x_p \
00965 + ((_b_lo[0] - _x_plo[0]) \
00966 + _x_plen[0]*( \
00967 (jR - _x_plo[1]) \
00968 + _x_plen[1]*( \
00969 (kR - _x_plo[2]) \
00970 + _n * _x_plen[2]))); \
00971 for(int _i = 0; _i < _b_len[0]; ++_i) { \
00972 const int iR = _i + _b_lo[0]; \
00973 const T & x##R = _x_pp[_i];
00974
00975
00976 #define ForAllThisBNN(T,b,ns,nc) \
00977 { \
00978 assert(contains(b)); \
00979 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
00980 const int *_th_plo = loVect(); \
00981 const int *_th_plen = size(); \
00982 const int *_b_lo = (b).loVect(); \
00983 const int *_b_len = (b).size().getVect(); \
00984 T* _th_p = dptr; \
00985 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
00986 int nR = _n; nR += 0; \
00987 for(int _k = 0; _k < _b_len[2]; ++_k) { \
00988 const int kR = _k + _b_lo[2]; \
00989 for(int _j = 0; _j < _b_len[1]; ++_j) { \
00990 const int jR = _j + _b_lo[1]; \
00991 T *_th_pp = _th_p \
00992 + ((_b_lo[0] - _th_plo[0]) \
00993 + _th_plen[0]*( \
00994 (jR - _th_plo[1]) \
00995 + _th_plen[1]*( \
00996 (kR - _th_plo[2]) \
00997 + _n * _th_plen[2]))); \
00998 for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
00999 int iR = _i + _b_lo[0]; iR += 0; \
01000 T &thisR = * _th_pp;
01001
01002 #define ForAllThisCBNN(T,b,ns,nc) \
01003 { \
01004 assert(contains(b)); \
01005 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01006 const int *_th_plo = loVect(); \
01007 const int *_th_plen = size(); \
01008 const int *_b_lo = (b).loVect(); \
01009 const int *_b_len = (b).size().getVect(); \
01010 const T* _th_p = dptr; \
01011 for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
01012 const int nR = _n; \
01013 for(int _k = 0; _k < _b_len[2]; ++_k) { \
01014 const int kR = _k + _b_lo[2]; \
01015 for(int _j = 0; _j < _b_len[1]; ++_j) { \
01016 const int jR = _j + _b_lo[1]; \
01017 const T *_th_pp = _th_p \
01018 + ((_b_lo[0] - _th_plo[0]) \
01019 + _th_plen[0]*( \
01020 (jR - _th_plo[1]) \
01021 + _th_plen[1]*( \
01022 (kR - _th_plo[2]) \
01023 + _n * _th_plen[2]))); \
01024 for(int _i = 0; _i < _b_len[0]; ++_i) { \
01025 const int iR = _i + _b_lo[0]; \
01026 const T &thisR = _th_pp[_i];
01027
01028 #define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
01029 { \
01030 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01031 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01032 Box _subbox_((x).box()); \
01033 _subbox_ &= box(); \
01034 _subbox_ &= b; \
01035 if(!_subbox_.isEmpty()) { \
01036 const int *_th_plo = loVect(); \
01037 const int *_th_plen = size(); \
01038 const int *_x_plo = (x).loVect(); \
01039 const int *_x_plen = (x).size(); \
01040 const int *_subbox_lo = _subbox_.loVect(); \
01041 const int *_subbox_len = _subbox_.size().getVect(); \
01042 T* _th_p = dataPtr(ns); \
01043 const T* _x_p = (x).dataPtr(nss); \
01044 for(int _n = 0; _n < (nc); ++_n) { \
01045 int nR = _n; nR += 0; \
01046 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01047 const int kR = _k + _subbox_lo[2]; \
01048 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01049 const int jR = _j + _subbox_lo[1]; \
01050 T *_th_pp = _th_p \
01051 + ((_subbox_lo[0] - _th_plo[0]) \
01052 + _th_plen[0]*( \
01053 (jR - _th_plo[1]) \
01054 + _th_plen[1]*( \
01055 (kR - _th_plo[2]) \
01056 + _n * _th_plen[2]))); \
01057 const T *_x_pp = _x_p \
01058 + ((_subbox_lo[0] - _x_plo[0]) \
01059 + _x_plen[0]*( \
01060 (jR - _x_plo[1]) \
01061 + _x_plen[1]*( \
01062 (kR - _x_plo[2]) \
01063 + _n * _x_plen[2]))); \
01064 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01065 int iR = _i + _subbox_lo[0]; iR += 0; \
01066 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01067
01068 #define ForAllThisBNNXCBN(T,b,ns,nc,x,bx,nss) \
01069 { \
01070 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01071 assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
01072 assert((bx).sameSize((b))); \
01073 if(!((b).isEmpty())) { \
01074 const int *_th_plo = loVect(); \
01075 const int *_th_plen = size(); \
01076 const int *_x_plo = (x).loVect(); \
01077 const int *_x_plen = (x).size(); \
01078 const int *_subbox_lo = (b).loVect(); \
01079 const int *_subbox_len = (b).size().getVect(); \
01080 const int *_bx_lo = (bx).loVect(); \
01081 T* _th_p = dataPtr(ns); \
01082 const T* _x_p = (x).dataPtr(nss); \
01083 for(int _n = 0; _n < (nc); ++_n) { \
01084 int nR = _n + ns; nR += 0; \
01085 int n##x##R = _n + nss; n##x##R += 0; \
01086 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01087 const int kR = _k + _subbox_lo[2]; \
01088 const int k##x##R = _k + _bx_lo[2]; \
01089 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01090 const int jR = _j + _subbox_lo[1]; \
01091 const int j##x##R = _j + _bx_lo[1]; \
01092 T *_th_pp = _th_p \
01093 + ((_subbox_lo[0] - _th_plo[0]) \
01094 + _th_plen[0]*( \
01095 (jR - _th_plo[1]) \
01096 + _th_plen[1]*( \
01097 (kR - _th_plo[2]) \
01098 + _n * _th_plen[2]))); \
01099 const T *_x_pp = _x_p \
01100 + ((_bx_lo[0] - _x_plo[0]) \
01101 + _x_plen[0]*( \
01102 (j##x##R - _x_plo[1]) \
01103 + _x_plen[1]*( \
01104 (k##x##R - _x_plo[2]) \
01105 + _n * _x_plen[2]))); \
01106 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01107 int iR = _i + _subbox_lo[0]; iR += 0; \
01108 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01109 T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
01110
01111 #define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy) \
01112 { \
01113 assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
01114 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01115 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01116 Box _subbox_(box()); \
01117 _subbox_ &= b; \
01118 assert((bx).sameSize(_subbox_)); \
01119 assert((by).sameSize(_subbox_)); \
01120 if(!_subbox_.isEmpty()) { \
01121 const int *_th_plo = loVect(); \
01122 const int *_th_plen = size(); \
01123 const int *_x_plo = (x).loVect(); \
01124 const int *_x_plen = (x).size(); \
01125 const int *_y_plo = (y).loVect(); \
01126 const int *_y_plen = (y).size(); \
01127 const int *_subbox_lo = _subbox_.loVect(); \
01128 const int *_subbox_len = _subbox_.size().getVect(); \
01129 const int *_bx_lo = (bx).loVect(); \
01130 const int *_by_lo = (by).loVect(); \
01131 T* _th_p = dataPtr(ns); \
01132 const T* _x_p = (x).dataPtr(nsx); \
01133 const T* _y_p = (y).dataPtr(nsy); \
01134 for(int _n = 0; _n < (nc); ++_n) { \
01135 int nR = _n + ns; nR += 0; \
01136 int n##x##R = _n + nsx; n##x##R += 0; \
01137 int n##y##R = _n + nsy; n##y##R += 0; \
01138 for(int _k = 0; _k < _subbox_len[2]; ++_k) { \
01139 const int kR = _k + _subbox_lo[2]; \
01140 const int k##x##R = _k + _bx_lo[2]; \
01141 const int k##y##R = _k + _by_lo[2]; \
01142 for(int _j = 0; _j < _subbox_len[1]; ++_j) { \
01143 const int jR = _j + _subbox_lo[1]; \
01144 const int j##x##R = _j + _bx_lo[1]; \
01145 const int j##y##R = _j + _by_lo[1]; \
01146 T *_th_pp = _th_p \
01147 + ((_subbox_lo[0] - _th_plo[0]) \
01148 + _th_plen[0]*( \
01149 (jR - _th_plo[1]) \
01150 + _th_plen[1]*( \
01151 (kR - _th_plo[2]) \
01152 + _n * _th_plen[2]))); \
01153 const T *_x_pp = _x_p \
01154 + ((_bx_lo[0] - _x_plo[0]) \
01155 + _x_plen[0]*( \
01156 (j##x##R - _x_plo[1]) \
01157 + _x_plen[1]*( \
01158 (k##x##R - _x_plo[2]) \
01159 + _n * _x_plen[2]))); \
01160 const T *_y_pp = _y_p \
01161 + ((_by_lo[0] - _y_plo[0]) \
01162 + _y_plen[0]*( \
01163 (j##y##R - _y_plo[1]) \
01164 + _y_plen[1]*( \
01165 (k##y##R - _y_plo[2]) \
01166 + _n * _y_plen[2]))); \
01167 for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
01168 int iR = _i + _subbox_lo[0]; iR += 0; \
01169 int i##x##R = _i + _bx_lo[0]; i##x##R += 0; \
01170 int i##y##R = _i + _by_lo[0]; i##y##R += 0; \
01171 T &thisR = * _th_pp; \
01172 const T & x##R = _x_pp[_i]; \
01173 const T & y##R = _y_pp[_i];
01174
01175 #define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ir) \
01176 { \
01177 assert((ir) >= 0 && (ir) < SpaceDim); \
01178 assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp()); \
01179 assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp()); \
01180 assert((x).contains(bx)); \
01181 assert((y).contains(by)); \
01182 assert((bx).sameSize(by)); \
01183 const int *_x_plo = (x).loVect(); \
01184 const int *_x_plen = (x).size(); \
01185 const int *_y_plo = (y).loVect(); \
01186 const int *_y_plen = (y).size(); \
01187 const int *_bx_lo = (bx).loVect(); \
01188 const int *_by_lo = (by).loVect(); \
01189 const int *_len = (bx).size().getVect(); \
01190 T* _x_p = (x).dataPtr(nsx); \
01191 const T* _y_p = (y).dataPtr(nsy); \
01192 for(int _n = 0; _n < (nc); ++_n) { \
01193 int n##x##R = _n + nsx; n##x##R += 0; \
01194 int n##y##R = _n + nsy; n##y##R += 0; \
01195 for(int _k = 0; _k < _len[2]; ++_k) { \
01196 const int k##x##R = _k + _bx_lo[2]; \
01197 const int krev##x##R = _len[2]-1-_k + _bx_lo[2]; \
01198 const int k##y##R = _k + _by_lo[2]; \
01199 for(int _j = 0; _j < _len[1]; ++_j) { \
01200 const int j##x##R = _j + _bx_lo[1]; \
01201 const int jrev##x##R = _len[1]-1-_j + _bx_lo[1]; \
01202 const int j##y##R = _j + _by_lo[1]; \
01203 T *_x_pp; \
01204 int _ix = 0; \
01205 int _istrd = 1; \
01206 if (ir == 0) { \
01207 _x_pp = _x_p \
01208 + ((_bx_lo[0] - _x_plo[0]) + _len[0]-1 \
01209 + _x_plen[0]*( \
01210 (j##x##R - _x_plo[1]) \
01211 + _x_plen[1]*( \
01212 (k##x##R - _x_plo[2]) \
01213 + _n * _x_plen[2]))); \
01214 _istrd = -1; \
01215 } else if (ir == 1) { \
01216 _x_pp = _x_p \
01217 + ((_bx_lo[0] - _x_plo[0]) \
01218 + _x_plen[0]*( \
01219 (jrev##x##R - _x_plo[1]) \
01220 + _x_plen[1]*( \
01221 (k##x##R - _x_plo[2]) \
01222 + _n * _x_plen[2]))); \
01223 } else { \
01224 _x_pp = _x_p \
01225 + ((_bx_lo[0] - _x_plo[0]) \
01226 + _x_plen[0]*( \
01227 (j##x##R - _x_plo[1]) \
01228 + _x_plen[1]*( \
01229 (krev##x##R - _x_plo[2]) \
01230 + _n * _x_plen[2]))); \
01231 } \
01232 const T *_y_pp = _y_p \
01233 + ((_by_lo[0] - _y_plo[0]) \
01234 + _y_plen[0]*( \
01235 (j##y##R - _y_plo[1]) \
01236 + _y_plen[1]*( \
01237 (k##y##R - _y_plo[2]) \
01238 + _n * _y_plen[2]))); \
01239 for(int _i = 0; _i < _len[0]; ++_i, _ix += _istrd) { \
01240 T & x##R = _x_pp[_ix]; \
01241 const T & y##R = _y_pp[_i];
01242
01243 #define EndFor }}}}}
01244 #define EndForTX }}}}}}
01245 #define EndForPencil }}}}
01246
01247 #endif
01248
01249
01250
01251
01252
01253 #define ForAllXPencil(T,x) ForAllXBPencil(T,x,((x).box()),0,((x).nComp()))
01254
01255
01256
01257
01258
01259
01260 #define ForAllX(T,x) ForAllXBNN(T,x,((x).box()),0,((x).nComp()))
01261
01262
01263
01264
01265 #define ForAllXC(T,x) ForAllXCBNN(T,x,((x).box()),0,((x).nComp()))
01266
01267
01268
01269
01270
01271 #define ForAllXB(T,x,b) ForAllXBNN(T,x,(b),0,(x).nComp())
01272
01273
01274
01275
01276 #define ForAllXBC(T,x,b) ForAllXCBNN(T,x,(b),0,(x).nComp())
01277
01278
01279
01280
01281
01282
01283 #define ForAllThis(T) ForAllThisBNN(T,domain,0,nComp())
01284
01285
01286
01287
01288 #define ForAllThisC(T) ForAllThisCBNN(T,domain,0,nComp())
01289
01290
01291
01292
01293
01294 #define ForAllThisB(T,b) ForAllThisBNN(T,(b),0,nComp())
01295
01296
01297
01298
01299 #define ForAllThisCB(T,b) ForAllThisCBNN(T,(b),0,nComp())
01300
01301
01302
01303
01304
01305 #define ForAllThisNN(T,ns,nc) ForAllThisBNN(T,domain,ns,nc)
01306
01307
01308
01309
01310
01311
01312 #define ForAllThisXC(T,x) ForAllThisBNNXC(T,domain,0,nComp(),x,0)
01313
01314 #endif
01315