[Bf-blender-cvs] [f0058e4] fracture_modifier: Fix elbeem omp for msvc

Jens Verwiebe noreply at git.blender.org
Tue Oct 4 00:05:26 CEST 2016


Commit: f0058e49803c8923d8871c72df3aa6b16e1b87ee
Author: Jens Verwiebe
Date:   Tue Oct 4 00:03:07 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rBf0058e49803c8923d8871c72df3aa6b16e1b87ee

Fix elbeem omp for msvc

===================================================================

M	intern/elbeem/intern/solver_main.cpp

===================================================================

diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp
index 34bd72e..68f7c04 100644
--- a/intern/elbeem/intern/solver_main.cpp
+++ b/intern/elbeem/intern/solver_main.cpp
@@ -376,11 +376,11 @@ LbmFsgrSolver::mainLoop(const int lev)
   // main loop region
 	const bool doReduce = true;
 	const int gridLoopBound=1;
-       const int gDebugLevel = ::gDebugLevel;
-       int calcNumInvIfCells = 0;
-       LbmFloat calcInitialMass = 0;
+	int calcNumInvIfCells = 0;
+	LbmFloat calcInitialMass = 0;
 	GRID_REGION_INIT();
 #if PARALLEL==1
+	const int gDebugLevel = ::gDebugLevel;
 #pragma omp parallel default(none) num_threads(mNumOMPThreads) \
   reduction(+: \
 	  calcCurrentMass,calcCurrentVolume, \
@@ -611,8 +611,8 @@ LbmFsgrSolver::mainLoop(const int lev)
 		// read distribution funtions of adjacent cells = stream step
 		DEFAULT_STREAM;
 
-               if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; calcNumInvIfCells++; }
-               if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; calcNumInvIfCells++; }
+		if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; calcNumInvIfCells++; }
+		if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; calcNumInvIfCells++; }
 
 		// calculate mass exchange for interface cells 
 		LbmFloat myfrac = RAC(ccel,dFfrac);
@@ -868,10 +868,8 @@ LbmFsgrSolver::mainLoop(const int lev)
 			// physical drop model
 			if(mPartUsePhysModel) {
 				LbmFloat realWorldFac = (mLevel[lev].simCellSize / mLevel[lev].timestep);
-				LbmFloat rux = (ux * realWorldFac);
-				LbmFloat ruy = (uy * realWorldFac);
-				LbmFloat ruz = (uz * realWorldFac);
-				LbmFloat rl = norm(ntlVec3Gfx(rux,ruy,ruz));
+				LbmVec ru(ux * realWorldFac, uy * realWorldFac, uz * realWorldFac);
+				LbmFloat rl = norm(ru);
 				basethresh *= rl;
 
 				// reduce probability in outer region?
@@ -963,14 +961,15 @@ LbmFsgrSolver::mainLoop(const int lev)
 				// average normal & velocity 
 				// -> mostly along velocity dir, many into surface
 				// fluid velocity (not normalized!)
-				LbmVec flvelVel = LbmVec(ux,uy,uz);
+				LbmVec flvelVel(ux,uy,uz);
 				LbmFloat flvelLen = norm(flvelVel);
 				// surface normal
-				LbmVec normVel = LbmVec(surfaceNormal[0],surfaceNormal[1],surfaceNormal[2]);
+				LbmVec normVel(surfaceNormal[0],surfaceNormal[1],surfaceNormal[2]);
 				normalize(normVel);
 				LbmFloat normScale = (0.01+flvelLen);
 				// jitter vector, 0.2 * flvel
-				LbmVec jittVel = LbmVec(jx,jy,jz)*(0.05+flvelLen)*0.1;
+				LbmVec jittVel(jx,jy,jz);
+				jittVel *= (0.05+flvelLen)*0.1;
 				// weighten velocities
 				const LbmFloat flvelWeight = 0.9;
 				LbmVec newpartVel = normVel*normScale*(1.-flvelWeight) + flvelVel*(flvelWeight) + jittVel; 
@@ -1108,8 +1107,8 @@ LbmFsgrSolver::mainLoop(const int lev)
 	mNumFilledCells  = calcCellsFilled;
 	mNumEmptiedCells = calcCellsEmptied;
 	mNumUsedCells = calcNumUsedCells;
-       mNumInvIfCells += calcNumInvIfCells;
-       mInitialMass += calcInitialMass;
+	mNumInvIfCells += calcNumInvIfCells;
+	mInitialMass += calcInitialMass;
 }
 
 
@@ -1120,13 +1119,13 @@ LbmFsgrSolver::preinitGrids()
 	const int lev = mMaxRefine;
 	const bool doReduce = false;
 	const int gridLoopBound=0;
-	const int gDebugLevel = ::gDebugLevel;
 
 	// preinit both grids
 	for(int s=0; s<2; s++) {
 	
 		GRID_REGION_INIT();
 #if PARALLEL==1
+	const int gDebugLevel = ::gDebugLevel;
 #pragma omp parallel default(none) num_threads(mNumOMPThreads) \
   reduction(+: \
 	  calcCurrentMass,calcCurrentVolume, \
@@ -1161,10 +1160,10 @@ LbmFsgrSolver::standingFluidPreinit()
 	const int lev = mMaxRefine;
 	const bool doReduce = false;
 	const int gridLoopBound=1;
-	const int gDebugLevel = ::gDebugLevel;
 
 	GRID_REGION_INIT();
 #if PARALLEL==1
+	const int gDebugLevel = ::gDebugLevel;
 #pragma omp parallel default(none) num_threads(mNumOMPThreads) \
   reduction(+: \
 	  calcCurrentMass,calcCurrentVolume, \




More information about the Bf-blender-cvs mailing list