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
22 // File : SMDS_LinearEdge.cxx
23 // Author : Jean-Michel BOULCOURT
27 #pragma warning(disable:4786)
30 #include "SMDS_LinearEdge.hxx"
31 #include "SMDS_MeshNode.hxx"
32 #include "SMDS_SetIterator.hxx"
34 #include <boost/make_shared.hpp>
36 //=======================================================================
37 //function : SMDS_LinearEdge
39 //=======================================================================
41 SMDS_LinearEdge::SMDS_LinearEdge(const SMDS_MeshNode * node1,
42 const SMDS_MeshNode * node2)
48 int SMDS_LinearEdge::NbNodes() const
53 int SMDS_LinearEdge::NbEdges() const
58 int SMDS_LinearEdge::NbFaces() const
63 int SMDS_LinearEdge::GetNodeIndex( const SMDS_MeshNode* node ) const
65 if ( node == myNodes[0] ) return 0;
66 if ( node == myNodes[1] ) return 1;
70 SMDS_ElemIteratorPtr SMDS_LinearEdge::nodesIterator() const
72 return boost::make_shared< SMDS_NodeArrayElemIterator >( &myNodes[0], &myNodes[0] + NbNodes() );
75 SMDS_NodeIteratorPtr SMDS_LinearEdge::nodeIterator() const
77 return boost::make_shared< SMDS_NodeArrayIterator >( &myNodes[0], &myNodes[0] + NbNodes() );
81 * \brief Return node by its index
82 * \param ind - node index
83 * \retval const SMDS_MeshNode* - the node
85 const SMDS_MeshNode* SMDS_LinearEdge::GetNode(const int ind) const
90 //=======================================================================
91 //function : ChangeNodes
93 //=======================================================================
95 bool SMDS_LinearEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
97 myNodes[0] = nodes[0];
98 myNodes[1] = nodes[1];