Revision: 23604
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23604
Author:   genscher
Date:     2009-10-02 13:09:05 +0200 (Fri, 02 Oct 2009)

Log Message:
-----------
Smoke:
* Dissolve is back
* Obstacles coming back (some bugs left i think)

Modified Paths:
--------------
    trunk/blender/intern/smoke/intern/FLUID_3D.cpp
    trunk/blender/intern/smoke/intern/FLUID_3D_STATIC.cpp
    trunk/blender/intern/smoke/intern/WTURBULENCE.cpp
    trunk/blender/source/blender/blenkernel/intern/smoke.c

Modified: trunk/blender/intern/smoke/intern/FLUID_3D.cpp
===================================================================
--- trunk/blender/intern/smoke/intern/FLUID_3D.cpp      2009-10-02 07:20:33 UTC 
(rev 23603)
+++ trunk/blender/intern/smoke/intern/FLUID_3D.cpp      2009-10-02 11:09:05 UTC 
(rev 23604)
@@ -399,16 +399,12 @@
                for (y = 1; y < _yRes - 1; y++, index += 2)
                        for (x = 1; x < _xRes - 1; x++, index++)
                        {
-                               // if(!_obstacles[index])
+                               if(!_obstacles[index])
                                {
                                        _xVelocity[index] -= 0.5f * 
(_pressure[index + 1]     - _pressure[index - 1]) * invDx;
                                        _yVelocity[index] -= 0.5f * 
(_pressure[index + _xRes]  - _pressure[index - _xRes]) * invDx;
                                        _zVelocity[index] -= 0.5f * 
(_pressure[index + _slabSize] - _pressure[index - _slabSize]) * invDx;
-                               }/*
-                               else
-                               {
-                                       _xVelocity[index] = _yVelocity[index] = 
_zVelocity[index] = 0.0f;
-                               }*/
+                               }
                        }
 
        if (_pressure) delete[] _pressure;
@@ -497,23 +493,15 @@
                                if (top && !bottom) {
                                        _pressure[index] += _pressure[index - 
_slabSize];
                                        pcnt += 1.;
-                                       // _zVelocity[index] +=  - 
_zVelocity[index - _slabSize];
-                                       // vp += 1.0;
                                }
                                if (!top && bottom) {
                                        _pressure[index] += _pressure[index + 
_slabSize];
                                        pcnt += 1.;
-                                       // _zVelocity[index] +=  - 
_zVelocity[index + _slabSize];
-                                       // vp += 1.0;
                                }
                                
                                if(pcnt > 0.000001f)
                                        _pressure[index] /= pcnt;
 
-                               // test - dg
-                               // if(vp > 0.000001f)
-                               //      _zVelocity[index] /= vp;
-
                                // TODO? set correct velocity bc's
                                // velocities are only set to zero right now
                                // this means it's not a full no-slip boundary 
condition

Modified: trunk/blender/intern/smoke/intern/FLUID_3D_STATIC.cpp
===================================================================
--- trunk/blender/intern/smoke/intern/FLUID_3D_STATIC.cpp       2009-10-02 
07:20:33 UTC (rev 23603)
+++ trunk/blender/intern/smoke/intern/FLUID_3D_STATIC.cpp       2009-10-02 
11:09:05 UTC (rev 23604)
@@ -296,7 +296,7 @@
        const int slabSize = res[0] * res[1];
 
        // scale dt up to grid resolution
-#if PARALLEL==1
+#if PARALLEL==1 && !_WIN32
 #pragma omp parallel
 #pragma omp for  schedule(static)
 #endif

Modified: trunk/blender/intern/smoke/intern/WTURBULENCE.cpp
===================================================================
--- trunk/blender/intern/smoke/intern/WTURBULENCE.cpp   2009-10-02 07:20:33 UTC 
(rev 23603)
+++ trunk/blender/intern/smoke/intern/WTURBULENCE.cpp   2009-10-02 11:09:05 UTC 
(rev 23604)
@@ -735,19 +735,17 @@
        // enlarge timestep to match grid
        const float dt = dtOrg * _amplify;
        const float invAmp = 1.0f / _amplify;
-       float *tempBig1 = new float[_totalCellsBig];
-       float *tempBig2 = new float[_totalCellsBig];
-       float *bigUx = new float[_totalCellsBig];
-       float *bigUy = new float[_totalCellsBig];
-       float *bigUz = new float[_totalCellsBig]; 
-       float *_energy = new float[_totalCellsSm];
-       float *highFreqEnergy = new float[_totalCellsSm];
-       float *eigMin  = new float[_totalCellsSm];
-       float *eigMax  = new float[_totalCellsSm];
+       float *tempBig1 = (float *)calloc(_totalCellsBig, sizeof(float));
+       float *tempBig2 = (float *)calloc(_totalCellsBig, sizeof(float));
+       float *bigUx = (float *)calloc(_totalCellsBig, sizeof(float));
+       float *bigUy = (float *)calloc(_totalCellsBig, sizeof(float));
+       float *bigUz = (float *)calloc(_totalCellsBig, sizeof(float)); 
+       float *_energy = (float *)calloc(_totalCellsSm, sizeof(float));
+       float *highFreqEnergy = (float *)calloc(_totalCellsSm, sizeof(float));
+       float *eigMin  = (float *)calloc(_totalCellsSm, sizeof(float));
+       float *eigMax  = (float *)calloc(_totalCellsSm, sizeof(float));
 
-       memset(highFreqEnergy, 0, sizeof(float)*_totalCellsSm);
-       memset(eigMin, 0, sizeof(float)*_totalCellsSm);
-       memset(eigMax, 0, sizeof(float)*_totalCellsSm);
+       memset(_tcTemp, 0, sizeof(float)*_totalCellsSm);
 
        // prepare textures
        advectTextureCoordinates(dtOrg, xvel,yvel,zvel, tempBig1, tempBig2);
@@ -771,16 +769,16 @@
 
   // parallel region setup
   float maxVelMagThreads[8] = { -1., -1., -1., -1., -1., -1., -1., -1. };
-#if PARALLEL==1
+#if PARALLEL==1 && !_WIN32
 #pragma omp parallel
 #endif
   { float maxVelMag1 = 0.;
-#if PARALLEL==1
+#if PARALLEL==1 && !_WIN32
     const int id  = omp_get_thread_num(); /*, num = omp_get_num_threads(); */
 #endif
 
   // vector noise main loop
-#if PARALLEL==1
+#if PARALLEL==1 && !_WIN32
 #pragma omp for  schedule(static)
 #endif
   for (int zSmall = 0; zSmall < _zResSm; zSmall++) 
@@ -912,7 +910,7 @@
         bigUx[index] = bigUy[index] = bigUz[index] = 0.;
     } // xyz
 
-#if PARALLEL==1
+#if PARALLEL==1 && !_WIN32
     maxVelMagThreads[id] = maxVelMag1;
 #else
     maxVelMagThreads[0] = maxVelMag1;
@@ -922,7 +920,7 @@
   
   // compute maximum over threads
   float maxVelMag = maxVelMagThreads[0];
-#if PARALLEL==1
+#if PARALLEL==1 && !_WIN32
   for (int i = 1; i < 8; i++) 
     if (maxVelMag < maxVelMagThreads[i]) 
       maxVelMag = maxVelMagThreads[i];
@@ -957,13 +955,13 @@
       SWAP_POINTERS(_densityBig, _densityBigOld);
   } // substep
 
-  delete[] tempBig1;
-  delete[] tempBig2;
-  delete[] bigUx;
-  delete[] bigUy;
-  delete[] bigUz;
-  delete[] _energy;
-  delete[] highFreqEnergy;
+  free(tempBig1);
+  free(tempBig2);
+  free(bigUx);
+  free(bigUy);
+  free(bigUz);
+  free(_energy);
+  free(highFreqEnergy);
   
   // wipe the density borders
   FLUID_3D::setZeroBorder(_densityBig, _resBig);
@@ -973,8 +971,8 @@
   // eigenvalues stored do not reflect the underlying texture coordinates
   resetTextureCoordinates(eigMin, eigMax);
 
-  delete[] eigMin;
-  delete[] eigMax;
+  free(eigMin);
+  free(eigMax);
   
   // output files
   // string prefix = string("./amplified.preview/density_bigxy_");

Modified: trunk/blender/source/blender/blenkernel/intern/smoke.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/smoke.c      2009-10-02 
07:20:33 UTC (rev 23603)
+++ trunk/blender/source/blender/blenkernel/intern/smoke.c      2009-10-02 
11:09:05 UTC (rev 23604)
@@ -1183,7 +1183,11 @@
                // simulate the actual smoke (c++ code in intern/smoke)
                // DG: interesting commenting this line + deactivating loading 
of noise files
                if(framenr!=startframe)
+               {
+                       if(sds->flags & MOD_SMOKE_DISSOLVE)
+                               smoke_dissolve(sds->fluid, sds->diss_speed, 
sds->flags & MOD_SMOKE_DISSOLVE_LOG);
                        smoke_step(sds->fluid, smd->time);
+               }
 
                // create shadows before writing cache so we get nice shadows 
for sstartframe, too
                if(get_lamp(scene, light))
@@ -1194,7 +1198,11 @@
                if(sds->wt)
                {
                        if(framenr!=startframe)
+                       {
+                               if(sds->flags & MOD_SMOKE_DISSOLVE)
+                                       smoke_dissolve_wavelet(sds->wt, 
sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
                                smoke_turbulence_step(sds->wt, sds->fluid);
+                       }
 
                        cache_wt->flag |= PTCACHE_SIMULATION_VALID;
                        cache_wt->simframe= framenr;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to