1 // Created on: 2014-05-28
2 // Created by: Oleg AGASHIN
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BRepMesh_EdgeChecker_HeaderFile
17 #define _BRepMesh_EdgeChecker_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Mutex.hxx>
21 #include <Poly_Triangulation.hxx>
22 #include <TopLoc_Location.hxx>
23 #include <TopoDS_Edge.hxx>
24 #include <Poly_PolygonOnTriangulation.hxx>
25 #include <BRep_Tool.hxx>
27 //! Auxilary class implementing functionality for checking consistency
28 //! of polygon on triangulation of the given edge.
29 class BRepMesh_EdgeChecker
34 //! \param theFaceTri Poly triangulation of face the edges relie to.
35 //! \param theFaceLoc Face location to be used to extract polygon on triangulation.
36 //! \param theMutex Upper level shared mutex to protect isFailed flag from concurrent write access.
37 //! \param isFailed Upper level shared flag indicating that polygon on triangulation of checked
38 //! edge is not consistent. If this flag is set to TRUE, other tasks will not check details of their data.
39 BRepMesh_EdgeChecker( Handle(Poly_Triangulation)& theFaceTri,
40 TopLoc_Location& theFaceLoc,
41 Standard_Mutex& theMutex,
42 Standard_Boolean& isFailed)
45 myFaceLoc(theFaceLoc),
51 //! \param theEdge edge to be checked.
52 void operator ()(const TopoDS_Edge& theEdge) const
54 if (theEdge.IsNull() || myIsFailed)
57 const Handle(Poly_PolygonOnTriangulation)& aPoly =
58 BRep_Tool::PolygonOnTriangulation(theEdge, myFaceTri, myFaceLoc);
63 // Trianglulation stored inside a face is different
64 // than the one an edge data connected to.
65 Standard_Mutex::Sentry aSentry(myMutex);
66 myIsFailed = Standard_True;
71 void operator =(const BRepMesh_EdgeChecker& /*theOther*/)
76 Standard_Mutex& myMutex;
77 Standard_Boolean& myIsFailed;
78 TopLoc_Location& myFaceLoc;
79 Handle(Poly_Triangulation)& myFaceTri;