//
//#define CHRONODEF
-
+//
+#ifndef DISABLE_PARAMESH
#include <boost/asio.hpp>
+#endif
#include "SMESH_Gen.hxx"
#include "SMESH_DriverMesh.hxx"
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue;
}
+#ifdef DISABLE_PARASMESH
+ compute_function(smToCompute, computeEvent,
+ shapeSM, aShapeOnly, allowedSubShapes,
+ aShapesId);
+#else
boost::asio::post(*(aMesh._pool), std::bind(compute_function, smToCompute, computeEvent,
shapeSM, aShapeOnly, allowedSubShapes,
aShapesId));
+#endif
}
// Waiting for the thread for Solids to finish
return ret;
};
-
//=============================================================================
/*
* Compute a mesh
#include "SMESH_SMESH.hxx"
+
#include "SMDSAbs_ElementType.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_Controls.hxx"
#include <ostream>
#include <boost/filesystem.hpp>
+#ifndef DISABLE_PARASMESH
#include <boost/asio/thread_pool.hpp>
#include <boost/thread.hpp>
+#endif
#ifdef WIN32
#pragma warning(disable:4251) // Warning DLL Interface ...
// Parallel computation functions
+#ifdef DISABLE_PARASMESH
+ void Lock() {};
+ 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 InitPoolThreads(){};
+ void DeletePoolThreads(){};
+ void wait(){}
+
+ bool IsParallel(){return _NbThreads > 0;}
+#else
void Lock() {_my_lock.lock();};
void Unlock() {_my_lock.unlock();};
void wait(){_pool->join(); DeletePoolThreads(); InitPoolThreads(); }
bool IsParallel(){return _NbThreads > 0;}
+#endif
// Temporary folder used during parallel Computation
boost::filesystem::path tmp_folder;
+ #ifndef DISABLE_PARASMESH
boost::asio::thread_pool * _pool = nullptr; //thread pool for computation
+ #endif
private:
TCallUp* _callUp;
// Mutex for multhitreading write in SMESH_Mesh
+#ifndef DISABLE_PARASMESH
boost::mutex _my_lock;
+#endif
int _NbThreads=0;
protected: