Salome HOME
SALOME Forum bug: sub-mesh removal leads to an Exception in a re-opened study.
[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
38 #include "SMESH_Hypothesis.hxx"
39 #include "SMESH_Mesh.hxx"
40 #include "SMESH_subMesh.hxx"
41
42 #include "SALOME_GenericObj_i.hh"
43
44 class SMESH_Gen_i;
45 class SMESH_GroupBase_i;
46 class SMESH_subMesh_i;
47 class SMESH_PreMeshInfo;
48 class SMESH_MeshEditor_i;
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   CORBA::Double GetComputeProgress();
269
270   CORBA::Long NbNodes()
271     throw (SALOME::SALOME_Exception);
272
273   CORBA::Long NbElements()
274     throw (SALOME::SALOME_Exception);
275
276   CORBA::Long Nb0DElements()
277     throw (SALOME::SALOME_Exception);
278
279   CORBA::Long NbBalls()
280     throw (SALOME::SALOME_Exception);
281
282   CORBA::Long NbEdges()
283     throw (SALOME::SALOME_Exception);
284
285   CORBA::Long NbEdgesOfOrder(SMESH::ElementOrder order)
286     throw (SALOME::SALOME_Exception);
287
288   CORBA::Long NbFaces()
289     throw (SALOME::SALOME_Exception);
290
291   CORBA::Long NbFacesOfOrder(SMESH::ElementOrder order)
292     throw (SALOME::SALOME_Exception);
293
294   CORBA::Long NbTriangles()
295     throw (SALOME::SALOME_Exception);
296
297   CORBA::Long NbTrianglesOfOrder(SMESH::ElementOrder order)
298     throw (SALOME::SALOME_Exception);
299
300   CORBA::Long NbBiQuadTriangles()
301     throw (SALOME::SALOME_Exception);
302
303   CORBA::Long NbQuadrangles()
304     throw (SALOME::SALOME_Exception);
305
306   CORBA::Long NbQuadranglesOfOrder(SMESH::ElementOrder order)
307     throw (SALOME::SALOME_Exception);
308
309   CORBA::Long NbBiQuadQuadrangles()
310     throw (SALOME::SALOME_Exception);
311
312   CORBA::Long NbPolygons()
313     throw (SALOME::SALOME_Exception);
314
315   CORBA::Long NbVolumes()
316     throw (SALOME::SALOME_Exception);
317
318   CORBA::Long NbVolumesOfOrder(SMESH::ElementOrder order)
319     throw (SALOME::SALOME_Exception);
320
321   CORBA::Long NbTetras()
322     throw (SALOME::SALOME_Exception);
323
324   CORBA::Long NbTetrasOfOrder(SMESH::ElementOrder order)
325     throw (SALOME::SALOME_Exception);
326
327   CORBA::Long NbHexas()
328     throw (SALOME::SALOME_Exception);
329
330   CORBA::Long NbHexasOfOrder(SMESH::ElementOrder order)
331     throw (SALOME::SALOME_Exception);
332
333   CORBA::Long NbTriQuadraticHexas()
334     throw (SALOME::SALOME_Exception);
335
336   CORBA::Long NbPyramids()
337     throw (SALOME::SALOME_Exception);
338
339   CORBA::Long NbPyramidsOfOrder(SMESH::ElementOrder order)
340     throw (SALOME::SALOME_Exception);
341
342   CORBA::Long NbPrisms()
343     throw (SALOME::SALOME_Exception);
344
345   CORBA::Long NbPrismsOfOrder(SMESH::ElementOrder order)
346     throw (SALOME::SALOME_Exception);
347
348   CORBA::Long NbHexagonalPrisms()
349     throw (SALOME::SALOME_Exception);
350
351   CORBA::Long NbPolyhedrons()
352     throw (SALOME::SALOME_Exception);
353
354   CORBA::Long NbSubMesh()
355     throw (SALOME::SALOME_Exception);
356
357   SMESH::long_array* GetElementsId()
358     throw (SALOME::SALOME_Exception);
359
360   SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
361     throw (SALOME::SALOME_Exception);
362
363   SMESH::long_array* GetNodesId()
364     throw (SALOME::SALOME_Exception);
365
366   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
367     throw (SALOME::SALOME_Exception);
368
369   SMESH::EntityType GetElementGeomType( CORBA::Long id )
370     throw (SALOME::SALOME_Exception);
371
372   /*!
373    * Returns ID of elements for given submesh
374    */
375   SMESH::long_array* GetSubMeshElementsId(CORBA::Long ShapeID)
376     throw (SALOME::SALOME_Exception);
377
378   /*!
379    * Returns ID of nodes for given submesh
380    * If param all==true - returns all nodes, else -
381    * returns only nodes on shapes.
382    */
383   SMESH::long_array* GetSubMeshNodesId(CORBA::Long ShapeID, CORBA::Boolean all)
384     throw (SALOME::SALOME_Exception);
385
386   /*!
387    * Returns type of elements for given submesh
388    */
389   SMESH::ElementType GetSubMeshElementType(CORBA::Long ShapeID)
390     throw (SALOME::SALOME_Exception);
391
392   char* Dump();
393
394   // Create groups of elements preventing computation of a sub-shape
395   SMESH::ListOfGroups* MakeGroupsOfBadInputElements( int         theSubShapeID,
396                                                      const char* theGroupName)
397     throw (SALOME::SALOME_Exception);
398
399   // Internal methods not available through CORBA
400   // They are called by corresponding interface methods
401   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
402                                                     SMESH::SMESH_Hypothesis_ptr anHyp);
403
404   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
405                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
406
407   static SMESH::Hypothesis_Status
408   ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
409
410   static void PrepareForWriting (const char* file, bool overwrite = true);
411
412   //int importMEDFile( const char* theFileName, const char* theMeshName );
413
414   SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
415
416   bool removeSubMesh(SMESH::SMESH_subMesh_ptr theSubMesh,
417                      GEOM::GEOM_Object_ptr theSubShapeObject );
418
419   SMESH::SMESH_GroupBase_ptr createGroup(SMESH::ElementType        theElemType,
420                                          const char*               theName,
421                                          const TopoDS_Shape&       theShape = TopoDS_Shape(),
422                                          const SMESH_PredicatePtr& thePred = SMESH_PredicatePtr());
423
424   void removeGroup( const int theId );
425
426   SMESH::SMESH_subMesh_ptr getSubMesh(int shapeID);
427   // return an existing subMesh object for the shapeID. shapeID == submeshID.
428
429   const std::map<int, SMESH::SMESH_GroupBase_ptr>& getGroups() { return _mapGroups; }
430   // return existing group objects
431
432   void onHypothesisModified();
433   // callback from _impl to forget not loaded mesh data (issue 0021208)
434
435   void checkMeshLoaded();
436
437   /*!
438    * \brief Update hypotheses assigned to geom groups if the latter change
439    *
440    * NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
441    */
442   void CheckGeomGroupModif();
443
444   CORBA::LongLong GetMeshPtr();
445
446   /*!
447    * \brief Assure that all groups are published
448    */
449   void CreateGroupServants();
450
451   /*!
452    * \brief Return groups cantained in _mapGroups by their IDs
453    */
454   SMESH::ListOfGroups* GetGroups(const std::list<int>& groupIDs) const;
455
456   /*!
457    * Get XYZ coordinates of node as list of double
458    * If there is not node for given ID - returns empty list
459    */
460   SMESH::double_array* GetNodeXYZ(CORBA::Long id);
461
462   /*!
463    * For given node returns list of IDs of inverse elements
464    * If there is not node for given ID - returns empty list
465    */
466   SMESH::long_array* GetNodeInverseElements(CORBA::Long id);
467
468   /*!
469    * \brief Return position of a node on shape
470    */
471   SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID);
472
473   /*!
474    * \brief Return position of an element on shape
475    */
476   SMESH::ElementPosition GetElementPosition(CORBA::Long ElemID);
477
478   /*!
479    * If given element is node returns IDs of shape from position
480    * If there is not node for given ID - returns -1
481    */
482   CORBA::Long GetShapeID(CORBA::Long id);
483
484   /*!
485    * For given element returns ID of result shape after
486    * ::FindShape() from SMESH_MeshEditor
487    * If there is not element for given ID - returns -1
488    */
489   CORBA::Long GetShapeIDForElem(CORBA::Long id);
490
491   /*!
492    * Returns number of nodes for given element
493    * If there is not element for given ID - returns -1
494    */
495   CORBA::Long GetElemNbNodes(CORBA::Long id);
496
497   /*!
498    * Returns IDs of nodes of given element
499    */
500   SMESH::long_array* GetElemNodes(CORBA::Long id);
501
502   /*!
503    * Returns ID of node by given index for given element
504    * If there is not element for given ID - returns -1
505    * If there is not node for given index - returns -2
506    */
507   CORBA::Long GetElemNode(CORBA::Long id, CORBA::Long index);
508
509   /*!
510    * Returns true if given node is medium node
511    * in given quadratic element
512    */
513   CORBA::Boolean IsMediumNode(CORBA::Long ide, CORBA::Long idn);
514
515   /*!
516    * Returns true if given node is medium node
517    * in one of quadratic elements
518    */
519   CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
520                                        SMESH::ElementType theElemType);
521
522   /*!
523    * Returns number of edges for given element
524    */
525   CORBA::Long ElemNbEdges(CORBA::Long id);
526
527   /*!
528    * Returns number of faces for given element
529    */
530   CORBA::Long ElemNbFaces(CORBA::Long id);
531   /*!
532    * Returns nodes of given face (counted from zero) for given element.
533    */
534   SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex);
535
536   /*!
537    * Returns an element based on all given nodes.
538    */
539   CORBA::Long FindElementByNodes(const SMESH::long_array& nodes);
540
541   /*!
542    * Returns true if given element is polygon
543    */
544   CORBA::Boolean IsPoly(CORBA::Long id);
545
546   /*!
547    * Returns true if given element is quadratic
548    */
549   CORBA::Boolean IsQuadratic(CORBA::Long id);
550
551   /*!
552    * Returns diameter of ball discrete element or zero in case of an invalid \a id
553    */
554   CORBA::Double GetBallDiameter(CORBA::Long id);
555
556   /*!
557    * Returns bary center for given element
558    */
559   SMESH::double_array* BaryCenter(CORBA::Long id);
560
561   /*!
562    * Returns information about imported MED file
563    */
564   virtual SMESH::MedFileInfo* GetMEDFileInfo();
565
566   /*!
567    * Sets list of notebook variables used for Mesh operations separated by ":" symbol
568    */
569   void SetParameters (const char* theParameters);
570
571   /*!
572    * Returns list of notebook variables used for Mesh operations separated by ":" symbol
573    */
574   char* GetParameters();
575
576   /*!
577    * Returns list of notebook variables used for last Mesh operation
578    */
579   SMESH::string_array* GetLastParameters();
580
581   /*!
582    * \brief Return submesh objects list in meshing order
583    */
584   virtual SMESH::submesh_array_array* GetMeshOrder();
585   /*!
586    * \brief Set submesh object order
587    */
588   virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
589
590
591   /*!
592    * Collect statistic of mesh elements given by iterator
593    */
594   static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
595                               SMESH::long_array&         theInfo);
596   /*!
597    * \brief Return iterator on elements of given type in given object
598    */
599   static SMDS_ElemIteratorPtr GetElements(SMESH::SMESH_IDSource_ptr obj,
600                                           SMESH::ElementType        type);
601
602   // =========================
603   // SMESH_IDSource interface
604   // =========================
605
606   virtual SMESH::long_array* GetIDs();
607   /*!
608    * Returns number of mesh elements of each \a EntityType
609    * Result array of number of elements per \a EntityType
610    * Inherited from SMESH_IDSource
611    */
612   virtual SMESH::long_array* GetMeshInfo();
613   /*!
614    * Returns number of mesh elements of each \a ElementType
615    */
616   virtual SMESH::long_array* GetNbElementsByType();
617   /*!
618    * Returns types of elements it contains
619    */
620   virtual SMESH::array_of_ElementType* GetTypes();
621   /*!
622    * Returns self
623    */
624   virtual SMESH::SMESH_Mesh_ptr GetMesh();
625   /*!
626    * Returns false if GetMeshInfo() returns incorrect information that may
627    * happen if mesh data is not yet fully loaded from the file of study.
628    */
629   bool IsMeshInfoCorrect();
630
631   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
632   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
633
634 private:
635   std::string prepareMeshNameAndGroups( const char* file, CORBA::Boolean overwrite );
636
637   /*!
638    * Check and correct names of mesh groups
639    */
640   void checkGroupNames();
641
642   /*!
643    * Convert submesh ids into submesh interfaces
644    */
645   void convertMeshOrder(const TListOfListOfInt&     theIdsOrder,
646                         SMESH::submesh_array_array& theSubMeshOrder,
647                         const bool                  theIsDump);
648
649 private:
650
651   static int    _idGenerator;
652   ::SMESH_Mesh* _impl;        // :: force no namespace here
653   SMESH_Gen_i*  _gen_i;
654   int           _id;          // id given by creator (unique within the creator instance)
655   int           _studyId;
656   std::map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
657   std::map<int, SMESH::SMESH_GroupBase_ptr>  _mapGroups;
658   std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
659   SMESH_MeshEditor_i*    _editor;
660   SMESH_MeshEditor_i*    _previewEditor;
661   SMESH::MedFileInfo_var _medFileInfo;
662   SMESH_PreMeshInfo*     _preMeshInfo; // mesh info before full loading from study file
663
664   SMESH_PreMeshInfo* & changePreMeshInfo() { return _preMeshInfo; }
665   friend class SMESH_PreMeshInfo;
666
667 private:
668
669   // Data used to track changes of GEOM groups
670   struct TGeomGroupData {
671     // keep study entry but not ior because GEOM_Object actually changes if
672     // number of items in a group varies (1) <-> (>1)
673     std::string       _groupEntry;
674     std::set<int>     _indices; // indices of group items within group's main shape
675     CORBA::Object_var _smeshObject; // SMESH object depending on GEOM group
676   };
677   std::list<TGeomGroupData> _geomGroupData;
678
679   /*!
680    * Remember GEOM group data
681    */
682   void addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
683                         CORBA::Object_ptr     theSmeshObj);
684   /*!
685    * Remove GEOM group data relating to removed smesh object
686    */
687   void removeGeomGroupData(CORBA::Object_ptr theSmeshObj);
688   /*!
689    * Return new group contents if it has been changed and update group data
690    */
691   TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
692
693 };
694
695 #endif