1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMDS : implementation of Salome mesh data structure
26 #pragma warning(disable:4786)
29 #include "SMDS_PolygonalFaceOfNodes.hxx"
31 #include "SMDS_SetIterator.hxx"
32 #include "SMDS_Mesh.hxx"
34 #include <boost/make_shared.hpp>
36 #include <utilities.h>
38 //=======================================================================
39 //function : Constructor
41 //=======================================================================
42 SMDS_PolygonalFaceOfNodes::
43 SMDS_PolygonalFaceOfNodes (const std::vector<const SMDS_MeshNode *>& nodes)
48 //=======================================================================
51 //=======================================================================
52 SMDSAbs_ElementType SMDS_PolygonalFaceOfNodes::GetType() const
57 //=======================================================================
58 //function : ChangeNodes
60 //=======================================================================
61 // bool SMDS_PolygonalFaceOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes)
63 // if (nodes.size() < 3)
71 //=======================================================================
72 //function : ChangeNodes
73 //purpose : to support the same interface, as SMDS_FaceOfNodes
74 //=======================================================================
75 // bool SMDS_PolygonalFaceOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
81 // myNodes.resize(nbNodes);
83 // for (; i < nbNodes; i++) {
84 // myNodes[i] = nodes[i];
90 //=======================================================================
93 //=======================================================================
94 int SMDS_PolygonalFaceOfNodes::NbNodes() const
96 return myNodes.size();
99 //=======================================================================
102 //=======================================================================
103 int SMDS_PolygonalFaceOfNodes::NbEdges() const
108 //=======================================================================
111 //=======================================================================
112 int SMDS_PolygonalFaceOfNodes::NbFaces() const
117 //=======================================================================
120 //=======================================================================
121 void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
123 OS << "polygonal face <" << GetID() << " > : ";
124 int i, nbNodes = myNodes.size();
125 for (i = 0; i < nbNodes - 1; i++)
126 OS << myNodes[i] << ",";
127 OS << myNodes[i] << ") " << endl;
130 /// ===================================================================
132 * \brief Iterator on edges of face
134 /// ===================================================================
137 * \brief Return node by its index
138 * \param ind - node index
139 * \retval const SMDS_MeshNode* - the node
141 const SMDS_MeshNode* SMDS_PolygonalFaceOfNodes::GetNode(const int ind) const
143 return myNodes[ WrappedIndex( ind )];
146 SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::nodesIterator() const
148 return boost::make_shared< SMDS_NodeArrayElemIterator >( &myNodes[0], &myNodes[0] + NbNodes() );
151 SMDS_NodeIteratorPtr SMDS_PolygonalFaceOfNodes::nodeIterator() const
153 return boost::make_shared< SMDS_NodeArrayIterator >( &myNodes[0], &myNodes[0] + NbNodes() );