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_PolygonalFaceOfNodes.hxx"
28 #include "SMDS_IteratorOfElements.hxx"
29 //#include "SMDS_MeshNode.hxx"
30 #include "utilities.h"
34 //=======================================================================
35 //function : Constructor
37 //=======================================================================
38 SMDS_PolygonalFaceOfNodes::SMDS_PolygonalFaceOfNodes
39 (std::vector<const SMDS_MeshNode *> nodes)
44 //=======================================================================
47 //=======================================================================
48 SMDSAbs_ElementType SMDS_PolygonalFaceOfNodes::GetType() const
51 //return SMDSAbs_PolygonalFace;
54 //=======================================================================
55 //function : ChangeNodes
57 //=======================================================================
58 bool SMDS_PolygonalFaceOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes)
68 //=======================================================================
69 //function : ChangeNodes
70 //purpose : to support the same interface, as SMDS_FaceOfNodes
71 //=======================================================================
72 bool SMDS_PolygonalFaceOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
78 myNodes.resize(nbNodes);
80 for (; i < nbNodes; i++) {
81 myNodes[i] = nodes[i];
87 //=======================================================================
90 //=======================================================================
91 int SMDS_PolygonalFaceOfNodes::NbNodes() const
93 return myNodes.size();
96 //=======================================================================
99 //=======================================================================
100 int SMDS_PolygonalFaceOfNodes::NbEdges() const
105 //=======================================================================
108 //=======================================================================
109 int SMDS_PolygonalFaceOfNodes::NbFaces() const
114 //=======================================================================
117 //=======================================================================
118 void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
120 OS << "polygonal face <" << GetID() << " > : ";
121 int i, nbNodes = myNodes.size();
122 for (i = 0; i < nbNodes - 1; i++)
123 OS << myNodes[i] << ",";
124 OS << myNodes[i] << ") " << endl;
127 //=======================================================================
128 //function : elementsIterator
130 //=======================================================================
131 class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator
133 //const SMDS_MeshNode* const *mySet;
134 const std::vector<const SMDS_MeshNode *> mySet;
138 //SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
139 // mySet(s),myLength(l),index(0) {}
140 SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
145 return index < mySet.size();
148 const SMDS_MeshElement* next()
151 return mySet[index-1];
155 SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
156 (SMDSAbs_ElementType type) const
161 return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
163 return SMDS_ElemIteratorPtr(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes));
165 MESSAGE("Error : edge iterator for SMDS_PolygonalFaceOfNodes not implemented");
168 return SMDS_ElemIteratorPtr
169 (new SMDS_IteratorOfElements
170 (this,type,SMDS_ElemIteratorPtr
171 (new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes))));
173 return SMDS_ElemIteratorPtr();