Little project: Getting fluidsim multithreaded.
[blender.git] / intern / elbeem / intern / paraloop.h
1
2 #define PERFORM_USQRMAXCHECK \
3 _Pragma("omp critical") {\
4 USQRMAXCHECK(usqr,ux,uy,uz, mMaxVlen, mMxvx,mMxvy,mMxvz); \
5 } \
6
7
8 #define LIST_EMPTY(x) \
9 _Pragma("omp critical") {\
10 mListEmpty.push_back( x ); }
11
12 #define LIST_FULL(x) \
13 _Pragma("omp critical") {\
14 mListFull.push_back( x ); }
15
16 #define FSGR_ADDPART(x)  \
17 _Pragma("omp critical") { \
18 mpParticles->addFullParticle( x ); } \
19
20
21 #define MAX_THREADS 2
22
23 #define  GRID_REGION_START()  \
24 { /* main_region */ \
25         int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \
26         if(gridLoopBound>0){ kstart=getForZMin1(), kend=getForZMax1(mMaxRefine); } \
27         int kdir = 1; \
28         const int id=omp_get_thread_num(); \
29         int jstart = (id*((mLevel[mMaxRefine].lSizey-gridLoopBound) / MAX_THREADS))+gridLoopBound; \
30         int jend   = (id+1)*((mLevel[mMaxRefine].lSizey-gridLoopBound)/ MAX_THREADS); \
31         if(id+1 == MAX_THREADS) \
32         { \
33         jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \
34         } \
35         if(jstart<1) jstart = 1; \
36         LbmFloat *ccel = NULL, *tcel = NULL; \
37         CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \
38         if(mLevel[mMaxRefine].setCurr==1) { \
39         kdir = -1; \
40         int temp = kend; \
41         kend = kstart-1; \
42         kstart = temp-1; \
43         temp = id; /* dummy remove warning */ \
44 } \
45
46
47
48 #define unused_GRID_REGION_END() \
49 } /* main_region */  \
50         // end unusedGRID_REGION_END
51