📄 basefabmacros.h
字号:
// This software is copyright (C) by the Lawrence Berkeley
// National Laboratory. Permission is granted to reproduce
// this software for non-commercial purposes provided that
// this notice is left intact.
//
// It is acknowledged that the U.S. Government has rights to
// this software under Contract DE-AC03-765F00098 between
// the U.S. Department of Energy and the University of
// California.
//
// This software is provided as a professional and academic
// contribution for joint exchange. Thus it is experimental,
// is provided ``as is'', with no warranties of any kind
// whatsoever, no support, no promise of updates, or printed
// documentation. By using this software, you acknowledge
// that the Lawrence Berkeley National Laboratory and
// Regents of the University of California shall have no
// liability with respect to the infringement of other
// copyrights by any part of this software.
//
#ifndef _CH_LAME_MACROS_H
#define _CH_LAME_MACROS_H
#include "SPACE.H"
#ifdef DOXYGEN
#define CH_SPACEDIM 1
#endif
#if (CH_SPACEDIM == 1)
#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(); \
T* _th_p = dptr; \
for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
const int nR = _n; \
T *_th_pp = _th_p \
+ ((_b_lo[0] - _th_plo[0]) \
+ _n * _th_plen[0]); \
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(); \
T* _th_p = x.dataPtr(); \
for(int nR = (ns); nR < (ns)+(nc); ++nR) { \
T * xR = _th_p \
+ ((_b_lo[0] - _th_plo[0]) \
+ nR * _th_plen[0]); \
const int thisLen = _b_len[0];
#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(); \
const T* _th_p = dptr; \
for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
int nR = _n; nR += 0; \
const T *_th_pp = _th_p \
+ ((_b_lo[0] - _th_plo[0]) \
+ _n * _th_plen[0]); \
const T &thisR = * _th_pp; \
const int thisLen = _b_len[0];
#define ForAllXBNN(T,x,b,ns,nc) \
{ \
assert(x.contains(b)); \
assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
const int *_x_plo = (x).loVect(); \
const int *_x_plen = (x).size(); \
const int *_b_lo = (b).loVect(); \
const int *_b_len = (b).size(); \
T* _x_p = (x) .dataPtr(); \
for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
const int nR = _n; \
T *_x_pp = _x_p \
+ ((_b_lo[0] - _x_plo[0]) \
+ _n * _x_plen[0]); \
for(int _i = 0; _i < _b_len[0]; ++_i, ++_x_pp) { \
const int iR = _i + _b_lo[0]; \
T &x##R = * _x_pp;
#define ForAllXCBNN(T,x,b,ns,nc) \
{ \
assert(x.contains(b)); \
assert((ns) >= 0 && (ns) + (nc) <= (x).nComp()); \
const int *_x_plo = (x).loVect(); \
const int *_x_plen = (x).size(); \
const int *_b_lo = (b).loVect(); \
const int *_b_len = (b).size().getVect(); \
const T* _x_p = (x).dataPtr(); \
for(int _n = (ns); _n < (ns)+(nc); ++_n) { \
const int nR = _n; \
const T *_x_pp = _x_p \
+ ((_b_lo[0] - _x_plo[0]) \
+ _n * _x_plen[0]); \
for(int _i = 0; _i < _b_len[0]; ++_i) { \
const int iR = _i + _b_lo[0]; \
const T & x##R = _x_pp[_i];
#define ForAllThisBNN(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) { \
int nR = _n; nR += 0; \
T *_th_pp = _th_p \
+ ((_b_lo[0] - _th_plo[0]) \
+ _n * _th_plen[0]); \
for(int _i = 0; _i < _b_len[0]; ++_i, ++_th_pp) { \
int iR = _i + _b_lo[0]; iR += 0; \
T &thisR = * _th_pp;
#define ForAllThisCBNN(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) { \
const int nR = _n; \
const T *_th_pp = _th_p \
+ ((_b_lo[0] - _th_plo[0]) \
+ _n * _th_plen[0]); \
for(int _i = 0; _i < _b_len[0]; ++_i) { \
const int iR = _i + _b_lo[0]; \
const T &thisR = _th_pp[_i];
#define ForAllThisBNNXC(T,b,ns,nc,x,nss) \
{ \
assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
Box _subbox_((x).box()); \
_subbox_ &= box(); \
_subbox_ &= b; \
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 *_subbox_lo = _subbox_.loVect(); \
const int *_subbox_len = _subbox_.size().getVect(); \
T* _th_p = dataPtr(ns); \
const T* _x_p = (x).dataPtr(nss); \
for(int _n = 0; _n < (nc); ++_n) { \
int nR = _n; nR += 0; \
T *_th_pp = _th_p \
+ ((_subbox_lo[0] - _th_plo[0]) \
+ _n * _th_plen[0]); \
const T *_x_pp = _x_p \
+ ((_subbox_lo[0] - _x_plo[0]) \
+ _n * _x_plen[0]); \
for(int _i = 0; _i < _subbox_len[0]; ++_i, ++_th_pp) { \
int iR = _i + _subbox_lo[0]; iR += 0; \
T &thisR = * _th_pp; const T & x##R = _x_pp[_i];
#define ForAllThisCBNNXC(T,b,ns,nc,x,nss) \
{ \
assert((ns) >= 0 && (ns) + (nc) <= nComp()); \
assert((nss) >= 0 && (nss) + (nc) <= (x).nComp()); \
Box _subbox_((x).box()); \
_subbox_ &= box(); \
_subbox_ &= b; \
if(!_subbox_.isEmpty()) { \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -