+ virtual double GetProgress() const;
This commit is contained in:
parent
31d67dddec
commit
672042c687
@ -128,6 +128,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
|
|||||||
_hypMaxElementArea = 0;
|
_hypMaxElementArea = 0;
|
||||||
_hypLengthFromEdges = 0;
|
_hypLengthFromEdges = 0;
|
||||||
_hypQuadranglePreference = 0;
|
_hypQuadranglePreference = 0;
|
||||||
|
_isSurfaceMeshing = true;
|
||||||
|
|
||||||
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
|
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
|
||||||
|
|
||||||
@ -181,6 +182,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
const TopoDS_Shape& aShape)
|
const TopoDS_Shape& aShape)
|
||||||
{
|
{
|
||||||
netgen::multithread.terminate = 0;
|
netgen::multithread.terminate = 0;
|
||||||
|
netgen::multithread.task = "Surface meshing";
|
||||||
|
|
||||||
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||||
int faceID = meshDS->ShapeToIndex( aShape );
|
int faceID = meshDS->ShapeToIndex( aShape );
|
||||||
@ -372,6 +374,36 @@ void NETGENPlugin_NETGEN_2D_ONLY::CancelCompute()
|
|||||||
netgen::multithread.terminate = 1;
|
netgen::multithread.terminate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return progress of Compute() [0.,1]
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
double NETGENPlugin_NETGEN_2D_ONLY::GetProgress() const
|
||||||
|
{
|
||||||
|
const char* task1 = "Surface meshing";
|
||||||
|
const char* task2 = "Optimizing surface";
|
||||||
|
double res = 0;
|
||||||
|
if ( _isSurfaceMeshing &&
|
||||||
|
strncmp( netgen::multithread.task, task1, 3 ) == 0 )
|
||||||
|
{
|
||||||
|
res = 0.3 * SMESH_Algo::GetProgressByTic(); // [0, 0.3]
|
||||||
|
}
|
||||||
|
else //if ( strncmp( netgen::multithread.task, task2, 3 ) == 0)
|
||||||
|
{
|
||||||
|
if ( _isSurfaceMeshing )
|
||||||
|
{
|
||||||
|
NETGENPlugin_NETGEN_2D_ONLY* me = (NETGENPlugin_NETGEN_2D_ONLY*) this;
|
||||||
|
me->_isSurfaceMeshing = false;
|
||||||
|
me->_progressTic = 0; // to re-start GetProgressByTic() from 0.
|
||||||
|
}
|
||||||
|
res = 0.3 + 0.7 * SMESH_Algo::GetProgressByTic(); // [0.3, 1.]
|
||||||
|
}
|
||||||
|
//cout << netgen::multithread.task << " " <<res << endl;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
|
@ -52,9 +52,9 @@ public:
|
|||||||
virtual bool Compute(SMESH_Mesh& aMesh,
|
virtual bool Compute(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Shape& aShape);
|
const TopoDS_Shape& aShape);
|
||||||
|
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
virtual void CancelCompute();
|
virtual void CancelCompute();
|
||||||
#endif
|
|
||||||
|
virtual double GetProgress() const;
|
||||||
|
|
||||||
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
|
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
|
||||||
MapShapeNbElems& aResMap);
|
MapShapeNbElems& aResMap);
|
||||||
@ -64,6 +64,8 @@ protected:
|
|||||||
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
|
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
|
||||||
const SMESHDS_Hypothesis* _hypQuadranglePreference;
|
const SMESHDS_Hypothesis* _hypQuadranglePreference;
|
||||||
const NETGENPlugin_Hypothesis_2D* _hypParameters;
|
const NETGENPlugin_Hypothesis_2D* _hypParameters;
|
||||||
|
|
||||||
|
bool _isSurfaceMeshing;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,6 +140,11 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh,
|
|||||||
_viscousLayersHyp = NULL;
|
_viscousLayersHyp = NULL;
|
||||||
_maxElementVolume = DBL_MAX;
|
_maxElementVolume = DBL_MAX;
|
||||||
|
|
||||||
|
// for correct work of GetProgress():
|
||||||
|
netgen::multithread.percent = 0.;
|
||||||
|
netgen::multithread.task = "Volume meshing";
|
||||||
|
_optimizationStarted = false;
|
||||||
|
|
||||||
list<const SMESHDS_Hypothesis*>::const_iterator itl;
|
list<const SMESHDS_Hypothesis*>::const_iterator itl;
|
||||||
const SMESHDS_Hypothesis* theHyp;
|
const SMESHDS_Hypothesis* theHyp;
|
||||||
|
|
||||||
@ -487,6 +492,8 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
|||||||
{
|
{
|
||||||
const int invalid_ID = -1;
|
const int invalid_ID = -1;
|
||||||
|
|
||||||
|
netgen::multithread.terminate = 0;
|
||||||
|
|
||||||
SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh();
|
SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh();
|
||||||
if ( MeshType == SMESH_MesherHelper::COMP )
|
if ( MeshType == SMESH_MesherHelper::COMP )
|
||||||
return error( COMPERR_BAD_INPUT_MESH,
|
return error( COMPERR_BAD_INPUT_MESH,
|
||||||
@ -573,6 +580,31 @@ void NETGENPlugin_NETGEN_3D::CancelCompute()
|
|||||||
netgen::multithread.terminate = 1;
|
netgen::multithread.terminate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return Compute progress
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
double NETGENPlugin_NETGEN_3D::GetProgress() const
|
||||||
|
{
|
||||||
|
double res;
|
||||||
|
const char* volMeshing = "Volume meshing";
|
||||||
|
const char* dlnMeshing = "Delaunay meshing";
|
||||||
|
if ( !_optimizationStarted &&
|
||||||
|
( strncmp( netgen::multithread.task, dlnMeshing, 3 ) == 0 ||
|
||||||
|
strncmp( netgen::multithread.task, volMeshing, 3 ) == 0 ))
|
||||||
|
{
|
||||||
|
res = 0.5 * netgen::multithread.percent / 100.; // [0., 0.5]
|
||||||
|
}
|
||||||
|
else // different otimizations
|
||||||
|
{
|
||||||
|
((NETGENPlugin_NETGEN_3D*)this)->_optimizationStarted = true;
|
||||||
|
res = 0.5 + 0.5 * SMESH_Algo::GetProgressByTic(); // [0.5, 1.]
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
|
@ -57,9 +57,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
|
|||||||
virtual bool Compute(SMESH_Mesh& aMesh,
|
virtual bool Compute(SMESH_Mesh& aMesh,
|
||||||
SMESH_MesherHelper* aHelper);
|
SMESH_MesherHelper* aHelper);
|
||||||
|
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
virtual void CancelCompute();
|
virtual void CancelCompute();
|
||||||
#endif
|
|
||||||
|
virtual double GetProgress() const;
|
||||||
|
|
||||||
virtual bool Evaluate(SMESH_Mesh& aMesh,
|
virtual bool Evaluate(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Shape& aShape,
|
const TopoDS_Shape& aShape,
|
||||||
@ -77,6 +77,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
|
|||||||
const NETGENPlugin_Hypothesis * _hypParameters;
|
const NETGENPlugin_Hypothesis * _hypParameters;
|
||||||
const StdMeshers_MaxElementVolume* _hypMaxElementVolume;
|
const StdMeshers_MaxElementVolume* _hypMaxElementVolume;
|
||||||
const StdMeshers_ViscousLayers* _viscousLayersHyp;
|
const StdMeshers_ViscousLayers* _viscousLayersHyp;
|
||||||
|
bool _optimizationStarted;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user