#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
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;};
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,
// 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();
int _nbNode = 1;
std::string _resource = "";
std::string _wcKey = "P11N0:SALOME";
+ std::string _walltime = "01:00:00";
};
#endif