[Bf-blender-cvs] [c813809] soc-2014-fluid: per-step simulation added
Roman Pogribnyi
noreply at git.blender.org
Thu Jul 31 00:12:39 CEST 2014
Commit: c8138097f7ef42b2c1a35ea03e1afc49a8e8f380
Author: Roman Pogribnyi
Date: Thu Jul 31 00:12:24 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rBc8138097f7ef42b2c1a35ea03e1afc49a8e8f380
per-step simulation added
===================================================================
M intern/smoke/intern/MANTA.cpp
M source/blender/python/manta_pp/pwrapper/pymain.cpp
===================================================================
diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index f909148..50ee200 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -347,7 +347,7 @@ void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
/*Flow solving stepsv, main loop*/
//setting 20 sim frames for now
// ss << "for t in range(0,20): \n"; // << scene->r.sfra << ", " << scene->r.efra << "): \n";
- ss << "for t in range(0, " << num_sim_frames << "): \n";
+ ss << "def sim_step(t):\n";
manta_advect_SemiLagr(ss, 1, "flags", "vel", "density", 2);
manta_advect_SemiLagr(ss, 1, "flags", "vel", "vel", 2);
@@ -359,9 +359,10 @@ void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
ss << " applyInflow=False\n";
ss << " if (t>=0 and t<75):\n";
ss << " source_shape.applyToGrid(grid=density, value=1)\n";
+ ss << " sourceVel.applyToGrid(grid=vel , value=velInflow,cutoff = 3)\n";
+
//ss << " densityInflowMesh( flags=flags, density=density, noise=noise, mesh=source, scale=1, sigma=0.5 )\n";
//ss << " densityInflow( flags=flags, density=density, noise=noise, shape=source, scale=1, sigma=0.5 )\n";
- ss << " sourceVel.applyToGrid(grid=vel , value=velInflow,cutoff = 3)\n";
//ss << " sourceVel.applyToGrid( grid=vel , value=velInflow )\n";
ss << " applyInflow=True\n";
@@ -403,7 +404,7 @@ void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
ss << " if (applyInflow): \n";
ss << " densityInflowMesh( flags=xl_flags, density=xl_density, noise=xl_noise, mesh=xl_source, scale=1, sigma=0.5 ) \n";
//ss << " densityInflow( flags=xl_flags, density=xl_density, noise=xl_noise, shape=xl_source, scale=1, sigma=0.5 ) \n";
- ss << " xl.step() \n";
+// ss << " xl.step() \n";
}
manta_setup_file << ss.rdbuf();
manta_setup_file.close();
diff --git a/source/blender/python/manta_pp/pwrapper/pymain.cpp b/source/blender/python/manta_pp/pwrapper/pymain.cpp
index 2b502e2..72a8534 100644
--- a/source/blender/python/manta_pp/pwrapper/pymain.cpp
+++ b/source/blender/python/manta_pp/pwrapper/pymain.cpp
@@ -18,7 +18,7 @@
#include "manta.h"
#include "../general.h"
#include "wchar.h"
-
+using namespace std;
namespace Manta {
extern void guiMain(int argc, char* argv[]);
extern void guiWaitFinish();
@@ -86,12 +86,13 @@ void runMantaScript(vector<string>& args) {
#else
// for linux, use this as it produces nicer error messages
PyRun_SimpleFileEx(fp, filename.c_str(), 1);
- fclose(fp);
-// Pb::finalize();
-// Pb::setup(filename, args);
-// fp = fopen(filename.c_str(),"rb");
-// debMsg("one more time",0);
-// PyRun_SimpleFileEx(fp, filename.c_str(), 1);
+ for (int frame=0; frame < 4; ++frame)
+ {
+ std::string frame_str = static_cast<ostringstream*>( &(ostringstream() << frame) )->str();
+ std::string py_string_0 = string("sim_step(").append(frame_str);
+ std::string py_string_1 = py_string_0.append(")\0");
+ PyRun_SimpleString(py_string_1.c_str());
+ }
fclose(fp);
#endif
More information about the Bf-blender-cvs
mailing list