From a39871a63751e370ce5d1c377752ea1e6bb63d9e Mon Sep 17 00:00:00 2001 From: Yoann Audouin Date: Wed, 9 Nov 2022 09:18:34 +0100 Subject: [PATCH] Further corrections --- src/SMESH/SMESH_DriverMesh.cxx | 7 ++++--- src/SMESH/SMESH_DriverMesh.hxx | 22 ++++++++++++---------- src/SMESH/SMESH_DriverShape.cxx | 4 ++-- src/SMESH/SMESH_DriverShape.hxx | 13 +++++++------ src/SMESH/SMESH_Gen.cxx | 2 +- src/SMESH/SMESH_Mesh.hxx | 4 ++-- src/SMESH/SMESH_MeshLocker.hxx | 3 ++- src/SMESH_I/SMESH_Mesh_i.cxx | 2 +- src/SMESH_I/SMESH_Mesh_i.hxx | 2 +- 9 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/SMESH/SMESH_DriverMesh.cxx b/src/SMESH/SMESH_DriverMesh.cxx index 01cc5df4c..60450141b 100644 --- a/src/SMESH/SMESH_DriverMesh.cxx +++ b/src/SMESH/SMESH_DriverMesh.cxx @@ -46,7 +46,7 @@ using namespace MEDCoupling; * * @return true if the mesh within the files are identical */ -bool diffMEDFile(const std::string mesh_file1, const std::string mesh_file2, const std::string mesh_name){ +bool SMESH_DriverMesh::diffMEDFile(const std::string mesh_file1, const std::string mesh_file2, const std::string mesh_name){ MEDFileUMesh* medmesh1 = MEDFileUMesh::New(mesh_file1, mesh_name); MEDFileUMesh* medmesh2 = MEDFileUMesh::New(mesh_file2, mesh_name); MEDCouplingUMesh *m0_1=medmesh1->getMeshAtLevel(0,false); @@ -70,7 +70,7 @@ std::string getMeshName(std::string mesh_file){ * * @return error code */ -int importMesh(const std::string mesh_file, SMESH_Mesh& aMesh){ +int SMESH_DriverMesh::importMesh(const std::string mesh_file, SMESH_Mesh& aMesh){ // TODO: change that as it depends on the language std::string mesh_name = getMeshName(mesh_file); MESSAGE("Importing mesh from " << mesh_file << " mesh " << mesh_name); @@ -87,7 +87,8 @@ int importMesh(const std::string mesh_file, SMESH_Mesh& aMesh){ * * @return error code */ -int exportMesh(const std::string mesh_file, SMESH_Mesh& aMesh, const std::string mesh_name){ + +int SMESH_DriverMesh::exportMesh(const std::string mesh_file, SMESH_Mesh& aMesh, const std::string mesh_name){ MESSAGE("Exporting mesh to " << mesh_file); aMesh.ExportMED(mesh_file.c_str(), // theFile diff --git a/src/SMESH/SMESH_DriverMesh.hxx b/src/SMESH/SMESH_DriverMesh.hxx index 370f99515..83485aa8a 100644 --- a/src/SMESH/SMESH_DriverMesh.hxx +++ b/src/SMESH/SMESH_DriverMesh.hxx @@ -30,16 +30,18 @@ #include #include +#include "SMESH_SMESH.hxx" class SMESH_Mesh; - -bool diffMEDFile(const std::string mesh_file1, - const std::string mesh_file2, - const std::string mesh_name); -int importMesh(const std::string mesh_file, - SMESH_Mesh& aMesh); -int exportMesh(const std::string mesh_file, - SMESH_Mesh& aMesh, - const std::string meshName); - +class SMESH_EXPORT SMESH_DriverMesh{ + public: + static bool diffMEDFile(const std::string mesh_file1, + const std::string mesh_file2, + const std::string mesh_name); + static int importMesh(const std::string mesh_file, + SMESH_Mesh& aMesh); + static int exportMesh(const std::string mesh_file, + SMESH_Mesh& aMesh, + const std::string meshName); +}; #endif diff --git a/src/SMESH/SMESH_DriverShape.cxx b/src/SMESH/SMESH_DriverShape.cxx index 678e2c8fd..8efa1943f 100644 --- a/src/SMESH/SMESH_DriverShape.cxx +++ b/src/SMESH/SMESH_DriverShape.cxx @@ -147,7 +147,7 @@ int exportBREPShape(const std::string shape_file, const TopoDS_Shape& aShape){ * * @return error code */ -int importShape(const std::string shape_file, TopoDS_Shape& aShape){ +int SMESH_DriverShape::importShape(const std::string shape_file, TopoDS_Shape& aShape){ #ifndef WIN32 std::string type = fs::path(shape_file).extension().string(); boost::algorithm::to_lower(type); @@ -171,7 +171,7 @@ int importShape(const std::string shape_file, TopoDS_Shape& aShape){ * * @return error code */ -int exportShape(const std::string shape_file, const TopoDS_Shape& aShape){ +int SMESH_DriverShape::exportShape(const std::string shape_file, const TopoDS_Shape& aShape){ #ifndef WIN32 std::string type = fs::path(shape_file).extension().string(); boost::algorithm::to_lower(type); diff --git a/src/SMESH/SMESH_DriverShape.hxx b/src/SMESH/SMESH_DriverShape.hxx index b9e3a360e..1d55b70a8 100644 --- a/src/SMESH/SMESH_DriverShape.hxx +++ b/src/SMESH/SMESH_DriverShape.hxx @@ -30,10 +30,11 @@ #include #include - +#include "SMESH_SMESH.hxx" class TopoDS_Shape; - -int importShape(const std::string shape_file, TopoDS_Shape& aShape); -int exportShape(const std::string shape_file, const TopoDS_Shape& aShape); - -#endif \ No newline at end of file +class SMESH_EXPORT SMESH_DriverShape{ + public: + static int importShape(const std::string shape_file, TopoDS_Shape& aShape); + static int exportShape(const std::string shape_file, const TopoDS_Shape& aShape); +}; +#endif diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 7a98988f9..bd8098302 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -340,7 +340,7 @@ bool SMESH_Gen::parallelComputeSubMeshes( if(file_name != "") { fs::path mesh_file = fs::path(aMesh.tmp_folder) / fs::path(file_name); - exportMesh(mesh_file.string(), aMesh, "MESH"); + SMESH_DriverMesh::exportMesh(mesh_file.string(), aMesh, "MESH"); } //Resetting threaded pool info diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 42e5b4c92..9c9606499 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -395,7 +395,7 @@ class SMESH_EXPORT SMESH_Mesh void Unlock() {}; int GetNbThreads(){return _NbThreads;}; - void SetNbThreads(int nbThreads){std::cout << "Warning Parallel Meshing is disabled on Windows it will behave as a slower normal compute" << std::endl;_NbThreads=nbThreads;}; + void SetNbThreads(long nbThreads){std::cout << "Warning Parallel Meshing is disabled on Windows it will behave as a slower normal compute" << std::endl;_NbThreads=nbThreads;}; void InitPoolThreads(){}; void DeletePoolThreads(){}; @@ -407,7 +407,7 @@ class SMESH_EXPORT SMESH_Mesh void Unlock() {_my_lock.unlock();}; int GetNbThreads(){return _NbThreads;}; - void SetNbThreads(int nbThreads){_NbThreads=nbThreads;}; + void SetNbThreads(long nbThreads){_NbThreads=nbThreads;}; void InitPoolThreads(){_pool = new boost::asio::thread_pool(_NbThreads);}; void DeletePoolThreads(){delete _pool;}; diff --git a/src/SMESH/SMESH_MeshLocker.hxx b/src/SMESH/SMESH_MeshLocker.hxx index e38c31b29..15b411909 100644 --- a/src/SMESH/SMESH_MeshLocker.hxx +++ b/src/SMESH/SMESH_MeshLocker.hxx @@ -26,10 +26,11 @@ // #ifndef _SMESH_MESHLOCKER_HXX_ #define _SMESH_MESHLOCKER_HXX_ +#include "SMESH_SMESH.hxx" class SMESH_Mesh; -class SMESH_MeshLocker{ +class SMESH_EXPORT SMESH_MeshLocker{ public: SMESH_MeshLocker(SMESH_Mesh * aMesh); ~SMESH_MeshLocker(); diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 6212a0c23..1ff5efe53 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -7042,7 +7042,7 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes() * \brief Set the number of threads for a parallel computation */ //============================================================================= - void SMESH_Mesh_i::SetNbThreads(long nbThreads){ +void SMESH_Mesh_i::SetNbThreads(CORBA::Long nbThreads){ _impl->SetNbThreads(nbThreads); } diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index b694fdc46..45928272d 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -673,7 +673,7 @@ private: SMESH::submesh_array_array& theSubMeshOrder, const bool theIsDump); - void SetNbThreads(long nbThreads); + void SetNbThreads(CORBA::Long nbThreads); /*! * \brief Finds concurrent sub-meshes -- 2.39.2