1 // SMESH SMDS : implementaion of Salome mesh data structure
3 // Copyright (C) 2003 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMDS_MeshNode.cxx
25 // Author : Jean-Michel BOULCOURT
29 #include "SMDS_MeshNode.ixx"
30 #include "SMDS_ListIteratorOfListOfMeshElement.hxx"
31 #include "SMDS_SpacePosition.hxx"
33 static Handle(SMDS_Position)& StaticInstancePosition()
35 static Handle(SMDS_SpacePosition) staticpos;
36 if (staticpos.IsNull())
37 staticpos = new SMDS_SpacePosition();
42 //=======================================================================
43 //function : SMDS_MeshNode
45 //=======================================================================
47 SMDS_MeshNode::SMDS_MeshNode(const Standard_Integer ID,
48 const Standard_Real x, const Standard_Real y, const Standard_Real z) :
49 SMDS_MeshElement(ID,1,SMDSAbs_Node),myPnt(x,y,z),myPosition(StaticInstancePosition())
54 //=======================================================================
55 //function : RemoveInverseElement
57 //=======================================================================
59 void SMDS_MeshNode::RemoveInverseElement(const Handle(SMDS_MeshElement)& parent)
62 SMDS_ListIteratorOfListOfMeshElement itLstInvCnx(myInverseElements);
64 for (;itLstInvCnx.More();itLstInvCnx.Next()) {
65 Handle(SMDS_MeshElement)& ME = itLstInvCnx.Value();
66 if (ME->IsSame(parent))
67 myInverseElements.Remove(itLstInvCnx);
68 if (!itLstInvCnx.More())
74 //=======================================================================
77 //=======================================================================
79 void SMDS_MeshNode::Print(Standard_OStream& OS) const
81 OS << "Node <" << myID << "> : X = " << myPnt.X() << " Y = " << myPnt.Y() << " Z = " << myPnt.Z() << endl;
85 //=======================================================================
86 //function : SetPosition
88 //=======================================================================
90 void SMDS_MeshNode::SetPosition(const Handle(SMDS_Position)& aPos)
95 //=======================================================================
96 //function : GetPosition
98 //=======================================================================
100 Handle(SMDS_Position) SMDS_MeshNode::GetPosition() const