//Occ include
#include <TopoDS.hxx>
-#ifndef DISABLE_PSMESH
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
namespace fs = boost::filesystem;
-#endif
/**
* @brief Import the content of a shape file (STEP) into a TopDS_Shape object
* @return error code
*/
int SMESH_DriverShape::importShape(const std::string shape_file, TopoDS_Shape& aShape){
-#ifndef DISABLE_PSMESH
std::string type = fs::path(shape_file).extension().string();
boost::algorithm::to_lower(type);
if (type == ".brep"){
} else {
throw SALOME_Exception("Unknow format for importShape: " + type);
}
-#else
- return 0;
-#endif
}
/**
* @return error code
*/
int SMESH_DriverShape::exportShape(const std::string shape_file, const TopoDS_Shape& aShape){
-#ifndef DISABLE_PSMESH
std::string type = fs::path(shape_file).extension().string();
boost::algorithm::to_lower(type);
if (type == ".brep"){
} else {
throw SALOME_Exception("Unknow format for exportShape: " + type);
}
-#else
- return 0;
-#endif
}
#include <Basics_Utils.hxx>
-#ifndef DISABLE_PSMESH
#include <boost/asio.hpp>
-#endif
using namespace std;
-#ifndef DISABLE_PSMESH
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
-#endif
// Environment variable separator
#ifdef WIN32
const bool complexShapeFirst,
const bool aShapeOnly)
{
-#ifdef DISABLE_PSMESH
- throw SALOME_Exception("ParallelMesh is not working on Windows");
-#else
-
bool ret = true;
SMESH_subMeshIteratorPtr smIt;
aMesh.GetMeshDS()->Modified();
return ret;
-#endif
};
//=============================================================================
#include <vector>
#include <ostream>
-#ifndef DISABLE_PSMESH
#include <boost/filesystem.hpp>
#include <boost/asio/thread_pool.hpp>
-#endif
#include <boost/thread.hpp>
#ifdef WIN32
virtual bool IsParallel(){std::cout << "Should not pass here: IsParallel" << std::endl;return false;};
-#ifndef DISABLE_PSMESH
virtual boost::filesystem::path GetTmpFolder() {return "";};
virtual boost::asio::thread_pool* GetPool() {return NULL;};
-#endif
virtual bool ComputeSubMeshes(
SMESH_Gen* gen,
TCallUp* _callUp;
// Mutex for multhitreading write in SMESH_Mesh
-#ifndef DISABLE_PSMESH
boost::mutex _my_lock;
-#endif
int _NbThreads=-1;
protected:
#include <windows.h>
#endif
-#ifndef DISABLE_PSMESH
#include <boost/filesystem.hpp>
namespace fs=boost::filesystem;
-#endif
-#ifndef DISABLE_PSMESH
#include <boost/asio.hpp>
-#endif
#include <utilities.h>
theDocument)
{
MESSAGE("SMESH_ParallelMesh::SMESH_ParallelMesh(int localId)");
-#ifndef DISABLE_PSMESH
_NbThreads = std::thread::hardware_concurrency();
-#else
- _NbThreads = 0;
-#endif
CreateTmpFolder();
};
//=============================================================================
void SMESH_ParallelMesh::CreateTmpFolder()
{
-#ifndef DISABLE_PSMESH
// 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
}
//
//=============================================================================
//=============================================================================
void SMESH_ParallelMesh::DeleteTmpFolder()
{
-#ifndef DISABLE_PSMESH
fs::remove_all(tmp_folder);
-#endif
}
bool SMESH_ParallelMesh::ComputeSubMeshes(
virtual ~SMESH_ParallelMesh();
-#ifndef DISABLE_PSMESH
void Lock() override {_my_lock.lock();};
void Unlock() override {_my_lock.unlock();};
boost::filesystem::path GetTmpFolder() override {return tmp_folder;};
boost::asio::thread_pool* GetPool() override {return _pool;};
-#else
- void Lock() override {};
- void Unlock() override {};
-
- int GetNbThreads() override {return 0;};
- void SetNbThreads(long nbThreads) {(void) nbThreads;};
-
- void InitPoolThreads() override {};
- void DeletePoolThreads() override {};
- void wait() override {};
-
- bool IsParallel() override {return false;};
-
- void CreateTmpFolder();
- void DeleteTmpFolder();
-#endif
bool ComputeSubMeshes(
SMESH_Gen* gen,
SMESH_ParallelMesh():SMESH_Mesh() {};
SMESH_ParallelMesh(const SMESH_ParallelMesh& aMesh):SMESH_Mesh(aMesh) {};
private:
-#ifndef DISABLE_PSMESH
boost::filesystem::path tmp_folder;
boost::asio::thread_pool * _pool = nullptr; //thread pool for computation
-#endif
};
#endif