Salome HOME
Update to match the change of SMDS (new DS).
[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 "SMESHDS_Command.hxx"
35 #include "SMESH_Hypothesis.hxx"
36 #include "SMESH_subMesh.hxx"
37 #include "Utils_SALOME_Exception.hxx"
38
39 #include <TopExp.hxx>
40 #include <TopExp_Explorer.hxx>
41 #include <TopoDS.hxx>
42 #include <TopoDS_Iterator.hxx>
43 #include <TopoDS_Compound.hxx>
44 #include <TopoDS_CompSolid.hxx>
45 #include <TopoDS_Solid.hxx>
46 #include <TopoDS_Shell.hxx>
47 #include <TopoDS_Face.hxx>
48 #include <TopoDS_Wire.hxx>
49 #include <TopoDS_Edge.hxx>
50 #include <TopoDS_Vertex.hxx>
51 #include <TopoDS_Shape.hxx>
52 #include <TopTools_IndexedMapOfShape.hxx>
53
54 #include <vector>
55 #include <list>
56 #include <map>
57
58 class SMESH_Gen;
59
60 class SMESH_Mesh
61 {
62   public:
63         SMESH_Mesh();
64         SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen,
65                 SMESHDS_Document * myDocument);
66
67         virtual ~ SMESH_Mesh();
68
69         void ShapeToMesh(const TopoDS_Shape & aShape) throw(SALOME_Exception);
70
71         bool AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
72                 throw(SALOME_Exception);
73
74         bool RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
75                 throw(SALOME_Exception);
76
77         const list <const SMESHDS_Hypothesis * >&
78                 GetHypothesisList(const TopoDS_Shape & aSubShape)
79                 throw(SALOME_Exception);
80
81         const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
82
83 //   const SMESHDS_ListOfAsciiString& GetLog()
84 //     throw (SALOME_Exception);
85
86         void ClearLog() throw(SALOME_Exception);
87
88         int GetId();
89
90         SMESHDS_Mesh * GetMeshDS();
91
92         SMESH_Gen *GetGen();
93
94         SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
95                 throw(SALOME_Exception);
96
97         SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape)
98                 throw(SALOME_Exception);
99
100         const list < SMESH_subMesh * >&
101                 GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
102                 throw(SALOME_Exception);
103
104         void ExportDAT(const char *file) throw(SALOME_Exception);
105         void ExportMED(const char *file) throw(SALOME_Exception);
106         void ExportUNV(const char *file) throw(SALOME_Exception);
107
108         int NbNodes() throw(SALOME_Exception);
109
110         int NbEdges() throw(SALOME_Exception);
111
112         int NbFaces() throw(SALOME_Exception);
113
114         int NbTriangles() throw(SALOME_Exception);
115
116         int NbQuadrangles() throw(SALOME_Exception);
117
118         int NbVolumes() throw(SALOME_Exception);
119
120         int NbTetras() throw(SALOME_Exception);
121
122         int NbHexas() throw(SALOME_Exception);
123
124         int NbSubMesh() throw(SALOME_Exception);
125
126   private:
127
128         int _id;                                        // id given by creator (unique within the creator instance)
129         int _studyId;
130         int _idDoc;                                     // id given by SMESHDS_Document
131         bool _isShapeToMesh;            // set to true when a shape is given (only once)
132         list<const SMESHDS_Hypothesis *> _subShapeHypothesisList;
133         list <SMESH_subMesh *> _subMeshesUsingHypothesisList;
134         SMESHDS_Document * _myDocument;
135         SMESHDS_Mesh * _myMeshDS;
136         TopTools_IndexedMapOfShape _subShapes;
137         map <int, SMESH_subMesh *>_mapSubMesh;
138         SMESH_Gen *_gen;
139 };
140
141 #endif