* \brief Set Number of Threads
*/
void SetNbThreads(in long nbThreads);
+ /*!
+
+ * \brief Set Number of Threads for mesher
+ */
+ void SetMesherNbThreads(in long nbThreads);
+
/*!
* Get mesh description
TopAbs_ShapeEnum previousShapeType = TopAbs_VERTEX;
int nbThreads = aMesh.GetNbThreads();
auto begin = std::chrono::high_resolution_clock::now();
+ std::cout << "Running mesh with threads: " << nbThreads << " mesher: " << aMesh.GetMesherNbThreads() << std::endl;
smIt = shapeSM->getDependsOnIterator(includeSelf, !complexShapeFirst);
}
if(aMesh.IsParallel())
{
- std::cout << "Submitting thread function " << std::endl;
- boost::asio::post(*(aMesh._pool), [](){std::cerr<< "In Here" << std::endl;});
boost::asio::post(*(aMesh._pool), std::bind(compute_function, 1, smToCompute, computeEvent,
shapeSM, aShapeOnly, allowedSubShapes,
aShapesId));
shapeSM, aShapeOnly, allowedSubShapes,
aShapesId);
-
-
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE &&
( shapeType != TopAbs_EDGE || !SMESH_Algo::isDegenerated( TopoDS::Edge( shape ))))
ret = false;
int GetNbThreads(){return _NbThreads;};
void SetNbThreads(int nbThreads){_NbThreads=nbThreads;};
+ int GetMesherNbThreads(){return _MesherNbThreads;};
+ void SetMesherNbThreads(int nbThreads){_MesherNbThreads=nbThreads;};
+
void InitPoolThreads(){_pool = new boost::asio::thread_pool(_NbThreads);};
void DeletePoolThreads(){delete _pool;};
// Mutex for multhitreading write in SMESH_Mesh
std::mutex _my_lock;
int _NbThreads=0;
+ int _MesherNbThreads=0;
protected:
SMESH_Mesh();
"GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
"GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes",
"IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor",
- "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder", "SetNbThreads"
+ "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder",
+ "SetNbThreads", "SetMesherNbThreads"
,"" }; // <- mark of end
sameMethods.Insert( names );
}
_impl->SetNbThreads(nbThreads);
}
+//=============================================================================
+/*!
+ * \brief Set the number of threads for the mesher for a parallel computation
+ */
+//=============================================================================
+void SMESH_Mesh_i::SetMesherNbThreads(int nbThreads){
+ _impl->SetMesherNbThreads(nbThreads);
+}
+
//=============================================================================
/*!
const bool theIsDump);
void SetNbThreads(int nbThreads);
+ void SetMesherNbThreads(int nbThreads);
/*!
* \brief Finds concurrent sub-meshes
geom = self.geom
return self.smeshpyD.Evaluate(self.mesh, geom)
- def ParallelCompute(self, nbThreads, geom=0, discardModifs=False, refresh=False):
+ def ParallelCompute(self, nbThreads, mesherNbThreads=1, geom=0, discardModifs=False, refresh=False):
"""
Parallel computation of the mesh and return the status of the computation
The mesh must contains have be constructed using create_parallel_mesh
True or False
"""
if (nbThreads <= 1):
+ raise ValueError("nbThreads must be strictly greater than 1")
+ if (mesherNbThreads < 1):
raise ValueError("nbThreads must be greater than 1")
+
+ self.mesh.SetMesherNbThreads(mesherNbThreads)
self.mesh.SetNbThreads(nbThreads)
return self.Compute(geom=geom, discardModifs=discardModifs, refresh=refresh)