bos #37471: fix compilation on Windows operating system. Note that SMESH_Gen::send_mesh current implementation is vetoed on windows OS (system call)

This commit is contained in:
Nabil Ghodbane 2023-09-20 15:48:33 +02:00
parent 9cefcee9dd
commit c7a9d1b06a
4 changed files with 12 additions and 10 deletions

View File

@ -301,6 +301,7 @@ const std::function<void(SMESH_subMesh*,
void SMESH_Gen::send_mesh(SMESH_Mesh& aMesh, std::string file_name)
{
#ifndef WIN32
SMESH_ParallelMesh& aParMesh = dynamic_cast<SMESH_ParallelMesh&>(aMesh);
// Calling run_mesher
// Path to mesher script
@ -351,6 +352,7 @@ void SMESH_Gen::send_mesh(SMESH_Mesh& aMesh, std::string file_name)
msg += cmd + "\n";
throw SALOME_Exception(msg);
}
#endif
}
//=============================================================================

View File

@ -32,10 +32,8 @@
#include <windows.h>
#endif
#ifndef WIN32
#include <boost/filesystem.hpp>
namespace fs=boost::filesystem;
#endif
#ifndef WIN32
#include <boost/asio.hpp>
@ -106,11 +104,9 @@ bool SMESH_ParallelMesh::keepingTmpFolfer()
//=============================================================================
void SMESH_ParallelMesh::CreateTmpFolder()
{
#ifndef WIN32
// Temporary folder that will be used by parallel computation
tmp_folder = fs::temp_directory_path()/fs::unique_path(fs::path("SMESH_%%%%-%%%%"));
fs::create_directories(tmp_folder);
#endif
}
//
//=============================================================================
@ -120,10 +116,8 @@ void SMESH_ParallelMesh::CreateTmpFolder()
//=============================================================================
void SMESH_ParallelMesh::DeleteTmpFolder()
{
#ifndef WIN32
MESSAGE("Deleting temporary folder" << tmp_folder.string());
fs::remove_all(tmp_folder);
#endif
}
//=============================================================================

View File

@ -35,7 +35,10 @@
#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
@ -49,20 +52,24 @@ class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
~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());};
boost::asio::thread_pool* GetPool() {return _pool;};
void DeletePoolThreads() {delete _pool;};
#else
void InitPoolThreads() {};
void* GetPool() {return NULL;};
void DeletePoolThreads(){};
#endif
void DeletePoolThreads() {delete _pool;};
int GetPoolNbThreads();
// Temporary folder
@ -126,7 +133,6 @@ class SMESH_EXPORT SMESH_ParallelMesh: public SMESH_Mesh
boost::asio::thread_pool * _pool = nullptr;
#endif
boost::filesystem::path tmp_folder;
int _method = ParallelismMethod::MultiThread;
int _NbThreads = std::thread::hardware_concurrency();

View File

@ -43,7 +43,7 @@ class SMESH_I_EXPORT SMESH_SequentialMesh_i:
SMESH_SequentialMesh_i( PortableServer::POA_ptr thePOA,
SMESH_Gen_i* myGen_i ):SMESH_Mesh_i(thePOA, myGen_i){};
virtual ~SMESH_SequentialMesh_i();
virtual ~SMESH_SequentialMesh_i(){};
};