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
22 #include "utilities.h"
23 #include "SMDS_VolumeOfNodes.hxx"
24 #include "SMDS_MeshNode.hxx"
26 ///////////////////////////////////////////////////////////////////////////////
27 /// Create an hexahedron. node 1,2,3,4 and 5,6,7,8 are quadrangle and
28 /// 5,1 and 7,3 are an edges.
29 ///////////////////////////////////////////////////////////////////////////////
30 SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
31 const SMDS_MeshNode * node1,
32 const SMDS_MeshNode * node2,
33 const SMDS_MeshNode * node3,
34 const SMDS_MeshNode * node4,
35 const SMDS_MeshNode * node5,
36 const SMDS_MeshNode * node6,
37 const SMDS_MeshNode * node7,
38 const SMDS_MeshNode * node8)
51 SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
52 const SMDS_MeshNode * node1,
53 const SMDS_MeshNode * node2,
54 const SMDS_MeshNode * node3,
55 const SMDS_MeshNode * node4)
64 SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
65 const SMDS_MeshNode * node1,
66 const SMDS_MeshNode * node2,
67 const SMDS_MeshNode * node3,
68 const SMDS_MeshNode * node4,
69 const SMDS_MeshNode * node5)
79 SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
80 const SMDS_MeshNode * node1,
81 const SMDS_MeshNode * node2,
82 const SMDS_MeshNode * node3,
83 const SMDS_MeshNode * node4,
84 const SMDS_MeshNode * node5,
85 const SMDS_MeshNode * node6)
95 //=======================================================================
98 //=======================================================================
100 void SMDS_VolumeOfNodes::Print(ostream & OS) const
102 OS << "volume <" << GetID() << "> : ";
104 for (i = 0; i < NbNodes(); ++i) OS << myNodes[i] << ",";
105 OS << myNodes[NbNodes()-1]<< ") " << endl;
108 int SMDS_VolumeOfNodes::NbFaces() const
116 default: MESSAGE("invalid number of nodes");
120 int SMDS_VolumeOfNodes::NbNodes() const
122 return myNodes.size();
125 int SMDS_VolumeOfNodes::NbEdges() const
133 default: MESSAGE("invalid number of nodes");
137 class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
139 const vector<const SMDS_MeshNode*>& mySet;
142 SMDS_VolumeOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
147 return index<mySet.size();
150 const SMDS_MeshElement* next()
153 return mySet[index-1];
157 SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
158 elementsIterator(SMDSAbs_ElementType type) const
163 return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
165 return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes));
167 MESSAGE("ERROR : Iterator not implemented");
168 return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
172 SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
174 return SMDSAbs_Volume;