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
23 #pragma warning(disable:4786)
26 #include "SMDS_FaceOfEdges.hxx"
27 #include "SMDS_IteratorOfElements.hxx"
28 #include "SMDS_MeshNode.hxx"
32 //=======================================================================
35 //=======================================================================
37 int SMDS_FaceOfEdges::NbEdges() const
42 int SMDS_FaceOfEdges::NbFaces() const
46 //=======================================================================
49 //=======================================================================
51 void SMDS_FaceOfEdges::Print(ostream & OS) const
53 OS << "face <" << GetID() << " > : ";
55 for (i = 0; i < NbEdges() - 1; i++) OS << myEdges[i] << ",";
56 OS << myEdges[i] << ") " << endl;
59 SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
64 //=======================================================================
65 //function : elementsIterator
67 //=======================================================================
69 class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
71 const SMDS_MeshEdge* const *mySet;
75 SMDS_FaceOfEdges_MyIterator(const SMDS_MeshEdge* const *s, int l):
76 mySet(s),myLength(l),index(0) {}
80 return index<myLength;
83 const SMDS_MeshElement* next()
86 return mySet[index-1];
90 SMDS_ElemIteratorPtr SMDS_FaceOfEdges::elementsIterator
91 (SMDSAbs_ElementType type) const
96 return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
98 return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges));
100 return SMDS_ElemIteratorPtr
101 (new SMDS_IteratorOfElements
102 (this,type, SMDS_ElemIteratorPtr
103 (new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges))));
107 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
108 const SMDS_MeshEdge* edge2,
109 const SMDS_MeshEdge* edge3)
118 SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
119 const SMDS_MeshEdge* edge2,
120 const SMDS_MeshEdge* edge3,
121 const SMDS_MeshEdge* edge4)
130 /*bool operator<(const SMDS_FaceOfEdges& f1, const SMDS_FaceOfEdges& f2)
132 set<SMDS_MeshNode> set1,set2;
133 SMDS_ElemIteratorPtr it;
134 const SMDS_MeshNode * n;
136 it=f1.nodesIterator();
140 n=static_cast<const SMDS_MeshNode *>(it->next());
145 it=f2.nodesIterator();
149 n=static_cast<const SMDS_MeshNode *>(it->next());