Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/smesh.git] / src / SMESH_I / SMESH_Mesh_i.hxx
1 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
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_i.hxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef _SMESH_MESH_I_HXX_
30 #define _SMESH_MESH_I_HXX_
31
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SMESH_Mesh)
34 #include CORBA_SERVER_HEADER(SMESH_Group)
35 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
36 #include CORBA_CLIENT_HEADER(GEOM_Gen)
37 #include CORBA_CLIENT_HEADER(GEOM_Shape)
38 #include CORBA_CLIENT_HEADER(MED)
39
40 class SMESH_Gen_i;
41 class SMESH_Group_i;
42
43 #include "SMESH_Hypothesis.hxx"
44 #include "SMESH_Mesh.hxx"
45 #include "SMESH_subMesh_i.hxx"
46 #include "SMESH_subMesh.hxx"
47 #include "SMESH_topo.hxx"
48
49 #include <map>
50
51 #include "SALOME_GenericObj_i.hh"
52
53 class SMESH_Mesh_i:
54   public virtual POA_SMESH::SMESH_Mesh,
55   public virtual SALOME::GenericObj_i
56 {
57 public:
58   SMESH_Mesh_i();
59   SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
60                 SMESH_Gen_i*            myGen_i,
61                 CORBA::Long             studyId );
62
63   virtual ~SMESH_Mesh_i();
64
65   // --- CORBA
66   void SetShape( GEOM::GEOM_Shape_ptr theShape )
67     throw (SALOME::SALOME_Exception);
68
69   SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
70                                          SMESH::SMESH_Hypothesis_ptr anHyp)
71     throw (SALOME::SALOME_Exception);
72
73   SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
74                                             SMESH::SMESH_Hypothesis_ptr anHyp)
75     throw (SALOME::SALOME_Exception);
76
77   SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
78     throw (SALOME::SALOME_Exception);
79
80   SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Shape_ptr aSubShape, const char* theName)
81     throw (SALOME::SALOME_Exception);
82
83   void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
84     throw (SALOME::SALOME_Exception);
85
86   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
87     throw (SALOME::SALOME_Exception);
88   
89   void RemoveGroup( SMESH::SMESH_Group_ptr theGroup )
90     throw (SALOME::SALOME_Exception);
91
92 //    SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
93 //      throw (SALOME::SALOME_Exception);
94
95   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
96     throw (SALOME::SALOME_Exception);
97
98   SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
99
100   void ClearLog()
101     throw (SALOME::SALOME_Exception);
102
103   CORBA::Long GetId()
104     throw (SALOME::SALOME_Exception);
105
106   CORBA::Long GetStudyId()
107     throw (SALOME::SALOME_Exception);
108
109   // --- C++ interface
110
111   void SetImpl(::SMESH_Mesh* impl);
112   ::SMESH_Mesh& GetImpl();         // :: force no namespace here
113
114   SMESH_Gen_i* GetGen() { return _gen_i; }
115   
116   /*!
117    * consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
118    */
119   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
120     throw (SALOME::SALOME_Exception);
121
122   void ExportMED( const char* file, CORBA::Boolean auto_groups )
123     throw (SALOME::SALOME_Exception);
124   void ExportDAT( const char* file )
125     throw (SALOME::SALOME_Exception);
126   void ExportUNV( const char* file )
127     throw (SALOME::SALOME_Exception);
128
129   SALOME_MED::MESH_ptr GetMEDMesh()
130     throw (SALOME::SALOME_Exception);
131   
132   CORBA::Long NbNodes()
133     throw (SALOME::SALOME_Exception);
134   
135   CORBA::Long NbEdges()
136     throw (SALOME::SALOME_Exception);
137   
138   CORBA::Long NbFaces()
139     throw (SALOME::SALOME_Exception);
140
141   CORBA::Long NbTriangles()
142     throw (SALOME::SALOME_Exception);
143
144   CORBA::Long NbQuadrangles()
145     throw (SALOME::SALOME_Exception);
146   
147   CORBA::Long NbVolumes()
148     throw (SALOME::SALOME_Exception);
149
150   CORBA::Long NbTetras()
151     throw (SALOME::SALOME_Exception);
152
153   CORBA::Long NbHexas()
154     throw (SALOME::SALOME_Exception);
155   
156   CORBA::Long NbPyramids()
157     throw (SALOME::SALOME_Exception);
158   
159   CORBA::Long NbPrisms()
160     throw (SALOME::SALOME_Exception);
161   
162   CORBA::Long NbSubMesh()
163     throw (SALOME::SALOME_Exception);
164
165   char* Dump();
166   
167   // Internal methods not available through CORBA
168   // They are called by corresponding interface methods
169   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
170                                                     SMESH::SMESH_Hypothesis_ptr anHyp);
171
172   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
173                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
174   
175   bool setShape( GEOM::GEOM_Shape_ptr theShape );
176
177   int importMEDFile( const char* theFileName, const char* theMeshName );
178
179   SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Shape_ptr theSubShape );
180
181   void removeSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Shape_ptr theSubShape );
182
183   SMESH::SMESH_Group_ptr createGroup( SMESH::ElementType theElemType, const char* theName );
184
185   void removeGroup( const int theId );
186
187   map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
188   map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
189
190 private:
191   static int myIdGenerator;
192   ::SMESH_Mesh* _impl;  // :: force no namespace here
193   SMESH_Gen_i* _gen_i;
194   int _id;          // id given by creator (unique within the creator instance)
195   int _studyId;
196   map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
197   map<int, SMESH::SMESH_Group_ptr>      _mapGroups;
198   map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
199 };
200
201 #endif
202