Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1993-06-01 |
2 | // Created by: Didier PIFFAULT | |
3 | // Copyright (c) 1993-1999 Matra Datavision | |
973c2be1 | 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | // |
973c2be1 | 6 | // This file is part of Open CASCADE Technology software library. |
b311480e | 7 | // |
d5f74e42 | 8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
973c2be1 | 10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
12 | // distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 13 | // |
973c2be1 | 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. | |
0d88155b | 16 | |
fc9b36d6 | 17 | #include <BRepMesh_SelectorOfDataStructureOfDelaun.hxx> |
0d88155b O |
18 | #include <BRepMesh_PairOfIndex.hxx> |
19 | ||
20 | //======================================================================= | |
fc9b36d6 | 21 | //function : Default constructor |
0d88155b O |
22 | //purpose : |
23 | //======================================================================= | |
24 | BRepMesh_SelectorOfDataStructureOfDelaun::BRepMesh_SelectorOfDataStructureOfDelaun() | |
2caff0b3 | 25 | : myAllocator(new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE)), |
26 | myNodes (10, myAllocator), | |
27 | myLinks (10, myAllocator), | |
28 | myElements(10, myAllocator), | |
29 | myFrontier(10, myAllocator) | |
fc9b36d6 | 30 | { |
31 | } | |
0d88155b | 32 | |
fc9b36d6 | 33 | //======================================================================= |
34 | //function : Constructor | |
35 | //purpose : | |
36 | //======================================================================= | |
37 | BRepMesh_SelectorOfDataStructureOfDelaun::BRepMesh_SelectorOfDataStructureOfDelaun( | |
38 | const Handle(BRepMesh_DataStructureOfDelaun)& theMesh) | |
2caff0b3 | 39 | : myAllocator(new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE)), |
40 | myMesh (theMesh), | |
41 | myNodes (10, myAllocator), | |
42 | myLinks (10, myAllocator), | |
43 | myElements(10, myAllocator), | |
44 | myFrontier(10, myAllocator) | |
fc9b36d6 | 45 | { |
46 | } | |
0d88155b | 47 | |
fc9b36d6 | 48 | //======================================================================= |
49 | //function : Initialize | |
50 | //purpose : | |
51 | //======================================================================= | |
52 | void BRepMesh_SelectorOfDataStructureOfDelaun::Initialize( | |
53 | const Handle(BRepMesh_DataStructureOfDelaun)& theMesh) | |
0d88155b | 54 | { |
fc9b36d6 | 55 | myMesh = theMesh; |
0d88155b O |
56 | myNodes.Clear(); |
57 | myLinks.Clear(); | |
58 | myElements.Clear(); | |
59 | myFrontier.Clear(); | |
60 | } | |
61 | ||
62 | //======================================================================= | |
fc9b36d6 | 63 | //function : NeighboursOf(Node) |
0d88155b O |
64 | //purpose : |
65 | //======================================================================= | |
fc9b36d6 | 66 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf( |
67 | const BRepMesh_Vertex& theNode) | |
0d88155b O |
68 | { |
69 | NeighboursOfNode(myMesh->IndexOf(theNode)); | |
70 | } | |
71 | ||
fc9b36d6 | 72 | //======================================================================= |
73 | //function : NeighboursOfNode(NodeIndex) | |
74 | //purpose : | |
75 | //======================================================================= | |
76 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfNode( | |
77 | const Standard_Integer theNodeIndex) | |
0d88155b | 78 | { |
848fa7e3 | 79 | BRepMesh::ListOfInteger::Iterator aLinkIt( |
fc9b36d6 | 80 | myMesh->LinksConnectedTo(theNodeIndex)); |
0d88155b | 81 | |
fc9b36d6 | 82 | for (; aLinkIt.More(); aLinkIt.Next()) |
83 | elementsOfLink(aLinkIt.Value()); | |
0d88155b O |
84 | } |
85 | ||
86 | //======================================================================= | |
fc9b36d6 | 87 | //function : NeighboursOf(Link) |
0d88155b O |
88 | //purpose : |
89 | //======================================================================= | |
fc9b36d6 | 90 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf( |
91 | const BRepMesh_Edge& theLink) | |
0d88155b O |
92 | { |
93 | NeighboursOfNode(theLink.FirstNode()); | |
94 | NeighboursOfNode(theLink.LastNode()); | |
95 | } | |
96 | ||
0d88155b | 97 | //======================================================================= |
fc9b36d6 | 98 | //function : NeighboursOfLink(LinkIndex) |
99 | //purpose : | |
0d88155b | 100 | //======================================================================= |
fc9b36d6 | 101 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfLink( |
102 | const Standard_Integer theLinkIndex) | |
0d88155b | 103 | { |
fc9b36d6 | 104 | NeighboursOf(myMesh->GetLink(theLinkIndex)); |
0d88155b O |
105 | } |
106 | ||
107 | //======================================================================= | |
fc9b36d6 | 108 | //function : NeighboursOf(Element) |
109 | //purpose : | |
0d88155b | 110 | //======================================================================= |
fc9b36d6 | 111 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf( |
112 | const BRepMesh_Triangle& theElement) | |
0d88155b | 113 | { |
fc9b36d6 | 114 | Standard_Integer v[3]; |
115 | myMesh->ElementNodes(theElement, v); | |
0d88155b | 116 | |
fc9b36d6 | 117 | for (Standard_Integer i = 0; i < 3; ++i) |
118 | NeighboursOfNode(v[i]); | |
0d88155b O |
119 | } |
120 | ||
0d88155b | 121 | //======================================================================= |
fc9b36d6 | 122 | //function : NeighboursOfElement(ElementIndex) |
123 | //purpose : | |
0d88155b | 124 | //======================================================================= |
fc9b36d6 | 125 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfElement( |
126 | const Standard_Integer theElementIndex) | |
127 | { | |
128 | NeighboursOf(myMesh->GetElement(theElementIndex)); | |
129 | } | |
0d88155b O |
130 | |
131 | //======================================================================= | |
fc9b36d6 | 132 | //function : NeighboursByEdgeOf(Element) |
0d88155b O |
133 | //purpose : |
134 | //======================================================================= | |
fc9b36d6 | 135 | void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursByEdgeOf( |
136 | const BRepMesh_Triangle& theElement) | |
137 | { | |
138 | Standard_Integer e[3]; | |
139 | Standard_Boolean o[3]; | |
140 | theElement.Edges(e, o); | |
0d88155b | 141 | |
fc9b36d6 | 142 | for (Standard_Integer i = 0; i < 3; ++i) |
143 | elementsOfLink(e[i]); | |
144 | } | |
0d88155b O |
145 | |
146 | //======================================================================= | |
fc9b36d6 | 147 | //function : elementsOfLink |
0d88155b O |
148 | //purpose : |
149 | //======================================================================= | |
fc9b36d6 | 150 | void BRepMesh_SelectorOfDataStructureOfDelaun::elementsOfLink( |
151 | const Standard_Integer theIndex) | |
152 | { | |
153 | const BRepMesh_PairOfIndex& aPair = myMesh->ElementsConnectedTo(theIndex); | |
154 | for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; ++j) | |
155 | myElements.Add(aPair.Index(j)); | |
156 | } |