Commit: b7d857f22ea49d825c7c3fccc5c402a1479880bb
Author: Sebastián Barschkis
Date:   Sat Nov 12 00:18:38 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBb7d857f22ea49d825c7c3fccc5c402a1479880bb

added missing grids to liquid/smoke grid import/export and also cleaned up 
scripts a bit

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

M       intern/mantaflow/intern/strings/liquid_script.h
M       intern/mantaflow/intern/strings/smoke_script.h

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

diff --git a/intern/mantaflow/intern/strings/liquid_script.h 
b/intern/mantaflow/intern/strings/liquid_script.h
index 475d2fc..77b2c45 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -43,7 +43,7 @@ if doOpen:\n\
 const std::string liquid_bounds_high = "\n\
 # prepare domain high\n\
 mantaMsg('Liquid domain high')\n\
-xl_flags.initDomain(boundaryWidth=boundaryWidth, phiWalls=phiObs)\n\
+xl_flags.initDomain(boundaryWidth=boundaryWidth)\n\
 if doOpen:\n\
     setOpenBound(flags=xl_flags, bWidth=boundaryWidth, 
openBound=boundConditions, type=FlagOutflow|FlagEmpty)\n";
 
@@ -61,8 +61,6 @@ minParticles   = pow(particleNumber,dim)\n\
 radiusFactor   = $PARTICLE_RADIUS$\n\
 randomness     = $PARTICLE_RANDOMNESS$\n\
 \n\
-maxVel  = 0\n\
-\n\
 using_highres = $USING_HIGHRES$\n";
 
 const std::string liquid_variables_high = "\n\
@@ -168,20 +166,17 @@ def manta_step(start_frame):\n\
 const std::string liquid_step_low = "\n\
 def liquid_step():\n\
     mantaMsg('Liquid step low')\n\
-    copyRealToVec3(sourceX=x_vel, sourceY=y_vel, sourceZ=z_vel, target=vel)\n\
-    copyRealToVec3(sourceX=x_obvel, sourceY=y_obvel, sourceZ=z_obvel, 
target=obvel)\n\
-    \n\
     # FLIP\n\
+    # Create interpolated version of original phi grid for later use in 
(optional) high-res step\n\
+    if using_highres:\n\
+        interpolateGrid(target=xl_phi, source=phi)\n\
+    \n\
     pp.advectInGrid(flags=flags, vel=vel, integrationMode=IntRK4, 
deleteInObstacle=False, stopInObstacle=False)\n\
     pushOutofObs(parts=pp, flags=flags, phiObs=phiObs)\n\
     \n\
     advectSemiLagrange(flags=flags, vel=vel, grid=phi, order=1, 
openBounds=doOpen, boundaryWidth=boundaryWidth) # first order is usually 
enough\n\
     advectSemiLagrange(flags=flags, vel=vel, grid=vel, order=2, 
openBounds=doOpen, boundaryWidth=boundaryWidth)\n\
     \n\
-    # Keep an original copy of interpolated phi grid for later use in 
(optional) high-res step\n\
-    if using_highres:\n\
-        interpolateGrid(target=xl_phi, source=phi)\n\
-    \n\
     # create level set of particles\n\
     gridParticleIndex(parts=pp , flags=flags, indexSys=pindex, index=gpi)\n\
     unionParticleLevelset(pp, pindex, flags, gpi, phiParts)\n\
@@ -225,7 +220,7 @@ def liquid_step():\n\
     # set source grids for resampling, used in adjustNumber!\n\
     pVel.setSource(vel, isMAC=True)\n\
     adjustNumber(parts=pp, vel=vel, flags=flags, minParticles=1*minParticles, 
maxParticles=2*minParticles, phi=phi, exclude=phiObs, 
radiusFactor=radiusFactor, narrowBand=narrowBandWidth)\n\
-    flipVelocityUpdate(vel=vel, velOld=velOld, flags=flags, parts=pp, 
partVel=pVel, flipRatio=0.95)\n\
+    flipVelocityUpdate(vel=vel, velOld=velOld, flags=flags, parts=pp, 
partVel=pVel, flipRatio=0.97)\n\
     \n\
     copyVec3ToReal(source=vel, targetX=x_vel, targetY=y_vel, targetZ=z_vel)\n\
     copyVec3ToReal(source=obvel, targetX=x_obvel, targetY=y_obvel, 
targetZ=z_obvel)\n";
@@ -271,6 +266,13 @@ def load_liquid_data_low(path):\n\
     velParts.load(os.path.join(path, 'velParts.uni'))\n\
     mapWeights.load(os.path.join(path, 'mapWeights.uni'))\n\
     \n\
+    x_vel.load(os.path.join(path, 'x_vel.uni'))\n\
+    y_vel.load(os.path.join(path, 'y_vel.uni'))\n\
+    z_vel.load(os.path.join(path, 'z_vel.uni'))\n\
+    x_obvel.load(os.path.join(path, 'x_obvel.uni'))\n\
+    y_obvel.load(os.path.join(path, 'y_obvel.uni'))\n\
+    z_obvel.load(os.path.join(path, 'z_obvel.uni'))\n\
+       \n\
     pp.load(os.path.join(path, 'pp.uni'))\n\
     pVel.load(os.path.join(path, 'pVel.uni'))\n\
     \n\
@@ -302,6 +304,13 @@ def save_liquid_data_low(path):\n\
     velParts.save(os.path.join(path, 'velParts.uni'))\n\
     mapWeights.save(os.path.join(path, 'mapWeights.uni'))\n\
     \n\
+    x_vel.save(os.path.join(path, 'x_vel.uni'))\n\
+    y_vel.save(os.path.join(path, 'y_vel.uni'))\n\
+    z_vel.save(os.path.join(path, 'z_vel.uni'))\n\
+    x_obvel.save(os.path.join(path, 'x_obvel.uni'))\n\
+    y_obvel.save(os.path.join(path, 'y_obvel.uni'))\n\
+    z_obvel.save(os.path.join(path, 'z_obvel.uni'))\n\
+       \n\
     pp.save(os.path.join(path, 'pp.uni'))\n\
     pVel.save(os.path.join(path, 'pVel.uni'))\n\
     \n\
diff --git a/intern/mantaflow/intern/strings/smoke_script.h 
b/intern/mantaflow/intern/strings/smoke_script.h
index a0e0e5e..8f0ad1b7 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -97,14 +97,14 @@ obvel       = s.create(MACGrid)\n\
 x_obvel     = s.create(RealGrid)\n\
 y_obvel     = s.create(RealGrid)\n\
 z_obvel     = s.create(RealGrid)\n\
-density     = s.create(LevelsetGrid)\n\
+density     = s.create(RealGrid)\n\
 pressure    = s.create(RealGrid)\n\
 forces      = s.create(MACGrid)\n\
 x_force     = s.create(RealGrid)\n\
 y_force     = s.create(RealGrid)\n\
 z_force     = s.create(RealGrid)\n\
-inflow_grid = s.create(LevelsetGrid)\n\
-fuel_inflow = s.create(LevelsetGrid)\n";
+inflow_grid = s.create(RealGrid)\n\
+fuel_inflow = s.create(RealGrid)\n";
 
 const std::string smoke_alloc_high = "\n\
 # prepare grids high\n\
@@ -251,7 +251,6 @@ def step_low():\n\
         mantaMsg('Adding buoyancy')\n\
         addBuoyancy(density=density, vel=vel, gravity=gravity, flags=flags)\n\
     \n\
-    #addObjectVelocity(flags, vel, obvel)\n\
     copyRealToVec3(sourceX=x_force, sourceY=y_force, sourceZ=z_force, 
target=forces)\n\
     mantaMsg('Adding forces')\n\
     addForceField(flags=flags, vel=vel, force=forces)\n\
@@ -347,9 +346,20 @@ def load_smoke_data_low(path):\n\
     density.load(os.path.join(path, 'density.uni'))\n\
     flags.load(os.path.join(path, 'flags.uni'))\n\
     vel.load(os.path.join(path, 'vel.uni'))\n\
+    obvel.load(os.path.join(path, 'obvel.uni'))\n\
+    pressure.load(os.path.join(path, 'pressure.uni'))\n\
     forces.load(os.path.join(path, 'forces.uni'))\n\
+    x_force.load(os.path.join(path, 'x_force.uni'))\n\
+    y_force.load(os.path.join(path, 'y_force.uni'))\n\
+    z_force.load(os.path.join(path, 'z_force.uni'))\n\
     inflow_grid.load(os.path.join(path, 'inflow_low.uni'))\n\
     fuel_inflow.load(os.path.join(path, 'fuel_inflow.uni'))\n\
+    x_vel.load(os.path.join(path, 'x_vel.uni'))\n\
+    y_vel.load(os.path.join(path, 'y_vel.uni'))\n\
+    z_vel.load(os.path.join(path, 'z_vel.uni'))\n\
+    x_obvel.load(os.path.join(path, 'x_obvel.uni'))\n\
+    y_obvel.load(os.path.join(path, 'y_obvel.uni'))\n\
+    z_obvel.load(os.path.join(path, 'z_obvel.uni'))\n\
     if using_colors:\n\
         color_r.load(os.path.join(path, 'color_r.uni'))\n\
         color_g.load(os.path.join(path, 'color_g.uni'))\n\
@@ -365,6 +375,14 @@ const std::string smoke_import_high = "\n\
 def load_smoke_data_high(path):\n\
     xl_density.load(os.path.join(path, 'xl_density.uni'))\n\
     xl_flags.load(os.path.join(path, 'xl_flags.uni'))\n\
+    \n\
+    texture_u.load(os.path.join(path, 'texture_u.uni'))\n\
+    texture_v.load(os.path.join(path, 'texture_v.uni'))\n\
+    texture_w.load(os.path.join(path, 'texture_w.uni'))\n\
+    texture_u2.load(os.path.join(path, 'texture_u2.uni'))\n\
+    texture_v2.load(os.path.join(path, 'texture_v2.uni'))\n\
+    texture_w2.load(os.path.join(path, 'texture_w2.uni'))\n\
+    \n\
     if using_colors:\n\
         xl_color_r.load(os.path.join(path, 'xl_color_r.uni'))\n\
         xl_color_g.load(os.path.join(path, 'xl_color_g.uni'))\n\
@@ -379,9 +397,20 @@ def save_smoke_data_low(path):\n\
     density.save(os.path.join(path, 'density.uni'))\n\
     flags.save(os.path.join(path, 'flags.uni'))\n\
     vel.save(os.path.join(path, 'vel.uni'))\n\
+    obvel.save(os.path.join(path, 'obvel.uni'))\n\
+    pressure.save(os.path.join(path, 'pressure.uni'))\n\
     forces.save(os.path.join(path, 'forces.uni'))\n\
+    x_force.save(os.path.join(path, 'x_force.uni'))\n\
+    y_force.save(os.path.join(path, 'y_force.uni'))\n\
+    z_force.save(os.path.join(path, 'z_force.uni'))\n\
     inflow_grid.save(os.path.join(path, 'inflow_low.uni'))\n\
     fuel_inflow.save(os.path.join(path, 'fuel_inflow.uni'))\n\
+    x_vel.save(os.path.join(path, 'x_vel.uni'))\n\
+    y_vel.save(os.path.join(path, 'y_vel.uni'))\n\
+    z_vel.save(os.path.join(path, 'z_vel.uni'))\n\
+    x_obvel.save(os.path.join(path, 'x_obvel.uni'))\n\
+    y_obvel.save(os.path.join(path, 'y_obvel.uni'))\n\
+    z_obvel.save(os.path.join(path, 'z_obvel.uni'))\n\
     if using_colors:\n\
         color_r.save(os.path.join(path, 'color_r.uni'))\n\
         color_g.save(os.path.join(path, 'color_g.uni'))\n\
@@ -394,9 +423,17 @@ def save_smoke_data_low(path):\n\
         react.save(os.path.join(path, 'react.uni'))\n";
 
 const std::string smoke_export_high = "\n\
-def save_smoke_data_low(path):\n\
+def save_smoke_data_high(path):\n\
     xl_density.save(os.path.join(path, 'xl_density.uni'))\n\
     xl_flags.save(os.path.join(path, 'xl_flags.uni'))\n\
+    \n\
+    texture_u.save(os.path.join(path, 'texture_u.uni'))\n\
+    texture_v.save(os.path.join(path, 'texture_v.uni'))\n\
+    texture_w.save(os.path.join(path, 'texture_w.uni'))\n\
+    texture_u2.save(os.path.join(path, 'texture_u2.uni'))\n\
+    texture_v2.save(os.path.join(path, 'texture_v2.uni'))\n\
+    texture_w2.save(os.path.join(path, 'texture_w2.uni'))\n\
+    \n\
     if using_colors:\n\
         xl_color_r.save(os.path.join(path, 'xl_color_r.uni'))\n\
         xl_color_g.save(os.path.join(path, 'xl_color_g.uni'))\n\

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to