[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56084] trunk/blender: use psys-> seed for smoke random number generator, increase size of MATHUTILS_TOT_CB and reduce float->double conversions.

Campbell Barton ideasman42 at gmail.com
Tue Apr 16 11:04:35 CEST 2013


Revision: 56084
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56084
Author:   campbellbarton
Date:     2013-04-16 09:04:34 +0000 (Tue, 16 Apr 2013)
Log Message:
-----------
use psys->seed for smoke random number generator, increase size of MATHUTILS_TOT_CB and reduce float->double conversions.

Modified Paths:
--------------
    trunk/blender/intern/smoke/intern/EIGENVALUE_HELPER.cpp
    trunk/blender/intern/smoke/intern/FLUID_3D.cpp
    trunk/blender/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
    trunk/blender/intern/smoke/intern/FLUID_3D_STATIC.cpp
    trunk/blender/intern/smoke/intern/INTERPOLATE.h
    trunk/blender/intern/smoke/intern/LU_HELPER.cpp
    trunk/blender/intern/smoke/intern/VEC3.h
    trunk/blender/intern/smoke/intern/WAVELET_NOISE.h
    trunk/blender/intern/smoke/intern/WTURBULENCE.cpp
    trunk/blender/source/blender/blenkernel/intern/smoke.c
    trunk/blender/source/blender/python/mathutils/mathutils.c

Modified: trunk/blender/intern/smoke/intern/EIGENVALUE_HELPER.cpp
===================================================================
--- trunk/blender/intern/smoke/intern/EIGENVALUE_HELPER.cpp	2013-04-16 07:13:49 UTC (rev 56083)
+++ trunk/blender/intern/smoke/intern/EIGENVALUE_HELPER.cpp	2013-04-16 09:04:34 UTC (rev 56084)
@@ -29,7 +29,7 @@
          for (int k = 0; k < i; k++) {
             scale = scale + fabs(eval.d[k]);
          }
-         if (scale == 0.0) {
+         if (scale == 0.0f) {
             eval.e[i] = eval.d[i-1];
             for (int j = 0; j < i; j++) {
                eval.d[j] = eval.V[i-1][j];
@@ -96,7 +96,7 @@
          eval.V[n-1][i] = eval.V[i][i];
          eval.V[i][i] = 1.0;
          float h = eval.d[i+1];
-         if (h != 0.0) {
+         if (h != 0.0f) {
             for (int k = 0; k <= i; k++) {
                eval.d[k] = eval.V[k][i+1] / h;
             }
@@ -181,7 +181,7 @@
                // Compute implicit shift
 
                float g = eval.d[l];
-               float p = (eval.d[l+1] - g) / (2.0 * eval.e[l]);
+               float p = (eval.d[l+1] - g) / (2.0f * eval.e[l]);
                float r = hypot(p,1.0);
                if (p < 0) {
                   r = -r;
@@ -280,7 +280,7 @@
          for (int i = m; i <= high; i++) {
             scale = scale + fabs(eval.H[i][m-1]);
          }
-         if (scale != 0.0) {
+         if (scale != 0.0f) {
    
             // Compute Householder transformation.
    
@@ -334,7 +334,7 @@
       }
 
       for (int m = high-1; m >= low+1; m--) {
-         if (eval.H[m][m-1] != 0.0) {
+         if (eval.H[m][m-1] != 0.0f) {
             for (int i = m+1; i <= high; i++) {
                eval.ort[i] = eval.H[i][m-1];
             }
@@ -406,7 +406,7 @@
          int l = n;
          while (l > low) {
             s = fabs(eval.H[l-1][l-1]) + fabs(eval.H[l][l]);
-            if (s == 0.0) {
+            if (s == 0.0f) {
                s = norm;
             }
             if (fabs(eval.H[l][l-1]) < eps * s) {
@@ -429,7 +429,7 @@
    
          } else if (l == n-1) {
             w = eval.H[n][n-1] * eval.H[n-1][n];
-            p = (eval.H[n-1][n-1] - eval.H[n][n]) / 2.0;
+            p = (eval.H[n-1][n-1] - eval.H[n][n]) / 2.0f;
             q = p * p + w;
             z = sqrt(fabs(q));
             eval.H[n][n] = eval.H[n][n] + exshift;
@@ -446,7 +446,7 @@
                }
                eval.d[n-1] = x + z;
                eval.d[n] = eval.d[n-1];
-               if (z != 0.0) {
+               if (z != 0.0f) {
                   eval.d[n] = x - w / z;
                }
                eval.e[n-1] = 0.0;
@@ -516,21 +516,21 @@
                   eval.H[i][i] -= x;
                }
                s = fabs(eval.H[n][n-1]) + fabs(eval.H[n-1][n-2]);
-               x = y = 0.75 * s;
-               w = -0.4375 * s * s;
+               x = y = 0.75f * s;
+               w = -0.4375f * s * s;
             }
 
             // MATLAB's new ad hoc shift
 
             if (iter == 30) {
-                s = (y - x) / 2.0;
+                s = (y - x) / 2.0f;
                 s = s * s + w;
                 if (s > 0) {
                     s = sqrt(s);
                     if (y < x) {
                        s = -s;
                     }
-                    s = x - w / ((y - x) / 2.0 + s);
+                    s = x - w / ((y - x) / 2.0f + s);
                     for (int i = low; i <= n; i++) {
                        eval.H[i][i] -= s;
                     }
@@ -580,15 +580,15 @@
                if (k != m) {
                   p = eval.H[k][k-1];
                   q = eval.H[k+1][k-1];
-                  r = (notlast ? eval.H[k+2][k-1] : 0.0);
+                  r = (notlast ? eval.H[k+2][k-1] : 0.0f);
                   x = fabs(p) + fabs(q) + fabs(r);
-                  if (x != 0.0) {
+                  if (x != 0.0f) {
                      p = p / x;
                      q = q / x;
                      r = r / x;
                   }
                }
-               if (x == 0.0) {
+               if (x == 0.0f) {
                   break;
                }
                s = sqrt(p * p + q * q + r * r);
@@ -651,7 +651,7 @@
       
       // Backsubstitute to find vectors of upper triangular form
 
-      if (norm == 0.0) {
+      if (norm == 0.0f) {
          return;
       }
    
@@ -670,13 +670,13 @@
                for (int j = l; j <= n; j++) {
                   r = r + eval.H[i][j] * eval.H[j][n];
                }
-               if (eval.e[i] < 0.0) {
+               if (eval.e[i] < 0.0f) {
                   z = w;
                   s = r;
                } else {
                   l = i;
-                  if (eval.e[i] == 0.0) {
-                     if (w != 0.0) {
+                  if (eval.e[i] == 0.0f) {
+                     if (w != 0.0f) {
                         eval.H[i][n] = -r / w;
                      } else {
                         eval.H[i][n] = -r / (eps * norm);
@@ -735,7 +735,7 @@
                }
                w = eval.H[i][i] - p;
    
-               if (eval.e[i] < 0.0) {
+               if (eval.e[i] < 0.0f) {
                   z = w;
                   r = ra;
                   s = sa;
@@ -752,8 +752,8 @@
                      x = eval.H[i][i+1];
                      y = eval.H[i+1][i];
                      vr = (eval.d[i] - p) * (eval.d[i] - p) + eval.e[i] * eval.e[i] - q * q;
-                     vi = (eval.d[i] - p) * 2.0 * q;
-                     if ((vr == 0.0) && (vi == 0.0)) {
+                     vi = (eval.d[i] - p) * 2.0f * q;
+                     if ((vr == 0.0f) && (vi == 0.0f)) {
                         vr = eps * norm * (fabs(w) + fabs(q) +
                         fabs(x) + fabs(y) + fabs(z));
                      }

Modified: trunk/blender/intern/smoke/intern/FLUID_3D.cpp
===================================================================
--- trunk/blender/intern/smoke/intern/FLUID_3D.cpp	2013-04-16 07:13:49 UTC (rev 56083)
+++ trunk/blender/intern/smoke/intern/FLUID_3D.cpp	2013-04-16 09:04:34 UTC (rev 56084)
@@ -574,17 +574,17 @@
 			for (int y = 1; y < _res[1]-1; y++)
 				for (int x = 1+(y+z)%2; x < _res[0]-1; x+=2) {
 					const int index = x + y*_res[0] + z * _slabSize;
-					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1./6. * w*(
+					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1.0f/6.0f * w*(
 							_xVelocityTemp[index+1] + _xVelocityTemp[index-1] +
 							_xVelocityTemp[index+_res[0]] + _xVelocityTemp[index-_res[0]] +
 							_xVelocityTemp[index+_slabSize] + _xVelocityTemp[index-_slabSize] );
 
-					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1./6. * w*(
+					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1.0f/6.0f * w*(
 							_yVelocityTemp[index+1] + _yVelocityTemp[index-1] +
 							_yVelocityTemp[index+_res[0]] + _yVelocityTemp[index-_res[0]] +
 							_yVelocityTemp[index+_slabSize] + _yVelocityTemp[index-_slabSize] );
 
-					_zForce[index] = (1-w)*_zVelocityTemp[index] + 1./6. * w*(
+					_zForce[index] = (1-w)*_zVelocityTemp[index] + 1.0f/6.0f * w*(
 							_zVelocityTemp[index+1] + _zVelocityTemp[index-1] +
 							_zVelocityTemp[index+_res[0]] + _zVelocityTemp[index-_res[0]] +
 							_zVelocityTemp[index+_slabSize] + _zVelocityTemp[index-_slabSize] );
@@ -596,17 +596,17 @@
 			for (int y = 1; y < _res[1]-1; y++)
 				for (int x = 1+(y+z+1)%2; x < _res[0]-1; x+=2) {
 					const int index = x + y*_res[0] + z * _slabSize;
-					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1./6. * w*(
+					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1.0f/6.0f * w*(
 							_xVelocityTemp[index+1] + _xVelocityTemp[index-1] +
 							_xVelocityTemp[index+_res[0]] + _xVelocityTemp[index-_res[0]] +
 							_xVelocityTemp[index+_slabSize] + _xVelocityTemp[index-_slabSize] );
 
-					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1./6. * w*(
+					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1.0f/6.0f * w*(
 							_yVelocityTemp[index+1] + _yVelocityTemp[index-1] +
 							_yVelocityTemp[index+_res[0]] + _yVelocityTemp[index-_res[0]] +
 							_yVelocityTemp[index+_slabSize] + _yVelocityTemp[index-_slabSize] );
 
-					_zForce[index] = (1-w)*_zVelocityTemp[index] + 1./6. * w*(
+					_zForce[index] = (1-w)*_zVelocityTemp[index] + 1.0f/6.0f * w*(
 							_zVelocityTemp[index+1] + _zVelocityTemp[index-1] +
 							_zVelocityTemp[index+_res[0]] + _zVelocityTemp[index-_res[0]] +
 							_zVelocityTemp[index+_slabSize] + _zVelocityTemp[index-_slabSize] );
@@ -636,17 +636,17 @@
 					* Uses xForce as temporary storage to allow other threads to read
 					* old values from xVelocityTemp
 					*/
-					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1./6. * w*(
+					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1.0f/6.0f * w*(
 							_xVelocityTemp[index+1] + _xVelocityTemp[index-1] +
 							_xVelocityTemp[index+_res[0]] + _xVelocityTemp[index-_res[0]] +
 							_xVelocityTemp[index+_slabSize] + _xVelocityTemp[index-_slabSize] );
 
-					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1./6. * w*(
+					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1.0f/6.0f * w*(
 							_yVelocityTemp[index+1] + _yVelocityTemp[index-1] +
 							_yVelocityTemp[index+_res[0]] + _yVelocityTemp[index-_res[0]] +
 							_yVelocityTemp[index+_slabSize] + _yVelocityTemp[index-_slabSize] );
 
-					_zForce[index] = (1-w)*_zVelocityTemp[index] + 1./6. * w*(
+					_zForce[index] = (1-w)*_zVelocityTemp[index] + 1.0f/6.0f * w*(
 							_zVelocityTemp[index+1] + _zVelocityTemp[index-1] +
 							_zVelocityTemp[index+_res[0]] + _zVelocityTemp[index-_res[0]] +
 							_zVelocityTemp[index+_slabSize] + _zVelocityTemp[index-_slabSize] );
@@ -663,17 +663,17 @@
 					* Uses xForce as temporary storage to allow other threads to read
 					* old values from xVelocityTemp
 					*/
-					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1./6. * w*(
+					_xForce[index] = (1-w)*_xVelocityTemp[index] + 1.0f/6.0f * w*(
 							_xVelocityTemp[index+1] + _xVelocityTemp[index-1] +
 							_xVelocityTemp[index+_res[0]] + _xVelocityTemp[index-_res[0]] +
 							_xVelocityTemp[index+_slabSize] + _xVelocityTemp[index-_slabSize] );
 
-					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1./6. * w*(
+					_yForce[index] = (1-w)*_yVelocityTemp[index] + 1.0f/6.0f * w*(
 							_yVelocityTemp[index+1] + _yVelocityTemp[index-1] +
 							_yVelocityTemp[index+_res[0]] + _yVelocityTemp[index-_res[0]] +

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list