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"
26 //=======================================================================
29 //=======================================================================
31 int SMDS_FaceOfEdges::NbEdges() const
33 return myEdges.size();
36 int SMDS_FaceOfEdges::NbFaces() const
40 //=======================================================================
43 //=======================================================================
45 void SMDS_FaceOfEdges::Print(ostream & OS) const
47 OS << "face <" << GetID() << " > : ";
49 for (i = 0; i < NbEdges() - 1; i++) OS << myEdges[i] << ",";
50 OS << myEdges[i] << ") " << endl;
53 SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
58 SMDS_Iterator<const SMDS_MeshElement *> * SMDS_FaceOfEdges::
59 elementsIterator(SMDSAbs_ElementType type) const
61 class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
63 const vector<const SMDS_MeshEdge*>& mySet;
66 MyIterator(const vector<const SMDS_MeshEdge*>& s):mySet(s),index(0)
71 return index<mySet.size();
74 const SMDS_MeshElement* next()
77 return mySet[index-1];
83 case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
84 case SMDSAbs_Edge:return new MyIterator(myEdges);
85 default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myEdges));
89 SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
98 SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
99 SMDS_MeshEdge* edge3, SMDS_MeshEdge* edge4)
108 /*bool operator<(const SMDS_FaceOfEdges& f1, const SMDS_FaceOfEdges& f2)
110 set<SMDS_MeshNode> set1,set2;
111 SMDS_Iterator<const SMDS_MeshElement*> * it;
112 const SMDS_MeshNode * n;
114 it=f1.nodesIterator();
118 n=static_cast<const SMDS_MeshNode *>(it->next());
123 it=f2.nodesIterator();
127 n=static_cast<const SMDS_MeshNode *>(it->next());