Salome HOME
Remove Opencascade dependencies
[modules/smesh.git] / src / SMDS / SMDS_MeshElement.cxx
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.cxx
25 //  Author : Jean-Michel BOULCOURT
26 //  Module : SMESH
27
28 using namespace std;
29 #include "SMDS_MeshElement.ixx"
30
31 //=======================================================================
32 //function : SMDS_MeshElement
33 //purpose  : 
34 //=======================================================================
35
36 SMDS_MeshElement::SMDS_MeshElement(const Standard_Integer ID, const Standard_Integer nb,const SMDSAbs_ElementType Type) 
37   :myID(ID),myNbNodes(nb),myType(Type)
38 {
39 }
40
41 //=======================================================================
42 //function : GetConnections
43 //purpose  : 
44 //=======================================================================
45
46 Standard_Address SMDS_MeshElement::GetConnections() const
47 {
48   return (Standard_Address)&myID;
49 }
50
51
52 //=======================================================================
53 //function : GetConnection
54 //purpose  : 
55 //=======================================================================
56
57 Standard_Integer SMDS_MeshElement::GetConnection(const Standard_Integer rank) const
58 {
59   return myID;
60 }
61
62
63 //=======================================================================
64 //function : InverseElements
65 //purpose  : 
66 //=======================================================================
67
68 const SMDS_ListOfMeshElement& SMDS_MeshElement::InverseElements() const
69 {
70   static SMDS_ListOfMeshElement empty;
71   return empty;
72 }
73
74 //=======================================================================
75 //function : ClearInverseElements
76 //purpose  : 
77 //=======================================================================
78
79 void SMDS_MeshElement::ClearInverseElements()
80 {
81 }
82
83 //=======================================================================
84 //function : AddInverseElement
85 //purpose  : 
86 //=======================================================================
87
88 void SMDS_MeshElement::AddInverseElement(const Handle(SMDS_MeshElement)& elem)
89 {
90 }
91
92 //=======================================================================
93 //function : NbEdges
94 //purpose  : 
95 //=======================================================================
96
97 Standard_Integer SMDS_MeshElement::NbEdges() const
98 {
99   return 0;
100 }
101
102 //=======================================================================
103 //function : NbFaces
104 //purpose  : 
105 //=======================================================================
106
107 Standard_Integer SMDS_MeshElement::NbFaces() const
108 {
109   return 0;
110 }
111
112
113 //=======================================================================
114 //function : GetEdgeDefinedByNodes
115 //purpose  : 
116 //=======================================================================
117
118 void SMDS_MeshElement::GetEdgeDefinedByNodes(const Standard_Integer rank,
119                                              Standard_Integer& idnode1,
120                                              Standard_Integer& idnode2) const
121 {
122   idnode1 = 0;
123   idnode2 = 0;
124 }
125
126 //=======================================================================
127 //function : GetFaceDefinedByNodes
128 //purpose  : 
129 //=======================================================================
130
131 void SMDS_MeshElement::GetFaceDefinedByNodes(const Standard_Integer rank,
132                                              const Standard_Address idnode,
133                                              Standard_Integer& nb) const
134 {
135   nb = 0;
136 }
137
138 //=======================================================================
139 //function : SetNormal
140 //purpose  : 
141 //=======================================================================
142
143 void SMDS_MeshElement::SetNormal(const Standard_Integer rank,
144                                  const Standard_Real vx,
145                                  const Standard_Real vy,
146                                  const Standard_Real vz)
147
148 {
149   if (myNormals.IsNull()) {
150     myNormals = new TColgp_HArray1OfDir(1,NbNodes());
151   }
152   myNormals->SetValue(rank, gp_Dir(vx,vy,vz));
153 }
154
155 //=======================================================================
156 //function : SetNormal
157 //purpose  : 
158 //=======================================================================
159
160 void SMDS_MeshElement::SetNormal(const Standard_Integer rank,
161                                  const gp_Vec& V)
162 {
163   if (myNormals.IsNull()) {
164     myNormals = new TColgp_HArray1OfDir(1,NbNodes());
165   }
166   myNormals->SetValue(rank, gp_Dir(V));
167 }
168
169 //=======================================================================
170 //function : GetNormal
171 //purpose  : 
172 //=======================================================================
173
174 gp_Dir SMDS_MeshElement::GetNormal(const Standard_Integer rank) 
175 {
176   if (myNormals.IsNull()) {
177     myNormals = new TColgp_HArray1OfDir(1,NbNodes());
178   }
179   return myNormals->Value(rank);
180 }
181
182 //=======================================================================
183 //function : Print
184 //purpose  : 
185 //=======================================================================
186
187 void SMDS_MeshElement::Print(Standard_OStream& OS) const
188 {
189   OS << "dump of mesh element" << endl;
190 }
191
192
193 Standard_OStream& operator << (Standard_OStream& OS
194                               ,const Handle(SMDS_MeshElement)& ME) 
195 {
196   ME->Print(OS);
197   return OS;
198 }