svn merge -r 12653:12664 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender-staging.git] / intern / elbeem / intern / paraloopend.h
index 81fc329d159a07d7cb2ae76b6e5400cea7ec2fff..54f5a529ea439d7ef07aa33fb9a0bebba19d35aa 100644 (file)
@@ -1,13 +1,41 @@
-// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-} /* i */ 
-       int i=0; 
-       ADVANCE_POINTERS(2*gridLoopBound); 
-} /* j */ 
-#pragma omp barrier 
-       /* COMPRESSGRIDS!=1 */ 
-       /* int i=0;  */ 
-       /* ADVANCE_POINTERS(mLevel[lev].lSizex*2);  */ 
-} /* all cell loop k,j,i */
-       if(doReduce) { } /* dummy remove warning */ 
-} /* main_region */ 
+// same as grid loop_end + barrier
+
+                       } // i
+               int i=0; //dummy
+               ADVANCE_POINTERS(2*gridLoopBound);
+       } // j
+
+#      if COMPRESSGRIDS==1
+#      if PARALLEL==1
+       //frintf(stderr," (id=%d k=%d) ",id,k);
+#pragma omp barrier
+#      endif // PARALLEL==1
+#      else // COMPRESSGRIDS==1
+       int i=0; //dummy
+       ADVANCE_POINTERS(mLevel[lev].lSizex*2);
+#      endif // COMPRESSGRIDS==1
+
+} // all cell loop k,j,i
+
+#pragma omp critical
+{
+       if(doReduce) {
+               // synchronize global vars
+               for(int j=0; j<calcListFull.size() ; j++) mListFull.push_back( calcListFull[j] ); 
+               for(int j=0; j<calcListEmpty.size(); j++) mListEmpty.push_back( calcListEmpty[j] ); 
+               for(int j=0; j<calcListParts.size(); j++) mpParticles->addFullParticle( calcListParts[j] );
+               if(calcMaxVlen>mMaxVlen) {  
+                       mMxvx = calcMxvx;  
+                       mMxvy = calcMxvy;  
+                       mMxvz = calcMxvz;  
+                       mMaxVlen = calcMaxVlen;  
+               }  
+               if(0) {debMsgStd("OMP_CRIT",DM_MSG,     "reduce id"<<id<<" curr: "<<mMaxVlen<<"|"<<mMxvx<<","<<mMxvy<<","<<mMxvz<< 
+                                                                                                                                                               "      calc[ "<<calcMaxVlen<<"|"<<calcMxvx<<","<<calcMxvy<<","<<calcMxvz<<"]  " ,4 ); }
+       }
+} // critical
+
+
+} /* main_region */  
+       //?lobOutstrForce = true;