[Bf-blender-cvs] [f6d5c34] fluid-mantaflow: fixed setup when with_manta flag is disabled

Sebastián Barschkis noreply at git.blender.org
Thu Jan 28 12:36:45 CET 2016


Commit: f6d5c3465a649157a7e3da97189697fa5dcfb0e6
Author: Sebastián Barschkis
Date:   Fri Sep 18 23:48:49 2015 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBf6d5c3465a649157a7e3da97189697fa5dcfb0e6

fixed setup when with_manta flag is disabled

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

M	intern/smoke/extern/smoke_API.h
M	intern/smoke/intern/FLUID_3D.h
M	intern/smoke/intern/WTURBULENCE.h
M	intern/smoke/intern/smoke_API.cpp
M	source/blender/blenkernel/intern/smoke.c

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

diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index 11bb26e..3e9be15 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -39,7 +39,11 @@ extern "C" {
 struct FLUID_3D;
 
 // low res
+#ifndef WITH_MANTA
+struct FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors);
+#else
 struct FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors, struct SmokeModifierData *smd);
+#endif
 void smoke_free(struct FLUID_3D *fluid);
 
 void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
@@ -77,7 +81,12 @@ size_t smoke_get_index(int x, int max_x, int y, int max_y, int z);
 size_t smoke_get_index2d(int x, int max_x, int y);
 void smoke_dissolve(struct FLUID_3D *fluid, int speed, int log);
 // wavelet turbulence functions
-struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, const char *noisefile_path, int use_fire, int use_colors,struct SmokeDomainSettings *sds);
+#ifndef WITH_MANTA
+struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, const char *noisefile_path, int use_fire, int use_colors);
+#else
+struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, const char *noisefile_path, int use_fire, int use_colors, struct SmokeDomainSettings *sds);
+#endif
+
 void smoke_turbulence_free(struct WTURBULENCE *wt);
 void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
 float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h
index fc60818..127f0bb 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -46,7 +46,12 @@ struct WTURBULENCE;
 struct FLUID_3D  
 {
 	public:
+		#ifndef WITH_MANTA
+		FLUID_3D(int *res, float dx, float dtdef, int init_heat, int init_fire, int init_colors);
+		#else
 		FLUID_3D(int *res, float dx, float dtdef, int init_heat, int init_fire, int init_colors, struct SmokeModifierData *smd);
+		#endif
+
 		FLUID_3D() {};
 		virtual ~FLUID_3D();
 
diff --git a/intern/smoke/intern/WTURBULENCE.h b/intern/smoke/intern/WTURBULENCE.h
index ca9a54e..54959be 100644
--- a/intern/smoke/intern/WTURBULENCE.h
+++ b/intern/smoke/intern/WTURBULENCE.h
@@ -36,7 +36,11 @@ struct WTURBULENCE
 {
 	public:
 		// both config files can be NULL, altCfg might override values from noiseCfg
-		WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, const char *noisefile_path, int init_fire, int init_colors,struct SmokeDomainSettings *sds);
+		#ifndef WITH_MANTA
+		WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, const char *noisefile_path, int init_fire, int init_colors);
+		#else
+		WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, const char *noisefile_path, int init_fire, int init_colors, struct SmokeDomainSettings *sds);
+		#endif
 
 		/// destructor
 		virtual ~WTURBULENCE();
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 8ecc06d..09830ba 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -43,6 +43,23 @@ extern "C" int *smoke_get_manta_flags(struct FLUID_3D *fluid){
 	return fluid->_manta_flags;
 }
 
+#ifndef WITH_MANTA
+extern "C" FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors )
+{
+	FLUID_3D *fluid = new FLUID_3D(res, dx, dtdef, use_heat, use_fire, use_colors);
+	return fluid;
+}
+
+extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, const char *noisefile_path, int use_fire, int use_colors)
+{
+	if (amplify)
+		return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype, noisefile_path, use_fire, use_colors);
+	else 
+		return NULL;
+}
+//////////////////////////////////////////////////////////////////////
+#else /*USING MANTAFLOW STRUCTURES*/
+//////////////////////////////////////////////////////////////////////
 extern "C" FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors, struct SmokeModifierData *smd )
 {
 	FLUID_3D *fluid = new FLUID_3D(res, dx, dtdef, use_heat, use_fire, use_colors, smd);
@@ -56,6 +73,7 @@ extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisety
 	else 
 		return NULL;
 }
+#endif /* WITH_MANTA */
 
 extern "C" void smoke_free(FLUID_3D *fluid)
 {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 012f825..ec08589 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -183,7 +183,13 @@ void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int
 		sds->fluid = NULL;
 		return;
 	}
-	sds->fluid = smoke_init(res, dx, DT_DEFAULT, use_heat, use_fire, use_colors, sds->smd);
+	
+	#ifndef WITH_MANTA
+		sds->fluid = smoke_init(res, dx, DT_DEFAULT, use_heat, use_fire, use_colors);
+	#else
+		sds->fluid = smoke_init(res, dx, DT_DEFAULT, use_heat, use_fire, use_colors, sds->smd);
+	#endif
+
 	smoke_initBlenderRNA(sds->fluid, &(sds->alpha), &(sds->beta), &(sds->time_scale), &(sds->vorticity), &(sds->border_collisions),
 	                     &(sds->burning_rate), &(sds->flame_smoke), sds->flame_smoke_color, &(sds->flame_vorticity), &(sds->flame_ignition), &(sds->flame_max_temp));
 
@@ -211,7 +217,11 @@ void smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[
 	/* smoke_turbulence_init uses non-threadsafe functions from fftw3 lib (like fftw_plan & co). */
 	BLI_lock_thread(LOCK_FFTW);
 
-	sds->wt = smoke_turbulence_init(res, sds->amplify + 1, sds->noise, BKE_tempdir_session(), use_fire, use_colors, sds);
+	#ifndef WITH_MANTA
+		sds->wt = smoke_turbulence_init(res, sds->amplify + 1, sds->noise, BKE_tempdir_session(), use_fire, use_colors);
+	#else
+		sds->wt = smoke_turbulence_init(res, sds->amplify + 1, sds->noise, BKE_tempdir_session(), use_fire, use_colors, sds);
+	#endif
 
 	BLI_unlock_thread(LOCK_FFTW);
 
@@ -2330,7 +2340,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
 							}
 							else { // inflow
 								apply_inflow_fields(sfs, emission_map[e_index], d_index, density, heat, fuel, react, color_r, color_g, color_b);
-								if(sds->manta_solver_res == 3){
+								if((sds->flags & MOD_SMOKE_USE_MANTA) && (sds->manta_solver_res == 3)) {
 									apply_inflow_fields(sfs, emission_map[e_index], d_index, inflow_grid, heat, fuel, react, color_r, color_g, color_b);
 								}
 																/* initial velocity */
@@ -2428,7 +2438,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
 							}  // bigdensity
 						} // low res loop
 
-				{ /*2D solver*/
+				if((sds->flags & MOD_SMOKE_USE_MANTA)) { /*2D solver*/
 					int cnty;
 					int cntz;
 					int step;




More information about the Bf-blender-cvs mailing list