Commit | Line | Data |
---|---|---|
7fd59977 | 1 | // File: MeshTest_CheckTopology.hxx |
2 | // Created: 5.10.2004 | |
3 | // Author: Michael SAZONOV | |
4 | // Copyright: Open CASCADE 2004 | |
5 | ||
6 | #ifndef MeshTest_CheckTopology_HeaderFile | |
7 | #define MeshTest_CheckTopology_HeaderFile | |
8 | ||
9 | #include <TopoDS_Shape.hxx> | |
10 | #include <NCollection_IndexedDataMap.hxx> | |
11 | #include <TColStd_SequenceOfInteger.hxx> | |
12 | #include <TColStd_SequenceOfReal.hxx> | |
13 | ||
446e11f3 A |
14 | //! This class checks topology of the mesh presented by |
15 | //! triangulations of faces. | |
16 | //! | |
17 | //! The following error are reported: | |
18 | //! - free links. A link is considered free if it has only one | |
19 | //! neighboring triangle and at least one of its nodes belongs to | |
20 | //! interior of the face rather than to its boundary. | |
21 | //! - cross face errors. It is a situation when a point on a common | |
22 | //! boundary between two faces has different 3d coordinates on each | |
23 | //! triangulation. The error is reported if the distance is greater | |
24 | //! than a deflection written in triangulations. | |
25 | //! - asynchronous edges. It is an edge having polygons on two neighboring | |
26 | //! triangulations with different number of points in the polygons. | |
27 | //! - free nodes -- nodes not shared by any triangle. | |
7fd59977 | 28 | |
29 | class MeshTest_CheckTopology | |
30 | { | |
31 | public: | |
446e11f3 | 32 | //! constructor |
7fd59977 | 33 | MeshTest_CheckTopology(const TopoDS_Shape& theShape) |
34 | : myShape(theShape) {} | |
7fd59977 | 35 | |
446e11f3 | 36 | //! performs checking |
7fd59977 | 37 | Standard_EXPORT void Perform(); |
7fd59977 | 38 | |
446e11f3 | 39 | //! returns the number of faces with free links |
7fd59977 | 40 | Standard_Integer NbFacesWithFL() const |
41 | { return myMapFaceLinks.Extent(); } | |
7fd59977 | 42 | |
446e11f3 A |
43 | //! returns the number (in the shape) of a face with free links |
44 | //! with the given index | |
7fd59977 | 45 | Standard_Integer GetFaceNumWithFL(const Standard_Integer theIndex) const |
46 | { return myMapFaceLinks.FindKey(theIndex); } | |
7fd59977 | 47 | |
446e11f3 | 48 | //! returns the number free links on a face with the given index |
7fd59977 | 49 | Standard_Integer NbFreeLinks(const Standard_Integer theIndex) const |
50 | { return myMapFaceLinks(theIndex).Length() / 2; } | |
7fd59977 | 51 | |
446e11f3 A |
52 | //! gets the numbers of nodes of a free link with the given index |
53 | //! in the face with the given index | |
7fd59977 | 54 | Standard_EXPORT void GetFreeLink(const Standard_Integer theFaceIndex, |
55 | const Standard_Integer theLinkIndex, | |
56 | Standard_Integer& theNode1, | |
57 | Standard_Integer& theNode2) const; | |
7fd59977 | 58 | |
446e11f3 | 59 | //! returns the number of cross face errors |
7fd59977 | 60 | Standard_Integer NbCrossFaceErrors() const |
61 | { return myErrorsVal.Length(); } | |
7fd59977 | 62 | |
446e11f3 | 63 | //! gets the attributes of a cross face error with the given index |
7fd59977 | 64 | Standard_EXPORT void GetCrossFaceError(const Standard_Integer theIndex, |
65 | Standard_Integer& theFace1, | |
66 | Standard_Integer& theNode1, | |
67 | Standard_Integer& theFace2, | |
68 | Standard_Integer& theNode2, | |
69 | Standard_Real& theValue) const; | |
7fd59977 | 70 | |
446e11f3 | 71 | //! returns the number of async edges |
7fd59977 | 72 | Standard_Integer NbAsyncEdges() const |
73 | { return myAsyncEdges.Length(); } | |
7fd59977 | 74 | |
446e11f3 | 75 | //! returns the number (in the shape) of an async edge with the given index |
7fd59977 | 76 | Standard_Integer GetAsyncEdgeNum(const Standard_Integer theIndex) const |
77 | { return myAsyncEdges(theIndex); } | |
446e11f3 A |
78 | |
79 | //! returns the number of free nodes | |
80 | Standard_Integer NbFreeNodes() const | |
81 | { return myFreeNodeFaces.Length(); } | |
82 | ||
83 | //! returns the number of face containing the Index-th detected free node, | |
84 | //! and number of this node in the triangulation of that face | |
85 | void GetFreeNodeNum (const Standard_Integer theIndex, | |
86 | Standard_Integer& theFaceNum, | |
87 | Standard_Integer& theNodeNum) const | |
88 | { | |
89 | theFaceNum = myFreeNodeFaces(theIndex); | |
90 | theNodeNum = myFreeNodeNums(theIndex); | |
91 | } | |
7fd59977 | 92 | |
93 | private: | |
94 | TopoDS_Shape myShape; | |
95 | NCollection_IndexedDataMap<Standard_Integer,TColStd_SequenceOfInteger> | |
96 | myMapFaceLinks; | |
446e11f3 | 97 | |
7fd59977 | 98 | TColStd_SequenceOfInteger myErrors; |
99 | TColStd_SequenceOfReal myErrorsVal; | |
446e11f3 | 100 | |
7fd59977 | 101 | TColStd_SequenceOfInteger myAsyncEdges; |
446e11f3 A |
102 | TColStd_SequenceOfInteger myFreeNodeFaces; |
103 | TColStd_SequenceOfInteger myFreeNodeNums; | |
7fd59977 | 104 | }; |
105 | ||
106 | #endif |