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