1 // Copyright (C) 2007-2010 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
22 // Author : Jean-Michel BOULCOURT
26 #pragma warning(disable:4786)
29 #include "SMDS_Mesh0DElement.hxx"
30 #include "SMDS_IteratorOfElements.hxx"
31 #include "SMDS_MeshNode.hxx"
35 //=======================================================================
36 //function : SMDS_Mesh0DElement
38 //=======================================================================
39 SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node)
44 //=======================================================================
47 //=======================================================================
48 void SMDS_Mesh0DElement::Print (ostream & OS) const
50 OS << "0D Element <" << GetID() << "> : (" << myNode << ") " << endl;
53 //=======================================================================
56 //=======================================================================
57 int SMDS_Mesh0DElement::NbNodes() const
62 //=======================================================================
65 //=======================================================================
66 int SMDS_Mesh0DElement::NbEdges() const
71 //=======================================================================
74 //=======================================================================
75 SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const
77 return SMDSAbs_0DElement;
80 //=======================================================================
81 //function : elementsIterator
83 //=======================================================================
84 class SMDS_Mesh0DElement_MyNodeIterator: public SMDS_ElemIterator
86 const SMDS_MeshNode * myNode;
89 SMDS_Mesh0DElement_MyNodeIterator(const SMDS_MeshNode * node):
90 myNode(node),myIndex(0) {}
97 const SMDS_MeshElement* next()
106 SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType type) const
110 case SMDSAbs_0DElement:
111 return SMDS_MeshElement::elementsIterator(SMDSAbs_0DElement);
113 return SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode));
115 return SMDS_ElemIteratorPtr
116 (new SMDS_IteratorOfElements
117 (this,type, SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode))));
121 //=======================================================================
122 //function : operator<
124 //=======================================================================
125 bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
127 int id1 = e1.myNode->GetID();
128 int id2 = e2.myNode->GetID();
134 * \brief Return node by its index
135 * \param ind - node index
136 * \retval const SMDS_MeshNode* - the node
138 const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const
145 //=======================================================================
146 //function : ChangeNode
148 //=======================================================================
149 bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node)