Salome HOME
make GetLength const
[modules/smesh.git] / src / SMESH / SMESH_Mesh.hxx
1 //  SMESH SMESH : implementaion of SMESH idl descriptions
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   : SMESH_Mesh.hxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef _SMESH_MESH_HXX_
30 #define _SMESH_MESH_HXX_
31
32 #include "SMESHDS_Document.hxx"
33 #include "SMESHDS_Mesh.hxx"
34 #include "SMESH_Hypothesis.hxx"
35 #include "SMESH_subMesh.hxx"
36 #include "SMESHDS_ListOfCommand.hxx"
37 //#include "SMESHDS_ListOfAsciiString.hxx"
38 //#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx"
39
40
41 #include "Utils_SALOME_Exception.hxx"
42
43 #include <TopExp.hxx>
44 #include <TopExp_Explorer.hxx>
45 #include <TopoDS.hxx>
46 #include <TopoDS_Iterator.hxx>
47 #include <TopoDS_Compound.hxx>
48 #include <TopoDS_CompSolid.hxx>
49 #include <TopoDS_Solid.hxx>
50 #include <TopoDS_Shell.hxx>
51 #include <TopoDS_Face.hxx>
52 #include <TopoDS_Wire.hxx>
53 #include <TopoDS_Edge.hxx>
54 #include <TopoDS_Vertex.hxx>
55 #include <TopoDS_Shape.hxx>
56 #include <TopTools_IndexedMapOfShape.hxx>
57
58 #include <vector>
59 #include <list>
60 #include <map>
61
62 class SMESH_Gen;
63
64 class SMESH_Mesh
65 {
66 public:
67   SMESH_Mesh();
68   SMESH_Mesh(int localId,
69              int studyId,
70              SMESH_Gen* gen,
71              const Handle(SMESHDS_Document)& myDocument);
72
73   virtual ~SMESH_Mesh();
74
75   void ShapeToMesh(const TopoDS_Shape& aShape)
76     throw (SALOME_Exception);
77
78   bool AddHypothesis(const TopoDS_Shape& aSubShape,
79                      int anHypId)
80     throw (SALOME_Exception);
81
82   bool RemoveHypothesis(const TopoDS_Shape& aSubShape,
83                         int anHypId)
84     throw (SALOME_Exception);
85
86   const list<SMESHDS_Hypothesis*>&
87   GetHypothesisList(const TopoDS_Shape& aSubShape)
88     throw (SALOME_Exception);
89
90   const SMESHDS_ListOfCommand& GetLog()
91     throw (SALOME_Exception);
92
93 //   const SMESHDS_ListOfAsciiString& GetLog()
94 //     throw (SALOME_Exception);
95
96   void ClearLog()
97     throw (SALOME_Exception);
98
99   int GetId();
100  
101   const Handle(SMESHDS_Mesh)& GetMeshDS();
102
103   SMESH_Gen* GetGen();
104
105   SMESH_subMesh* GetSubMesh(const TopoDS_Shape & aSubShape)
106     throw (SALOME_Exception);
107
108   SMESH_subMesh* GetSubMeshContaining(const TopoDS_Shape & aSubShape)
109     throw (SALOME_Exception);
110
111   const list <SMESH_subMesh*>&
112   GetSubMeshUsingHypothesis(SMESHDS_Hypothesis* anHyp)
113     throw (SALOME_Exception);
114
115   void ExportDAT( const char* file )
116     throw (SALOME_Exception);
117   void ExportMED( const char* file )
118     throw (SALOME_Exception);
119   void ExportUNV( const char* file )
120     throw (SALOME_Exception);
121     
122   int NbNodes()
123     throw (SALOME_Exception);
124   
125   int NbEdges()
126     throw (SALOME_Exception);
127   
128   int NbFaces()
129     throw (SALOME_Exception);
130
131   int NbTriangles()
132     throw (SALOME_Exception);
133
134   int NbQuadrangles()
135     throw (SALOME_Exception);
136   
137   int NbVolumes()
138     throw (SALOME_Exception);
139
140   int NbTetras()
141     throw (SALOME_Exception);
142
143   int NbHexas()
144     throw (SALOME_Exception);
145   
146   int NbSubMesh()
147     throw (SALOME_Exception);
148   
149
150 private:
151
152   int _id;          // id given by creator (unique within the creator instance)
153   int _studyId;
154   int _idDoc;       // id given by SMESHDS_Document
155   bool _isShapeToMesh; // set to true when a shape is given (only once)
156   list<SMESHDS_Hypothesis*> _subShapeHypothesisList;
157   list<SMESH_subMesh*> _subMeshesUsingHypothesisList;
158   Handle (SMESHDS_Document) _myDocument;
159   Handle (SMESHDS_Mesh) _myMeshDS;
160   TopTools_IndexedMapOfShape _subShapes;
161   map<int, SMESH_subMesh*> _mapSubMesh;
162   SMESH_Gen* _gen;
163 };
164
165 #endif