2 // File: SMDSControl_BoundaryFaces.cxx
3 // Created: Tue Mar 12 23:46:24 2002
4 // Author: Jean-Michel BOULCOURT
5 // <jmb@localhost.localdomain>
8 #include "SMDSControl_BoundaryFaces.ixx"
9 #include "SMDSControl.hxx"
11 #include "SMDS_MeshVolumesIterator.hxx"
12 #include "SMDS_MeshElement.hxx"
13 #include "SMDS_MeshFace.hxx"
14 #include "SMDS_MeshTriangle.hxx"
15 #include "SMDS_MeshQuadrangle.hxx"
16 #include "SMDS_MapIteratorOfExtendedMap.hxx"
18 //=======================================================================
19 //function : SMDSControl_BoundaryFaces
21 //=======================================================================
23 SMDSControl_BoundaryFaces::SMDSControl_BoundaryFaces(const Handle(SMDS_Mesh)& M)
24 :SMDSControl_MeshBoundary(M)
28 //=======================================================================
31 //=======================================================================
33 void SMDSControl_BoundaryFaces::Compute()
35 myBoundaryMesh = myMesh->AddSubMesh();
36 SMDS_MeshVolumesIterator itvol(myMesh);
38 Standard_Integer idnode[4]; // max number of nodes for a face
39 Standard_Integer nbnode;
41 for (;itvol.More();itvol.Next()) {
42 Handle(SMDS_MeshElement) ME = itvol.Value();
45 Standard_Integer nbfaces = ME->NbFaces();
47 for (Standard_Integer iface=1; iface<=nbfaces; ++iface) {
49 ME->GetFaceDefinedByNodes(iface,idnode,nbnode);
52 Handle(SMDS_MeshElement) face = new SMDS_MeshTriangle(0,idnode[0],idnode[1],idnode[2]);
53 if (!myBoundaryFaces.Add(face))
54 myBoundaryFaces.Remove(face);
60 Handle(SMDS_MeshElement) face = new SMDS_MeshQuadrangle(0,idnode[0],idnode[1],idnode[2],idnode[3]);
61 if (!myBoundaryFaces.Add(face))
62 myBoundaryFaces.Remove(face);
69 SMDS_MapIteratorOfExtendedMap itbound(myBoundaryFaces);
71 for (;itbound.More();itbound.Next()) {
72 const Handle(SMDS_MeshElement)& face = itbound.Key();
73 if (face->NbNodes() == 3)
74 myBoundaryMesh->AddFace(face->GetConnection(1),face->GetConnection(2),face->GetConnection(3));
76 myBoundaryMesh->AddFace(face->GetConnection(1),face->GetConnection(2),face->GetConnection(3),
77 face->GetConnection(4));