[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56950] trunk/blender/intern/smoke/intern/ FLUID_3D.cpp: Fix: Smoke simulator produced slightly different results on every run if openmp was enabled .

Miika Hamalainen blender at miikah.org
Tue May 21 20:57:20 CEST 2013


Revision: 56950
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56950
Author:   miikah
Date:     2013-05-21 18:57:19 +0000 (Tue, 21 May 2013)
Log Message:
-----------
Fix: Smoke simulator produced slightly different results on every run if openmp was enabled.

This was a typical threading issue. Move that particular function out of the parallel block.

Modified Paths:
--------------
    trunk/blender/intern/smoke/intern/FLUID_3D.cpp

Modified: trunk/blender/intern/smoke/intern/FLUID_3D.cpp
===================================================================
--- trunk/blender/intern/smoke/intern/FLUID_3D.cpp	2013-05-21 17:25:35 UTC (rev 56949)
+++ trunk/blender/intern/smoke/intern/FLUID_3D.cpp	2013-05-21 18:57:19 UTC (rev 56950)
@@ -365,6 +365,7 @@
 	int zEnd=_zRes;
 #endif
 
+	wipeBoundariesSL(0, _zRes);
 
 #if PARALLEL==1
 	#pragma omp parallel
@@ -376,7 +377,6 @@
 		int zEnd = (int)((float)(i+1)*partSize + 0.5f);
 #endif
 
-		wipeBoundariesSL(zBegin, zEnd);
 		addVorticity(zBegin, zEnd);
 		addBuoyancy(_heat, _density, gravity, zBegin, zEnd);
 		addForce(zBegin, zEnd);
@@ -879,7 +879,7 @@
 	if (zEnd == _zRes)
 	{
 		index=0;
-		int indexx=0;
+		int index_top=0;
 		const int cellsslab = totalCells - slabSize;
 
 		for (y = 0; y < _yRes; y++)
@@ -887,19 +887,19 @@
 			{
 
 				// back slab
-				indexx = index + cellsslab;
-				_xVelocity[indexx] = 0.0f;
-				_yVelocity[indexx] = 0.0f;
-				_zVelocity[indexx] = 0.0f;
-				_density[indexx] = 0.0f;
+				index_top = index + cellsslab;
+				_xVelocity[index_top] = 0.0f;
+				_yVelocity[index_top] = 0.0f;
+				_zVelocity[index_top] = 0.0f;
+				_density[index_top] = 0.0f;
 				if (_fuel) {
-					_fuel[index] = 0.0f;
-					_react[index] = 0.0f;
+					_fuel[index_top] = 0.0f;
+					_react[index_top] = 0.0f;
 				}
 				if (_color_r) {
-					_color_r[index] = 0.0f;
-					_color_g[index] = 0.0f;
-					_color_b[index] = 0.0f;
+					_color_r[index_top] = 0.0f;
+					_color_g[index_top] = 0.0f;
+					_color_b[index_top] = 0.0f;
 				}
 			}
 	}




More information about the Bf-blender-cvs mailing list