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_MeshElement.cxx
25 // Author : Jean-Michel BOULCOURT
29 #include "SMDS_MeshElement.ixx"
31 //=======================================================================
32 //function : SMDS_MeshElement
34 //=======================================================================
36 SMDS_MeshElement::SMDS_MeshElement(const Standard_Integer ID, const Standard_Integer nb,const SMDSAbs_ElementType Type)
37 :myID(ID),myNbNodes(nb),myType(Type)
41 //=======================================================================
42 //function : GetConnections
44 //=======================================================================
46 Standard_Address SMDS_MeshElement::GetConnections() const
48 return (Standard_Address)&myID;
52 //=======================================================================
53 //function : GetConnection
55 //=======================================================================
57 Standard_Integer SMDS_MeshElement::GetConnection(const Standard_Integer rank) const
63 //=======================================================================
64 //function : InverseElements
66 //=======================================================================
68 const SMDS_ListOfMeshElement& SMDS_MeshElement::InverseElements() const
70 static SMDS_ListOfMeshElement empty;
74 //=======================================================================
75 //function : ClearInverseElements
77 //=======================================================================
79 void SMDS_MeshElement::ClearInverseElements()
83 //=======================================================================
84 //function : AddInverseElement
86 //=======================================================================
88 void SMDS_MeshElement::AddInverseElement(const Handle(SMDS_MeshElement)& elem)
92 //=======================================================================
95 //=======================================================================
97 Standard_Integer SMDS_MeshElement::NbEdges() const
102 //=======================================================================
105 //=======================================================================
107 Standard_Integer SMDS_MeshElement::NbFaces() const
113 //=======================================================================
114 //function : GetEdgeDefinedByNodes
116 //=======================================================================
118 void SMDS_MeshElement::GetEdgeDefinedByNodes(const Standard_Integer rank,
119 Standard_Integer& idnode1,
120 Standard_Integer& idnode2) const
126 //=======================================================================
127 //function : GetFaceDefinedByNodes
129 //=======================================================================
131 void SMDS_MeshElement::GetFaceDefinedByNodes(const Standard_Integer rank,
132 const Standard_Address idnode,
133 Standard_Integer& nb) const
138 //=======================================================================
139 //function : SetNormal
141 //=======================================================================
143 void SMDS_MeshElement::SetNormal(const Standard_Integer rank,
144 const Standard_Real vx,
145 const Standard_Real vy,
146 const Standard_Real vz)
149 if (myNormals.IsNull()) {
150 myNormals = new TColgp_HArray1OfDir(1,NbNodes());
152 myNormals->SetValue(rank, gp_Dir(vx,vy,vz));
155 //=======================================================================
156 //function : SetNormal
158 //=======================================================================
160 void SMDS_MeshElement::SetNormal(const Standard_Integer rank,
163 if (myNormals.IsNull()) {
164 myNormals = new TColgp_HArray1OfDir(1,NbNodes());
166 myNormals->SetValue(rank, gp_Dir(V));
169 //=======================================================================
170 //function : GetNormal
172 //=======================================================================
174 gp_Dir SMDS_MeshElement::GetNormal(const Standard_Integer rank)
176 if (myNormals.IsNull()) {
177 myNormals = new TColgp_HArray1OfDir(1,NbNodes());
179 return myNormals->Value(rank);
182 //=======================================================================
185 //=======================================================================
187 void SMDS_MeshElement::Print(Standard_OStream& OS) const
189 OS << "dump of mesh element" << endl;
193 Standard_OStream& operator << (Standard_OStream& OS
194 ,const Handle(SMDS_MeshElement)& ME)