1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // SMESH SMDS : implementaion of Salome mesh data structure
21 // File : SMDS_Mesh0DElement.cxx
25 #pragma warning(disable:4786)
28 #include "SMDS_Mesh0DElement.hxx"
29 #include "SMDS_IteratorOfElements.hxx"
30 #include "SMDS_MeshNode.hxx"
31 #include "utilities.h"
35 //=======================================================================
36 //function : SMDS_Mesh0DElement
38 //=======================================================================
39 SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node)
41 MESSAGE("SMDS_Mesh0DElement " << GetID());
45 //=======================================================================
48 //=======================================================================
49 void SMDS_Mesh0DElement::Print (ostream & OS) const
51 OS << "0D Element <" << GetID() << "> : (" << myNode << ") " << endl;
54 //=======================================================================
57 //=======================================================================
58 int SMDS_Mesh0DElement::NbNodes() const
63 //=======================================================================
66 //=======================================================================
67 int SMDS_Mesh0DElement::NbEdges() const
72 //=======================================================================
75 //=======================================================================
76 SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const
78 return SMDSAbs_0DElement;
81 vtkIdType SMDS_Mesh0DElement::GetVtkType() const
86 //=======================================================================
87 //function : elementsIterator
89 //=======================================================================
90 class SMDS_Mesh0DElement_MyNodeIterator: public SMDS_ElemIterator
92 const SMDS_MeshNode * myNode;
95 SMDS_Mesh0DElement_MyNodeIterator(const SMDS_MeshNode * node):
96 myNode(node),myIndex(0) {}
103 const SMDS_MeshElement* next()
112 SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType type) const
116 case SMDSAbs_0DElement:
117 return SMDS_MeshElement::elementsIterator(SMDSAbs_0DElement);
119 return SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode));
121 return SMDS_ElemIteratorPtr
122 (new SMDS_IteratorOfElements
123 (this,type, SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode))));
128 * \brief Return node by its index
129 * \param ind - node index
130 * \retval const SMDS_MeshNode* - the node
132 const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const
139 //=======================================================================
140 //function : ChangeNode
142 //=======================================================================
143 bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node)