Commit: 2e6fbe23b8bcd362ae14e36b395dafc5d6d716aa
Author: Roman Pogribnyi
Date:   Tue Nov 4 17:45:03 2014 +0100
Branches: soc-2014-fluid
https://developer.blender.org/rB2e6fbe23b8bcd362ae14e36b395dafc5d6d716aa

SMOKE: wavelets included in setups

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

M       intern/smoke/extern/smoke_API.h
A       intern/smoke/intern/BASIC_FLUID.cpp
M       intern/smoke/intern/MANTA.cpp
M       intern/smoke/intern/MANTA.h
M       intern/smoke/intern/WTURBULENCE.cpp
M       intern/smoke/intern/WTURBULENCE.h
M       intern/smoke/intern/scenarios/smoke.h
M       intern/smoke/intern/smoke_API.cpp
M       release/datafiles/locale
M       release/scripts/addons
M       release/scripts/addons_contrib
M       release/scripts/startup/bl_ui/properties_physics_smoke.py
M       scons
M       source/blender/blenkernel/intern/smoke.c

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

diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index e83a73b..0efe035 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -74,7 +74,7 @@ size_t smoke_get_index(int x, int max_x, int y, int max_y, 
int z);
 size_t smoke_get_index2d(int x, int max_x, int y);
 void smoke_dissolve(struct FLUID_3D *fluid, int speed, int log);
 // wavelet turbulence functions
-struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int 
noisetype, const char *noisefile_path, int use_fire, int use_colors);
+struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int 
noisetype, const char *noisefile_path, int use_fire, int use_colors,struct 
SmokeDomainSettings *sds);
 void smoke_turbulence_free(struct WTURBULENCE *wt);
 void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
 float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
@@ -148,7 +148,7 @@ void smoke_ensure_colors(struct FLUID_3D *fluid, struct 
WTURBULENCE *wt, float i
        void smoke_dissolve(struct Manta_API *fluid, int speed, int log);
        
        // wavelet turbulence functions
-       struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int 
noisetype, const char *noisefile_path, int use_fire, int use_colors);
+       struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int 
noisetype, const char *noisefile_path, int use_fire, int use_colors,struct 
SmokeDomainSettings *sds);
        void smoke_turbulence_free(struct WTURBULENCE *wt);
        void smoke_turbulence_step(struct WTURBULENCE *wt, struct Manta_API 
*fluid);
        
diff --git a/intern/smoke/intern/BASIC_FLUID.cpp 
b/intern/smoke/intern/BASIC_FLUID.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index 40e373b..a28db4c 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -293,34 +293,7 @@ void *Manta_API::run_manta_scene_thread(void *arguments)
 
 void Manta_API::run_manta_scene(Manta_API * fluid)
 {
-//     smd->domain->manta_sim_frame = 0;
-//     PyGILState_STATE gilstate = PyGILState_Ensure();
-////   for (int fr=0; fr< 1; ++fr)
-//     int fr = s->r.cfra;
-//     {
-////           if(smd->domain->manta_sim_frame == -1)
-////                   break;
-//             printf("Simulation Step");
-//             manta_write_effectors(s, smd);
-//             smd->domain->manta_sim_frame = fr;
-//             std::string frame_str = static_cast<ostringstream*>( 
&(ostringstream() << fr) )->str();
-//             std::string py_string_0 = string("sim_step(").append(frame_str);
-//             std::string py_string_1 = py_string_0.append(")\0");
-//             //              std::string py_string_1 = 
string("sim_step()\0");
-//             PyRun_SimpleString(py_string_1.c_str());
-//             //              frame_num ++;
-//     }
-//     PyGILState_Release(gilstate);
-       //returning simulation state to "not simulating" aka -1
-//     smd->domain->manta_sim_frame = -1;
-//
-//     
-//     
-//     args.frame_num = smd->domain->manta_end_frame - 
smd->domain->manta_start_frame;
-//     int rc = pthread_create(&manta_thread, NULL, run_manta_sim_thread, 
(void *)args);
-//     pthread_join(manta_thread,NULL);
-//     pthread_detach(manta_thread);
-       run_manta_sim_thread(fluid);
+       run_manta_sim_lowRes(fluid);
 }
 
 void Manta_API::stop_manta_sim()
@@ -409,29 +382,39 @@ void Manta_API::export_obstacles(float *data, int x, int 
y, int z)
        PyGILState_Release(gilstate);           
 }
 
-
-void Manta_API::run_manta_sim_thread(Manta_API *fluid)
+void Manta_API::run_manta_sim_lowRes(Manta_API *fluid)
 {
        PyGILState_STATE gilstate = PyGILState_Ensure();
-//     for (int fr=0; fr< num_sim_steps; ++fr) {
-//             if(smd->domain->manta_sim_frame == -1)
-//                     break;
-               printf("Simulation Step");
-               int sim_frame = 1;
-               manta_write_effectors(fluid);
-               std::string frame_str = static_cast<ostringstream*>( 
&(ostringstream() << sim_frame) )->str();
-               std::string py_string_0 = 
string("sim_step_low(").append(frame_str);
-               std::string py_string_1 = py_string_0.append(")\0");
+       int sim_frame = 1;
+       manta_write_effectors(fluid);
+       std::string frame_str = static_cast<ostringstream*>( &(ostringstream() 
<< sim_frame) )->str();
+       std::string py_string_0 = string("sim_step_low(").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;
-       //}
-       //returning simulation state to "not simulating" aka -1
+       PyRun_SimpleString("print ('pyhton density pointer:' + 
density.getDataPointer())");
+       PyRun_SimpleString(py_string_1.c_str());
+       cout<< "done"<<manta_sim_running<<endl;
        PyGILState_Release(gilstate);
        updatePointers();
 }
 
+void Manta_API::run_manta_sim_highRes(WTURBULENCE *wt)
+{
+       PyGILState_STATE gilstate = PyGILState_Ensure();
+       int sim_frame = 1;
+//     manta_write_effectors(fluid);
+       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);
+}
+
+
 void Manta_API::generate_manta_sim_file_lowRes(SmokeModifierData *smd)
 {
        string smoke_script = smoke_setup_low  + smoke_step_low ;       
@@ -450,7 +433,6 @@ void 
Manta_API::generate_manta_sim_file_highRes(SmokeModifierData *smd)
        PyGILState_STATE gilstate = PyGILState_Ensure();
        PyRun_SimpleString(final_script.c_str());
        PyGILState_Release(gilstate);
-       updatePointers();
 }
 
 std::string Manta_API::getRealValue( const std::string& varName, 
SmokeModifierData *smd)
@@ -617,7 +599,16 @@ void Manta_API::updatePointers()
        void *gridPointer = NULL;
        ss >> gridPointer;
        _density = (float* )gridPointer;
+       ss.str("");
+}
 
+void Manta_API::updateHighResPointers(WTURBULENCE *wt)
+{
+       stringstream ss(getGridPointer("xl_density", "xl"));
+       void *gridPointer = NULL;
+       ss >> gridPointer;
+       wt->_densityBig = (float* )gridPointer;
+       ss.str("");
 }
 
 Manta_API::Manta_API(int *res, float dx, float dtdef, int init_heat, int 
init_fire, int init_colors,SmokeDomainSettings *sds): _xRes(res[0]), 
_yRes(res[1]), _zRes(res[2]), _res(0.0f)
diff --git a/intern/smoke/intern/MANTA.h b/intern/smoke/intern/MANTA.h
index 7b5de1d..2920890 100644
--- a/intern/smoke/intern/MANTA.h
+++ b/intern/smoke/intern/MANTA.h
@@ -99,22 +99,23 @@ public:
        
        void *run_manta_scene_thread(void *threadid);
        
-       void run_manta_sim_thread(Manta_API *fluid);
+       void run_manta_sim_lowRes(Manta_API *fluid);
+       void run_manta_sim_highRes(WTURBULENCE *wt);
        
        void run_manta_scene(Manta_API * fluid);
        
        void stop_manta_sim();
        
        void generate_manta_sim_file_lowRes(SmokeModifierData *smd);
-       void generate_manta_sim_file_highRes(SmokeModifierData *smd);
+       static void generate_manta_sim_file_highRes(SmokeModifierData *smd);
        
        void manta_sim_step(int frame);
        
-       std::string getRealValue(const string& varName, SmokeModifierData *sds);
+       static std::string getRealValue(const string& varName, 
SmokeModifierData *sds);
        
-       std::string parseLine(const string& line, SmokeModifierData *sds);
+       static std::string parseLine(const string& line, SmokeModifierData 
*sds);
        
-       std::string parseScript(const string& setup_string, SmokeModifierData 
*sds);    
+       static std::string parseScript(const string& setup_string, 
SmokeModifierData *sds);     
        
        pthread_t manta_thread;
        
@@ -125,6 +126,7 @@ public:
        
        std::string getGridPointer(string gridName, string solverName);
        void updatePointers();
+       void updateHighResPointers(WTURBULENCE *wt);
 };
 
 
diff --git a/intern/smoke/intern/WTURBULENCE.cpp 
b/intern/smoke/intern/WTURBULENCE.cpp
index 02ee163..36d5a59 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -48,6 +48,10 @@
 // 2^ {-5/6}
 static const float persistence = 0.56123f;
 
+#ifdef WITH_MANTA
+#include "MANTA.h"
+#endif
+
 #ifndef WITH_MANTA  /*old WTurbulence Solver*/
 
 //////////////////////////////////////////////////////////////////////
@@ -1206,7 +1210,7 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* 
xvel, float* yvel, floa
 
 #else                                           /*USING MANTAFLOW WTURBULENCE*/
 
-WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int 
noisetype, const char *noisefile_path, int init_fire, int init_colors)
+WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int 
noisetype, const char *noisefile_path, int init_fire, int 
init_colors,SmokeDomainSettings *sds)
 {
        // if noise magnitude is below this threshold, its contribution
        // is negilgible, so stop evaluating new octaves
diff --git a/intern/smoke/intern/WTURBULENCE.h 
b/intern/smoke/intern/WTURBULENCE.h
index 3663532..31e809f 100644
--- a/intern/smoke/intern/WTURBULENCE.h
+++ b/intern/smoke/intern/WTURBULENCE.h
@@ -36,7 +36,7 @@ struct WTURBULENCE
 {
        public:
                // both config files can be NULL, altCfg might override values 
from noiseCfg
-               WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, 
int noisetype, const char *noisefile_path, int init_fire, int init_colors);
+               WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, 
int noisetype, const char *noisefile_path, int init_fire, int 
init_colors,struct SmokeDomainSettings *sds);
 
                /// destructor
                virtual ~WTURBULENCE();
diff --git a/intern/smoke/intern/scenarios/smoke.h 
b/intern/smoke/intern/scenarios/smoke.h
index 26f3c59..34b4613 100644
--- a/intern/smoke/intern/scenarios/smoke.h
+++ b/intern/smoke/intern/scenarios/smoke.h
@@ -133,16 +133,7 @@ const string smoke_step_high = "def sim_step_high(t):\n\
     sPos *= 2.0 \n\
   for substep in range(upres):  \n\
     advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_density, 
order=$ADVECT_ORDER$)  \n\
-  #DENSITY INFLOW\n\
-  \n\
-  #if (applyInflow): \n\
-  #  if noise.valScale > 0.:\n\
-  #    densityInflowMeshNoise( flags=xl_flags, density=xl_density, 
noise=xl_wltnoise, mesh=source, sca

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to