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_FaceOfNodes.hxx"
23 #include "SMDS_IteratorOfElements.hxx"
24 #include "SMDS_MeshNode.hxx"
25 #include "utilities.h"
27 //=======================================================================
30 //=======================================================================
32 int SMDS_FaceOfNodes::NbEdges() const
37 int SMDS_FaceOfNodes::NbFaces() const
42 int SMDS_FaceOfNodes::NbNodes() const
44 return myNodes.size();
46 //=======================================================================
49 //=======================================================================
51 void SMDS_FaceOfNodes::Print(ostream & OS) const
53 OS << "face <" << GetID() << " > : ";
55 for (i = 0; i < NbNodes() - 1; i++) OS << myNodes[i] << ",";
56 OS << myNodes[i] << ") " << endl;
59 class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
61 const vector<const SMDS_MeshNode*>& mySet;
64 SMDS_FaceOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
69 return index<mySet.size();
72 const SMDS_MeshElement* next()
75 return mySet[index-1];
78 SMDS_ElemIteratorPtr SMDS_FaceOfNodes::
79 elementsIterator(SMDSAbs_ElementType type) const
84 return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
86 return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes));
88 MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
91 return SMDS_ElemIteratorPtr
92 (new SMDS_IteratorOfElements
93 (this,type,SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes))));
97 SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
98 const SMDS_MeshNode* node2,
99 const SMDS_MeshNode* node3)
107 SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
108 const SMDS_MeshNode* node2,
109 const SMDS_MeshNode* node3,
110 const SMDS_MeshNode* node4)
119 /*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
121 set<SMDS_MeshNode> set1,set2;
122 SMDS_ElemIteratorPtr it;
123 const SMDS_MeshNode * n;
125 it=f1.nodesIterator();
129 n=static_cast<const SMDS_MeshNode *>(it->next());
134 it=f2.nodesIterator();
138 n=static_cast<const SMDS_MeshNode *>(it->next());