[Bf-blender-cvs] [c3ba70bbae7] fluid-mantaflow: Mantaflow: Updated fluid wrapper and script files

Sebastián Barschkis noreply at git.blender.org
Sat Apr 6 22:13:51 CEST 2019


Commit: c3ba70bbae7b1335583c6ade8119b0ec11070fe4
Author: Sebastián Barschkis
Date:   Fri Apr 5 22:59:43 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBc3ba70bbae7b1335583c6ade8119b0ec11070fe4

Mantaflow: Updated fluid wrapper and script files

Includes setup in which inflow is applied on mantaflow side

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

M	intern/mantaflow/CMakeLists.txt
M	intern/mantaflow/extern/manta_fluid_API.h
M	intern/mantaflow/intern/FLUID.cpp
M	intern/mantaflow/intern/FLUID.h
M	intern/mantaflow/intern/manta_fluid_API.cpp
M	intern/mantaflow/intern/strings/fluid_script.h
M	intern/mantaflow/intern/strings/liquid_script.h
M	intern/mantaflow/intern/strings/smoke_script.h

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

diff --git a/intern/mantaflow/CMakeLists.txt b/intern/mantaflow/CMakeLists.txt
index 5ffdd9f3402..2a4e945cfba 100644
--- a/intern/mantaflow/CMakeLists.txt
+++ b/intern/mantaflow/CMakeLists.txt
@@ -23,6 +23,8 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+set(MANTAVERSION "0.12")
+
 if(WITH_OPENMP)
 	set(MANTA_PP
 		intern/manta_pp/omp
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 89994c382be..c16185d378b 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -80,13 +80,15 @@ float *fluid_get_in_velocity_z(struct FLUID *fluid);
 float *fluid_get_force_x(struct FLUID *fluid);
 float *fluid_get_force_y(struct FLUID *fluid);
 float *fluid_get_force_z(struct FLUID *fluid);
-float *fluid_get_phiguidein(struct FLUID *fluid);
+float *fluid_get_phiguide_in(struct FLUID *fluid);
 int *fluid_get_num_obstacle(struct FLUID *fluid);
 int *fluid_get_num_guide(struct FLUID *fluid);
 int fluid_get_res_x(struct FLUID *fluid);
 int fluid_get_res_y(struct FLUID *fluid);
 int fluid_get_res_z(struct FLUID *fluid);
-
+float *fluid_get_phi_in(struct FLUID *fluid);
+float *fluid_get_phiobs_in(struct FLUID *fluid);
+float *fluid_get_phiout_in(struct FLUID *fluid);
 
 /* Smoke functions */
 void smoke_manta_export(struct FLUID* smoke, struct SmokeModifierData *smd);
@@ -113,7 +115,13 @@ float *smoke_get_color_r(struct FLUID *smoke);
 float *smoke_get_color_g(struct FLUID *smoke);
 float *smoke_get_color_b(struct FLUID *smoke);
 int *smoke_get_obstacle(struct FLUID *smoke);
-float *smoke_get_emission_in(struct FLUID *fluid);
+float *smoke_get_density_in(struct FLUID* smoke);
+float *smoke_get_heat_in(struct FLUID* smoke);
+float *smoke_get_color_r_in(struct FLUID* smoke);
+float *smoke_get_color_g_in(struct FLUID* smoke);
+float *smoke_get_color_b_in(struct FLUID* smoke);
+float *smoke_get_fuel_in(struct FLUID* smoke);
+float *smoke_get_react_in(struct FLUID* smoke);
 int smoke_has_heat(struct FLUID *smoke);
 int smoke_has_fuel(struct FLUID *smoke);
 int smoke_has_colors(struct FLUID *smoke);
@@ -129,7 +137,6 @@ int smoke_turbulence_has_colors(struct FLUID *smoke);
 void smoke_turbulence_get_res(struct FLUID *smoke, int *res);
 int smoke_turbulence_get_cells(struct FLUID *smoke);
 
-
 /* Liquid functions */
 void liquid_manta_export(struct FLUID* smoke, struct SmokeModifierData *smd);
 void liquid_ensure_sndparts(struct FLUID *fluid, struct SmokeModifierData *smd);
@@ -143,9 +150,6 @@ int liquid_get_mesh_res_y(struct FLUID *fluid);
 int liquid_get_mesh_res_z(struct FLUID *fluid);
 int liquid_get_particle_upres(struct FLUID *fluid);
 int liquid_get_mesh_upres(struct FLUID *fluid);
-float *liquid_get_phiin(struct FLUID *liquid);
-float *liquid_get_phiobsin(struct FLUID *liquid);
-float *liquid_get_phioutin(struct FLUID *liquid);
 int liquid_get_num_verts(struct FLUID *liquid);
 int liquid_get_num_normals(struct FLUID *liquid);
 int liquid_get_num_triangles(struct FLUID *liquid);
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index e7c5911322d..4fb435cf81c 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -50,7 +50,7 @@
 
 std::atomic<bool> FLUID::mantaInitialized(false);
 std::atomic<int> FLUID::solverID(0);
-int FLUID::with_debug(0);
+int FLUID::with_debug(1);
 
 FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
 {
@@ -89,7 +89,6 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
 
 	// Smoke low res grids
 	mDensity        = NULL;
-	mEmissionIn     = NULL;
 	mShadow         = NULL;
 	mHeat           = NULL;
 	mVelocityX      = NULL;
@@ -105,6 +104,13 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
 	mColorG         = NULL;
 	mColorB         = NULL;
 	mObstacle       = NULL;
+	mDensityIn      = NULL;
+	mHeatIn         = NULL;
+	mColorRIn       = NULL;
+	mColorGIn       = NULL;
+	mColorBIn       = NULL;
+	mFuelIn         = NULL;
+	mReactIn        = NULL;
 
 	// Smoke high res grids
 	mDensityHigh    = NULL;
@@ -121,7 +127,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID)
 	mTextureV2      = NULL;
 	mTextureW2      = NULL;
 
-	// Liquid low res grids
+	// Fluid low res grids
 	mPhiIn          = NULL;
 	mPhiOutIn       = NULL;
 	mPhi            = NULL;
@@ -306,6 +312,7 @@ void FLUID::initSmokeNoise(SmokeModifierData *smd)
 	std::vector<std::string> pythonCommands;
 	std::string tmpString = smoke_alloc_noise
 		+ smoke_variables_noise
+		+ smoke_wavelet_noise
 		+ smoke_adaptive_step_noise
 		+ smoke_save_noise
 		+ smoke_load_noise
@@ -1390,6 +1397,7 @@ void FLUID::updateVariables(SmokeModifierData *smd)
 	if (mUsingNoise) {
 		tmpString += fluid_variables_noise;
 		tmpString += smoke_variables_noise;
+		tmpString += smoke_wavelet_noise;
 	}
 	if (mUsingDrops || mUsingBubbles || mUsingFloats || mUsingTracers) {
 		tmpString += fluid_variables_particles;
@@ -1435,8 +1443,7 @@ void FLUID::exportSmokeScript(SmokeModifierData *smd)
 		+ fluid_variables
 		+ smoke_variables;
 	if (noise) {
-		manta_script += fluid_variables_noise
-			+ smoke_variables_noise;
+		manta_script += fluid_variables_noise;
 	}
 	if (guiding)
 		manta_script += fluid_variables_guiding;
@@ -1473,6 +1480,10 @@ void FLUID::exportSmokeScript(SmokeModifierData *smd)
 	if (invel)
 		manta_script += fluid_alloc_invel;
 
+	// Noise field
+	if (noise)
+		manta_script += smoke_wavelet_noise;
+
 	// Time
 	manta_script += header_time
 		+ fluid_adaptive_time_stepping
@@ -2127,6 +2138,7 @@ void FLUID::updatePointers()
 	std::string mesh_ext2  = "_" + mesh2;
 
 	mObstacle  = (int*)   stringToPointer(pyObjectToString(callPythonFunction("flags" + solver_ext, func)));
+	mPhiIn     = (float*) stringToPointer(pyObjectToString(callPythonFunction("phiIn" + solver_ext, func)));
 
 	mVelocityX = (float*) stringToPointer(pyObjectToString(callPythonFunction("x_vel" + solver_ext, func)));
 	mVelocityY = (float*) stringToPointer(pyObjectToString(callPythonFunction("y_vel" + solver_ext, func)));
@@ -2167,7 +2179,6 @@ void FLUID::updatePointers()
 	// Liquid
 	if (mUsingLiquid) {
 		mPhi   = (float*) stringToPointer(pyObjectToString(callPythonFunction("phi"   + solver_ext, func)));
-		mPhiIn = (float*) stringToPointer(pyObjectToString(callPythonFunction("phiIn" + solver_ext, func)));
 
 		mFlipParticleData     = (std::vector<pData>*) stringToPointer(pyObjectToString(callPythonFunction("pp"   + solver_ext, func)));
 		mFlipParticleVelocity = (std::vector<pVel>*)  stringToPointer(pyObjectToString(callPythonFunction("pVel" + parts_ext,  func)));
@@ -2189,21 +2200,29 @@ void FLUID::updatePointers()
 	// Smoke
 	if (mUsingSmoke) {
 		mDensity        = (float*) stringToPointer(pyObjectToString(callPythonFunction("density"    + solver_ext, func)));
-		mEmissionIn     = (float*) stringToPointer(pyObjectToString(callPythonFunction("emissionIn" + solver_ext, func)));
+		mDensityIn      = (float*) stringToPointer(pyObjectToString(callPythonFunction("densityIn"  + solver_ext, func)));
 		mShadow         = (float*) stringToPointer(pyObjectToString(callPythonFunction("shadow"     + solver_ext, func)));
 
 		if (mUsingHeat) {
 			mHeat       = (float*) stringToPointer(pyObjectToString(callPythonFunction("heat"   + solver_ext,    func)));
+			mHeatIn     = (float*) stringToPointer(pyObjectToString(callPythonFunction("heatIn" + solver_ext, func)));
 		}
 		if (mUsingFire) {
 			mFlame      = (float*) stringToPointer(pyObjectToString(callPythonFunction("flame"  + solver_ext,   func)));
 			mFuel       = (float*) stringToPointer(pyObjectToString(callPythonFunction("fuel"   + solver_ext,   func)));
 			mReact      = (float*) stringToPointer(pyObjectToString(callPythonFunction("react"  + solver_ext,   func)));
+
+			mFuelIn     = (float*) stringToPointer(pyObjectToString(callPythonFunction("fuelIn"  + solver_ext,   func)));
+			mReactIn    = (float*) stringToPointer(pyObjectToString(callPythonFunction("reactIn" + solver_ext,   func)));
 		}
 		if (mUsingColors) {
 			mColorR     = (float*) stringToPointer(pyObjectToString(callPythonFunction("color_r"   + solver_ext, func)));
 			mColorG     = (float*) stringToPointer(pyObjectToString(callPythonFunction("color_g"   + solver_ext, func)));
 			mColorB     = (float*) stringToPointer(pyObjectToString(callPythonFunction("color_b"   + solver_ext, func)));
+
+			mColorRIn   = (float*) stringToPointer(pyObjectToString(callPythonFunction("color_r_in"   + solver_ext, func)));
+			mColorGIn   = (float*) stringToPointer(pyObjectToString(callPythonFunction("color_g_in"   + solver_ext, func)));
+			mColorBIn   = (float*) stringToPointer(pyObjectToString(callPythonFunction("color_b_in"   + solver_ext, func)));
 		}
 	}
 }
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 735d87f2fab..46969964a81 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -98,7 +98,6 @@ public:
 	void exportSmokeScript(struct SmokeModifierData *smd);
 	void exportLiquidScript(struct SmokeModifierData *smd);
 
-	// Smoke getters
 	inline size_t getTotalCells() { return mTotalCells; }
 	inline size_t getTotalCellsHigh() { return mTotalCellsHigh; }
 	inline bool usingNoise() { return mUsingNoise; }
@@ -116,7 +115,8 @@ public:
 	inline int getResZHigh() { return mResZNoise; }
 	inline int getMeshUpres() { return mUpresMesh; }
 	inline int getParticleUpres() { return mUpresParticle; }
-	
+
+	// Smoke getters
 	inline float* getDensity() { return mDensity; }
 	inline float* getHeat() { return mHeat; }
 	inline float* getVelocityX() { return mVelocityX; }
@@ -143,8 +143,14 @@ public:
 	inline float* getColorR() { return mColorR; }
 	inline float* getColorG() { return mColorG; }
 	inline float* getColorB() { return mColorB; }
-	inline float* getEmissionIn() { return mEmissionIn; }
 	inline float* getShadow() { return mShadow; }
+	inline float* getDensityIn() { return mDensityIn; }
+	inline float* getHeatIn() { return mHeatIn; }
+	inline float* getColorRIn() { return mColorRIn; }
+	inline float* getColorGIn() { return mColorGIn; }
+	inline float* getColorBIn() { return mColorBIn; }
+	inline float* getFuelI

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list