1 // SMESH SMDS : implementaion of Salome mesh data structure
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 #include "SMDS_FaceOfEdges.hxx"
23 #include "SMDS_IteratorOfElements.hxx"
24 #include "SMDS_MeshNode.hxx"
28 //=======================================================================
31 //=======================================================================
33 int SMDS_FaceOfEdges::NbEdges() const
35 return myEdges.size();
38 int SMDS_FaceOfEdges::NbFaces() const
42 //=======================================================================
45 //=======================================================================
47 void SMDS_FaceOfEdges::Print(ostream & OS) const
49 OS << "face <" << GetID() << " > : ";
51 for (i = 0; i < NbEdges() - 1; i++) OS << myEdges[i] << ",";
52 OS << myEdges[i] << ") " << endl;
55 SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
60 class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
62 const vector<const SMDS_MeshEdge*>& mySet;
65 SMDS_FaceOfEdges_MyIterator(const vector<const SMDS_MeshEdge*>& s):
70 return index<mySet.size();
73 const SMDS_MeshElement* next()
76 return mySet[index-1];
79 SMDS_ElemIteratorPtr SMDS_FaceOfEdges::
80 elementsIterator(SMDSAbs_ElementType type) const
85 return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
87 return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges));
89 return SMDS_ElemIteratorPtr
90 (new SMDS_IteratorOfElements
91 (this,type, SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges))));
95 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
96 const SMDS_MeshEdge* edge2,
97 const SMDS_MeshEdge* edge3)
105 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
106 const SMDS_MeshEdge* edge2,
107 const SMDS_MeshEdge* edge3,
108 const SMDS_MeshEdge* edge4)
117 /*bool operator<(const SMDS_FaceOfEdges& f1, const SMDS_FaceOfEdges& f2)
119 set<SMDS_MeshNode> set1,set2;
120 SMDS_ElemIteratorPtr it;
121 const SMDS_MeshNode * n;
123 it=f1.nodesIterator();
127 n=static_cast<const SMDS_MeshNode *>(it->next());
132 it=f2.nodesIterator();
136 n=static_cast<const SMDS_MeshNode *>(it->next());