Salome HOME
yfr : Merge with v1.2
[modules/smesh.git] / src / SMDS / SMDS_MeshElement.hxx
1 //  SMESH SMDS : implementaion of Salome mesh data structure
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMDS_MeshElement.hxx
25 //  Module : SMESH
26
27 #ifndef _SMDS_MeshElement_HeaderFile
28 #define _SMDS_MeshElement_HeaderFile
29
30 #ifndef _Standard_HeaderFile
31 #include <Standard.hxx>
32 #endif
33 #ifndef _Handle_SMDS_MeshElement_HeaderFile
34 #include "Handle_SMDS_MeshElement.hxx"
35 #endif
36
37 #ifndef _Standard_Integer_HeaderFile
38 #include <Standard_Integer.hxx>
39 #endif
40 #ifndef _SMDSAbs_ElementType_HeaderFile                                                                           
41 #include "SMDSAbs_ElementType.hxx"
42 #endif
43 #ifndef _Handle_TColgp_HArray1OfDir_HeaderFile
44 #include "Handle_TColgp_HArray1OfDir.hxx"
45 #endif
46 #ifndef _SMDS_MeshObject_HeaderFile
47 #include "SMDS_MeshObject.hxx"
48 #endif
49 #ifndef _Standard_Boolean_HeaderFile
50 #include <Standard_Boolean.hxx>
51 #endif
52 #ifndef _Standard_Address_HeaderFile
53 #include <Standard_Address.hxx>
54 #endif
55 #ifndef _Standard_Real_HeaderFile
56 #include <Standard_Real.hxx>
57 #endif
58 #ifndef _Standard_OStream_HeaderFile
59 #include <Standard_OStream.hxx>
60 #endif
61 class TColgp_HArray1OfDir;
62 class Standard_OutOfRange;
63 class SMDS_ListOfMeshElement;
64 class gp_Vec;
65 class gp_Dir;
66
67
68 class SMDS_MeshElement : public SMDS_MeshObject {
69
70 public:
71
72     inline void* operator new(size_t,void* anAddress) 
73       {
74         return anAddress;
75       }
76     inline void* operator new(size_t size) 
77       { 
78         return Standard::Allocate(size); 
79       }
80     inline void  operator delete(void *anAddress) 
81       { 
82         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
83       }
84 //    inline void  operator delete(void *anAddress, size_t size) 
85 //      { 
86 //        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
87 //      }
88  // Methods PUBLIC
89  // 
90 Standard_EXPORT inline   Standard_Integer HashCode(const Standard_Integer Upper) const;
91 Standard_EXPORT inline   Standard_Boolean IsSame(const Handle(SMDS_MeshElement)& other) const;
92 Standard_EXPORT inline   Standard_Boolean IsEqual(const Handle(SMDS_MeshElement)& other) const;
93 Standard_EXPORT inline   Standard_Boolean IsNodeInElement(const Standard_Integer idnode) const;
94 Standard_EXPORT virtual  void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const;
95 Standard_EXPORT virtual  void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const;
96 Standard_EXPORT virtual  Standard_Integer GetConnection(const Standard_Integer rank) const;
97 Standard_EXPORT virtual  void AddInverseElement(const Handle(SMDS_MeshElement)& ME) ;
98 Standard_EXPORT virtual const SMDS_ListOfMeshElement& InverseElements() const;
99 Standard_EXPORT virtual  void ClearInverseElements() ;
100 Standard_EXPORT inline   Standard_Integer NbNodes() const;
101 Standard_EXPORT virtual  Standard_Integer NbEdges() const;
102 Standard_EXPORT virtual  Standard_Integer NbFaces() const;
103 Standard_EXPORT inline   Standard_Integer GetID() const;
104 Standard_EXPORT virtual  Standard_Integer GetKey() const = 0;
105 Standard_EXPORT virtual  void SetNormal(const Standard_Integer rank,const Standard_Real vx,const Standard_Real vy,const Standard_Real vz) ;
106 Standard_EXPORT virtual  void SetNormal(const Standard_Integer rank,const gp_Vec& v) ;
107 Standard_EXPORT virtual  gp_Dir GetNormal(const Standard_Integer rank) ;
108 Standard_EXPORT virtual  void Print(Standard_OStream& OS) const;
109 friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& OS, const Handle(SMDS_MeshElement)& );
110 Standard_EXPORT inline   SMDSAbs_ElementType GetType() const;
111 Standard_EXPORT ~SMDS_MeshElement();
112
113
114
115
116  // Type management
117  //
118  Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshElement_Type_();
119  Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
120  Standard_EXPORT Standard_Boolean              IsKind(const Handle(Standard_Type)&) const;
121
122 protected:
123
124  // Methods PROTECTED
125  // 
126 Standard_EXPORT SMDS_MeshElement(const Standard_Integer ID,const Standard_Integer NbConnections,const SMDSAbs_ElementType Type);
127 Standard_EXPORT virtual  Standard_Address GetConnections() const;
128
129
130  // Fields PROTECTED
131  //
132 Standard_Integer myID;
133 Standard_Integer myNbNodes;
134 Handle_TColgp_HArray1OfDir myNormals;
135
136
137 private: 
138
139  // Methods PRIVATE
140  // 
141
142
143  // Fields PRIVATE
144  //
145 SMDSAbs_ElementType myType;
146
147
148 };
149
150
151 #include "SMDS_MeshElement.lxx"
152
153
154
155 // other inline functions and methods (like "C++: function call" methods)
156 //
157
158
159 #endif