_hypMaxElementArea = 0;
_hypLengthFromEdges = 0;
_hypQuadranglePreference = 0;
+ _isSurfaceMeshing = true;
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
const TopoDS_Shape& aShape)
{
netgen::multithread.terminate = 0;
+ netgen::multithread.task = "Surface meshing";
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
int faceID = meshDS->ShapeToIndex( aShape );
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;
+}
+
//=============================================================================
/*!
*
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
-#ifdef WITH_SMESH_CANCEL_COMPUTE
virtual void CancelCompute();
-#endif
+
+ virtual double GetProgress() const;
virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap);
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
const SMESHDS_Hypothesis* _hypQuadranglePreference;
const NETGENPlugin_Hypothesis_2D* _hypParameters;
+
+ bool _isSurfaceMeshing;
};
#endif
_viscousLayersHyp = NULL;
_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;
const SMESHDS_Hypothesis* theHyp;
const TopoDS_Shape& aShape)
{
netgen::multithread.terminate = 0;
-
+
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
SMESH_MesherHelper helper(aMesh);
{
const int invalid_ID = -1;
+ netgen::multithread.terminate = 0;
+
SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh();
if ( MeshType == SMESH_MesherHelper::COMP )
return error( COMPERR_BAD_INPUT_MESH,
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;
+}
+
//=============================================================================
/*!
*
virtual bool Compute(SMESH_Mesh& aMesh,
SMESH_MesherHelper* aHelper);
-#ifdef WITH_SMESH_CANCEL_COMPUTE
virtual void CancelCompute();
-#endif
+
+ virtual double GetProgress() const;
virtual bool Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
const NETGENPlugin_Hypothesis * _hypParameters;
const StdMeshers_MaxElementVolume* _hypMaxElementVolume;
const StdMeshers_ViscousLayers* _viscousLayersHyp;
+ bool _optimizationStarted;
};
#endif