Implement Cancel Compute
This commit is contained in:
parent
c9d186bf9d
commit
2cdf1b2ac7
@ -1661,6 +1661,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
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)
|
||||
@ -1726,6 +1730,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
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);
|
||||
@ -1760,6 +1768,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
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)
|
||||
@ -1825,6 +1837,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
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)
|
||||
@ -1887,6 +1903,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
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)
|
||||
@ -1907,6 +1927,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
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)
|
||||
@ -2062,6 +2086,10 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
||||
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 ))
|
||||
|
@ -41,6 +41,13 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
||||
namespace nglib {
|
||||
#include <nglib.h>
|
||||
}
|
||||
#include <meshing.hpp>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=============================================================================
|
||||
@ -122,6 +129,9 @@ bool NETGENPlugin_NETGEN_2D::CheckHypothesis
|
||||
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);
|
||||
@ -131,6 +141,12 @@ bool NETGENPlugin_NETGEN_2D::Compute(SMESH_Mesh& aMesh,
|
||||
return mesher.Compute();
|
||||
}
|
||||
|
||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
||||
void NETGENPlugin_NETGEN_2D::CancelCompute()
|
||||
{
|
||||
netgen::multithread.terminate = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -53,6 +53,10 @@ public:
|
||||
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);
|
||||
|
||||
|
@ -41,6 +41,13 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
||||
namespace nglib {
|
||||
#include <nglib.h>
|
||||
}
|
||||
#include <meshing.hpp>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=============================================================================
|
||||
@ -125,6 +132,9 @@ bool NETGENPlugin_NETGEN_2D3D::CheckHypothesis
|
||||
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);
|
||||
@ -134,6 +144,12 @@ bool NETGENPlugin_NETGEN_2D3D::Compute(SMESH_Mesh& aMesh,
|
||||
return mesher.Compute();
|
||||
}
|
||||
|
||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
||||
void NETGENPlugin_NETGEN_2D3D::CancelCompute()
|
||||
{
|
||||
netgen::multithread.terminate = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -53,6 +53,10 @@ public:
|
||||
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);
|
||||
|
@ -362,6 +362,9 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh,
|
||||
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();
|
||||
@ -461,6 +464,10 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||
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);
|
||||
}
|
||||
@ -537,6 +544,12 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||
return !err;
|
||||
}
|
||||
|
||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
||||
void NETGENPlugin_NETGEN_2D_ONLY::CancelCompute()
|
||||
{
|
||||
netgen::multithread.terminate = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -53,6 +53,10 @@ public:
|
||||
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);
|
||||
|
||||
|
@ -180,6 +180,9 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh,
|
||||
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();
|
||||
@ -335,6 +338,9 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||
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);
|
||||
|
||||
@ -375,6 +381,10 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
|
||||
#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);
|
||||
}
|
||||
@ -541,6 +551,13 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
return compute( aMesh, *aHelper, nodeVec, Netgen_mesh);
|
||||
}
|
||||
|
||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
||||
void NETGENPlugin_NETGEN_3D::CancelCompute()
|
||||
{
|
||||
netgen::multithread.terminate = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
|
@ -57,6 +57,10 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user