[Bf-blender-cvs] [3430e0a] fluid-mantaflow: minor cleanups
Sebastián Barschkis
noreply at git.blender.org
Thu Jan 28 12:37:02 CET 2016
Commit: 3430e0aab9dd11f66bed9287d936821d77b8be09
Author: Sebastián Barschkis
Date: Mon Oct 12 20:38:51 2015 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB3430e0aab9dd11f66bed9287d936821d77b8be09
minor cleanups
===================================================================
M intern/smoke/intern/FLUID_3D.cpp
M intern/smoke/intern/MANTA.cpp
M intern/smoke/intern/scenarios/smoke.h
M intern/smoke/intern/smoke_API.cpp
M source/blender/python/manta_pp/pwrapper/pymain.cpp
===================================================================
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 0523aa1..6b5ca9e 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -754,7 +754,7 @@ FLUID_3D::~FLUID_3D()
void FLUID_3D::step(float dt, float gravity[3])
{
// Blender computes heat buoyancy, not yet impl. in Manta
- manta_write_effectors(this);
+ //manta_write_effectors(this);
Manta_API::updatePointers(this);
PyGILState_STATE gilstate = PyGILState_Ensure();
diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index 79e4526..0b47622 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -282,7 +282,7 @@ string Manta_API::gridNameFromType(const string &type)
void Manta_API::addGrid(void * data, string name, string type, int x, int y, int z, bool is2D = false)
{
if (data == NULL || name == "" || gridNameFromType(type) == "") return;
- //cout << "Adding Grid:" << name << endl;
+ cout << "Adding Grid: " << name << endl;
std::ostringstream stringStream;
/* Temporary gridname */
diff --git a/intern/smoke/intern/scenarios/smoke.h b/intern/smoke/intern/scenarios/smoke.h
index aec8331..261a07f 100644
--- a/intern/smoke/intern/scenarios/smoke.h
+++ b/intern/smoke/intern/scenarios/smoke.h
@@ -76,7 +76,6 @@ if $USE_WAVELETS$ and $UPRES$ > 0:\n\
xl.timestep = $XL_TIMESTEP$\n\
\n\
# prepare grids\n\
- vel = s.create(MACGrid)\n\
xl_vel = xl.create(MACGrid)\n\
xl_density = xl.create(RealGrid)\n\
xl_flags = xl.create(FlagGrid)\n\
@@ -98,7 +97,7 @@ if $USE_WAVELETS$ and $UPRES$ > 0:\n\
xl_noise.valOffset = $NOISE_VALOFFSET$ \n\
xl_noise.timeAnim = $NOISE_TIMEANIM$ * $UPRES$ \n\
xl_wltnoise = xl.create(NoiseField, loadFromFile=True) \n\
- xl_wltnoise.posScale = vec3( int(1.0*gs.x) ) * 0.5 \n\
+ xl_wltnoise.posScale = vec3( int(1.0*xl_gs.x) ) * 0.5 \n\
xl_wltnoise.posScale = xl_wltnoise.posScale * 0.5\n\
xl_wltnoise.timeAnim = 0.1 \n\
\n\
@@ -179,10 +178,14 @@ def step_low():\n\
density.add(inflow_grid)\n\
\n\
if manta_using_heat:\n\
+ print ('Adding heat buoyancy')\n\
gravity=vec3(0,0,-0.0981) if solver_dim==3 else vec3(0,-0.0981,0)\n\
- addBuoyancy2(flags=flags, grid=density, vel=vel, gravity=gravity, coefficient=$ALPHA$)\n\
+ print ('Here 1')\n\
+ addBuoyancy2(flags=flags, grid=density, vel=vel, gravity=gravity, coefficient=(-0.001))\n\
+ print ('Here 2')\n\
addBuoyancy2(flags=flags, grid=heat_low, vel=vel, gravity=gravity, coefficient=$BETA$*(-10))\n\
else:\n\
+ print ('Adding buoyancy')\n\
gravity=vec3(0,0,-0.01 * $ALPHA$) if solver_dim==3 else vec3(0,-0.01* $ALPHA$,0)\n\
addBuoyancy(density=density, vel=vel, gravity=gravity, flags=flags)\n\
\n\
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 3904fd9..945413d 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -616,7 +616,7 @@ extern "C" void manta_write_effectors(struct FLUID_3D *fluid)
}
}
}
- else if (fluid->manta_resoution == 2){
+ else if (fluid->manta_resoution == 2) {
accumulated_force = (Manta::Vec3*)malloc(size_x * size_z * sizeof(Manta::Vec3));
int step(0);
for (int x(0); x < size_x; x++){
@@ -626,12 +626,11 @@ extern "C" void manta_write_effectors(struct FLUID_3D *fluid)
}
}
}
- else{
+ else {
cout << "ERROR: Manta solver resoltion is neither 2 nor 3; Cannot write forces"<<endl;
return;
}
-
bool is2D = (fluid->manta_resoution == 2);
Manta_API::addGrid(accumulated_force, "forces", "Vec3", size_x, size_y, size_z, is2D);
}
diff --git a/source/blender/python/manta_pp/pwrapper/pymain.cpp b/source/blender/python/manta_pp/pwrapper/pymain.cpp
index 290ab66..ce3f9be 100644
--- a/source/blender/python/manta_pp/pwrapper/pymain.cpp
+++ b/source/blender/python/manta_pp/pwrapper/pymain.cpp
@@ -21,6 +21,7 @@
#include "fileio.h"
#include "wchar.h"
#include <fstream>
+
using namespace std;
namespace Manta {
extern void guiMain(int argc, char* argv[]);
@@ -45,7 +46,6 @@ static bool manta_initialized = false;
// if globals().has_key(x):\n\
// del x \n\
// except NameError as e:\n\
-print (\'not deleted\') \n\
const string clean_code1 = "\n\
if 's' in globals() : del s \n\
@@ -64,6 +64,10 @@ if 'energy' in globals() : del energy \n\
if 'tempFlag' in globals() : del tempFlag \n\
if 'sdf_flow' in globals() : del sdf_flow \n\
if 'source_shape' in globals() : del source_shape\n";
+
+const string clean_code_low = "\
+del [res, solver_dim, gs, s, timings, flags, vel, density, pressure, color_r_low, color_g_low, color_b_low, heat_low, flame_low, fuel_low, react_low, forces, inflow_grid, fuel_inflow, manta_using_colors, manta_using_heat, manta_using_fire, low_flags_updated]";
+
const static string clean_code2 = "del s;del noise;del xl;del xl_noise;del xl_wltnoise;";
//for latter full object release
//const static string clean_code2 = "del [s, noise, source, sourceVel, xl, xl_vel, xl_density, xl_flags,xl_source, xl_noise, flags, vel, density, pressure, energy, tempFlag, sdf_flow, forces, source,source_shape, xl_wltnoise]";
@@ -175,7 +179,7 @@ void initializeMantaflow(vector<string>& args) {
srand(0);
PyGILState_STATE gilstate = PyGILState_Ensure();
/*cleaning possible previous setups*/
- //PyRun_SimpleString(clean_code1.c_str());
+ //PyRun_SimpleString(clean_code_low.c_str());
if (! manta_initialized)
{
More information about the Bf-blender-cvs
mailing list