⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basefabmacros.h

📁 自适应网格划分通用程序包
💻 H
📖 第 1 页 / 共 5 页
字号:
                for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp, ++_x_pp, ++iR, ++i##x##R) {  \
                    T &thisR = * _th_pp; const T & x##R = * _x_pp;

#define ForAllThisBNNXCBNYCBN(T,b,ns,nc,x,bx,nsx,y,by,nsy)              \
{                                                                       \
    assert((ns) >= 0 && (ns) + (nc) <= nComp());                        \
    assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp());                  \
    assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp());                  \
    Box _subbox_ = box();                                               \
    _subbox_ &= b;                                                      \
    assert((bx).sameSize(_subbox_));                                    \
    assert((by).sameSize(_subbox_));                                    \
    if(!_subbox_.isEmpty()) {                                           \
        const int *_th_plo = loVect();                                  \
        const int *_th_plen = size();                                   \
        const int *_x_plo = (x).loVect();                               \
        const int *_x_plen = (x).size();                                \
        const int *_y_plo = (y).loVect();                               \
        const int *_y_plen = (y).size();                                \
        const int *_subbox_lo = _subbox_.loVect();                      \
        const int *_subbox_len = _subbox_.size().getVect();             \
        const int *_bx_lo = (bx).loVect();                              \
        const int *_by_lo = (by).loVect();                              \
        T* _th_p = dataPtr(ns);                                         \
        const T* _x_p  = (x).dataPtr(nsx);                              \
        const T* _y_p  = (y).dataPtr(nsy);                              \
        for(int _n = 0; _n < (nc); ++_n) {                              \
            int nR = _n + ns; nR += 0;                                  \
            int n##x##R = _n + nsx; n##x##R += 0;                       \
            int n##y##R = _n + nsy; n##y##R += 0;                       \
            for(int _j = 0; _j < _subbox_len[1]; ++_j) {                \
                const int jR = _j + _subbox_lo[1];                      \
                const int j##x##R = _j + _bx_lo[1];                     \
                const int j##y##R = _j + _by_lo[1];                     \
                T *_th_pp = _th_p                                       \
                    + ((_subbox_lo[0] - _th_plo[0])                     \
                       + _th_plen[0]*(                                  \
                           (jR - _th_plo[1])                            \
                           + _n * _th_plen[1]));                        \
                const T *_x_pp = _x_p                                   \
                    + ((_bx_lo[0] - _x_plo[0])                          \
                       + _x_plen[0]*(                                   \
                           (j##x##R - _x_plo[1])                        \
                           + _n * _x_plen[1]));                         \
                const T *_y_pp = _y_p                                   \
                    + ((_by_lo[0] - _y_plo[0])                          \
                       + _y_plen[0]*(                                   \
                           (j##y##R - _y_plo[1])                        \
                           + _n * _y_plen[1]));                         \
                for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) {  \
                    int iR = _i + _subbox_lo[0];  iR += 0;              \
                    int i##x##R = _i + _bx_lo[0]; i##x##R += 0;         \
                    int i##y##R = _i + _by_lo[0]; i##y##R += 0;         \
                    T &thisR = * _th_pp;                                \
                    const T & x##R = _x_pp[_i];                         \
                    const T & y##R = _y_pp[_i];

#define ForAllRevXBNYCBNNN(T,x,bx,nsx,y,by,nsy,nc,ir)                   \
{                                                                       \
    assert((nsx) >= 0 && (nsx) + (nc) <= (x).nComp());                  \
    assert((nsy) >= 0 && (nsy) + (nc) <= (y).nComp());                  \
    assert((ir) >= 0 && (ir) < SpaceDim);                               \
    assert((x).contains(bx));                                           \
    assert((y).contains(by));                                           \
    assert((bx).sameSize(by));                                          \
    const int *_x_plo = (x).loVect();                                   \
    const int *_x_plen = (x).size();                                    \
    const int *_y_plo = (y).loVect();                                   \
    const int *_y_plen = (y).size();                                    \
    const int *_bx_lo = (bx).loVect();                                  \
    const int *_by_lo = (by).loVect();                                  \
    const int *_len = (bx).size().getVect();                            \
    T* _x_p  = (x).dataPtr(nsx);                                        \
    const T* _y_p  = (y).dataPtr(nsy);                                  \
    for(int _n = 0; _n < (nc); ++_n) {                                  \
        int n##x##R = _n + nsx; n##x##R += 0;                           \
        int n##y##R = _n + nsy; n##y##R += 0;                           \
        for(int _j = 0; _j < _len[1]; ++_j) {                           \
            const int j##x##R = _j + _bx_lo[1];                 \
            const int jrev##x##R = _len[1]-1-_j + _bx_lo[1];            \
            const int j##y##R = _j + _by_lo[1];                 \
            T *_x_pp;                                                   \
            int _ix = 0;                                                \
            int _istrd;                                                 \
            if (ir == 0) {                                              \
                _x_pp = _x_p                                            \
                    + ((_bx_lo[0] - _x_plo[0]) + _len[0] - 1            \
                       + _x_plen[0]*(                                   \
                           (j##x##R - _x_plo[1])                        \
                           + _n * _x_plen[1]));                         \
                _istrd = -1;                                            \
            } else {                                                    \
                _x_pp = _x_p                                            \
                    + ((_bx_lo[0] - _x_plo[0])                          \
                       + _x_plen[0]*(                                   \
                           (jrev##x##R - _x_plo[1])                     \
                           + _n * _x_plen[1]));                         \
                _istrd = 1;                                             \
            }                                                           \
            const T *_y_pp = _y_p                                       \
                    + ((_by_lo[0] - _y_plo[0])                          \
                       + _y_plen[0]*(                                   \
                           (j##y##R - _y_plo[1])                        \
                           + _n * _y_plen[1]));                         \
            int _x_rev = _len[0]-1; _x_rev += 0;                        \
            for(int _i = 0; _i < _len[0]; ++_i, _ix+=_istrd) {          \
                T & x##R = _x_pp[_ix];                                  \
                const T & y##R = _y_pp[_i];


#define EndFor }}}}
#define EndForTX }}}}}
#define EndForPencil }}}

#elif (CH_SPACEDIM == 3)

#define ForAllThisCPencil(T,b,ns,nc)                                    \
{                                                                       \
    assert(contains(b));                                                \
    assert((ns) >= 0 && (ns) + (nc) <= nComp());                        \
    const int *_th_plo = loVect();                                      \
    const int *_th_plen = size();                                       \
    const int *_b_lo = (b).loVect();                                    \
    const int *_b_len = (b).size().getVect();                           \
    const T* _th_p = dptr;                                              \
    for(int _n = (ns); _n < (ns)+(nc); ++_n) {                          \
        int nR = _n; nR += 0;                                           \
        for(int _k = 0; _k < _b_len[2]; ++_k) {                         \
            const int kR = _k + _b_lo[2];                               \
            for(int _j = 0; _j < _b_len[1]; ++_j) {                     \
                const int jR = _j + _b_lo[1];                           \
                const T *_th_pp = _th_p                                 \
                    + ((_b_lo[0] - _th_plo[0])                          \
                       + _th_plen[0]*(                                  \
                           (jR - _th_plo[1])                            \
                           + _th_plen[1]*(                              \
                               (kR - _th_plo[2])                        \
                               + _n * _th_plen[2])));                   \
                const T &thisR = * _th_pp;                              \
                const int thisLen = _b_len[0];

#define ForAllThisPencil(T,b,ns,nc)                                     \
{                                                                       \
    assert(contains(b));                                                \
    assert((ns) >= 0 && (ns) + (nc) <= nComp());                        \
    const int *_th_plo = loVect();                                      \
    const int *_th_plen = size();                                       \
    const int *_b_lo = (b).loVect();                                    \
    const int *_b_len = (b).size().getVect();                           \
    T* _th_p = dptr;                                                    \
    for(int _n = (ns); _n < (ns)+(nc); ++_n) {                          \
        const int nR = _n;                                              \
        for(int _k = 0; _k < _b_len[2]; ++_k) {                         \
            const int kR = _k + _b_lo[2];                               \
            for(int _j = 0; _j < _b_len[1]; ++_j) {                     \
                const int jR = _j + _b_lo[1];                           \
                T *_th_pp = _th_p                                       \
                    + ((_b_lo[0] - _th_plo[0])                          \
                       + _th_plen[0]*(                                  \
                           (jR - _th_plo[1])                            \
                           + _th_plen[1]*(                              \
                               (kR - _th_plo[2])                        \
                               + _n * _th_plen[2])));                   \
                T &thisR = * _th_pp;                                    \
                const int thisLen = _b_len[0];                          \

#define ForAllXBPencil(T,x,b,ns,nc)                                     \
{                                                                       \
    assert((x).contains(b));                                            \
    assert((ns) >= 0 && (ns) + (nc) <= (x).nComp());                    \
    const int *_th_plo = (x).loVect();                                  \
    const int *_th_plen = (x).size();                                   \
    const int *_b_lo = (b).loVect();                                    \
    const int *_b_len = (b).size().getVect();                           \
    T* _th_p = (x) .dataPtr();                                          \
    for(int nR = (ns); nR < (ns)+(nc); ++nR) {                          \
        for(int _k = 0; _k < _b_len[2]; ++_k) {                         \
            const int kR = _k + _b_lo[2];                               \
            for(int _j = 0; _j < _b_len[1]; ++_j) {                     \
                const int jR = _j + _b_lo[1];                           \
                T *xR = _th_p                                           \
                    + ((_b_lo[0] - _th_plo[0])                          \
                       + _th_plen[0]*(                                  \
                           (jR - _th_plo[1])                            \
                           + _th_plen[1]*(                              \
                               (kR - _th_plo[2])                        \
                               + nR * _th_plen[2])));                   \
                const int thisLen = _b_len[0];                         


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -