[Bf-blender-cvs] [aa59cb6] soc-2014-fluid: Running Manta in separate thread

Roman Pogribnyi noreply at git.blender.org
Wed Jul 2 11:51:44 CEST 2014


Commit: aa59cb66150077f8e5f09ceab6adebcde2052e8a
Author: Roman Pogribnyi
Date:   Sat Jun 21 10:26:36 2014 +0200
https://developer.blender.org/rBaa59cb66150077f8e5f09ceab6adebcde2052e8a

Running Manta in separate thread

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

M	intern/smoke/intern/MANTA.h

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

diff --git a/intern/smoke/intern/MANTA.h b/intern/smoke/intern/MANTA.h
index fad7074..1c72169 100644
--- a/intern/smoke/intern/MANTA.h
+++ b/intern/smoke/intern/MANTA.h
@@ -8,6 +8,7 @@
 #include <sstream>
 #include <stdlib.h>
 #include <fstream>
+#include <pthread.h>
 
 extern "C" bool manta_check_grid_size(struct FLUID_3D *fluid, int dimX, int dimY, int dimZ)
 {
@@ -162,6 +163,12 @@ static void add_mesh_transform_method(stringstream& ss)
 	"  obj.offset(vec3(res/2, res/2, res/2))\n\n";
 }
 
+void *run_manta_scene(void *threadid)
+{
+	system("./manta manta_scene.py");
+	pthread_exit(NULL);
+}
+
 static void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
 {
 	/*for now, simpleplume file creation
@@ -355,9 +362,11 @@ static void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
 		//ss << "    densityInflow( flags=xl_flags, density=xl_density, noise=xl_noise, shape=xl_source, scale=1, sigma=0.5 ) \n";
 		ss << "  xl.step()   \n";
 	}
-	
 	manta_setup_file << ss.rdbuf();
 	manta_setup_file.close();
+	pthread_t manta_thread;
+	int rc = pthread_create(&manta_thread, NULL, run_manta_scene, NULL);
+	pthread_detach(manta_thread);
 }
 
 #endif /* MANTA_H */




More information about the Bf-blender-cvs mailing list