Salome HOME
0021952: Add an option to write planar meshes as 3D meshes in MED files
[modules/smesh.git] / src / SMESH_I / SMESH_Mesh_i.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SMESH_Mesh_i.hxx
23 //  Author : Paul RASCLE, EDF
24 //  Module : SMESH
25
26 #ifndef _SMESH_MESH_I_HXX_
27 #define _SMESH_MESH_I_HXX_
28
29 #include "SMESH.hxx"
30
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SMESH_Gen)
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(MED)
38
39 #include "SMESH_Hypothesis.hxx"
40 #include "SMESH_Mesh.hxx"
41 #include "SMESH_subMesh.hxx"
42
43 #include "SALOME_GenericObj_i.hh"
44
45 class SMESH_Gen_i;
46 class SMESH_GroupBase_i;
47 class SMESH_subMesh_i;
48 class SMESH_PreMeshInfo;
49
50 #include <map>
51
52 class SMESH_I_EXPORT SMESH_Mesh_i:
53   public virtual POA_SMESH::SMESH_Mesh,
54   public virtual SALOME::GenericObj_i
55 {
56   SMESH_Mesh_i();
57   SMESH_Mesh_i(const SMESH_Mesh_i&);
58 public:
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
67   void SetShape( GEOM::GEOM_Object_ptr theShapeObject )
68     throw (SALOME::SALOME_Exception);
69
70   CORBA::Boolean HasShapeToMesh()
71     throw (SALOME::SALOME_Exception);
72
73   GEOM::GEOM_Object_ptr GetShapeToMesh()
74     throw (SALOME::SALOME_Exception);
75
76   CORBA::Boolean IsLoaded()
77     throw (SALOME::SALOME_Exception);
78
79   void Load()
80     throw (SALOME::SALOME_Exception);
81
82   void Clear()
83     throw (SALOME::SALOME_Exception);
84
85   void ClearSubMesh(CORBA::Long ShapeID)
86     throw (SALOME::SALOME_Exception);
87
88   SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
89                                          SMESH::SMESH_Hypothesis_ptr anHyp)
90     throw (SALOME::SALOME_Exception);
91
92   SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
93                                             SMESH::SMESH_Hypothesis_ptr anHyp)
94     throw (SALOME::SALOME_Exception);
95
96   SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
97     throw (SALOME::SALOME_Exception);
98
99   SMESH::submesh_array* GetSubMeshes()
100     throw (SALOME::SALOME_Exception);
101
102   SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName)
103     throw (SALOME::SALOME_Exception);
104
105   void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
106     throw (SALOME::SALOME_Exception);
107
108   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
109     throw (SALOME::SALOME_Exception);
110
111   SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType    theElemType,
112                                                    const char*           theName,
113                                                    GEOM::GEOM_Object_ptr theGeomObj )
114     throw (SALOME::SALOME_Exception);
115
116   SMESH::SMESH_GroupOnFilter_ptr CreateGroupFromFilter(SMESH::ElementType theElemType,
117                                                        const char*        theName,
118                                                        SMESH::Filter_ptr  theFilter )
119     throw (SALOME::SALOME_Exception);
120
121   void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
122     throw (SALOME::SALOME_Exception);
123
124   void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
125     throw (SALOME::SALOME_Exception);
126
127   SMESH::ListOfGroups* GetGroups()
128     throw (SALOME::SALOME_Exception);
129
130   CORBA::Long NbGroups()
131     throw (SALOME::SALOME_Exception);
132
133   SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
134                                       SMESH::SMESH_GroupBase_ptr theGroup2,
135                                       const char* theName )
136     throw (SALOME::SALOME_Exception);
137
138   SMESH::SMESH_Group_ptr UnionListOfGroups( const SMESH::ListOfGroups& theGroups,
139                                             const char* theName)
140     throw (SALOME::SALOME_Exception);
141
142   SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
143                                           SMESH::SMESH_GroupBase_ptr theGroup2,
144                                           const char* theName )
145     throw (SALOME::SALOME_Exception);
146
147   SMESH::SMESH_Group_ptr IntersectListOfGroups( const SMESH::ListOfGroups&  theGroups,
148                                                 const char* theName )
149     throw (SALOME::SALOME_Exception);
150
151   SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
152                                     SMESH::SMESH_GroupBase_ptr theGroup2,
153                                     const char* theName )
154     throw (SALOME::SALOME_Exception);
155
156   SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups,
157                                           const SMESH::ListOfGroups& theToolGroups,
158                                           const char* theName )
159     throw (SALOME::SALOME_Exception);
160
161   SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups,
162                                          SMESH::ElementType theElemType,
163                                          const char* theName )
164     throw (SALOME::SALOME_Exception);
165
166
167   SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupBase_ptr theGroupOn )
168     throw (SALOME::SALOME_Exception);
169
170   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
171     throw (SALOME::SALOME_Exception);
172
173   SMESH::SMESH_MeshEditor_ptr GetMeshEditor() throw (SALOME::SALOME_Exception);
174
175   SMESH::SMESH_MeshEditor_ptr GetMeshEditPreviewer() throw (SALOME::SALOME_Exception);
176
177   CORBA::Boolean HasModificationsToDiscard() throw (SALOME::SALOME_Exception);
178
179   void ClearLog() throw (SALOME::SALOME_Exception);
180
181   CORBA::Long GetId() throw (SALOME::SALOME_Exception);
182
183   CORBA::Long GetStudyId() throw (SALOME::SALOME_Exception);
184
185   // --- C++ interface
186
187   void SetImpl(::SMESH_Mesh* impl);
188   ::SMESH_Mesh& GetImpl();         // :: force no namespace here
189
190   SMESH_Gen_i* GetGen() { return _gen_i; }
191
192   int ImportUNVFile( const char* theFileName )
193     throw (SALOME::SALOME_Exception);
194
195   int ImportSTLFile( const char* theFileName )
196     throw (SALOME::SALOME_Exception);
197
198   SMESH::ComputeError* ImportGMFFile( const char* theFileName,
199                                       bool        theMakeRequiredGroups)
200     throw (SALOME::SALOME_Exception);
201
202   /*!
203    * consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
204    */
205   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
206     throw (SALOME::SALOME_Exception);
207
208   SMESH::DriverMED_ReadStatus ImportCGNSFile( const char*  theFileName,
209                                               const int    theMeshIndex,
210                                               std::string& theMeshName)
211     throw (SALOME::SALOME_Exception);
212
213   /*!
214    *  Auto color
215    */
216   void SetAutoColor(CORBA::Boolean theAutoColor)
217     throw (SALOME::SALOME_Exception);
218
219   CORBA::Boolean GetAutoColor()
220     throw (SALOME::SALOME_Exception);
221
222   /*! Check group names for duplications.
223    *  Consider maximum group name length stored in MED file.
224    */
225   CORBA::Boolean HasDuplicatedGroupNamesMED();
226   /*!
227    * Return string representation of a MED file version comprising nbDigits
228    */
229   char* GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits);
230
231   void ExportToMEDX( const char*        file,
232                      CORBA::Boolean     auto_groups,
233                      SMESH::MED_VERSION version,
234                      CORBA::Boolean     overwrite,
235                      CORBA::Boolean     autoDimension=true) throw (SALOME::SALOME_Exception);
236   void ExportToMED ( const char*        file,
237                      CORBA::Boolean     auto_groups,
238                      SMESH::MED_VERSION version ) throw (SALOME::SALOME_Exception);
239   void ExportMED   ( const char*        file,
240                      CORBA::Boolean     auto_groups ) throw (SALOME::SALOME_Exception);
241
242   void ExportSAUV( const char* file, CORBA::Boolean auto_groups ) throw (SALOME::SALOME_Exception);
243
244   void ExportDAT( const char* file ) throw (SALOME::SALOME_Exception);
245   void ExportUNV( const char* file ) throw (SALOME::SALOME_Exception);
246   void ExportSTL( const char* file, bool isascii ) throw (SALOME::SALOME_Exception);
247   void ExportCGNS(SMESH::SMESH_IDSource_ptr meshPart,
248                   const char*               file,
249                   CORBA::Boolean            overwrite) throw (SALOME::SALOME_Exception);
250   void ExportGMF(SMESH::SMESH_IDSource_ptr meshPart,
251                  const char*               file,
252                  CORBA::Boolean            withRequiredGroups) throw (SALOME::SALOME_Exception);
253
254   void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
255                        const char*               file,
256                        CORBA::Boolean            auto_groups,
257                        SMESH::MED_VERSION        version,
258                        CORBA::Boolean            overwrite,
259                        CORBA::Boolean            autoDim=true) throw (SALOME::SALOME_Exception);
260   void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
261                        const char*               file) throw (SALOME::SALOME_Exception);
262   void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
263                        const char*               file) throw (SALOME::SALOME_Exception);
264   void ExportPartToSTL(SMESH::SMESH_IDSource_ptr meshPart,
265                        const char*               file,
266                        CORBA::Boolean            isascii) throw (SALOME::SALOME_Exception);
267
268   SALOME_MED::MESH_ptr GetMEDMesh()
269     throw (SALOME::SALOME_Exception);
270
271   CORBA::Long NbNodes()
272     throw (SALOME::SALOME_Exception);
273
274   CORBA::Long NbElements()
275     throw (SALOME::SALOME_Exception);
276
277   CORBA::Long Nb0DElements()
278     throw (SALOME::SALOME_Exception);
279
280   CORBA::Long NbBalls()
281     throw (SALOME::SALOME_Exception);
282
283   CORBA::Long NbEdges()
284     throw (SALOME::SALOME_Exception);
285
286   CORBA::Long NbEdgesOfOrder(SMESH::ElementOrder order)
287     throw (SALOME::SALOME_Exception);
288
289   CORBA::Long NbFaces()
290     throw (SALOME::SALOME_Exception);
291
292   CORBA::Long NbFacesOfOrder(SMESH::ElementOrder order)
293     throw (SALOME::SALOME_Exception);
294
295   CORBA::Long NbTriangles()
296     throw (SALOME::SALOME_Exception);
297
298   CORBA::Long NbTrianglesOfOrder(SMESH::ElementOrder order)
299     throw (SALOME::SALOME_Exception);
300
301   CORBA::Long NbBiQuadTriangles()
302     throw (SALOME::SALOME_Exception);
303
304   CORBA::Long NbQuadrangles()
305     throw (SALOME::SALOME_Exception);
306
307   CORBA::Long NbQuadranglesOfOrder(SMESH::ElementOrder order)
308     throw (SALOME::SALOME_Exception);
309
310   CORBA::Long NbBiQuadQuadrangles()
311     throw (SALOME::SALOME_Exception);
312
313   CORBA::Long NbPolygons()
314     throw (SALOME::SALOME_Exception);
315
316   CORBA::Long NbVolumes()
317     throw (SALOME::SALOME_Exception);
318
319   CORBA::Long NbVolumesOfOrder(SMESH::ElementOrder order)
320     throw (SALOME::SALOME_Exception);
321
322   CORBA::Long NbTetras()
323     throw (SALOME::SALOME_Exception);
324
325   CORBA::Long NbTetrasOfOrder(SMESH::ElementOrder order)
326     throw (SALOME::SALOME_Exception);
327
328   CORBA::Long NbHexas()
329     throw (SALOME::SALOME_Exception);
330
331   CORBA::Long NbHexasOfOrder(SMESH::ElementOrder order)
332     throw (SALOME::SALOME_Exception);
333
334   CORBA::Long NbTriQuadraticHexas()
335     throw (SALOME::SALOME_Exception);
336
337   CORBA::Long NbPyramids()
338     throw (SALOME::SALOME_Exception);
339
340   CORBA::Long NbPyramidsOfOrder(SMESH::ElementOrder order)
341     throw (SALOME::SALOME_Exception);
342
343   CORBA::Long NbPrisms()
344     throw (SALOME::SALOME_Exception);
345
346   CORBA::Long NbPrismsOfOrder(SMESH::ElementOrder order)
347     throw (SALOME::SALOME_Exception);
348
349   CORBA::Long NbHexagonalPrisms()
350     throw (SALOME::SALOME_Exception);
351
352   CORBA::Long NbPolyhedrons()
353     throw (SALOME::SALOME_Exception);
354
355   CORBA::Long NbSubMesh()
356     throw (SALOME::SALOME_Exception);
357
358   SMESH::long_array* GetElementsId()
359     throw (SALOME::SALOME_Exception);
360
361   SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
362     throw (SALOME::SALOME_Exception);
363
364   SMESH::long_array* GetNodesId()
365     throw (SALOME::SALOME_Exception);
366
367   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
368     throw (SALOME::SALOME_Exception);
369
370   SMESH::EntityType GetElementGeomType( CORBA::Long id )
371     throw (SALOME::SALOME_Exception);
372
373   /*!
374    * Returns ID of elements for given submesh
375    */
376   SMESH::long_array* GetSubMeshElementsId(CORBA::Long ShapeID)
377     throw (SALOME::SALOME_Exception);
378
379   /*!
380    * Returns ID of nodes for given submesh
381    * If param all==true - returns all nodes, else -
382    * returns only nodes on shapes.
383    */
384   SMESH::long_array* GetSubMeshNodesId(CORBA::Long ShapeID, CORBA::Boolean all)
385     throw (SALOME::SALOME_Exception);
386
387   /*!
388    * Returns type of elements for given submesh
389    */
390   SMESH::ElementType GetSubMeshElementType(CORBA::Long ShapeID)
391     throw (SALOME::SALOME_Exception);
392
393   char* Dump();
394
395   // Create groups of elements preventing computation of a sub-shape
396   SMESH::ListOfGroups* MakeGroupsOfBadInputElements( int         theSubShapeID,
397                                                      const char* theGroupName)
398     throw (SALOME::SALOME_Exception);
399
400   // Internal methods not available through CORBA
401   // They are called by corresponding interface methods
402   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
403                                                     SMESH::SMESH_Hypothesis_ptr anHyp);
404
405   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
406                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
407
408   static SMESH::Hypothesis_Status
409   ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
410
411   static void PrepareForWriting (const char* file, bool overwrite = true);
412
413   //int importMEDFile( const char* theFileName, const char* theMeshName );
414
415   SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
416
417   bool removeSubMesh(SMESH::SMESH_subMesh_ptr theSubMesh,
418                      GEOM::GEOM_Object_ptr theSubShapeObject );
419
420   SMESH::SMESH_GroupBase_ptr createGroup(SMESH::ElementType        theElemType,
421                                          const char*               theName,
422                                          const TopoDS_Shape&       theShape = TopoDS_Shape(),
423                                          const SMESH_PredicatePtr& thePred = SMESH_PredicatePtr());
424
425   void removeGroup( const int theId );
426
427   SMESH::SMESH_subMesh_ptr getSubMesh(int shapeID);
428   // return an existing subMesh object for the shapeID. shapeID == submeshID.
429
430   const std::map<int, SMESH::SMESH_GroupBase_ptr>& getGroups() { return _mapGroups; }
431   // return existing group objects
432
433   void onHypothesisModified();
434   // callback from _impl to forget not loaded mesh data (issue 0021208)
435
436   void checkMeshLoaded();
437
438   /*!
439    * \brief Update hypotheses assigned to geom groups if the latter change
440    *
441    * NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
442    */
443   void CheckGeomGroupModif();
444
445   CORBA::LongLong GetMeshPtr();
446
447   /*!
448    * \brief Assure that all groups are published
449    */
450   void CreateGroupServants();
451
452   /*!
453    * \brief Return groups cantained in _mapGroups by their IDs
454    */
455   SMESH::ListOfGroups* GetGroups(const std::list<int>& groupIDs) const;
456
457   /*!
458    * Get XYZ coordinates of node as list of double
459    * If there is not node for given ID - returns empty list
460    */
461   SMESH::double_array* GetNodeXYZ(CORBA::Long id);
462
463   /*!
464    * For given node returns list of IDs of inverse elements
465    * If there is not node for given ID - returns empty list
466    */
467   SMESH::long_array* GetNodeInverseElements(CORBA::Long id);
468
469   /*!
470    * \brief Return position of a node on shape
471    */
472   SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID);
473
474   /*!
475    * \brief Return position of an element on shape
476    */
477   SMESH::ElementPosition GetElementPosition(CORBA::Long ElemID);
478
479   /*!
480    * If given element is node returns IDs of shape from position
481    * If there is not node for given ID - returns -1
482    */
483   CORBA::Long GetShapeID(CORBA::Long id);
484
485   /*!
486    * For given element returns ID of result shape after
487    * ::FindShape() from SMESH_MeshEditor
488    * If there is not element for given ID - returns -1
489    */
490   CORBA::Long GetShapeIDForElem(CORBA::Long id);
491
492   /*!
493    * Returns number of nodes for given element
494    * If there is not element for given ID - returns -1
495    */
496   CORBA::Long GetElemNbNodes(CORBA::Long id);
497
498   /*!
499    * Returns IDs of nodes of given element
500    */
501   SMESH::long_array* GetElemNodes(CORBA::Long id);
502
503   /*!
504    * Returns ID of node by given index for given element
505    * If there is not element for given ID - returns -1
506    * If there is not node for given index - returns -2
507    */
508   CORBA::Long GetElemNode(CORBA::Long id, CORBA::Long index);
509
510   /*!
511    * Returns true if given node is medium node
512    * in given quadratic element
513    */
514   CORBA::Boolean IsMediumNode(CORBA::Long ide, CORBA::Long idn);
515
516   /*!
517    * Returns true if given node is medium node
518    * in one of quadratic elements
519    */
520   CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
521                                        SMESH::ElementType theElemType);
522
523   /*!
524    * Returns number of edges for given element
525    */
526   CORBA::Long ElemNbEdges(CORBA::Long id);
527
528   /*!
529    * Returns number of faces for given element
530    */
531   CORBA::Long ElemNbFaces(CORBA::Long id);
532   /*!
533    * Returns nodes of given face (counted from zero) for given element.
534    */
535   SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex);
536
537   /*!
538    * Returns an element based on all given nodes.
539    */
540   CORBA::Long FindElementByNodes(const SMESH::long_array& nodes);
541
542   /*!
543    * Returns true if given element is polygon
544    */
545   CORBA::Boolean IsPoly(CORBA::Long id);
546
547   /*!
548    * Returns true if given element is quadratic
549    */
550   CORBA::Boolean IsQuadratic(CORBA::Long id);
551
552   /*!
553    * Returns diameter of ball discrete element or zero in case of an invalid \a id
554    */
555   CORBA::Double GetBallDiameter(CORBA::Long id);
556
557   /*!
558    * Returns bary center for given element
559    */
560   SMESH::double_array* BaryCenter(CORBA::Long id);
561
562   /*!
563    * Returns information about imported MED file
564    */
565   virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
566
567   /*!
568    * Sets list of notebook variables used for Mesh operations separated by ":" symbol
569    */
570   void SetParameters (const char* theParameters);
571
572   /*!
573    * Returns list of notebook variables used for Mesh operations separated by ":" symbol
574    */
575   char* GetParameters();
576
577   /*!
578    * Returns list of notebook variables used for last Mesh operation
579    */
580   SMESH::string_array* GetLastParameters();
581
582   /*!
583    * Collect statistic of mesh elements given by iterator
584    */
585   static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
586                               SMESH::long_array&         theInfo);
587
588   /*!
589    * \brief Return submesh objects list in meshing order
590    */
591   virtual SMESH::submesh_array_array* GetMeshOrder();
592   /*!
593    * \brief Set submesh object order
594    */
595   virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
596
597
598   // =========================
599   // SMESH_IDSource interface
600   // =========================
601
602   virtual SMESH::long_array* GetIDs();
603   /*!
604    * Returns statistic of mesh elements
605    * Result array of number enityties
606    * Inherited from SMESH_IDSource
607    */
608   virtual SMESH::long_array* GetMeshInfo();
609   /*!
610    * Returns types of elements it contains
611    */
612   virtual SMESH::array_of_ElementType* GetTypes();
613   /*!
614    * Returns self
615    */
616   virtual SMESH::SMESH_Mesh_ptr GetMesh();
617   /*!
618    * Returns false if GetMeshInfo() returns incorrect information that may
619    * happen if mesh data is not yet fully loaded from the file of study.
620    */
621   bool IsMeshInfoCorrect();
622
623   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
624   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
625
626 private:
627   std::string prepareMeshNameAndGroups( const char* file, CORBA::Boolean overwrite );
628
629   /*!
630    * Check and correct names of mesh groups
631    */
632   void checkGroupNames();
633
634   /*!
635    * Convert submesh ids into submesh interfaces
636    */
637   void convertMeshOrder(const TListOfListOfInt&     theIdsOrder,
638                         SMESH::submesh_array_array& theSubMeshOrder,
639                         const bool                  theIsDump);
640
641 private:
642
643   static int    _idGenerator;
644   ::SMESH_Mesh* _impl;        // :: force no namespace here
645   SMESH_Gen_i*  _gen_i;
646   int           _id;          // id given by creator (unique within the creator instance)
647   int           _studyId;
648   std::map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
649   std::map<int, SMESH::SMESH_GroupBase_ptr>  _mapGroups;
650   std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
651   SALOME_MED::MedFileInfo_var _medFileInfo;
652   SMESH_PreMeshInfo*          _preMeshInfo; // mesh info before full loading from study file
653
654   SMESH_PreMeshInfo* & changePreMeshInfo() { return _preMeshInfo; }
655   friend class SMESH_PreMeshInfo;
656
657 private:
658
659   // Data used to track changes of GEOM groups
660   struct TGeomGroupData {
661     // keep study entry but not ior because GEOM_Object actually changes if
662     // number of items in a group varies (1) <-> (>1)
663     std::string       _groupEntry;
664     std::set<int>     _indices; // indices of group items within group's main shape
665     CORBA::Object_ptr _smeshObject; // SMESH object depending on GEOM group
666   };
667   std::list<TGeomGroupData> _geomGroupData;
668
669   /*!
670    * Remember GEOM group data
671    */
672   void addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
673                         CORBA::Object_ptr     theSmeshObj);
674   /*!
675    * Remove GEOM group data relating to removed smesh object
676    */
677   void removeGeomGroupData(CORBA::Object_ptr theSmeshObj);
678   /*!
679    * \brief Return new group contents if it has been changed and update group data
680    */
681   TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
682
683 };
684
685 #endif