Salome HOME
Some forgotten return statments
[modules/smesh.git] / src / SMDS / SMDSControl_BoundaryEdges.cxx
1 //  SMESH SMDS : implementaion of Salome mesh data structure
2 //
3 //  Copyright (C) 2003  OPEN CASCADE
4 // 
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. 
9 // 
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. 
14 // 
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 
18 // 
19 //  See http://www.opencascade.org or email : webmaster@opencascade.org 
20 //
21 //
22 //
23 //  File   : SMDSControl_BoundaryEdges.cxx
24 //  Author : Jean-Michel BOULCOURT
25 //  Module : SMESH
26
27 using namespace std;
28 #include "SMDSControl_BoundaryEdges.ixx"
29 #include "SMDSControl.hxx"
30
31 #include "SMDS_MeshFacesIterator.hxx"
32 #include "SMDS_MeshElement.hxx"
33 #include "SMDS_MeshEdge.hxx"
34 #include "SMDS_MapIteratorOfExtendedMap.hxx"
35
36 //=======================================================================
37 //function : SMDSControl_BoundaryEdges
38 //purpose  : 
39 //=======================================================================
40
41 SMDSControl_BoundaryEdges::SMDSControl_BoundaryEdges(const Handle(SMDS_Mesh)& M)
42   :SMDSControl_MeshBoundary(M)
43 {
44 }
45
46 //=======================================================================
47 //function : Compute
48 //purpose  : 
49 //=======================================================================
50
51 void SMDSControl_BoundaryEdges::Compute()
52 {
53   Standard_Integer idnode1;
54   Standard_Integer idnode2;
55   Standard_Integer nbedg;
56
57   myBoundaryMesh = myMesh->AddSubMesh();
58   SMDS_MeshFacesIterator itface(myMesh);
59
60   for (;itface.More();itface.Next()) {
61     Handle(SMDS_MeshElement) ME = itface.Value();
62
63     nbedg = ME->NbEdges();
64
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);
70     }
71   }
72   
73   SMDS_MapIteratorOfExtendedMap itbound(myBoundaryEdges);
74
75   for (;itbound.More();itbound.Next()) {
76     const Handle(SMDS_MeshElement)& edge = itbound.Key();
77     myBoundaryMesh->AddEdge(edge->GetConnection(1),edge->GetConnection(2));
78   }
79 }