1 // Created on: 1993-06-01
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <BRepMesh_SelectorOfDataStructureOfDelaun.ixx>
23 #include <BRepMesh_PairOfIndex.hxx>
25 //=======================================================================
26 //function : BRepMesh_SelectorOfDataStructureOfDelaun
28 //=======================================================================
29 BRepMesh_SelectorOfDataStructureOfDelaun::BRepMesh_SelectorOfDataStructureOfDelaun()
30 : myNodes(10, new NCollection_IncAllocator),
31 myLinks(10, new NCollection_IncAllocator),
32 myElements(10, new NCollection_IncAllocator),
33 myFrontier(10, new NCollection_IncAllocator)
37 BRepMesh_SelectorOfDataStructureOfDelaun::BRepMesh_SelectorOfDataStructureOfDelaun(const Handle(BRepMesh_DataStructureOfDelaun)& theMesh)
39 myNodes(10, myMesh->Allocator()),
40 myLinks(10, myMesh->Allocator()),
41 myElements(10, myMesh->Allocator()),
42 myFrontier(10, myMesh->Allocator())
45 void BRepMesh_SelectorOfDataStructureOfDelaun::Initialize(const Handle(BRepMesh_DataStructureOfDelaun)& theMesh)
54 //=======================================================================
55 //function : NeighboursOfNode
57 //=======================================================================
58 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf(const BRepMesh_Vertex& theNode)
60 NeighboursOfNode(myMesh->IndexOf(theNode));
63 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfNode(const Standard_Integer indexNode)
65 BRepMesh_ListOfInteger::Iterator itL(myMesh->LinkNeighboursOf(indexNode));
67 for (; itL.More(); itL.Next()) {
68 const BRepMesh_PairOfIndex& aPair = myMesh->ElemConnectedTo(itL.Value());
69 for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++)
70 myElements.Add(aPair.Index(j));
74 //=======================================================================
75 //function : NeighboursOfLink
77 //=======================================================================
78 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf(const BRepMesh_Edge& theLink)
80 NeighboursOfNode(theLink.FirstNode());
81 NeighboursOfNode(theLink.LastNode());
84 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfLink(const Standard_Integer indexLink)
86 NeighboursOf(myMesh->GetLink(indexLink));
89 //=======================================================================
90 //function : NeighboursOfElement
91 //purpose : by edge and by vertices
92 //=======================================================================
93 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf(const BRepMesh_Triangle& theElem)
95 Standard_Integer v1, v2, v3, ev;
96 Standard_Boolean o1, o2, o3;
97 theElem.Edges(v1, v3, ev, o1, o2, o3);
98 v2=myMesh->GetLink(v1).LastNode();
99 v1=myMesh->GetLink(v1).FirstNode();
100 ev=myMesh->GetLink(v3).LastNode();
101 if (v1!=ev && v2!=ev) v3=ev;
102 else v3=myMesh->GetLink(v3).FirstNode();
103 NeighboursOfNode(v1);
104 NeighboursOfNode(v2);
105 NeighboursOfNode(v3);
108 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfElement(const Standard_Integer indexElem)
110 NeighboursOf(myMesh->GetElement(indexElem));
113 //=======================================================================
114 //function : NeighboursByEdgeOf
115 //purpose : Neighbours Of an element only by edge
116 //=======================================================================
117 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursByEdgeOf(const BRepMesh_Triangle& theElem)
119 Standard_Integer e[3], iEd;
120 Standard_Boolean o1, o2, o3;
121 theElem.Edges(e[0], e[1], e[2], o1, o2, o3);
123 for (iEd=0; iEd<3; iEd++) {
124 const BRepMesh_PairOfIndex& aPair = myMesh->ElemConnectedTo(e[iEd]);
125 for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; j++)
126 myElements.Add(aPair.Index(j));
131 //=======================================================================
132 //function : NeighboursOfSelector
134 //=======================================================================
135 void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOf(const BRepMesh_SelectorOfDataStructureOfDelaun& /*theSelector*/)
138 //=======================================================================
139 //function : AddNeighbours
141 //=======================================================================
142 void BRepMesh_SelectorOfDataStructureOfDelaun::AddNeighbours()
145 //=======================================================================
148 //=======================================================================
149 const BRepMesh_MapOfInteger& BRepMesh_SelectorOfDataStructureOfDelaun::Nodes()const
152 //=======================================================================
155 //=======================================================================
156 const BRepMesh_MapOfInteger& BRepMesh_SelectorOfDataStructureOfDelaun::Links()const
159 //=======================================================================
160 //function : Elements
162 //=======================================================================
163 const BRepMesh_MapOfInteger& BRepMesh_SelectorOfDataStructureOfDelaun::Elements()const
166 //=======================================================================
167 //function : FrontierLinks
169 //=======================================================================
170 const BRepMesh_MapOfInteger& BRepMesh_SelectorOfDataStructureOfDelaun::FrontierLinks()const