Salome HOME
Cleanup of parallel meshing + documentation
[modules/smesh.git] / src / SMESH / SMESH_Mesh.hxx
index 18da4e93f0830dd7201c943af091a4b08ece2cfd..c0cbb37b66c88b0694a366f6da9ba77be5118650 100644 (file)
@@ -33,6 +33,7 @@
 #include "SMESH_ComputeError.hxx"
 #include "SMESH_Controls.hxx"
 #include "SMESH_Hypothesis.hxx"
+#include "SMESH_subMesh.hxx"
 #include "SMDS_Iterator.hxx"
 
 #include "Utils_SALOME_Exception.hxx"
 #include <vector>
 #include <ostream>
 
+#ifndef WIN32
 #include <boost/filesystem.hpp>
 #include <boost/asio/thread_pool.hpp>
+#endif
 #include <boost/thread.hpp>
 
 #ifdef WIN32
@@ -70,6 +73,7 @@ class TopoDS_Solid;
 
 class DriverMED_W_SMESHDS_Mesh;
 
+typedef std::set<int> TSetOfInt;
 typedef std::list<int> TListOfInt;
 typedef std::list<TListOfInt> TListOfListOfInt;
 
@@ -388,23 +392,32 @@ class SMESH_EXPORT SMESH_Mesh
 
   // Parallel computation functions
 
-  void Lock() {_my_lock.lock();};
-  void Unlock() {_my_lock.unlock();};
-
-  int GetNbThreads(){return _NbThreads;};
-  void SetNbThreads(int nbThreads){_NbThreads=nbThreads;};
+  virtual void Lock(){};
+  virtual void Unlock(){};
 
-  void InitPoolThreads(){_pool = new boost::asio::thread_pool(_NbThreads);};
-  void DeletePoolThreads(){delete _pool;};
+  virtual int GetNbThreads(){return 0;};
+  virtual void SetNbThreads(long nbThreads){(void) nbThreads;};
 
-  void wait(){_pool->join(); DeletePoolThreads(); InitPoolThreads(); }
+  virtual void InitPoolThreads(){std::cout << "Should not pass here: InitPoolThread" << std::endl;};
+  virtual void DeletePoolThreads(){std::cout << "Should not pass here: DeletePoolThread" << std::endl;};
+  virtual void wait(){std::cout << "Should not pass here: wait" << std::endl;};
 
-  bool IsParallel(){return _NbThreads > 0;}
+  virtual bool IsParallel(){std::cout << "Should not pass here: IsParallel" << std::endl;return false;};
 
-  // Temporary folder used during parallel Computation
-  boost::filesystem::path tmp_folder;
-  boost::asio::thread_pool *     _pool = nullptr; //thread pool for computation
+  virtual boost::filesystem::path GetTmpFolder() {return "";};
+  virtual boost::asio::thread_pool* GetPool() {return NULL;};
 
+  virtual bool ComputeSubMeshes(
+            SMESH_Gen* gen,
+            SMESH_Mesh & aMesh,
+            const TopoDS_Shape & aShape,
+            const ::MeshDimension       aDim,
+            TSetOfInt*                  aShapesId /*=0*/,
+            TopTools_IndexedMapOfShape* allowedSubShapes,
+            SMESH_subMesh::compute_event &computeEvent,
+            const bool includeSelf,
+            const bool complexShapeFirst,
+            const bool aShapeOnly){(void) gen;(void) aMesh;(void) aShape;(void) aDim;(void) aShapesId;(void) allowedSubShapes;(void) computeEvent;(void) includeSelf;(void) complexShapeFirst;(void) aShapeOnly;std::cout << "Should not pass here: computesubmesh" << std::endl;return false;};
 
 private:
 
@@ -453,8 +466,10 @@ protected:
   TCallUp*                    _callUp;
 
   // Mutex for multhitreading write in SMESH_Mesh
+#ifndef WIN32
   boost::mutex _my_lock;
-  int _NbThreads=0;
+#endif
+  int _NbThreads=-1;
 
 protected:
   SMESH_Mesh();