1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030785: Mesh - protect BRepMesh_IncrementalMesh::Perform from raising exception

IMeshTools_ModelAlgo and IMeshTools_ModelBuilder have been changed to provide exception protected interfaces for performing the operations.
Protect single Edge/Face discretization methods from raising exceptions to skip broken Edges/Faces and allow mesh construction on the whole model.
This commit is contained in:
emv
2019-06-17 16:26:45 +03:00
committed by bugmaster
parent fe525c6f7c
commit c2a25d522b
17 changed files with 235 additions and 140 deletions

View File

@@ -16,6 +16,8 @@
#ifndef _IMeshTools_ModelAlgo_HeaderFile
#define _IMeshTools_ModelAlgo_HeaderFile
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
@@ -32,10 +34,22 @@ public:
{
}
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean Perform (
//! Exceptions protected processing of the given model.
Standard_Boolean Perform (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) = 0;
const IMeshTools_Parameters& theParameters)
{
try
{
OCC_CATCH_SIGNALS
return performInternal (theModel, theParameters);
}
catch (Standard_Failure const&)
{
return Standard_False;
}
}
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelAlgo, Standard_Transient)
@@ -45,6 +59,11 @@ protected:
Standard_EXPORT IMeshTools_ModelAlgo()
{
}
//! Performs processing of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) = 0;
};
#endif

View File

@@ -17,6 +17,8 @@
#define _IMeshTools_ModelBuilder_HeaderFile
#include <Message_Algorithm.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
@@ -38,11 +40,26 @@ public:
{
}
//! Creates discrete model for the given shape.
//! Exceptions protected method to create discrete model for the given shape.
//! Returns nullptr in case of failure.
Standard_EXPORT virtual Handle (IMeshData_Model) Perform (
Handle (IMeshData_Model) Perform (
const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters) = 0;
const IMeshTools_Parameters& theParameters)
{
ClearStatus ();
try
{
OCC_CATCH_SIGNALS
return performInternal (theShape, theParameters);
}
catch (Standard_Failure const&)
{
SetStatus (Message_Fail2);
return NULL;
}
}
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelBuilder, Message_Algorithm)
@@ -52,6 +69,12 @@ protected:
Standard_EXPORT IMeshTools_ModelBuilder()
{
}
//! Creates discrete model for the given shape.
//! Returns nullptr in case of failure.
Standard_EXPORT virtual Handle (IMeshData_Model) performInternal (
const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters) = 0;
};
#endif