[Bf-blender-cvs] [1ad9eeb] soc-2014-fluid: more vars from sds, flow density added to manta

Roman Pogribnyi noreply at git.blender.org
Wed Oct 15 19:53:39 CEST 2014


Commit: 1ad9eebd511a3158bec224e3f5e967b5f9f92990
Author: Roman Pogribnyi
Date:   Sat Sep 27 14:48:56 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rB1ad9eebd511a3158bec224e3f5e967b5f9f92990

more vars from sds, flow density added to manta

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

M	intern/smoke/extern/smoke_API.h
M	intern/smoke/intern/MANTA.h
M	intern/smoke/intern/scenarios/smoke.h
M	intern/smoke/intern/smoke_API.cpp
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/python/manta_pp/pwrapper/pymain.cpp

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

diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index fe25efa..9133b5a 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -120,7 +120,7 @@ void smoke_mantaflow_sim_step(struct Scene *scene, struct SmokeModifierData *smd
 void smoke_mantaflow_stop_sim();
 void manta_write_effectors(struct Scene *s, struct SmokeModifierData *smd);
 void manta_update_effectors(struct Scene *scene, struct Object *ob,struct SmokeDomainSettings *sds, float dt);
-void manta_write_emitters(int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z,float *influence, float *vel);
+void manta_write_emitters(struct SmokeFlowSettings *sfs, int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z,float *influence, float *vel);
 
 #ifdef __cplusplus
 }
diff --git a/intern/smoke/intern/MANTA.h b/intern/smoke/intern/MANTA.h
index 849c291..8793f02 100644
--- a/intern/smoke/intern/MANTA.h
+++ b/intern/smoke/intern/MANTA.h
@@ -14,7 +14,7 @@
 #include "../../../source/blender/blenlib/BLI_path_util.h"
 
 void export_force_fields(int size_x, int size_y, int size_z, float *f_x, float*f_y, float*f_z);/*defined in pymain.cpp*/
-void export_em_fields(int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z, float *inf, float *vel);/*defined in pymain.cpp*/
+void export_em_fields(float flow_density, int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z, float *inf, float *vel);/*defined in pymain.cpp*/
 extern "C" void manta_write_effectors(struct Scene *s, struct SmokeModifierData *smd); /*defined in smoke_api.cpp*/
 
 /*for passing to detached thread*/
diff --git a/intern/smoke/intern/scenarios/smoke.h b/intern/smoke/intern/scenarios/smoke.h
index 1c9d72c..5f87d0b 100644
--- a/intern/smoke/intern/scenarios/smoke.h
+++ b/intern/smoke/intern/scenarios/smoke.h
@@ -86,20 +86,19 @@ const string smoke_step_low = "def sim_step(t):\n\
   #load emission data\n\
   source_grid.load('manta_em_influence.uni')\n\
   density.add(source_grid)\n\
+  #addForceField(flags=flags, vel=vel,force=forces)\n\
   \n\
-  \n\
-  advectSemiLagrange(flags=flags, vel=vel, grid=density, order=2)\n\
-  advectSemiLagrange(flags=flags, vel=vel, grid=vel    , order=2, strength=1.0)\n\
+  advectSemiLagrange(flags=flags, vel=vel, grid=density, order=$ADVECT_ORDER$)\n\
+  advectSemiLagrange(flags=flags, vel=vel, grid=vel    , order=$ADVECT_ORDER$, strength=1.0)\n\
   \n\
   setWallBcs(flags=flags, vel=vel)    \n\
-  addBuoyancy(density=density, vel=vel, gravity=vec3(0,-6e-4,0), flags=flags)\n\
+  addBuoyancy(density=density, vel=vel, gravity=vec3($BUYO_X$,$BUYO_Y$,$BUYO_Z$), flags=flags)\n\
   \n\
   solvePressure(flags=flags, vel=vel, pressure=pressure, useResNorm=True)\n\
   setWallBcs(flags=flags, vel=vel)\n\
   \n\
   density.writeGridToMemory(memLoc = \"$DENSITY_MEM$\",sizeAllowed = \"$DENSITY_SIZE$\") \n\
   s.step()";
-//  #density.save('den%04d_start.txt' % t) \n\
 //  if (t>=0 and t<75):\n\
 //    densityInflow(flags=flags, density=density, noise=noise, shape=source, scale=1, sigma=0.5)\n\
 //    #if noise.valScale > 0.:\n\
@@ -107,18 +106,14 @@ const string smoke_step_low = "def sim_step(t):\n\
 //    #else:\n\
 //    #  densityInflowMesh(flags=flags, density=density, mesh=source, value=1)\n\
 //    #applyInflow=True\n\
-//  #density.save('den%04d_1.txt' % t) \n\
 //  addForceField(flags=flags, vel=vel,force=forces)\n\
-//  #density.save('den%04d_2.txt' % t) \n\
 //  advectSemiLagrange(flags=flags, vel=vel, grid=density, order=$ADVECT_ORDER$) \n\
 //  advectSemiLagrange(flags=flags, vel=vel, grid=vel, order=$ADVECT_ORDER$, strength=1.0) \n\
-//  #density.save('den%04d_3.txt' % t) \n\
 //  setWallBcs(flags=flags, vel=vel) \n\
 //  addBuoyancy(density=density, vel=vel, gravity=vec3($BUYO_X$,$BUYO_Y$,$BUYO_Z$), flags=flags) \n\
 //  solvePressure(flags=flags, vel=vel, pressure=pressure, useResNorm=True, openBound='xXyYzZ', cgMaxIterFac=1, cgAccuracy=0.01) \n\
 //  setWallBcs(flags=flags, vel=vel) \n\
 //  print(\"Writing Grid to \" + str($DENSITY_MEM$) + \" with size\" + str($DENSITY_SIZE$))\n\
-//  #density.save('den%04d_end.txt' % t) \n\
 //  density.writeGridToMemory(memLoc = \"$DENSITY_MEM$\",sizeAllowed = \"$DENSITY_SIZE$\") \n\
 //  #density.save('den%04d_temp.uni' % t) \n\
 //  #os.rename('den%04d_temp.uni' % t, 'den%04d.uni' % t) \n\
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 0163296..a8d979d 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -531,10 +531,10 @@ extern "C" void manta_write_effectors(struct Scene *s, struct SmokeModifierData
 	export_force_fields(size_x, size_y, size_z, force_x, force_y, force_z);
 }
 
-extern "C" void manta_write_emitters(int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z,float *influence, float *vel)
+extern "C" void manta_write_emitters(struct SmokeFlowSettings *sfs, int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z,float *influence, float *vel)
 {
 //	manta_update_effectors(s, smd->domain->manta_obj, smd->domain, 0.1f);
-	export_em_fields( min_x,  min_y,  min_z,  max_x,  max_y,  max_z,  d_x,  d_y,  d_z,  influence,  vel);
+	export_em_fields(sfs->density, min_x,  min_y,  min_z,  max_x,  max_y,  max_z,  d_x,  d_y,  d_z,  influence,  vel);
 }
 
 extern "C" void smoke_mantaflow_stop_sim()
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index f57e1a0..1c81aae 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -2225,7 +2225,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
 				// we got nice flow object
 				SmokeFlowSettings *sfs = smd2->flow;
 				EmissionMap *em = &emaps[flowIndex];
-				manta_write_emitters(em->min[0],em->min[1],em->min[2],em->max[0],em->max[1],em->max[2],sds->res[0],sds->res[1],sds->res[2], em->influence, em->velocity);
+				manta_write_emitters(sfs,em->min[0],em->min[1],em->min[2],em->max[0],em->max[1],em->max[2],sds->res[0],sds->res[1],sds->res[2], em->influence, em->velocity);
 				float *density = smoke_get_density(sds->fluid);
 				float *color_r = smoke_get_color_r(sds->fluid);
 				float *color_g = smoke_get_color_g(sds->fluid);
diff --git a/source/blender/python/manta_pp/pwrapper/pymain.cpp b/source/blender/python/manta_pp/pwrapper/pymain.cpp
index 50b6480..30500cd 100644
--- a/source/blender/python/manta_pp/pwrapper/pymain.cpp
+++ b/source/blender/python/manta_pp/pwrapper/pymain.cpp
@@ -91,7 +91,7 @@ void export_fields(int size_x, int size_y, int size_z, float *f_x, float*f_y, fl
 //	writeGridTxt("s.txt", &force_fields);
 }
 		   
-void export_em_fields(int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z, float *inf, float *vel)
+void export_em_fields(float flow_density, int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z, float *inf, float *vel)
 {
 //	assert(size_x>0 && size_y>0 && size_z>0);
 	assert(inf != NULL);
@@ -111,7 +111,7 @@ void export_em_fields(int min_x, int min_y, int min_z, int max_x, int max_y, int
 			for (int z=0; z < em_size[2]; ++z)
 			{
 					index = x + y * em_size_x + z * em_size_xy;
-					em_inf_fields.get(x + min_x, y + min_y, z + min_z) = inf[index];//f_x[x],f_y[y],f_z[z]);				
+					em_inf_fields.get(x + min_x, y + min_y, z + min_z) = flow_density * inf[index];//f_x[x],f_y[y],f_z[z]);				
 //					if(vel != NULL)	
 //						em_vel_fields.get(x, y, z) = Vec3(vel[index*3],vel[index*3+1],vel[index*3+2]);
 			}




More information about the Bf-blender-cvs mailing list