[Bf-blender-cvs] [9019d66b6a1] fluid-mantaflow: added control fields for float and tracer particle amount

Sebastián Barschkis noreply at git.blender.org
Sat Jul 29 00:44:28 CEST 2017


Commit: 9019d66b6a1bfab7f88701b8a6292b3f156d7792
Author: Sebastián Barschkis
Date:   Wed Jul 26 17:36:28 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB9019d66b6a1bfab7f88701b8a6292b3f156d7792

added control fields for float and tracer particle amount

float / tracer particle amount now determined by probability

===================================================================

M	intern/mantaflow/intern/FLUID.cpp
M	intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
M	intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
M	intern/mantaflow/intern/strings/liquid_script.h
M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/makesdna/DNA_smoke_types.h
M	source/blender/makesrna/intern/rna_smoke.c

===================================================================

diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 3eee5e25ca0..4848f55f85e 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -665,6 +665,10 @@ std::string FLUID::getRealValue(const std::string& varName,  SmokeModifierData *
 		ss << smd->domain->particle_velocity_threshold;
 	else if (varName == "SNDPARTICLE_BUBBLE_RISE")
 		ss << smd->domain->particle_bubble_rise;
+	else if (varName == "SNDPARTICLE_FLOAT_AMOUNT")
+		ss << smd->domain->particle_float_amount;
+	else if (varName == "SNDPARTICLE_TRACER_AMOUNT")
+		ss << smd->domain->particle_tracer_amount;
 	else if (varName == "USING_DROP_PARTS")
 		ss << (smd->domain->particle_type & MOD_SMOKE_PARTICLE_DROP ? "True" : "False");
 	else if (varName == "USING_BUBBLE_PARTS")
diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
index 8d2c22df684..5c2816717a1 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
@@ -719,7 +719,7 @@ void combineGridVel( MACGrid& vel, Grid<Vec3>& weight, MACGrid& combineVel, Leve
 
 
 
-void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, LevelsetGrid& phi, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>& partType, Real dropVelThresh, Real bubbleRise, Real tracerAmount, int minParticles, int maxParticles, Vec3 gravity, bool drops=true, bool floats=false, bool tracers=false, bool bubbles=true) {
+void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, LevelsetGrid& phi, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>& partType, Real dropVelThresh, Real bubbleRise, Real floatAmount, Real tracerAmount, int minParticles, int maxParticles, Vec3 gravity, bool drops=true, bool floats=false, bool tracers=false, bool bubbles=true) {
 	Real dt = flags.getParent()->getDt();
 	Vec3 grav = gravity * flags.getParent()->getDt() / flags.getDx();
 	Grid<int> tmp( vel.getParent() );
@@ -877,9 +877,8 @@ void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, L
 			// Only generate particles at surface and slightly inside fluid
 			if ( phi(i,j,k) > FLOAT_THRESH || phi(i,j,k) < -FLOAT_THRESH ) continue;
 
-			// Already sufficient particles in cell?
-			int cnt = tmp(i,j,k);
-			if (cnt >= minParticles) continue;
+			// Only seed if random num exceeds given amount probability
+			if (mRand.getFloat(0., 1.) > floatAmount) continue;
 
 			if ( flags.isFluid(i,j,k) || flags.isEmpty(i,j,k) ) {
 				// Get phi for next particle position
@@ -921,10 +920,6 @@ void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, L
 			// Only generate particles inside fluid
 			if ( phi(i,j,k) > 0. ) continue;
 
-			// Already sufficient particles in cell?
-			int cnt = tmp(i,j,k);
-			if (cnt >= minParticles) continue;
-
 			// Only seed if random num exceeds given amount probability
 			if (mRand.getFloat(0., 1.) > tracerAmount) continue;
 
@@ -958,7 +953,7 @@ void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, L
 			}
 		}
 	}
-} static PyObject* _W_18 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "sampleSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; BasicParticleSystem& parts = *_args.getPtr<BasicParticleSystem >("parts",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<M [...]
+} static PyObject* _W_18 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "sampleSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; BasicParticleSystem& parts = *_args.getPtr<BasicParticleSystem >("parts",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<M [...]
 
 
 } // namespace
diff --git a/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp b/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
index 2514d072669..389bdd9a6d0 100644
--- a/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
+++ b/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
@@ -600,7 +600,7 @@ void combineGridVel( MACGrid& vel, Grid<Vec3>& weight, MACGrid& combineVel, Leve
 
 
 
-void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, LevelsetGrid& phi, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>& partType, Real dropVelThresh, Real bubbleRise, Real tracerAmount, int minParticles, int maxParticles, Vec3 gravity, bool drops=true, bool floats=false, bool tracers=false, bool bubbles=true) {
+void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, LevelsetGrid& phi, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>& partType, Real dropVelThresh, Real bubbleRise, Real floatAmount, Real tracerAmount, int minParticles, int maxParticles, Vec3 gravity, bool drops=true, bool floats=false, bool tracers=false, bool bubbles=true) {
 	Real dt = flags.getParent()->getDt();
 	Vec3 grav = gravity * flags.getParent()->getDt() / flags.getDx();
 	Grid<int> tmp( vel.getParent() );
@@ -758,9 +758,8 @@ void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, L
 			// Only generate particles at surface and slightly inside fluid
 			if ( phi(i,j,k) > FLOAT_THRESH || phi(i,j,k) < -FLOAT_THRESH ) continue;
 
-			// Already sufficient particles in cell?
-			int cnt = tmp(i,j,k);
-			if (cnt >= minParticles) continue;
+			// Only seed if random num exceeds given amount probability
+			if (mRand.getFloat(0., 1.) > floatAmount) continue;
 
 			if ( flags.isFluid(i,j,k) || flags.isEmpty(i,j,k) ) {
 				// Get phi for next particle position
@@ -802,10 +801,6 @@ void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, L
 			// Only generate particles inside fluid
 			if ( phi(i,j,k) > 0. ) continue;
 
-			// Already sufficient particles in cell?
-			int cnt = tmp(i,j,k);
-			if (cnt >= minParticles) continue;
-
 			// Only seed if random num exceeds given amount probability
 			if (mRand.getFloat(0., 1.) > tracerAmount) continue;
 
@@ -839,7 +834,7 @@ void sampleSndParts(BasicParticleSystem& parts, FlagGrid& flags, MACGrid& vel, L
 			}
 		}
 	}
-} static PyObject* _W_18 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "sampleSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; BasicParticleSystem& parts = *_args.getPtr<BasicParticleSystem >("parts",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<M [...]

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list