{
OCC_CATCH_SIGNALS;
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
comment << text(err);
}
catch (Standard_Failure& ex)
{
OCC_CATCH_SIGNALS;
netgen::OCCGenerateMesh(occgeo, tmpNgMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
// compute mesh on internal edges
endWith = netgen::MESHCONST_MESHEDGES;
err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
{
OCC_CATCH_SIGNALS;
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
comment << text(err);
}
catch (Standard_Failure& ex)
{
OCC_CATCH_SIGNALS;
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
comment << text (err);
}
catch (Standard_Failure& ex)
{
OCC_CATCH_SIGNALS;
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
comment << text(err);
}
catch (Standard_Failure& ex)
{
OCC_CATCH_SIGNALS;
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
comment << text(err);
}
catch (Standard_Failure& ex)
int startWith = netgen::MESHCONST_ANALYSE;
int endWith = netgen::MESHCONST_MESHEDGES;
int err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
ngLib.setMesh(( Ng_Mesh*) ngMesh );
if (err) {
if ( SMESH_subMesh* sm = _mesh->GetSubMeshContaining( _shape ))
#include <list>
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+namespace nglib {
+#include <nglib.h>
+}
+#include <meshing.hpp>
+#endif
+
using namespace std;
//=============================================================================
bool NETGENPlugin_NETGEN_2D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ netgen::multithread.terminate = 0;
+#endif
//SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
NETGENPlugin_Mesher mesher(&aMesh, aShape, false);
return mesher.Compute();
}
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+void NETGENPlugin_NETGEN_2D::CancelCompute()
+{
+ netgen::multithread.terminate = 1;
+}
+#endif
//=============================================================================
/*!
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ virtual void CancelCompute();
+#endif
+
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
#include <list>
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+namespace nglib {
+#include <nglib.h>
+}
+#include <meshing.hpp>
+#endif
+
using namespace std;
//=============================================================================
bool NETGENPlugin_NETGEN_2D3D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ netgen::multithread.terminate = 0;
+#endif
// SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
NETGENPlugin_Mesher mesher(&aMesh, aShape, true);
return mesher.Compute();
}
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+void NETGENPlugin_NETGEN_2D3D::CancelCompute()
+{
+ netgen::multithread.terminate = 1;
+}
+#endif
//=============================================================================
/*!
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ virtual void CancelCompute();
+#endif
+
virtual bool Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ netgen::multithread.terminate = 0;
+#endif
MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::Compute()");
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
OCC_CATCH_SIGNALS;
#endif
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
if ( err )
error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task);
}
return !err;
}
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+void NETGENPlugin_NETGEN_2D_ONLY::CancelCompute()
+{
+ netgen::multithread.terminate = 1;
+}
+#endif
//=============================================================================
/*!
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ virtual void CancelCompute();
+#endif
+
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ netgen::multithread.terminate = 0;
+#endif
MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume);
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
vector< const SMDS_MeshNode* >& nodeVec,
Ng_Mesh * Netgen_mesh)
{
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ netgen::multithread.terminate = 0;
+#endif
netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
#endif
ngMesh->CalcLocalH();
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ if(netgen::multithread.terminate)
+ return false;
+#endif
if ( err )
error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task);
}
return compute( aMesh, *aHelper, nodeVec, Netgen_mesh);
}
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+void NETGENPlugin_NETGEN_3D::CancelCompute()
+{
+ netgen::multithread.terminate = 1;
+}
+#endif
+
//=============================================================================
/*!
*
virtual bool Compute(SMESH_Mesh& aMesh,
SMESH_MesherHelper* aHelper);
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+ virtual void CancelCompute();
+#endif
+
virtual bool Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);