[Bf-blender-cvs] [1a914c0c069] fluid-mantaflow: added missing openmp files for guiding

Sebastián Barschkis noreply at git.blender.org
Sat Aug 5 07:44:23 CEST 2017


Commit: 1a914c0c0693987bc4d11c59ff3e791b4a39e093
Author: Sebastián Barschkis
Date:   Sat Aug 5 07:43:56 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB1a914c0c0693987bc4d11c59ff3e791b4a39e093

added missing openmp files for guiding

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

M	intern/mantaflow/intern/manta_pp/omp/plugin/fluidguiding.cpp
M	intern/mantaflow/intern/manta_pp/omp/registration.cpp

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

diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/fluidguiding.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/fluidguiding.cpp
index a48b58ed5df..8bfbdd6ac69 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/fluidguiding.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/fluidguiding.cpp
@@ -213,26 +213,29 @@ Real getEpsDual(const Real eps_abs, const Real eps_rel, MACGrid &y) {
 	return eps_dual;
 }
 
-//! Create a spiral velocity field in 2D as a test scene
-void getSpiralVelocity2D(const FlagGrid &flags, MACGrid &vel, Real strength = 1.0) {
-	int nx = flags.getSizeX(), ny = flags.getSizeY();
+//! Create a spiral velocity field in 2D as a test scene (optionally in 3D)
+void getSpiralVelocity(const FlagGrid &flags, MACGrid &vel, Real strength = 1.0, bool with3D=false) {
+	int nx = flags.getSizeX(), ny = flags.getSizeY(), nz = 1;
+	if (with3D) nz = flags.getSizeZ();
 	Real midX = 0.5*(Real)(nx - 1);
 	Real midY = 0.5*(Real)(ny - 1);
-	int k = 0;
+	Real midZ = 0.5*(Real)(nz - 1);
 	for (int i = 0; i < nx; i++) {
 		for (int j = 0; j < ny; j++) {
-			int idx = flags.index(i, j, k);
-			Real diffX = midX - i;
-			Real diffY = midY - j;
-			Real hypotenuse = sqrt(diffX*diffX + diffY*diffY);
-			if (hypotenuse > 0) {
-				vel[idx].x = diffY / hypotenuse;
-				vel[idx].y = -diffX / hypotenuse;
+			for (int k = 0; k < nz; k++) {
+				int idx = flags.index(i, j, k);
+				Real diffX = midX - i;
+				Real diffY = midY - j;
+				Real hypotenuse = sqrt(diffX*diffX + diffY*diffY);
+				if (hypotenuse > 0) {
+					vel[idx].x = diffY / hypotenuse;
+					vel[idx].y = -diffX / hypotenuse;
+				}
 			}
 		}
 	}
 	vel.multConst(strength);
-} static PyObject* _W_0 (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, "getSpiralVelocity2D" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; const FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); Real strength = _args.getOpt<Real >("strength",2 [...]
+} static PyObject* _W_0 (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, "getSpiralVelocity" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; const FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); Real strength = _args.getOpt<Real >("strength",2,1 [...]
 
 //! Set the guiding weight W as a gradient in the y-direction
 void setGradientYWeight(Grid<Real> &W, const int minY, const int maxY, const Real valAtMin, const Real valAtMax) {
diff --git a/intern/mantaflow/intern/manta_pp/omp/registration.cpp b/intern/mantaflow/intern/manta_pp/omp/registration.cpp
index b2f83c2ddc4..05946925eb7 100644
--- a/intern/mantaflow/intern/manta_pp/omp/registration.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/registration.cpp
@@ -73,7 +73,7 @@ extern "C" {
 		extern void PbRegister_sampleSndParts() ;
 		extern void PbRegister_processBurn() ;
 		extern void PbRegister_updateFlame() ;
-		extern void PbRegister_getSpiralVelocity2D() ;
+		extern void PbRegister_getSpiralVelocity() ;
 		extern void PbRegister_setGradientYWeight() ;
 		extern void PbRegister_PD_fluid_guiding() ;
 		extern void PbRegister_KEpsilonComputeProduction() ;
@@ -230,7 +230,7 @@ namespace Pb {
 		PbRegister_sampleSndParts() ;
 		PbRegister_processBurn() ;
 		PbRegister_updateFlame() ;
-		PbRegister_getSpiralVelocity2D() ;
+		PbRegister_getSpiralVelocity() ;
 		PbRegister_setGradientYWeight() ;
 		PbRegister_PD_fluid_guiding() ;
 		PbRegister_KEpsilonComputeProduction() ;




More information about the Bf-blender-cvs mailing list