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_FaceOfNodes.hxx"
31 #include "SMDS_SetIterator.hxx"
32 #include "SMDS_MeshNode.hxx"
33 #include "SMDS_Mesh.hxx"
35 #include <utilities.h>
37 #include <boost/make_shared.hpp>
39 //=======================================================================
42 //=======================================================================
44 int SMDS_FaceOfNodes::NbEdges() const
49 int SMDS_FaceOfNodes::NbFaces() const
54 int SMDS_FaceOfNodes::NbNodes() const
59 int SMDS_FaceOfNodes::GetNodeIndex( const SMDS_MeshNode* node ) const
61 for ( int i = 0; i < myNbNodes; ++i )
62 if ( myNodes[i] == node )
67 //=======================================================================
70 //=======================================================================
72 void SMDS_FaceOfNodes::Print(ostream & OS) const
74 OS << "face <" << GetID() << " > : ";
76 for (i = 0; i < NbNodes() - 1; i++) OS << myNodes[i] << ",";
77 OS << myNodes[i] << ") " << endl;
80 SMDS_ElemIteratorPtr SMDS_FaceOfNodes::nodesIterator() const
82 return boost::make_shared< SMDS_NodeArrayElemIterator >( &myNodes[0], &myNodes[0] + NbNodes() );
85 SMDS_NodeIteratorPtr SMDS_FaceOfNodes::nodeIterator() const
87 return boost::make_shared< SMDS_NodeArrayIterator >( &myNodes[0], &myNodes[0] + NbNodes() );
90 SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
91 const SMDS_MeshNode* node2,
92 const SMDS_MeshNode* node3)
101 SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
102 const SMDS_MeshNode* node2,
103 const SMDS_MeshNode* node3,
104 const SMDS_MeshNode* node4)
112 bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
121 else if (nbNodes != 3)
128 * \brief Return node by its index
129 * \param ind - node index
130 * \retval const SMDS_MeshNode* - the node
132 const SMDS_MeshNode* SMDS_FaceOfNodes::GetNode(const int ind) const
134 return myNodes[ ind ];
137 SMDSAbs_EntityType SMDS_FaceOfNodes::GetEntityType() const
139 return NbNodes() == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
141 SMDSAbs_GeometryType SMDS_FaceOfNodes::GetGeomType() const
143 return NbNodes() == 3 ? SMDSGeom_TRIANGLE : SMDSGeom_QUADRANGLE;