1 // SMESH SMDS : implementaion of Salome mesh data structure
3 // Copyright (C) 2003 OPEN CASCADE
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.opencascade.org or email : webmaster@opencascade.org
23 // File : SMDSControl_BoundaryEdges.cxx
24 // Author : Jean-Michel BOULCOURT
28 #include "SMDSControl_BoundaryEdges.ixx"
29 #include "SMDSControl.hxx"
31 #include "SMDS_MeshFacesIterator.hxx"
32 #include "SMDS_MeshElement.hxx"
33 #include "SMDS_MeshEdge.hxx"
34 #include "SMDS_MapIteratorOfExtendedMap.hxx"
36 //=======================================================================
37 //function : SMDSControl_BoundaryEdges
39 //=======================================================================
41 SMDSControl_BoundaryEdges::SMDSControl_BoundaryEdges(const Handle(SMDS_Mesh)& M)
42 :SMDSControl_MeshBoundary(M)
46 //=======================================================================
49 //=======================================================================
51 void SMDSControl_BoundaryEdges::Compute()
53 Standard_Integer idnode1;
54 Standard_Integer idnode2;
55 Standard_Integer nbedg;
57 myBoundaryMesh = myMesh->AddSubMesh();
58 SMDS_MeshFacesIterator itface(myMesh);
60 for (;itface.More();itface.Next()) {
61 Handle(SMDS_MeshElement) ME = itface.Value();
63 nbedg = ME->NbEdges();
65 for (Standard_Integer iedge=1; iedge<=nbedg; ++iedge) {
66 ME->GetEdgeDefinedByNodes(iedge,idnode1,idnode2);
67 Handle(SMDS_MeshElement) edge = new SMDS_MeshEdge(0,idnode1,idnode2);
68 if (!myBoundaryEdges.Add(edge))
69 myBoundaryEdges.Remove(edge);
73 SMDS_MapIteratorOfExtendedMap itbound(myBoundaryEdges);
75 for (;itbound.More();itbound.Next()) {
76 const Handle(SMDS_MeshElement)& edge = itbound.Key();
77 myBoundaryMesh->AddEdge(edge->GetConnection(1),edge->GetConnection(2));