use psys->seed for smoke random number generator, increase size of MATHUTILS_TOT_CB...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 16 Apr 2013 09:04:34 +0000 (09:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 16 Apr 2013 09:04:34 +0000 (09:04 +0000)
intern/smoke/intern/EIGENVALUE_HELPER.cpp
intern/smoke/intern/FLUID_3D.cpp
intern/smoke/intern/FLUID_3D_SOLVERS.cpp
intern/smoke/intern/FLUID_3D_STATIC.cpp
intern/smoke/intern/INTERPOLATE.h
intern/smoke/intern/LU_HELPER.cpp
intern/smoke/intern/VEC3.h
intern/smoke/intern/WAVELET_NOISE.h
intern/smoke/intern/WTURBULENCE.cpp
source/blender/blenkernel/intern/smoke.c
source/blender/python/mathutils/mathutils.c

index 4910a2b42a769d7515bcbdbfd0c95c729450907e..31537bed39e1b36866d9d9518a6914cf2e778c44 100644 (file)
@@ -29,7 +29,7 @@ void Eigentred2(sEigenvalue& eval) {
          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 @@ void Eigentred2(sEigenvalue& eval) {
          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 @@ void Eigentql2 (sEigenvalue& eval) {
                // 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 @@ void Eigenorthes (sEigenvalue& eval) {
          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 @@ void Eigenorthes (sEigenvalue& eval) {
       }
 
       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 @@ void Eigenhqr2 (sEigenvalue& eval) {
          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 @@ void Eigenhqr2 (sEigenvalue& eval) {
    
          } 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 @@ void Eigenhqr2 (sEigenvalue& eval) {
                }
                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 @@ void Eigenhqr2 (sEigenvalue& eval) {
                   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 @@ void Eigenhqr2 (sEigenvalue& eval) {
                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 @@ void Eigenhqr2 (sEigenvalue& eval) {
       
       // Backsubstitute to find vectors of upper triangular form
 
-      if (norm == 0.0) {
+      if (norm == 0.0f) {
          return;
       }
    
@@ -670,13 +670,13 @@ void Eigenhqr2 (sEigenvalue& eval) {
                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 @@ void Eigenhqr2 (sEigenvalue& eval) {
                }
                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 @@ void Eigenhqr2 (sEigenvalue& eval) {
                      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));
                      }
index 5f0b2439200038675ed5396827606396dcfdc4eb..fb467f54ab04e801019d61eebfa52c29af02b870 100644 (file)
@@ -574,17 +574,17 @@ void FLUID_3D::artificialDampingSL(int zBegin, int zEnd) {
                        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 @@ void FLUID_3D::artificialDampingSL(int zBegin, int zEnd) {
                        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 @@ void FLUID_3D::artificialDampingExactSL(int pos) {
                                        * 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 @@ void FLUID_3D::artificialDampingExactSL(int pos) {
                                        * 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] );
@@ -1244,27 +1244,27 @@ void FLUID_3D::setObstaclePressure(float *_pressure, int zBegin, int zEnd)
                                float pcnt = 0.;
                                if (left && !right) {
                                        _pressure[index] += _pressure[index + 1];
-                                       pcnt += 1.;
+                                       pcnt += 1.0f;
                                }
                                if (!left && right) {
                                        _pressure[index] += _pressure[index - 1];
-                                       pcnt += 1.;
+                                       pcnt += 1.0f;
                                }
                                if (up && !down) {
                                        _pressure[index] += _pressure[index - _xRes];
-                                       pcnt += 1.;
+                                       pcnt += 1.0f;
                                }
                                if (!up && down) {
                                        _pressure[index] += _pressure[index + _xRes];
-                                       pcnt += 1.;
+                                       pcnt += 1.0f;
                                }
                                if (top && !bottom) {
                                        _pressure[index] += _pressure[index - _slabSize];
-                                       pcnt += 1.;
+                                       pcnt += 1.0f;
                                }
                                if (!top && bottom) {
                                        _pressure[index] += _pressure[index + _slabSize];
-                                       pcnt += 1.;
+                                       pcnt += 1.0f;
                                }
                                
                                if(pcnt > 0.000001f)
@@ -1369,7 +1369,7 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
        // set flame vorticity from RNA value
        float flame_vorticity = (*_flame_vorticity)/_constantScaling;
        //int x,y,z,index;
-       if(_vorticityEps+flame_vorticity<=0.) return;
+       if(_vorticityEps+flame_vorticity<=0.0f) return;
 
        int _blockSize=zEnd-zBegin;
        int _blockTotalCells = _slabSize * (_blockSize+2);
index 42a8b2d6923cf001b417aeaf3c82604eee09ff6b..3b51aa11b35207e0fc7a80cc1c2607126eef87d5 100644 (file)
@@ -76,12 +76,12 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip)
           if (!skip[index - _slabSize]) _Acenter[index] += heatConst;
 
                  _residual[index] = b[index] - (_Acenter[index] * field[index] + 
-          field[index - 1] * (skip[index - 1] ? 0.0 : -heatConst) + 
-          field[index + 1] * (skip[index + 1] ? 0.0 : -heatConst) +
-          field[index - _xRes] * (skip[index - _xRes] ? 0.0 : -heatConst) + 
-          field[index + _xRes] * (skip[index + _xRes] ? 0.0 : -heatConst) +
-          field[index - _slabSize] * (skip[index - _slabSize] ? 0.0 : -heatConst) + 
-          field[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -heatConst));
+          field[index - 1] * (skip[index - 1] ? 0.0f : -heatConst) +
+          field[index + 1] * (skip[index + 1] ? 0.0f : -heatConst) +
+          field[index - _xRes] * (skip[index - _xRes] ? 0.0f : -heatConst) +
+          field[index + _xRes] * (skip[index + _xRes] ? 0.0f : -heatConst) +
+          field[index - _slabSize] * (skip[index - _slabSize] ? 0.0f : -heatConst) +
+          field[index + _slabSize] * (skip[index + _slabSize] ? 0.0f : -heatConst));
         }
                else
                {
@@ -111,12 +111,12 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip)
           {
 
                        _q[index] = (_Acenter[index] * _direction[index] + 
-            _direction[index - 1] * (skip[index - 1] ? 0.0 : -heatConst) + 
-            _direction[index + 1] * (skip[index + 1] ? 0.0 : -heatConst) +
-            _direction[index - _xRes] * (skip[index - _xRes] ? 0.0 : -heatConst) + 
-            _direction[index + _xRes] * (skip[index + _xRes] ? 0.0 : -heatConst) +
-            _direction[index - _slabSize] * (skip[index - _slabSize] ? 0.0 : -heatConst) + 
-            _direction[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -heatConst));
+            _direction[index - 1] * (skip[index - 1] ? 0.0f : -heatConst) +
+            _direction[index + 1] * (skip[index + 1] ? 0.0f : -heatConst) +
+            _direction[index - _xRes] * (skip[index - _xRes] ? 0.0f : -heatConst) +
+            _direction[index + _xRes] * (skip[index + _xRes] ? 0.0f : -heatConst) +
+            _direction[index - _slabSize] * (skip[index - _slabSize] ? 0.0f : -heatConst) +
+            _direction[index + _slabSize] * (skip[index + _slabSize] ? 0.0f : -heatConst));
           }
                  else
                  {
@@ -199,20 +199,20 @@ void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
                        if (!skip[index])
                        {
                          // set the matrix to the Poisson stencil in order
-                         if (!skip[index + 1]) Acenter += 1.;
-                         if (!skip[index - 1]) Acenter += 1.;
-                         if (!skip[index + _xRes]) Acenter += 1.;
-                         if (!skip[index - _xRes]) Acenter += 1.;
-                         if (!skip[index + _slabSize]) Acenter += 1.;
-                         if (!skip[index - _slabSize]) Acenter += 1.;
+                         if (!skip[index + 1]) Acenter += 1.0f;
+                         if (!skip[index - 1]) Acenter += 1.0f;
+                         if (!skip[index + _xRes]) Acenter += 1.0f;
+                         if (!skip[index - _xRes]) Acenter += 1.0f;
+                         if (!skip[index + _slabSize]) Acenter += 1.0f;
+                         if (!skip[index - _slabSize]) Acenter += 1.0f;
 
                          _residual[index] = b[index] - (Acenter * field[index] +  
-                         field[index - 1] * (skip[index - 1] ? 0.0 : -1.0f)+ 
-                         field[index + 1] * (skip[index + 1] ? 0.0 : -1.0f)+
-                         field[index - _xRes] * (skip[index - _xRes] ? 0.0 : -1.0f)+ 
-                         field[index + _xRes] * (skip[index + _xRes] ? 0.0 : -1.0f)+
-                         field[index - _slabSize] * (skip[index - _slabSize] ? 0.0 : -1.0f)+ 
-                         field[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -1.0f) );
+                         field[index - 1] * (skip[index - 1] ? 0.0f : -1.0f) +
+                         field[index + 1] * (skip[index + 1] ? 0.0f : -1.0f) +
+                         field[index - _xRes] * (skip[index - _xRes] ? 0.0f : -1.0f)+
+                         field[index + _xRes] * (skip[index + _xRes] ? 0.0f : -1.0f)+
+                         field[index - _slabSize] * (skip[index - _slabSize] ? 0.0f : -1.0f)+
+                         field[index + _slabSize] * (skip[index + _slabSize] ? 0.0f : -1.0f) );
                        }
                        else
                        {
@@ -220,10 +220,10 @@ void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
                        }
 
                        // P^-1
-                       if(Acenter < 1.0)
+                       if(Acenter < 1.0f)
                                _Precond[index] = 0.0;
                        else
-                               _Precond[index] = 1.0 / Acenter;
+                               _Precond[index] = 1.0f / Acenter;
 
                        // p = P^-1 * r
                        _direction[index] = _residual[index] * _Precond[index];
@@ -237,7 +237,7 @@ void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
   //while ((i < _iterations) && (deltaNew > eps*delta0))
   float maxR = 2.0f * eps;
   // while (i < _iterations)
-  while ((i < _iterations) && (maxR > 0.001*eps))
+  while ((i < _iterations) && (maxR > 0.001f * eps))
   {
 
        float alpha = 0.0f;
@@ -252,20 +252,20 @@ void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
           if (!skip[index])
           {
             // set the matrix to the Poisson stencil in order
-            if (!skip[index + 1]) Acenter += 1.;
-            if (!skip[index - 1]) Acenter += 1.;
-            if (!skip[index + _xRes]) Acenter += 1.;
-            if (!skip[index - _xRes]) Acenter += 1.;
-            if (!skip[index + _slabSize]) Acenter += 1.;
-            if (!skip[index - _slabSize]) Acenter += 1.;
+            if (!skip[index + 1]) Acenter += 1.0f;
+            if (!skip[index - 1]) Acenter += 1.0f;
+            if (!skip[index + _xRes]) Acenter += 1.0f;
+            if (!skip[index - _xRes]) Acenter += 1.0f;
+            if (!skip[index + _slabSize]) Acenter += 1.0f;
+            if (!skip[index - _slabSize]) Acenter += 1.0f;
 
                        _q[index] = Acenter * _direction[index] +  
-            _direction[index - 1] * (skip[index - 1] ? 0.0 : -1.0f) + 
-            _direction[index + 1] * (skip[index + 1] ? 0.0 : -1.0f) +
-            _direction[index - _xRes] * (skip[index - _xRes] ? 0.0 : -1.0f) + 
-            _direction[index + _xRes] * (skip[index + _xRes] ? 0.0 : -1.0f)+
-            _direction[index - _slabSize] * (skip[index - _slabSize] ? 0.0 : -1.0f) + 
-            _direction[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -1.0f);
+            _direction[index - 1] * (skip[index - 1] ? 0.0f : -1.0f) +
+            _direction[index + 1] * (skip[index + 1] ? 0.0f : -1.0f) +
+            _direction[index - _xRes] * (skip[index - _xRes] ? 0.0f : -1.0f) +
+            _direction[index + _xRes] * (skip[index + _xRes] ? 0.0f : -1.0f)+
+            _direction[index - _slabSize] * (skip[index - _slabSize] ? 0.0f : -1.0f) +
+            _direction[index + _slabSize] * (skip[index + _slabSize] ? 0.0f : -1.0f);
           }
                  else
                  {
index e0a31a9d0c12d08a097a27e64b3efcd0cf4ab988..e783198559d5d818cbdf25f1190c8dd779b1f082 100644 (file)
@@ -317,12 +317,12 @@ void FLUID_3D::advectFieldSemiLagrange(const float dt, const float* velx, const
                                float zTrace = z - dt * velz[index];
 
                                // clamp backtrace to grid boundaries
-                               if (xTrace < 0.5) xTrace = 0.5;
-                               if (xTrace > xres - 1.5) xTrace = xres - 1.5;
-                               if (yTrace < 0.5) yTrace = 0.5;
-                               if (yTrace > yres - 1.5) yTrace = yres - 1.5;
-                               if (zTrace < 0.5) zTrace = 0.5;
-                               if (zTrace > zres - 1.5) zTrace = zres - 1.5;
+                               if (xTrace < 0.5f) xTrace = 0.5f;
+                               if (xTrace > xres - 1.5f) xTrace = xres - 1.5f;
+                               if (yTrace < 0.5f) yTrace = 0.5f;
+                               if (yTrace > yres - 1.5f) yTrace = yres - 1.5f;
+                               if (zTrace < 0.5f) zTrace = 0.5f;
+                               if (zTrace > zres - 1.5f) zTrace = zres - 1.5f;
 
                                // locate neighbors to interpolate
                                const int x0 = (int)xTrace;
@@ -403,7 +403,7 @@ void FLUID_3D::advectFieldMacCormack2(const float dt, const float* xVelocity, co
 
 
        // phiHatN = A^R(phiHatN1)
-       advectFieldSemiLagrange( -1.0*dt, xVelocity, yVelocity, zVelocity, phiHatN, t1, res, zBegin, zEnd);             // uses wide data from old field and velocities (both are whole)
+       advectFieldSemiLagrange( -1.0f*dt, xVelocity, yVelocity, zVelocity, phiHatN, t1, res, zBegin, zEnd);            // uses wide data from old field and velocities (both are whole)
 
        // phiN1 = phiHatN1 + (phiN - phiHatN) / 2
        const int border = 0; 
@@ -456,12 +456,12 @@ void FLUID_3D::clampExtrema(const float dt, const float* velx, const float* vely
                                float zTrace = z - dt * velz[index];
 
                                // clamp backtrace to grid boundaries
-                               if (xTrace < 0.5) xTrace = 0.5;
-                               if (xTrace > xres - 1.5) xTrace = xres - 1.5;
-                               if (yTrace < 0.5) yTrace = 0.5;
-                               if (yTrace > yres - 1.5) yTrace = yres - 1.5;
-                               if (zTrace < 0.5) zTrace = 0.5;
-                               if (zTrace > zres - 1.5) zTrace = zres - 1.5;
+                               if (xTrace < 0.5f) xTrace = 0.5f;
+                               if (xTrace > xres - 1.5f) xTrace = xres - 1.5f;
+                               if (yTrace < 0.5f) yTrace = 0.5f;
+                               if (yTrace > yres - 1.5f) yTrace = yres - 1.5f;
+                               if (zTrace < 0.5f) zTrace = 0.5f;
+                               if (zTrace > zres - 1.5f) zTrace = zres - 1.5f;
 
                                // locate neighbors to interpolate
                                const int x0 = (int)xTrace;
index b76c8df0b592fc35e1832e356d1a3a21644ba52b..fbead5df87c3a6687b75e1b2bad40be013f9fd39 100644 (file)
@@ -62,12 +62,12 @@ static inline float lerp(float* field, float x, float y, int res) {
 ////////////////////////////////////////////////////////////////////////////////////////// 
 static inline float lerp3d(float* field, float x, float y, float z,  int xres, int yres, int zres) {
        // clamp pos to grid boundaries
-       if (x < 0.5) x = 0.5;
-       if (x > xres - 1.5) x = xres - 1.5;
-       if (y < 0.5) y = 0.5;
-       if (y > yres - 1.5) y = yres - 1.5;
-       if (z < 0.5) z = 0.5;
-       if (z > zres - 1.5) z = zres - 1.5;
+       if (x < 0.5f) x = 0.5f;
+       if (x > xres - 1.5f) x = xres - 1.5f;
+       if (y < 0.5f) y = 0.5f;
+       if (y > yres - 1.5f) y = yres - 1.5f;
+       if (z < 0.5f) z = 0.5f;
+       if (z > zres - 1.5f) z = zres - 1.5f;
 
        // locate neighbors to interpolate
        const int x0 = (int)x;
@@ -113,12 +113,12 @@ template <class T>
 static inline float lerp3dToFloat(T* field1,
                float x, float y, float z,  int xres, int yres, int zres) {
        // clamp pos to grid boundaries
-       if (x < 0.5) x = 0.5;
-       if (x > xres - 1.5) x = xres - 1.5;
-       if (y < 0.5) y = 0.5;
-       if (y > yres - 1.5) y = yres - 1.5;
-       if (z < 0.5) z = 0.5;
-       if (z > zres - 1.5) z = zres - 1.5;
+       if (x < 0.5f) x = 0.5f;
+       if (x > xres - 1.5f) x = xres - 1.5f;
+       if (y < 0.5f) y = 0.5f;
+       if (y > yres - 1.5f) y = yres - 1.5f;
+       if (z < 0.5f) z = 0.5f;
+       if (z > zres - 1.5f) z = zres - 1.5f;
 
        // locate neighbors to interpolate
        const int x0 = (int)x;
@@ -164,12 +164,12 @@ static inline float lerp3dToFloat(T* field1,
 static inline Vec3 lerp3dVec(float* field1, float* field2, float* field3, 
                float x, float y, float z,  int xres, int yres, int zres) {
        // clamp pos to grid boundaries
-       if (x < 0.5) x = 0.5;
-       if (x > xres - 1.5) x = xres - 1.5;
-       if (y < 0.5) y = 0.5;
-       if (y > yres - 1.5) y = yres - 1.5;
-       if (z < 0.5) z = 0.5;
-       if (z > zres - 1.5) z = zres - 1.5;
+       if (x < 0.5f) x = 0.5f;
+       if (x > xres - 1.5f) x = xres - 1.5f;
+       if (y < 0.5f) y = 0.5f;
+       if (y > yres - 1.5f) y = yres - 1.5f;
+       if (z < 0.5f) z = 0.5f;
+       if (z > zres - 1.5f) z = zres - 1.5f;
 
        // locate neighbors to interpolate
        const int x0 = (int)x;
index 400603710710d54c942bf740b330c69cc212a120..40973cc081b84af1d2068b7aca628e9fc7208a8a 100644 (file)
@@ -51,10 +51,10 @@ sLU computeLU( float a[3][3])
             int kmax = min(i,j);
             double s = 0.0;
             for (int k = 0; k < kmax; k++) {
-               s += result.values[i][k]*LUcolj[k];
+               s += (double)(result.values[i][k]*LUcolj[k]);
             }
 
-            result.values[i][j] = LUcolj[i] -= s;
+            result.values[i][j] = LUcolj[i] -= (float)s;
          }
    
          // Find pivot and exchange if necessary.
@@ -80,7 +80,7 @@ sLU computeLU( float a[3][3])
 
          // Compute multipliers.
          
-         if ((j < m) && (result.values[j][j] != 0.0)) {
+         if ((j < m) && (result.values[j][j] != 0.0f)) {
             for (int i = j+1; i < m; i++) {
                result.values[i][j] /= result.values[j][j];
             }
index 63ce68566a947911102e9745dadc23593198a80e..dafe5e52dbdef88be97030b3ca309ed001576f14 100644 (file)
@@ -730,7 +730,7 @@ inline Real normHelper(const Vector3Dim<Real> &v) {
        return norm(v);
 }      
 inline Real normHelper(const Real &v) {
-       return (0. < v) ? v : -v ; 
+       return (0.0f < v) ? v : -v ;
 }      
 inline Real normHelper(const int &v) {
        return (0 < v) ? (Real)(v) : (Real)(-v) ; 
index 1b2fbfab58c95d39a824d8a1ca440513504c6d87..9f01c8a697839674122c65ba38792f030a4275dd 100644 (file)
@@ -395,20 +395,20 @@ static inline float WNoiseDx(Vec3 p, float* data) {
   int c[3], mid[3], n = noiseTileSize;
   float w[3][3], t, result = 0;
   
-  mid[0] = (int)ceil(p[0] - 0.5); 
-  t = mid[0] - (p[0] - 0.5);
+  mid[0] = (int)ceil(p[0] - 0.5f);
+  t = mid[0] - (p[0] - 0.5f);
        w[0][0] = -t;
        w[0][2] = (1.f - t);
        w[0][1] = 2.0f * t - 1.0f;
   
-  mid[1] = (int)ceil(p[1] - 0.5); 
-  t = mid[1] - (p[1] - 0.5);
+  mid[1] = (int)ceil(p[1] - 0.5f);
+  t = mid[1] - (p[1] - 0.5f);
   w[1][0] = t * t / 2; 
   w[1][2] = (1 - t) * (1 - t) / 2;
   w[1][1] = 1 - w[1][0] - w[1][2];
 
-  mid[2] = (int)ceil(p[2] - 0.5); 
-  t = mid[2] - (p[2] - 0.5);
+  mid[2] = (int)ceil(p[2] - 0.5f);
+  t = mid[2] - (p[2] - 0.5f);
   w[2][0] = t * t / 2; 
   w[2][2] = (1 - t) * (1 - t)/2; 
   w[2][1] = 1 - w[2][0] - w[2][2];
@@ -437,20 +437,20 @@ static inline float WNoiseDy(Vec3 p, float* data) {
   int c[3], mid[3], n=noiseTileSize; 
   float w[3][3], t, result =0;
   
-  mid[0] = (int)ceil(p[0] - 0.5); 
-  t = mid[0]-(p[0] - 0.5);
+  mid[0] = (int)ceil(p[0] - 0.5f);
+  t = mid[0]-(p[0] - 0.5f);
   w[0][0] = t * t / 2; 
   w[0][2] = (1 - t) * (1 - t) / 2;
   w[0][1] = 1 - w[0][0] - w[0][2];
   
-  mid[1] = (int)ceil(p[1] - 0.5); 
-  t = mid[1]-(p[1] - 0.5);
+  mid[1] = (int)ceil(p[1] - 0.5f);
+  t = mid[1]-(p[1] - 0.5f);
        w[1][0] = -t;
        w[1][2] = (1.f - t);
        w[1][1] = 2.0f * t - 1.0f;
 
-  mid[2] = (int)ceil(p[2] - 0.5); 
-  t = mid[2] - (p[2] - 0.5);
+  mid[2] = (int)ceil(p[2] - 0.5f);
+  t = mid[2] - (p[2] - 0.5f);
   w[2][0] = t * t / 2; 
   w[2][2] = (1 - t) * (1 - t)/2; 
   w[2][1] = 1 - w[2][0] - w[2][2];
@@ -480,20 +480,20 @@ static inline float WNoiseDz(Vec3 p, float* data) {
   int c[3], mid[3], n=noiseTileSize; 
   float w[3][3], t, result =0;
 
-  mid[0] = (int)ceil(p[0] - 0.5); 
-  t = mid[0]-(p[0] - 0.5);
+  mid[0] = (int)ceil(p[0] - 0.5f);
+  t = mid[0]-(p[0] - 0.5f);
   w[0][0] = t * t / 2; 
   w[0][2] = (1 - t) * (1 - t) / 2;
   w[0][1] = 1 - w[0][0] - w[0][2];
   
-  mid[1] = (int)ceil(p[1] - 0.5); 
-  t = mid[1]-(p[1] - 0.5);
+  mid[1] = (int)ceil(p[1] - 0.5f);
+  t = mid[1]-(p[1] - 0.5f);
   w[1][0] = t * t / 2; 
   w[1][2] = (1 - t) * (1 - t) / 2;
   w[1][1] = 1 - w[1][0] - w[1][2];
 
-  mid[2] = (int)ceil(p[2] - 0.5); 
-  t = mid[2] - (p[2] - 0.5);
+  mid[2] = (int)ceil(p[2] - 0.5f);
+  t = mid[2] - (p[2] - 0.5f);
        w[2][0] = -t;
        w[2][2] = (1.f - t);
        w[2][1] = 2.0f * t - 1.0f;
index 5b6509afeadd8f39edb3cb462ac63e696390107d..efc6c19a4c508f243f75f047041ad4e184fcae41 100644 (file)
@@ -64,14 +64,14 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
        // DG - RNA-fied _strength = 2.;
        
        // add the corresponding octaves of noise
-       _octaves = (int)(log((float)_amplify) / log(2.0f) + 0.5); // XXX DEBUG/ TODO: int casting correct? - dg
+       _octaves = (int)(log((float)_amplify) / log(2.0f) + 0.5f); // XXX DEBUG/ TODO: int casting correct? - dg
        
        // noise resolution
        _xResBig = _amplify * xResSm;
        _yResBig = _amplify * yResSm;
        _zResBig = _amplify * zResSm;
        _resBig = Vec3Int(_xResBig, _yResBig, _zResBig);
-       _invResBig = Vec3(1./(float)_resBig[0], 1./(float)_resBig[1], 1./(float)_resBig[2]);
+       _invResBig = Vec3(1.0f/(float)_resBig[0], 1.0f/(float)_resBig[1], 1.0f/(float)_resBig[2]);
        _slabSizeBig = _xResBig*_yResBig;
        _totalCellsBig = _slabSizeBig * _zResBig;
        
@@ -80,7 +80,7 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
        _yResSm = yResSm;
        _zResSm = zResSm;
        _resSm = Vec3Int(xResSm, yResSm, zResSm);
-       _invResSm = Vec3(1./(float)_resSm[0], 1./(float)_resSm[1], 1./(float)_resSm[2] );
+       _invResSm = Vec3(1.0f/(float)_resSm[0], 1.0f/(float)_resSm[1], 1.0f/(float)_resSm[2] );
        _slabSizeSm = _xResSm*_yResSm;
        _totalCellsSm = _slabSizeSm * _zResSm;
        
@@ -115,9 +115,9 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
        _tcTemp = new float[_totalCellsSm];
        
        // map all 
-       const float dx = 1./(float)(_resSm[0]);
-       const float dy = 1./(float)(_resSm[1]);
-       const float dz = 1./(float)(_resSm[2]);
+       const float dx = 1.0f/(float)(_resSm[0]);
+       const float dy = 1.0f/(float)(_resSm[1]);
+       const float dz = 1.0f/(float)(_resSm[2]);
        int index = 0;
        for (int z = 0; z < _zResSm; z++) 
        for (int y = 0; y < _yResSm; y++) 
@@ -438,13 +438,13 @@ void WTURBULENCE::resetTextureCoordinates(float *_eigMin, float *_eigMax)
 {
   // allowed deformation of the textures
   const float limit = 2.f;
-  const float limitInv = 1./limit;
+  const float limitInv = 1.0f/limit;
 
   // standard reset
   int resets = 0;
-  const float dx = 1./(float)(_resSm[0]);
-  const float dy = 1./(float)(_resSm[1]);
-  const float dz = 1./(float)(_resSm[2]);
+  const float dx = 1.0f/(float)(_resSm[0]);
+  const float dy = 1.0f/(float)(_resSm[1]);
+  const float dz = 1.0f/(float)(_resSm[2]);
 
   for (int z = 1; z < _zResSm-1; z++)
     for (int y = 1; y < _yResSm-1; y++)
@@ -988,13 +988,13 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
 
       // base amplitude for octave 0
       float coefficient = sqrtf(2.0f * fabs(energy));
-      const float amplitude = *_strength * fabs(0.5 * coefficient) * persistence;
+      const float amplitude = *_strength * fabs(0.5f * coefficient) * persistence;
 
       // add noise to velocity, but only if the turbulence is
       // sufficiently undeformed, and the energy is large enough
       // to make a difference
-      const bool addNoise = eigMax[indexSmall] < 2. && 
-                            eigMin[indexSmall] > 0.5;
+      const bool addNoise = eigMax[indexSmall] < 2.0f &&
+                            eigMin[indexSmall] > 0.5f;
       if (addNoise && amplitude > _cullingThreshold) {
         // base amplitude for octave 0
         float amplitudeScaled = amplitude;
@@ -1029,7 +1029,7 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
       // zero out velocity inside obstacles
       float obsCheck = INTERPOLATE::lerp3dToFloat(
           obstacles, posSm[0], posSm[1], posSm[2], _xResSm, _yResSm, _zResSm); 
-      if (obsCheck > 0.95
+      if (obsCheck > 0.95f)
         bigUx[index] = bigUy[index] = bigUz[index] = 0.;
     } // xyz*/
 
index ba6e8fe0a3a96c80cd1c8b8f1570f94a24aec1d9..009112be2c9d5a394c13980dc26ee182e82f2c04 100644 (file)
@@ -969,7 +969,7 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
                sim.scene = scene;
                sim.ob = flow_ob;
                sim.psys = psys;
-               sim.rng = BLI_rng_new(sim.rng);
+               sim.rng = BLI_rng_new(psys->seed);
 
                if (psys->part->type == PART_HAIR)
                {
index 47600e65351dd65a01aef87be481e2f079d4631d..57b00559a8a33da0f38e2c0b96110343b57428ef 100644 (file)
@@ -340,7 +340,7 @@ int mathutils_deepcopy_args_check(PyObject *args)
 /* Mathutils Callbacks */
 
 /* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
-#define MATHUTILS_TOT_CB 13
+#define MATHUTILS_TOT_CB 15
 static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL};
 
 unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb)