Back to index

salome-smesh  6.5.0
SMDS_MeshNode.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMDS : implementaion of Salome mesh data structure
00024 //  File   : SMDS_MeshNode.hxx
00025 //  Module : SMESH
00026 //
00027 #ifndef _SMDS_MeshNode_HeaderFile
00028 #define _SMDS_MeshNode_HeaderFile
00029 
00030 #include "SMESH_SMDS.hxx"
00031 
00032 #include "SMDS_MeshElement.hxx"
00033 #include "SMDS_Position.hxx"
00034 #include "ObjectPool.hxx"
00035 
00036 class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
00037 {
00038 public:
00039   friend class SMESHDS_Mesh;
00040   friend class SMDS_Mesh;
00041   friend class ObjectPool<SMDS_MeshNode>;
00042   friend class SMDS_VtkFace;
00043 
00044   void Print(std::ostream & OS) const;
00045   double X() const; // ! NOT thread safe methods !
00046   double Y() const;
00047   double Z() const;
00048   void   GetXYZ(double xyx[3]) const; // thread safe getting coords
00049   SMDS_ElemIteratorPtr    GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
00050   int                     NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
00051   const SMDS_PositionPtr& GetPosition() const;
00052   SMDSAbs_ElementType     GetType() const;
00053   virtual vtkIdType       GetVtkType() const;
00054   SMDSAbs_EntityType      GetEntityType() const {return SMDSEntity_Node;}
00055   int                     NbNodes() const;
00056 
00057   friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
00058 
00059   void SetPosition(const SMDS_PositionPtr& aPos);
00060   void setXYZ(double x, double y, double z);
00061 
00062   static int nbNodes;
00063 
00064 protected:
00065   SMDS_MeshNode();
00066   SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
00067   virtual ~SMDS_MeshNode();
00068   void init(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
00069   inline void setVtkId(int vtkId) { myVtkID = vtkId; };
00070   double* getCoord() const;
00071   void AddInverseElement(const SMDS_MeshElement * ME);
00072   void RemoveInverseElement(const SMDS_MeshElement * parent);
00073   void ClearInverseElements();
00074   bool emptyInverseElements();
00075 
00076   SMDS_ElemIteratorPtr
00077   elementsIterator(SMDSAbs_ElementType type) const;
00078 
00079 private:
00080   SMDS_PositionPtr myPosition;
00081 };
00082 
00083 #endif