//=======================================================================
void BRepMesh_BaseMeshAlgo::Perform(
const IMeshData::IFaceHandle& theDFace,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
{
try
{
if (initDataStructure())
{
- generateMesh();
+ if (!theRange.More())
+ {
+ return;
+ }
+ generateMesh(theRange);
commitSurfaceTriangulation();
}
}
//! Performs processing of the given face.
Standard_EXPORT virtual void Perform(
const IMeshData::IFaceHandle& theDFace,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
Standard_EXPORT virtual Standard_Boolean initDataStructure();
//! Generates mesh for the contour stored in data structure.
- Standard_EXPORT virtual void generateMesh() = 0;
+ Standard_EXPORT virtual void generateMesh(const Message_ProgressRange& theRange) = 0;
private:
//! Perfroms processing of generated mesh.
//! By default does nothing.
//! Expected to be called from method generateMesh() in successor classes.
- virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
+ virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/,
+ const Message_ProgressRange& /*theRange*/)
{
}
};
createTriangles( theVertexIndexes( anVertexIdx ), aLoopEdges );
// Add other nodes to the mesh
- createTrianglesOnNewVertices( theVertexIndexes );
+ createTrianglesOnNewVertices (theVertexIndexes, Message_ProgressRange());
}
// Destruction of triangles containing a top of the super triangle
//purpose : Creation of triangles from the new nodes
//=======================================================================
void BRepMesh_Delaun::createTrianglesOnNewVertices(
- IMeshData::VectorOfInteger& theVertexIndexes)
+ IMeshData::VectorOfInteger& theVertexIndexes,
+ const Message_ProgressRange& theRange)
{
Handle(NCollection_IncAllocator) aAllocator =
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
Standard_Integer anIndex = theVertexIndexes.Lower();
Standard_Integer anUpper = theVertexIndexes.Upper();
- for( ; anIndex <= anUpper; ++anIndex )
+ Message_ProgressScope aPS(theRange, "Create triangles on new vertices", anUpper);
+ for (; anIndex <= anUpper; ++anIndex, aPS.Next())
{
+ if (!aPS.More())
+ {
+ return;
+ }
aAllocator->Reset(Standard_False);
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
//function : AddVertices
//purpose : Adds some vertices in the triangulation.
//=======================================================================
-void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices)
+void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices,
+ const Message_ProgressRange& theRange)
{
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
std::make_heap(theVertices.begin(), theVertices.end(), aCmp);
std::sort_heap(theVertices.begin(), theVertices.end(), aCmp);
- createTrianglesOnNewVertices(theVertices);
+ createTrianglesOnNewVertices(theVertices, theRange);
}
//=======================================================================
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
+#include <Message_ProgressRange.hxx>
class Bnd_B2d;
class Bnd_Box2d;
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
//! Adds some vertices into the triangulation.
- Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices);
+ Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
//! Modify mesh to use the edge.
//! @return True if done
IMeshData::SequenceOfBndB2d& thePolyBoxes);
//! Creates the triangles on new nodes.
- void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices);
+ void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices,
+ const Message_ProgressRange& theRange);
//! Cleanup mesh from the free triangles.
void cleanupMesh();
//function : generateMesh
//purpose :
//=======================================================================
-void BRepMesh_DelaunayBaseMeshAlgo::generateMesh()
+void BRepMesh_DelaunayBaseMeshAlgo::generateMesh(const Message_ProgressRange& theRange)
{
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = getStructure();
const Handle(VectorOfPnt)& aNodesMap = getNodesMap();
BRepMesh_MeshTool aCleaner(aStructure);
aCleaner.EraseFreeLinks();
- postProcessMesh(aMesher);
+ if (!theRange.More())
+ {
+ return;
+ }
+ postProcessMesh(aMesher, theRange);
}
protected:
//! Generates mesh for the contour stored in data structure.
- Standard_EXPORT virtual void generateMesh() Standard_OVERRIDE;
+ Standard_EXPORT virtual void generateMesh (const Message_ProgressRange& theRange) Standard_OVERRIDE;
};
#endif
protected:
//! Perfroms processing of generated mesh. Generates surface nodes and inserts them into structure.
- virtual void postProcessMesh(BRepMesh_Delaun& theMesher) Standard_OVERRIDE
+ virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE
{
+ Message_ProgressScope aPS(theRange, "Post process mesh", 2);
// Insert surface nodes.
- DelaunayInsertionBaseClass::postProcessMesh(theMesher);
+ DelaunayInsertionBaseClass::postProcessMesh (theMesher, aPS.Next());
+ if (!aPS.More())
+ {
+ return;
+ }
if (this->getParameters().ControlSurfaceDeflection &&
this->getStructure()->ElementsOfDomain().Extent() > 0)
{
- optimizeMesh(theMesher);
+ optimizeMesh(theMesher, aPS.Next());
+ }
+ else
+ {
+ aPS.Next();
}
}
//! Checks deviation of a mesh from geometrical surface.
//! Inserts additional nodes in case of huge deviation.
- virtual void optimizeMesh(BRepMesh_Delaun& theMesher)
+ virtual void optimizeMesh (BRepMesh_Delaun& theMesher,
+ const Message_ProgressRange& theRange)
{
Handle(NCollection_IncAllocator) aTmpAlloc =
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
const Standard_Integer aIterationsNb = 11;
Standard_Boolean isInserted = Standard_True;
+ Message_ProgressScope aPS(theRange, "Iteration", aIterationsNb);
for (Standard_Integer aPass = 1; aPass <= aIterationsNb && isInserted && !myIsAllDegenerated; ++aPass)
{
+ if (!aPS.More())
+ {
+ return;
+ }
// Reset stop condition
myMaxSqDeflection = -1.;
myIsAllDegenerated = Standard_True;
{
break;
}
-
// Iterate on current triangles
IMeshData::IteratorOfMapOfInteger aTriangleIt(this->getStructure()->ElementsOfDomain());
for (; aTriangleIt.More(); aTriangleIt.Next())
splitTriangleGeometry(aTriangle);
}
- isInserted = this->insertNodes(myControlNodes, theMesher);
+ isInserted = this->insertNodes(myControlNodes, theMesher, aPS.Next());
}
myCouplesMap.Nullify();
}
//! Perfroms processing of generated mesh. Generates surface nodes and inserts them into structure.
- virtual void postProcessMesh(BRepMesh_Delaun& theMesher) Standard_OVERRIDE
+ virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE
{
- InsertionBaseClass::postProcessMesh(theMesher);
+ if (!theRange.More())
+ {
+ return;
+ }
+ InsertionBaseClass::postProcessMesh (theMesher, Message_ProgressRange()); // shouldn't be range passed here?
if (!myIsPreProcessSurfaceNodes)
{
const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
- insertNodes(aSurfaceNodes, theMesher);
+ insertNodes(aSurfaceNodes, theMesher, theRange);
}
}
//! Inserts nodes into mesh.
Standard_Boolean insertNodes(
const Handle(IMeshData::ListOfPnt2d)& theNodes,
- BRepMesh_Delaun& theMesher)
+ BRepMesh_Delaun& theMesher,
+ const Message_ProgressRange& theRange)
{
if (theNodes.IsNull() || theNodes->IsEmpty())
{
}
}
- theMesher.AddVertices(aVertexIndexes);
+ theMesher.AddVertices (aVertexIndexes, theRange);
+ if (!theRange.More())
+ {
+ return Standard_False;
+ }
return !aVertexIndexes.IsEmpty();
}
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Transient.hxx>
+#include <Message_ProgressRange.hxx>
//! This is a common interface for meshing algorithms
//! instantiated by Mesh Factory and implemented by plugins.
}
//! Compute triangulation for set shape.
- virtual void Perform() = 0;
+ virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretRoot,Standard_Transient)
//=======================================================================
Standard_Boolean BRepMesh_EdgeDiscret::performInternal (
const Handle (IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
{
+ (void )theRange;
myModel = theModel;
myParameters = theParameters;
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle (IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE;
private:
{
}
+//! Auxiliary functor for parallel processing of Faces.
+class BRepMesh_FaceDiscret::FaceListFunctor
+{
+public:
+ FaceListFunctor (BRepMesh_FaceDiscret* theAlgo,
+ const Message_ProgressRange& theRange)
+ : myAlgo (theAlgo),
+ myScope (theRange, "Face Discret", theAlgo->myModel->FacesNb())
+ {
+ myRanges.reserve (theAlgo->myModel->FacesNb());
+ for (Standard_Integer aFaceIter = 0; aFaceIter < theAlgo->myModel->FacesNb(); ++aFaceIter)
+ {
+ myRanges.push_back (myScope.Next());
+ }
+ }
+
+ void operator() (const Standard_Integer theFaceIndex) const
+ {
+ if (!myScope.More())
+ {
+ return;
+ }
+ Message_ProgressScope aFaceScope(myRanges[theFaceIndex], NULL, 1);
+ myAlgo->process(theFaceIndex, aFaceScope.Next());
+ }
+
+private:
+ mutable BRepMesh_FaceDiscret* myAlgo;
+ Message_ProgressScope myScope;
+ std::vector<Message_ProgressRange> myRanges;
+};
+
//=======================================================================
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_FaceDiscret::performInternal(
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
{
myModel = theModel;
myParameters = theParameters;
return Standard_False;
}
- OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1));
+ FaceListFunctor aFunctor(this, theRange);
+ OSD_Parallel::For(0, myModel->FacesNb(), aFunctor, !(myParameters.InParallel && myModel->FacesNb() > 1));
+ if (!theRange.More())
+ {
+ return Standard_False;
+ }
myModel.Nullify(); // Do not hold link to model.
return Standard_True;
// Function: process
// Purpose :
//=======================================================================
-void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
+void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex,
+ const Message_ProgressRange& theRange) const
{
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
if (aDFace->IsSet(IMeshData_Failure) ||
return;
}
- aMeshingAlgo->Perform(aDFace, myParameters);
+ if (!theRange.More())
+ {
+ aDFace->SetStatus (IMeshData_UserBreak);
+ return;
+ }
+ aMeshingAlgo->Perform(aDFace, myParameters, theRange);
}
catch (Standard_Failure const&)
{
#include <IMeshTools_Parameters.hxx>
#include <IMeshData_Types.hxx>
#include <IMeshTools_MeshAlgoFactory.hxx>
+#include <NCollection_Array1.hxx>
//! Class implements functionality starting triangulation of model's faces.
//! Each face is processed separately and can be executed in parallel mode.
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
- //! Functor API to discretize the given edge.
- inline void operator() (const Standard_Integer theFaceIndex) const {
- process(theFaceIndex);
- }
-
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
protected:
//! Performs processing of faces of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE;
private:
//! Checks existing discretization of the face and updates data model.
- void process(const Standard_Integer theFaceIndex) const;
+ void process (const Standard_Integer theFaceIndex,
+ const Message_ProgressRange& theRange) const;
+
+private:
+ class FaceListFunctor;
private:
//=======================================================================
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
const TopoDS_Shape& theShape,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
: myParameters(theParameters)
{
myShape = theShape;
- Perform();
+ Perform(theRange);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
-void BRepMesh_IncrementalMesh::Perform()
+void BRepMesh_IncrementalMesh::Perform(const Message_ProgressRange& theRange)
{
Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
- Perform (aContext);
+ Perform (aContext, theRange);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
-void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext)
+void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext, const Message_ProgressRange& theRange)
{
initParameters();
theContext->ChangeParameters() = myParameters;
theContext->ChangeParameters().CleanModel = Standard_False;
+ Message_ProgressScope aPS(theRange, "Perform incmesh", 10);
IMeshTools_MeshBuilder aIncMesh(theContext);
- aIncMesh.Perform();
-
+ aIncMesh.Perform(aPS.Next(9));
+ if (!aPS.More())
+ {
+ myStatus = IMeshData_UserBreak;
+ return;
+ }
myStatus = IMeshData_NoError;
const Handle(IMeshData_Model)& aModel = theContext->GetModel();
if (!aModel.IsNull())
}
}
}
-
+ aPS.Next(1);
setDone();
}
//! @param theShape shape to be meshed.
//! @param theParameters - parameters of meshing
Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
- const IMeshTools_Parameters& theParameters);
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
//! Performs meshing ot the shape.
- Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
+ Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Performs meshing using custom context;
- Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext);
+ Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext,
+ const Message_ProgressRange& theRange = Message_ProgressRange());
public: //! @name accessing to parameters.
//=======================================================================
Standard_Boolean BRepMesh_ModelHealer::performInternal(
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
{
+ (void )theRange;
myModel = theModel;
myParameters = theParameters;
if (myModel.IsNull())
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE;
private:
//=======================================================================
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& /*theParameters*/)
+ const IMeshTools_Parameters& /*theParameters*/,
+ const Message_ProgressRange& theRange)
{
+ (void )theRange;
if (theModel.IsNull())
{
return Standard_False;
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE;
};
#endif
//=======================================================================
Standard_Boolean BRepMesh_ModelPreProcessor::performInternal(
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
{
+ (void )theRange;
if (theModel.IsNull())
{
return Standard_False;
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE;
};
#endif
//! Performs processing of the given face.
virtual void Perform(
const IMeshData::IFaceHandle& theDFace,
- const IMeshTools_Parameters& theParameters) Standard_OVERRIDE
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) Standard_OVERRIDE
{
myRangeSplitter.Reset(theDFace, theParameters);
myClassifier = new BRepMesh_Classifier;
- BaseAlgo::Perform(theDFace, theParameters);
+ if (!theRange.More())
+ {
+ return;
+ }
+ BaseAlgo::Perform(theDFace, theParameters, theRange);
myClassifier.Nullify();
}
#include <Draw_Drawable3D.hxx>
#include <Draw_Grid.hxx>
#include <Draw_Number.hxx>
+#include <Message.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <Draw_SequenceOfDrawable3D.hxx>
#include <Message.hxx>
//! Enumerates statuses used to notify state of discrete model.
enum IMeshData_Status
{
- IMeshData_NoError = 0x0, //!< Mesh generation is successful.
- IMeshData_OpenWire = 0x1, //!< Notifies open wire problem, which can potentially lead to incorrect results.
- IMeshData_SelfIntersectingWire = 0x2, //!< Notifies self-intersections on discretized wire, which can potentially lead to incorrect results.
- IMeshData_Failure = 0x4, //!< Failed to generate mesh for some faces.
- IMeshData_ReMesh = 0x8, //!< Deflection of some edges has been decreased due to interference of discrete model.
- IMeshData_UnorientedWire = 0x10, //!< Notifies bad orientation of a wire, which can potentially lead to incorrect results.
- IMeshData_TooFewPoints = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
- IMeshData_Outdated = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
- IMeshData_Reused = 0x80 //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
+ IMeshData_NoError = 0x0, //!< Mesh generation is successful.
+ IMeshData_OpenWire = 0x1, //!< Notifies open wire problem, which can potentially lead to incorrect results.
+ IMeshData_SelfIntersectingWire = 0x2, //!< Notifies self-intersections on discretized wire, which can potentially lead to incorrect results.
+ IMeshData_Failure = 0x4, //!< Failed to generate mesh for some faces.
+ IMeshData_ReMesh = 0x8, //!< Deflection of some edges has been decreased due to interference of discrete model.
+ IMeshData_UnorientedWire = 0x10, //!< Notifies bad orientation of a wire, which can potentially lead to incorrect results.
+ IMeshData_TooFewPoints = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
+ IMeshData_Outdated = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
+ IMeshData_Reused = 0x80, //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
+ IMeshData_UserBreak = 0x160 //!< User break
};
#endif
#include <IMeshData_Model.hxx>
#include <IMeshTools_Parameters.hxx>
#include <IMeshTools_ModelAlgo.hxx>
+#include <Message_ProgressRange.hxx>
//! Interface class representing context of BRepMesh algorithm.
//! Intended to cache discrete model and instances of tools for
}
// Discretize edges of a model.
- return myEdgeDiscret->Perform(myModel, myParameters);
+ return myEdgeDiscret->Perform(myModel, myParameters, Message_ProgressRange());
}
//! Performs healing of discrete model built by DiscretizeEdges() method
return myModelHealer.IsNull() ?
Standard_True :
- myModelHealer->Perform(myModel, myParameters);
+ myModelHealer->Perform (myModel, myParameters, Message_ProgressRange());
}
//! Performs pre-processing of discrete model using assigned algorithm.
return myPreProcessor.IsNull() ?
Standard_True :
- myPreProcessor->Perform(myModel, myParameters);
+ myPreProcessor->Perform (myModel, myParameters, Message_ProgressRange());
}
//! Performs meshing of faces of discrete model using assigned meshing algorithm.
//! @return True on success, False elsewhere.
- Standard_EXPORT virtual Standard_Boolean DiscretizeFaces()
+ virtual Standard_Boolean DiscretizeFaces (const Message_ProgressRange& theRange)
{
if (myModel.IsNull() || myFaceDiscret.IsNull())
{
}
// Discretize faces of a model.
- return myFaceDiscret->Perform(myModel, myParameters);
+ return myFaceDiscret->Perform (myModel, myParameters, theRange);
}
//! Performs post-processing of discrete model using assigned algorithm.
return myPostProcessor.IsNull() ?
Standard_True :
- myPostProcessor->Perform(myModel, myParameters);
+ myPostProcessor->Perform(myModel, myParameters, Message_ProgressRange());
}
//! Cleans temporary context data.
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <IMeshData_Types.hxx>
+#include <Message_ProgressRange.hxx>
struct IMeshTools_Parameters;
//! Performs processing of the given face.
Standard_EXPORT virtual void Perform(
const IMeshData::IFaceHandle& theDFace,
- const IMeshTools_Parameters& theParameters) = 0;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) = 0;
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshAlgo, Standard_Transient)
// Function: Perform
// Purpose :
//=======================================================================
-void IMeshTools_MeshBuilder::Perform ()
+void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
{
ClearStatus ();
return;
}
+ Message_ProgressScope aPS(theRange, "Mesh Perform", 10);
+
if (aContext->BuildModel ())
{
if (aContext->DiscretizeEdges ())
{
if (aContext->PreProcessModel())
{
- if (aContext->DiscretizeFaces())
+ if (aContext->DiscretizeFaces(aPS.Next(9)))
{
if (aContext->PostProcessModel())
{
}
else
{
+ if (!aPS.More())
+ {
+ SetStatus(Message_Fail8);
+ aContext->Clean();
+ return;
+ }
SetStatus(Message_Fail6);
}
}
Message_Warn1 : Message_Fail2);
}
}
-
+ aPS.Next(1);
aContext->Clean ();
}
#include <Message_Algorithm.hxx>
#include <IMeshTools_Context.hxx>
#include <Standard_Type.hxx>
+#include <Message_ProgressRange.hxx>
//! Builds mesh for each face of shape without triangulation.
//! In case if some faces of shape have already been triangulated
}
//! Performs meshing ot the shape using current context.
- Standard_EXPORT virtual void Perform ();
+ Standard_EXPORT virtual void Perform (const Message_ProgressRange& theRange);
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshBuilder, Message_Algorithm)
#include <Standard_Failure.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
+#include <Message_ProgressRange.hxx>
class IMeshData_Model;
struct IMeshTools_Parameters;
//! Exceptions protected processing of the given model.
Standard_Boolean Perform (
const Handle (IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters)
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange)
{
try
{
OCC_CATCH_SIGNALS
- return performInternal (theModel, theParameters);
+ return performInternal (theModel, theParameters, theRange);
}
catch (Standard_Failure const&)
{
//! Performs processing of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle (IMeshData_Model)& theModel,
- const IMeshTools_Parameters& theParameters) = 0;
+ const IMeshTools_Parameters& theParameters,
+ const Message_ProgressRange& theRange) = 0;
};
#endif
\ No newline at end of file
#include <CSLib.hxx>
#include <DBRep.hxx>
#include <Draw_Appli.hxx>
+#include <Draw_ProgressIndicator.hxx>
#include <Draw_Segment2D.hxx>
#include <DrawTrSurf.hxx>
#include <GeometryTest.hxx>
#include <IMeshData_Status.hxx>
#include <Message.hxx>
+#include <Message_ProgressRange.hxx>
#include <Poly_Connect.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
di << "Incremental Mesh, multi-threading "
<< (aMeshParams.InParallel ? "ON" : "OFF") << "\n";
- BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams);
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
+ BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams, aProgress->Start());
di << "Meshing statuses: ";
const Standard_Integer aStatus = aMesher.GetStatusFlags();
else
{
Standard_Integer i;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 9; i++)
{
Standard_Integer aFlag = aStatus & (1 << i);
if (aFlag)
case IMeshData_Reused:
di << "Reused ";
break;
+ case IMeshData_UserBreak:
+ di << "User break";
+ break;
case IMeshData_NoError:
default:
break;
--- /dev/null
+puts "========="
+puts "0025113: Progress indicator in mesh"
+puts "========="
+puts ""
+
+restore [locate_data_file bug21134_r.brep] a
+tclean a
+XProgress +t
+set output [incmesh a 0.005]
+
+set ctr { "Perform incmesh" "Mesh Perform"
+ "Face Discret" "100%"
+ "Create triangles on new vertices" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: Non parallel version incmesh command: Mismatch data on '$data'"
+ break;
+ }
+}
+
--- /dev/null
+puts "========="
+puts "0025113: Progress indicator in mesh"
+puts "========="
+puts ""
+
+restore [locate_data_file bug21134_r.brep] a
+tclean a
+XProgress +t
+set output [incmesh a 0.005 -parallel]
+
+set ctr { "Perform incmesh" "Mesh Perform"
+ "Face Discret" "100%"
+ "Create triangles on new vertices" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: Parallel version incmesh command for: Mismatch data on '$data'"
+ break;
+ }
+}
+