Blender V2.61 - r43446
|
00001 00005 // advance pointer in main loop 00006 #define ADVANCE_POINTERS(p) \ 00007 ccel += (QCELLSTEP*(p)); \ 00008 tcel += (QCELLSTEP*(p)); \ 00009 pFlagSrc+= (p); \ 00010 pFlagDst+= (p); \ 00011 i+= (p); 00012 00013 #define MAX_CALC_ARR 4 00014 00015 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00016 // init region vars 00017 #define GRID_REGION_INIT() \ 00018 const int istart = -1+gridLoopBound; \ 00019 const int iend = mLevel[mMaxRefine].lSizex-1-gridLoopBound; \ 00020 LbmFloat calcCurrentMass=0; \ 00021 LbmFloat calcCurrentVolume=0; \ 00022 int calcCellsFilled=0; \ 00023 int calcCellsEmptied=0; \ 00024 int calcNumUsedCells=0; \ 00025 00026 00027 00028 00029 // ----------------------------------------------------------------------------------- 00030 // serial stuff 00031 #if PARALLEL!=1 00032 00033 #define PERFORM_USQRMAXCHECK USQRMAXCHECK(usqr,ux,uy,uz, mMaxVlen, mMxvx,mMxvy,mMxvz); 00034 #define LIST_EMPTY(x) mListEmpty.push_back( x ); 00035 #define LIST_FULL(x) mListFull.push_back( x ); 00036 #define FSGR_ADDPART(x) mpParticles->addFullParticle( x ); 00037 00038 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00039 #define GRID_REGION_START() \ 00040 { /* main_region */ \ 00041 int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \ 00042 if(gridLoopBound>0){ kstart=getForZMin1(), kend=getForZMax1(mMaxRefine); } \ 00043 int kdir = 1; \ 00044 int jstart = gridLoopBound; \ 00045 int jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \ 00046 const int id=0; \ 00047 LbmFloat *ccel = NULL, *tcel = NULL; \ 00048 CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \ 00049 if(mLevel[mMaxRefine].setCurr==1) { \ 00050 kdir = -1; \ 00051 int temp = kend; \ 00052 kend = kstart-1; \ 00053 kstart = temp-1; \ 00054 temp = id; /* dummy remove warning */ \ 00055 } \ 00056 00057 00058 00059 00060 00061 // ----------------------------------------------------------------------------------- 00062 #else // PARALLEL==1 00063 00064 //#include "paraloop.h" 00065 #define PERFORM_USQRMAXCHECK USQRMAXCHECK(usqr,ux,uy,uz, calcMaxVlen, calcMxvx,calcMxvy,calcMxvz); 00066 #define LIST_EMPTY(x) calcListEmpty.push_back( x ); 00067 #define LIST_FULL(x) calcListFull.push_back( x ); 00068 #define FSGR_ADDPART(x) calcListParts.push_back( x ); 00069 00070 00071 // parallel region 00072 //was: # pragma omp parallel default(shared) 00073 #if COMPRESSGRIDS!=1 00074 // requires compressed grids...! 00075 ERROR! 00076 #endif 00077 00078 // loop start 00079 #define GRID_REGION_START() \ 00080 { \ 00081 \ 00082 \ 00083 if(mSizez<2) { \ 00084 mPanic = 1; \ 00085 errFatal("ParaLoop::2D","Not valid...!", SIMWORLD_GENERICERROR); \ 00086 } \ 00087 \ 00088 \ 00089 vector<LbmPoint> calcListFull; \ 00090 vector<LbmPoint> calcListEmpty; \ 00091 vector<ParticleObject> calcListParts; \ 00092 LbmFloat calcMxvx, calcMxvy, calcMxvz, calcMaxVlen; \ 00093 calcMxvx = calcMxvy = calcMxvz = calcMaxVlen = 0.0; \ 00094 calcListEmpty.reserve(mListEmpty.capacity() / omp_get_num_threads() ); \ 00095 calcListFull.reserve( mListFull.capacity() / omp_get_num_threads() ); \ 00096 calcListParts.reserve(mSizex); \ 00097 \ 00098 \ 00099 const int id = omp_get_thread_num(); \ 00100 const int Nthrds = omp_get_num_threads(); \ 00101 \ 00102 \ 00103 \ 00104 \ 00105 \ 00106 int kdir = 1; \ 00107 \ 00108 int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \ 00109 if(gridLoopBound>0){ kstart=getForZMin1(); kend=getForZMax1(mMaxRefine); } \ 00110 LbmFloat *ccel = NULL, *tcel = NULL; \ 00111 CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \ 00112 \ 00113 \ 00114 if(mLevel[mMaxRefine].setCurr==1) { \ 00115 kdir = -1; \ 00116 int temp = kend; \ 00117 kend = kstart-1; \ 00118 kstart = temp-1; \ 00119 } \ 00120 \ 00121 const int Nj = mLevel[mMaxRefine].lSizey; \ 00122 int jstart = 0+( (id * Nj ) / Nthrds ); \ 00123 int jend = 0+(((id+1) * Nj ) / Nthrds ); \ 00124 if( ((Nj/Nthrds) *Nthrds) != Nj) { \ 00125 errMsg("LbmFsgrSolver","Invalid domain size Nj="<<Nj<<" Nthrds="<<Nthrds); \ 00126 } \ 00127 \ 00128 if(jstart<gridLoopBound) jstart = gridLoopBound; \ 00129 if(jend>mLevel[mMaxRefine].lSizey-gridLoopBound) jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \ 00130 \ 00131 debMsgStd("ParaLoop::OMP",DM_MSG,"Thread:"<<id<<" i:"<<istart<<"-"<<iend<<" j:"<<jstart<<"-"<<jend<<", k:"<<kstart<<"-"<<kend<<" ", 1); \ 00132 \ 00133 00134 00135 00136 00137 // para GRID LOOP END is parainc3 00138 00139 #endif // PARALLEL==1 00140 00141 00142 // ----------------------------------------------------------------------------------- 00143 00144 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00145 #define GRID_LOOP_START() \ 00146 for(int k=kstart;k!=kend;k+=kdir) { \ 00147 pFlagSrc = &RFLAG(lev, istart, jstart, k, SRCS(lev)); \ 00148 pFlagDst = &RFLAG(lev, istart, jstart, k, TSET(lev)); \ 00149 ccel = RACPNT(lev, istart, jstart, k, SRCS(lev)); \ 00150 tcel = RACPNT(lev, istart, jstart, k, TSET(lev)); \ 00151 for(int j=jstart;j!=jend;++j) { \ 00152 /* for(int i=0;i<mLevel[lev].lSizex-2; ) { */ \ 00153 for(int i=istart;i!=iend; ) { \ 00154 ADVANCE_POINTERS(1); \ 00155 00156 00157 00158 00159 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 00160 #define GRID_LOOPREG_END() \ 00161 \ 00162 } /* i */ \ 00163 int i=0; \ 00164 ADVANCE_POINTERS(2*gridLoopBound); \ 00165 } /* j */ \ 00166 /* COMPRESSGRIDS!=1 */ \ 00167 /* int i=0; */ \ 00168 /* ADVANCE_POINTERS(mLevel[lev].lSizex*2); */ \ 00169 } /* all cell loop k,j,i */ \ 00170 if(doReduce) { } /* dummy remove warning */ \ 00171 } /* main_region */ \ 00172 \ 00173 00174 00175 00176 00177 // old loop for COMPRESSGRIDS==0 00178 #define old__GRID_LOOP_START() \ 00179 for(int k=kstart;k<kend;++k) { \ 00180 for(int j=1;j<mLevel[lev].lSizey-1;++j) { \ 00181 for(int i=0;i<mLevel[lev].lSizex-2; ) { 00182 00183