Commit: 497c40b29c978aed9943d4f18cb5c44f5774b583
Author: Sebastián Barschkis
Date:   Tue Sep 8 01:02:59 2015 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB497c40b29c978aed9943d4f18cb5c44f5774b583

refactored updatePointers functions

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

M       intern/smoke/intern/FLUID_3D.cpp
M       intern/smoke/intern/MANTA.cpp
M       intern/smoke/intern/MANTA.h
M       intern/smoke/intern/WTURBULENCE.cpp

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

diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index a0a6eed..17faded 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -666,7 +666,7 @@ _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
        vector<string> a;
        a.push_back("manta_scene.py");
        runMantaScript(final_script,a); /*need this to delete previous solvers 
and grids*/
-       Manta_API::updatePointers(this, using_colors);
+       Manta_API::updatePointers(this);
 }
 
 void FLUID_3D::initHeat()
@@ -676,7 +676,7 @@ void FLUID_3D::initHeat()
                PyGILState_STATE gilstate = PyGILState_Ensure();
                PyRun_SimpleString(smoke_init_heat_low.c_str());
                PyGILState_Release(gilstate);
-               Manta_API::updatePointers(this, using_colors);
+               Manta_API::updatePointers(this);
        }
 }
 
@@ -692,7 +692,7 @@ void FLUID_3D::initColors(float init_r, float init_g, float 
init_b)
                PyRun_SimpleString(ss.str().c_str());
                PyRun_SimpleString(smoke_init_colors_low.c_str());
                PyGILState_Release(gilstate);
-               Manta_API::updatePointers(this, true);
+               Manta_API::updatePointers(this);
        }
 }
 
@@ -703,7 +703,7 @@ void FLUID_3D::initFire()
                PyGILState_STATE gilstate = PyGILState_Ensure();
                PyRun_SimpleString(smoke_init_fire_low.c_str());
                PyGILState_Release(gilstate);
-               Manta_API::updatePointers(this, true);
+               Manta_API::updatePointers(this);
        }
 }
 
@@ -759,7 +759,7 @@ void FLUID_3D::step(float dt, float gravity[3])
 {
        // Blender computes heat buoyancy, not yet impl. in Manta
        manta_write_effectors(this);
-       Manta_API::updatePointers(this,using_colors);
+       Manta_API::updatePointers(this);
 //     diffuseHeat();
 
        int sim_frame = 1;
@@ -770,7 +770,7 @@ void FLUID_3D::step(float dt, float gravity[3])
        PyRun_SimpleString(py_string_1.c_str());
        cout<< "done"<<manta_sim_running<<endl;
        PyGILState_Release(gilstate);
-       Manta_API::updatePointers(this,using_colors);
+       Manta_API::updatePointers(this);
 
        for (int i = 0; i < _totalCells; i++)
        {
@@ -788,7 +788,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float 
*react, float *heat,
        PyGILState_STATE gilstate = PyGILState_Ensure();
        PyRun_SimpleString(fire_process_burn.c_str());
        PyGILState_Release(gilstate);
-       Manta_API::updatePointers(this, true);
+       Manta_API::updatePointers(this);
 }
 
 void FLUID_3D::updateFlame(float *react, float *flame, int total_cells)
@@ -796,7 +796,7 @@ void FLUID_3D::updateFlame(float *react, float *flame, int 
total_cells)
        PyGILState_STATE gilstate = PyGILState_Ensure();
        PyRun_SimpleString(fire_update_flame.c_str());
        PyGILState_Release(gilstate);
-       Manta_API::updatePointers(this, true);
+       Manta_API::updatePointers(this);
 }
 
 #endif /*WITH_MANTA*/
diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index 8f11a51..6697ef0 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -390,12 +390,10 @@ void Manta_API::run_manta_sim_highRes(WTURBULENCE *wt)
        std::string frame_str = static_cast<ostringstream*>( &(ostringstream() 
<< sim_frame) )->str();
        std::string py_string_0 = string("sim_step_high(").append(frame_str);
        std::string py_string_1 = py_string_0.append(")\0");
-       cout << "Debug C++: densityPointer:" << 
Manta_API::getGridPointer("density", "s")<<endl;
        PyRun_SimpleString("print ('pyhton density pointer:' + 
density.getDataPointer())");
        PyRun_SimpleString(py_string_1.c_str());
-       cout<< "done"<<manta_sim_running<<endl;
        PyGILState_Release(gilstate);
-       updateHighResPointers(wt,false);
+       updateHighResPointers(wt/*,false*/);
 }
 
 void Manta_API::generate_manta_sim_file_highRes(SmokeModifierData *smd)
@@ -607,7 +605,7 @@ void * Manta_API::pointerFromString(const std::string& s){
 }
 
 
-void Manta_API::updatePointers(FLUID_3D *fluid, bool updateColor)
+void Manta_API::updatePointers(FLUID_3D *fluid)
 {
        //blender_to_manta: whether we copy data from blender density/velocity 
field to mantaflow or the other way around
        /*in 2D case, we want to copy in the Z-axis field that is in the middle 
of X and Y axes */
@@ -651,9 +649,7 @@ void Manta_API::updatePointers(FLUID_3D *fluid, bool 
updateColor)
                fluid->_color_b = (float* 
)pointerFromString(getGridPointer("color_b_low", "s"));
        }
        if (fluid->using_heat) {
-               cout<< "Updating Heat" << fluid->_heat<< endl;
                fluid->_heat = (float* 
)pointerFromString(getGridPointer("heat_low", "s"));
-               cout<< "Updating Heat" << fluid->_heat<< endl;
        }
        if (fluid->using_fire) {
                fluid->_flame = (float* 
)pointerFromString(getGridPointer("flame_low", "s"));
@@ -662,10 +658,10 @@ void Manta_API::updatePointers(FLUID_3D *fluid, bool 
updateColor)
        }
 }
 
-void Manta_API::updateHighResPointers(WTURBULENCE *wt, bool updateColor)
+void Manta_API::updateHighResPointers(WTURBULENCE *wt)
 {
        wt->_densityBig = (float* 
)pointerFromString(getGridPointer("xl_density", "xl"));;
-       if (updateColor){
+       if (wt->using_colors){
                wt->_color_rBig = (float* 
)pointerFromString(getGridPointer("color_r_high", "xl"));
                wt->_color_gBig = (float* 
)pointerFromString(getGridPointer("color_g_high", "xl"));
                wt->_color_bBig = (float* 
)pointerFromString(getGridPointer("color_b_high", "xl"));
diff --git a/intern/smoke/intern/MANTA.h b/intern/smoke/intern/MANTA.h
index fad858a..cb2cb2e 100644
--- a/intern/smoke/intern/MANTA.h
+++ b/intern/smoke/intern/MANTA.h
@@ -125,8 +125,8 @@ public:
        static void export_obstacles(float *data, int x, int y, int z, bool 
is2D);
        
        static std::string getGridPointer(string gridName, string solverName);
-       static void updatePointers(FLUID_3D *fluid, bool updateColor);
-       static void updateHighResPointers(WTURBULENCE *wt,bool updateColor);
+       static void updatePointers(FLUID_3D *fluid);
+       static void updateHighResPointers(WTURBULENCE *wt);
        static void manta_export_grids(SmokeModifierData *smd);
 };
 
diff --git a/intern/smoke/intern/WTURBULENCE.cpp 
b/intern/smoke/intern/WTURBULENCE.cpp
index 4db2c49..58fff5f 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -1292,7 +1292,7 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int 
zResSm, int amplify, int no
        setNoise(noisetype, noisefile_path);
        sds->smd->domain->wt = this;
        Manta_API::generate_manta_sim_file_highRes(sds->smd);
-       Manta_API::updateHighResPointers(this,using_colors);
+       Manta_API::updateHighResPointers(this);
 }
 
 /// destructor
@@ -1330,7 +1330,7 @@ void WTURBULENCE::initFire()
                PyGILState_STATE gilstate = PyGILState_Ensure();
                PyRun_SimpleString(smoke_init_fire_high.c_str());
                PyGILState_Release(gilstate);
-               Manta_API::updateHighResPointers(this, true);
+               Manta_API::updateHighResPointers(this);
        }
 }
 
@@ -1346,7 +1346,7 @@ void WTURBULENCE::initColors(float init_r, float init_g, 
float init_b)
                PyRun_SimpleString(ss.str().c_str());
                PyRun_SimpleString(smoke_init_colors_high.c_str());
                PyGILState_Release(gilstate);
-               Manta_API::updateHighResPointers(this,true);
+               Manta_API::updateHighResPointers(this);
        }
 }
 
@@ -1367,7 +1367,7 @@ void WTURBULENCE::stepTurbulenceReadable(float dt, float* 
xvel, float* yvel, flo
        std::string py_string_1 = py_string_0.append(")\0");
        PyRun_SimpleString(py_string_1.c_str());
        PyGILState_Release(gilstate);
-       Manta_API::updateHighResPointers(this,using_colors);
+       Manta_API::updateHighResPointers(this);
 }
 
 // step more complete version -- include rotation correction
@@ -1382,7 +1382,7 @@ void WTURBULENCE::stepTurbulenceFull(float dt, float* 
xvel, float* yvel, float*
        std::string py_string_1 = py_string_0.append(")\0");
        PyRun_SimpleString(py_string_1.c_str());
        PyGILState_Release(gilstate);
-       Manta_API::updateHighResPointers(this,using_colors);
+       Manta_API::updateHighResPointers(this);
 }
 
 // texcoord functions

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to