[Bf-blender-cvs] [8fa642db3d6] fluid-mantaflow: reactivated smoke adaptive domain settings
Sebastián Barschkis
noreply at git.blender.org
Wed Dec 6 22:23:42 CET 2017
Commit: 8fa642db3d6cb8beee97e6243996492e2b1625a8
Author: Sebastián Barschkis
Date: Wed Dec 6 22:21:56 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB8fa642db3d6cb8beee97e6243996492e2b1625a8
reactivated smoke adaptive domain settings
===================================================================
M intern/mantaflow/intern/FLUID.cpp
M intern/mantaflow/intern/manta_pp/omp/noisefield.cpp
M intern/mantaflow/intern/manta_pp/omp/noisefield.h
M intern/mantaflow/intern/manta_pp/tbb/noisefield.cpp
M intern/mantaflow/intern/manta_pp/tbb/noisefield.h
M intern/mantaflow/intern/strings/smoke_script.h
M release/scripts/startup/bl_ui/properties_physics_smoke.py
===================================================================
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index f4efba099f6..3e0f858c3eb 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -286,7 +286,6 @@ void FLUID::initSmokeHigh(SmokeModifierData *smd)
{
std::string tmpString = smoke_alloc_high
+ smoke_variables_high
- + smoke_uv_setup
+ smoke_bounds_high
+ smoke_wavelet_turbulence_noise
+ smoke_export_high
@@ -943,7 +942,6 @@ void FLUID::exportSmokeScript(SmokeModifierData *smd)
+ fluid_adaptive_time_stepping_high
+ smoke_variables_high
+ smoke_alloc_high
- + smoke_uv_setup
+ smoke_bounds_high
+ smoke_wavelet_turbulence_noise;
diff --git a/intern/mantaflow/intern/manta_pp/omp/noisefield.cpp b/intern/mantaflow/intern/manta_pp/omp/noisefield.cpp
index 8ea97fb0b47..88e2b7a4b86 100644
--- a/intern/mantaflow/intern/manta_pp/omp/noisefield.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/noisefield.cpp
@@ -42,6 +42,7 @@ namespace Manta {
int WaveletNoiseField::randomSeed = 13322223;
Real* WaveletNoiseField::mNoiseTile = NULL;
+std::atomic<int> WaveletNoiseField::mNoiseReferenceCount(0);
static Real _aCoeffs[32] = {
0.000334,-0.001528, 0.000410, 0.003545,-0.000938,-0.008233, 0.002172, 0.019120,
@@ -107,7 +108,7 @@ void WaveletNoiseField::generateTile( int loadFromFile) {
const int n = NOISE_TILE_SIZE;
const int n3 = n*n*n, n3d=n3*3;
- if(mNoiseTile) return;
+ if(mNoiseTile) { mNoiseReferenceCount++; return; }
Real *noise3 = new Real[n3d];
if(loadFromFile) {
FILE* fp = fopen(TILENAME,"rb");
@@ -116,6 +117,7 @@ void WaveletNoiseField::generateTile( int loadFromFile) {
fclose(fp);
debMsg("Noise tile loaded from file " TILENAME , 1);
mNoiseTile = noise3;
+ mNoiseReferenceCount++;
return;
}
}
@@ -185,6 +187,7 @@ void WaveletNoiseField::generateTile( int loadFromFile) {
}
mNoiseTile = noise3;
+ mNoiseReferenceCount++;
delete[] temp13;
delete[] temp23;
diff --git a/intern/mantaflow/intern/manta_pp/omp/noisefield.h b/intern/mantaflow/intern/manta_pp/omp/noisefield.h
index a72d7e5645c..4939b398e77 100644
--- a/intern/mantaflow/intern/manta_pp/omp/noisefield.h
+++ b/intern/mantaflow/intern/manta_pp/omp/noisefield.h
@@ -29,6 +29,7 @@
#include "vectorbase.h"
#include "manta.h"
#include "grid.h"
+#include <atomic>
namespace Manta {
@@ -39,7 +40,8 @@ namespace Manta {
class WaveletNoiseField : public PbClass { public:
WaveletNoiseField( FluidSolver* parent, int fixedSeed=-1 , int loadFromFile=false ); static int _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { PbClass* obj = Pb::objFromPy(_self); if (obj) delete obj; try { PbArgs _args(_linargs, _kwds); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(0, "WaveletNoiseField::WaveletNoiseField" , !noTiming ); { ArgLocker _lock; FluidSolver* parent = _args.getPtr<FluidSolver >("parent",0,&_lock); int fixedSeed = _args [...]
~WaveletNoiseField() {
- if(mNoiseTile) { delete mNoiseTile; mNoiseTile=NULL; }
+ mNoiseReferenceCount--;
+ if(!mNoiseReferenceCount.load() && mNoiseTile) { debMsg("Deleting noise tile", 1); delete mNoiseTile; mNoiseTile=NULL; }
};
//! evaluate noise
@@ -70,7 +72,7 @@ class WaveletNoiseField : public PbClass { public:
Real mClampPos;static PyObject* _GET_mClampPos(PyObject* self, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); return toPy(pbo->mClampPos); } static int _SET_mClampPos(PyObject* self, PyObject* val, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); pbo->mClampPos = fromPy<Real >(val); return 0; }
// animated over time
Real mTimeAnim;static PyObject* _GET_mTimeAnim(PyObject* self, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); return toPy(pbo->mTimeAnim); } static int _SET_mTimeAnim(PyObject* self, PyObject* val, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); pbo->mTimeAnim = fromPy<Real >(val); return 0; }
-
+
protected:
// noise evaluation functions
static inline Real WNoiseDx (const Vec3& p, Real *data);
@@ -93,14 +95,16 @@ class WaveletNoiseField : public PbClass { public:
// pre-compute tile data for wavelet noise
void generateTile( int loadFromFile );
-
+
// animation over time
// grid size normalization (inverse size)
Real mGsInvX, mGsInvY, mGsInvZ;
// random offset into tile to simulate different random seeds
Vec3 mSeedOffset;
-
- static Real* mNoiseTile; // global random seed storage
+
+ static Real* mNoiseTile;
+ static std::atomic<int> mNoiseReferenceCount;
+ // global random seed storage
static int randomSeed; public: PbArgs _args; }
#define _C_WaveletNoiseField
;
diff --git a/intern/mantaflow/intern/manta_pp/tbb/noisefield.cpp b/intern/mantaflow/intern/manta_pp/tbb/noisefield.cpp
index 8ea97fb0b47..88e2b7a4b86 100644
--- a/intern/mantaflow/intern/manta_pp/tbb/noisefield.cpp
+++ b/intern/mantaflow/intern/manta_pp/tbb/noisefield.cpp
@@ -42,6 +42,7 @@ namespace Manta {
int WaveletNoiseField::randomSeed = 13322223;
Real* WaveletNoiseField::mNoiseTile = NULL;
+std::atomic<int> WaveletNoiseField::mNoiseReferenceCount(0);
static Real _aCoeffs[32] = {
0.000334,-0.001528, 0.000410, 0.003545,-0.000938,-0.008233, 0.002172, 0.019120,
@@ -107,7 +108,7 @@ void WaveletNoiseField::generateTile( int loadFromFile) {
const int n = NOISE_TILE_SIZE;
const int n3 = n*n*n, n3d=n3*3;
- if(mNoiseTile) return;
+ if(mNoiseTile) { mNoiseReferenceCount++; return; }
Real *noise3 = new Real[n3d];
if(loadFromFile) {
FILE* fp = fopen(TILENAME,"rb");
@@ -116,6 +117,7 @@ void WaveletNoiseField::generateTile( int loadFromFile) {
fclose(fp);
debMsg("Noise tile loaded from file " TILENAME , 1);
mNoiseTile = noise3;
+ mNoiseReferenceCount++;
return;
}
}
@@ -185,6 +187,7 @@ void WaveletNoiseField::generateTile( int loadFromFile) {
}
mNoiseTile = noise3;
+ mNoiseReferenceCount++;
delete[] temp13;
delete[] temp23;
diff --git a/intern/mantaflow/intern/manta_pp/tbb/noisefield.h b/intern/mantaflow/intern/manta_pp/tbb/noisefield.h
index a72d7e5645c..4939b398e77 100644
--- a/intern/mantaflow/intern/manta_pp/tbb/noisefield.h
+++ b/intern/mantaflow/intern/manta_pp/tbb/noisefield.h
@@ -29,6 +29,7 @@
#include "vectorbase.h"
#include "manta.h"
#include "grid.h"
+#include <atomic>
namespace Manta {
@@ -39,7 +40,8 @@ namespace Manta {
class WaveletNoiseField : public PbClass { public:
WaveletNoiseField( FluidSolver* parent, int fixedSeed=-1 , int loadFromFile=false ); static int _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { PbClass* obj = Pb::objFromPy(_self); if (obj) delete obj; try { PbArgs _args(_linargs, _kwds); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(0, "WaveletNoiseField::WaveletNoiseField" , !noTiming ); { ArgLocker _lock; FluidSolver* parent = _args.getPtr<FluidSolver >("parent",0,&_lock); int fixedSeed = _args [...]
~WaveletNoiseField() {
- if(mNoiseTile) { delete mNoiseTile; mNoiseTile=NULL; }
+ mNoiseReferenceCount--;
+ if(!mNoiseReferenceCount.load() && mNoiseTile) { debMsg("Deleting noise tile", 1); delete mNoiseTile; mNoiseTile=NULL; }
};
//! evaluate noise
@@ -70,7 +72,7 @@ class WaveletNoiseField : public PbClass { public:
Real mClampPos;static PyObject* _GET_mClampPos(PyObject* self, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); return toPy(pbo->mClampPos); } static int _SET_mClampPos(PyObject* self, PyObject* val, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); pbo->mClampPos = fromPy<Real >(val); return 0; }
// animated over time
Real mTimeAnim;static PyObject* _GET_mTimeAnim(PyObject* self, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); return toPy(pbo->mTimeAnim); } static int _SET_mTimeAnim(PyObject* self, PyObject* val, void* cl) { WaveletNoiseField* pbo = dynamic_cast<WaveletNoiseField*>(Pb::objFromPy(self)); pbo->mTimeAnim = fromPy<Real >(val); return 0; }
-
+
protected:
// noise evaluation functions
static inline Real WNoiseDx (const Vec3& p, Real *data);
@@ -93,14 +95,16 @@ class WaveletNoiseField : public PbClass { public:
// pre-compute tile data for wavelet noise
void generateTile( int loadFromFile );
-
+
// animation over time
// grid size normalization (inverse size)
Real mGsInvX, mGsInvY, mGsInvZ;
// random offset into tile to simulate different random seeds
Vec3 mSeedOffset;
-
- static Real* mNoiseTile; // global random seed storage
+
+ static Real* mNoiseTile;
+ static std::atomic<int> mNoiseReferenceCount;
+ // global random seed storage
static int randomSeed; public: PbArgs _args; }
#define _C_WaveletNoiseField
;
diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h
index 23f9f1d4557..d003c03733b 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -66,6 +66,7 @@ mantaMsg('Smoke variables high')\n\
wltStrength_s$ID$ = $WLT_STR$\n\
octaves_s$ID$ = 0\n\
uvs_s$ID$ = 2\n\
+uv_s$ID$
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list