Salome HOME
Adding Multinode method for smesh parallelism (with windows fixed)
[modules/smesh.git] / src / SMESH / SMESH_ParallelMesh.hxx
index 3241a522baec53b55f547a53f3a1fbb2972b19fd..4a418a49f31a4fde82847f1f0e90027e54a50e84 100644 (file)
 
 #include "SMESH_Gen.hxx"
 #include "SMESH_subMesh.hxx"
-
+#ifdef WIN32
+#include <thread>
+#include <boost/filesystem.hpp>
+#endif
 enum ParallelismMethod {MultiThread, MultiNode};
 
 class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
@@ -46,24 +49,35 @@ class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
                        bool              theIsEmbeddedMode,
                        SMESHDS_Document* theDocument);
 
-  virtual ~SMESH_ParallelMesh();
+  ~SMESH_ParallelMesh();
 
   // Locking mechanism
+  #ifndef WIN32
   void Lock() override {_my_lock.lock();};
   void Unlock() override {_my_lock.unlock();};
   // We need to recreate the pool afterthe join
   void wait() override {_pool->join(); DeletePoolThreads(); InitPoolThreads(); };
+  #endif
 
   // Thread Pool
+#ifndef WIN32
   void InitPoolThreads() {_pool = new boost::asio::thread_pool(GetPoolNbThreads());};
-  void DeletePoolThreads() {delete _pool;};
   boost::asio::thread_pool* GetPool() {return _pool;};
+  void DeletePoolThreads() {delete _pool;};
+#else
+  void InitPoolThreads() {};
+  void* GetPool() {return NULL;};
+  void DeletePoolThreads(){};
+#endif
+
   int GetPoolNbThreads();
 
   // Temporary folder
+  bool keepingTmpFolfer();
   void CreateTmpFolder();
   void DeleteTmpFolder();
   boost::filesystem::path GetTmpFolder() {return tmp_folder;};
+  void cleanup();
 
   //
   bool IsParallel() override {return true;};
@@ -92,6 +106,9 @@ class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
   std::string GetWcKey() {return _wcKey;};
   void SetWcKey(std::string wcKey) {_wcKey = wcKey;};
 
+  std::string GetWalltime() {return _walltime;};
+  void SetWalltime(std::string walltime) {_walltime = walltime;};
+
   // Parallel computation
   bool ComputeSubMeshes(
             SMESH_Gen* gen,
@@ -112,11 +129,10 @@ class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
   // Mutex for multhitreading write in SMESH_Mesh
 #ifndef WIN32
   boost::mutex _my_lock;
-#endif
-  boost::filesystem::path tmp_folder;
   // thread pool for computation
   boost::asio::thread_pool *     _pool = nullptr;
-
+#endif
+  boost::filesystem::path tmp_folder;
   int _method = ParallelismMethod::MultiThread;
 
   int _NbThreads = std::thread::hardware_concurrency();
@@ -126,5 +142,6 @@ class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
   int _nbNode = 1;
   std::string _resource = "";
   std::string _wcKey = "P11N0:SALOME";
+  std::string _walltime = "01:00:00";
 };
 #endif