Salome HOME
Merge from V6_3_BR branch (Windows porting) 27/10/2011
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.hxx
1 // Copyright (C) 2007-2011  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_Gen_i.hxx
23 //  Author : Paul RASCLE, EDF
24 //  Module : SMESH
25
26 #ifndef _SMESH_GEN_I_HXX_
27 #define _SMESH_GEN_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_Hypothesis)
35 #include CORBA_CLIENT_HEADER(GEOM_Gen)
36 #include CORBA_CLIENT_HEADER(SALOMEDS)
37 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
38
39 #include "SMESH_Mesh_i.hxx"
40 #include "SMESH_Hypothesis_i.hxx"
41 #include "SALOME_Component_i.hxx"
42 #include "SALOME_NamingService.hxx"
43
44 #include "SMESH_Gen.hxx"
45 #include "GEOM_Client.hxx"
46
47 #include <TCollection_AsciiString.hxx>
48 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
49 #include <TColStd_HSequenceOfAsciiString.hxx>
50
51 #include <map>
52 #include <sstream>
53
54 class SMESH_Mesh_i;
55 class SALOME_LifeCycleCORBA;
56
57 // ===========================================================
58 // Study context - stores study-connected objects references
59 // ==========================================================
60 class SMESH_I_EXPORT StudyContext
61 {
62 public:
63   // constructor
64   StudyContext() {}
65   // destructor
66   ~StudyContext()
67   {
68     mapIdToIOR.clear();
69     mapIdToId.clear();
70   }
71   // register object in the internal map and return its id
72   int addObject( string theIOR )
73   {
74     int nextId = getNextId();
75     mapIdToIOR[ nextId ]  = theIOR;
76     return nextId;
77   }
78   // find the object id in the internal map by the IOR
79   int findId( string theIOR )
80   {
81     map<int, string>::iterator imap;
82     for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
83       if ( imap->second == theIOR )
84         return imap->first;
85     }
86     return 0;
87   }
88   // get object's IOR by id
89   string getIORbyId( const int theId )
90   {
91     if ( mapIdToIOR.find( theId ) != mapIdToIOR.end() )
92       return mapIdToIOR[ theId ];
93     return string( "" );
94   }
95   // get object's IOR by old id
96   string getIORbyOldId( const int theOldId )
97   {
98     if ( mapIdToId.find( theOldId ) != mapIdToId.end() )
99       return getIORbyId( mapIdToId[ theOldId ] );
100     return string( "" );
101   }
102   // maps old object id to the new one (used when restoring data)
103   void mapOldToNew( const int oldId, const int newId ) {
104     mapIdToId[ oldId ] = newId;
105   }
106   // get old id by a new one
107   int getOldId( const int newId ) {
108     map<int, int>::iterator imap;
109     for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
110       if ( imap->second == newId )
111         return imap->first;
112     }
113     return 0;
114   }
115
116 private:
117   // get next free object identifier
118   int getNextId()
119   {
120     int id = 1;
121     while( mapIdToIOR.find( id ) != mapIdToIOR.end() )
122       id++;
123     return id;
124   }
125
126   map<int, string> mapIdToIOR;      // persistent-to-transient map
127   map<int, int>    mapIdToId;       // used to translate object from persistent to transient form
128 };
129
130 // ===========================================================
131 // SMESH module's engine
132 // ==========================================================
133 class SMESH_I_EXPORT SMESH_Gen_i:
134   public virtual POA_SMESH::SMESH_Gen,
135   public virtual Engines_Component_i
136 {
137 public:
138   // Get last created instance of the class
139   static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
140   // Get ORB object
141   static CORBA::ORB_var GetORB() { return myOrb;}
142   // Get SMESH module's POA object
143   static PortableServer::POA_var GetPOA() { return myPoa;}
144   // Get Naming Service object
145   static SALOME_NamingService* GetNS();
146   // Get SALOME_LifeCycleCORBA object
147   static SALOME_LifeCycleCORBA* GetLCC();
148   // Retrieve and get GEOM engine reference
149   static GEOM::GEOM_Gen_ptr GetGeomEngine();
150   // Get object of the CORBA reference
151   static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
152   // Get CORBA object corresponding to the SALOMEDS::SObject
153   static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
154   // Get the SALOMEDS::SObject corresponding to a CORBA object
155   static SALOMEDS::SObject_ptr ObjectToSObject(SALOMEDS::Study_ptr theStudy,
156                                                CORBA::Object_ptr   theObject);
157   // Get GEOM Object correspoding to TopoDS_Shape
158   GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
159   // Get TopoDS_Shape correspoding to GEOM_Object
160   TopoDS_Shape GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject);
161
162   // Default constructor
163   SMESH_Gen_i();
164   // Standard constructor
165   SMESH_Gen_i( CORBA::ORB_ptr            orb,
166                PortableServer::POA_ptr   poa,
167                PortableServer::ObjectId* contId,
168                const char*               instanceName,
169                const char*               interfaceName );
170   // Destructor
171   virtual ~SMESH_Gen_i();
172
173   // *****************************************
174   // Interface methods
175   // *****************************************
176   // Set a new Mesh object name
177   void SetName(const char* theIOR,
178                const char* theName);
179
180   //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
181   void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
182
183   // Set current study
184   void SetEmbeddedMode( CORBA::Boolean theMode );
185   // Get current study
186   CORBA::Boolean IsEmbeddedMode();
187
188   // Set current study
189   void SetCurrentStudy( SALOMEDS::Study_ptr theStudy );
190   // Get current study
191   SALOMEDS::Study_ptr GetCurrentStudy();
192
193   // Create hypothesis/algorothm of given type
194   SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
195                                                 const char* theLibName)
196     throw ( SALOME::SALOME_Exception );
197
198   // Return hypothesis of given type holding parameter values of the existing mesh
199   SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char*           theHypType,
200                                                             const char*           theLibName,
201                                                             SMESH::SMESH_Mesh_ptr theMesh,
202                                                             GEOM::GEOM_Object_ptr theGeom,
203                                                             CORBA::Boolean        byMesh)
204     throw ( SALOME::SALOME_Exception );
205
206   /*!
207    * Sets number of segments per diagonal of boundary box of geometry by which
208    * default segment length of appropriate 1D hypotheses is defined
209    */
210   void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) throw ( SALOME::SALOME_Exception );
211   /*!
212    * \brief Sets default number of segments per edge
213    */
214   void SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception );
215
216   // Create empty mesh on a shape
217   SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
218     throw ( SALOME::SALOME_Exception );
219
220   // Create empty mesh
221   SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
222     throw ( SALOME::SALOME_Exception );
223
224   //  Create mesh(es) and import data from UNV fileter
225   SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
226     throw ( SALOME::SALOME_Exception );
227
228   //  Create mesh(es) and import data from MED file
229   SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
230                                           SMESH::DriverMED_ReadStatus& theStatus )
231     throw ( SALOME::SALOME_Exception );
232
233   //  Create mesh(es) and import data from MED file
234   SMESH::mesh_array* CreateMeshesFromSAUV( const char* theFileName,
235                                            SMESH::DriverMED_ReadStatus& theStatus )
236     throw ( SALOME::SALOME_Exception );
237
238   //  Create mesh(es) and import data from STL file
239   SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
240     throw ( SALOME::SALOME_Exception );
241
242   //  Create mesh(es) and import data from CGNS file
243   SMESH::mesh_array* CreateMeshesFromCGNS( const char* theFileName,
244                                            SMESH::DriverMED_ReadStatus& theStatus )
245     throw ( SALOME::SALOME_Exception );
246
247   // Copy a part of mesh
248   SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
249                                  const char*               meshName,
250                                  CORBA::Boolean            toCopyGroups,
251                                  CORBA::Boolean            toKeepIDs);
252
253   // Compute mesh on a shape
254   CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
255                           GEOM::GEOM_Object_ptr theShapeObject )
256     throw ( SALOME::SALOME_Exception );
257
258   // Cancel Compute mesh on a shape
259   void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
260                       GEOM::GEOM_Object_ptr theShapeObject );
261
262   /*!
263    * \brief Return errors of mesh computation
264    */
265   SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
266                                                GEOM::GEOM_Object_ptr  theShapeObject )
267     throw ( SALOME::SALOME_Exception );
268
269   /*!
270    * Evaluate mesh on a shape and
271    *  returns statistic of mesh elements
272    * Result array of number enityties
273    */
274   SMESH::long_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
275                               GEOM::GEOM_Object_ptr theShapeObject)
276     throw ( SALOME::SALOME_Exception );
277
278   // Returns true if mesh contains enough data to be computed
279   CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
280                                    GEOM::GEOM_Object_ptr theShapeObject )
281     throw ( SALOME::SALOME_Exception );
282
283   /*!
284    * Calculate Mesh as preview till indicated dimension on shape
285    * First, verify list of hypothesis associated with the subShape.
286    * Return mesh preview structure
287    */
288   SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
289                                         GEOM::GEOM_Object_ptr theSubObject,
290                                         SMESH::Dimension      theDimension,
291                                         SMESH::long_array&    theShapesId )
292     throw ( SALOME::SALOME_Exception );
293
294   // Returns errors of hypotheses definintion
295   SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
296                                          GEOM::GEOM_Object_ptr theSubObject )
297       throw ( SALOME::SALOME_Exception );
298
299   // Return mesh elements preventing computation of a subshape
300   SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
301                                                  CORBA::Short          theSubShapeID )
302     throw ( SALOME::SALOME_Exception );
303
304   // Get sub-shapes unique ID's list
305   SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr      theMainShapeObject,
306                                      const SMESH::object_array& theListOfSubShape )
307     throw ( SALOME::SALOME_Exception );
308
309   // Return geometrical object the given element is built on. Publish it in study.
310   GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
311                                                   CORBA::Long            theElementID,
312                                                   const char*            theGeomName)
313     throw ( SALOME::SALOME_Exception );
314
315   // Return geometrical object the given element is built on. Don't publish it in study.
316   GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr  theMesh,
317                                                    CORBA::Long            theElementID)
318     throw ( SALOME::SALOME_Exception );
319
320   // Concatenate the given meshes into one mesh
321   SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
322                                           CORBA::Boolean           theUniteIdenticalGroups,
323                                           CORBA::Boolean           theMergeNodesAndElements,
324                                           CORBA::Double            theMergeTolerance,
325                                           CORBA::Boolean           theCommonGroups)
326     throw ( SALOME::SALOME_Exception );
327
328   // Concatenate the given meshes into one mesh
329   SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::mesh_array& theMeshesArray,
330                                     CORBA::Boolean           theUniteIdenticalGroups,
331                                     CORBA::Boolean           theMergeNodesAndElements,
332                                     CORBA::Double            theMergeTolerance)
333     throw ( SALOME::SALOME_Exception );
334
335   // Concatenate the given meshes into one mesh
336   // Create the groups of all elements from initial meshes
337   SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray,
338                                               CORBA::Boolean           theUniteIdenticalGroups,
339                                               CORBA::Boolean           theMergeNodesAndElements,
340                                               CORBA::Double            theMergeTolerance)
341     throw ( SALOME::SALOME_Exception );
342
343   // Get MED version of the file by its name
344   CORBA::Boolean GetMEDVersion(const char* theFileName,
345                                SMESH::MED_VERSION& theVersion);
346
347   // Get names of meshes defined in file with the specified name
348   SMESH::string_array* GetMeshNames(const char* theFileName);
349
350   // ****************************************************
351   // Interface inherited methods (from SALOMEDS::Driver)
352   // ****************************************************
353
354   // Save SMESH data
355   SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
356                          const char*              theURL,
357                          bool                     isMultiFile );
358   // Load SMESH data
359   bool Load( SALOMEDS::SComponent_ptr theComponent,
360              const SALOMEDS::TMPFile& theStream,
361              const char*              theURL,
362              bool                     isMultiFile );
363   // Save SMESH data in ASCII format
364   SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
365                                 const char*              theURL,
366                                 bool                     isMultiFile );
367   // Load SMESH data in ASCII format
368   bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
369                   const SALOMEDS::TMPFile& theStream,
370                   const char*              theURL,
371                   bool                     isMultiFile );
372
373   // Create filter manager
374   SMESH::FilterManager_ptr CreateFilterManager();
375
376   // Return a pattern mesher
377   SMESH::SMESH_Pattern_ptr GetPattern();
378
379   // Create measurement instance
380   SMESH::Measurements_ptr  CreateMeasurements();
381
382   // Clears study-connected data when it is closed
383   void Close( SALOMEDS::SComponent_ptr theComponent );
384
385   // Get component data type
386   char* ComponentDataType();
387
388   // Transform data from transient form to persistent
389   char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
390                                 const char*           IORString,
391                                 CORBA::Boolean        isMultiFile,
392                                 CORBA::Boolean        isASCII );
393   // Transform data from persistent form to transient
394   char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
395                                 const char*           aLocalPersistentID,
396                                 CORBA::Boolean        isMultiFile,
397                                 CORBA::Boolean        isASCII );
398
399   // Returns true if object can be published in the study
400   bool CanPublishInStudy( CORBA::Object_ptr theIOR );
401   // Publish object in the study
402   SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr   theStudy,
403                                         SALOMEDS::SObject_ptr theSObject,
404                                         CORBA::Object_ptr     theObject,
405                                         const char*           theName )
406     throw ( SALOME::SALOME_Exception );
407
408   // Copy-paste methods - returns true if object can be copied to the clipboard
409   CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr theObject ) { return false; }
410   // Copy-paste methods - copy object to the clipboard
411   SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID ) { return false; }
412   // Copy-paste methods - returns true if object can be pasted from the clipboard
413   CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; }
414   // Copy-paste methods - paste object from the clipboard
415   SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream,
416                                    CORBA::Long              theObjectID,
417                                    SALOMEDS::SObject_ptr    theObject ) {
418     SALOMEDS::SObject_var aResultSO;
419     return aResultSO._retn();
420   }
421
422   // ============
423   // Dump python
424   // ============
425
426   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
427                                        CORBA::Boolean isPublished,
428                                        CORBA::Boolean isMultiFile,
429                                        CORBA::Boolean& isValidScript);
430
431   void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
432
433   void RemoveLastFromPythonScript (int theStudyID);
434
435   void SavePython (SALOMEDS::Study_ptr theStudy);
436
437   TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy,
438                                            Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
439                                            Resource_DataMapOfAsciiStringAsciiString& theNames,
440                                            bool isPublished,
441                                            bool isMultiFile,
442                                            bool& aValidScript,
443                                            const TCollection_AsciiString& theSavedTrace);
444
445   TCollection_AsciiString GetNewPythonLines (int theStudyID);
446
447   void CleanPythonTrace (int theStudyID);
448
449
450   // *****************************************
451   // Internal methods
452   // *****************************************
453 public:
454   // Get shape reader
455   GEOM_Client* GetShapeReader();
456
457   // Tags definition
458   static long GetHypothesisRootTag();
459   static long GetAlgorithmsRootTag();
460   static long GetRefOnShapeTag();
461   static long GetRefOnAppliedHypothesisTag();
462   static long GetRefOnAppliedAlgorithmsTag();
463   static long GetSubMeshOnVertexTag();
464   static long GetSubMeshOnEdgeTag();
465   static long GetSubMeshOnFaceTag();
466   static long GetSubMeshOnSolidTag();
467   static long GetSubMeshOnCompoundTag();
468   static long GetSubMeshOnWireTag();
469   static long GetSubMeshOnShellTag();
470   static long GetNodeGroupsTag();
471   static long GetEdgeGroupsTag();
472   static long GetFaceGroupsTag();
473   static long GetVolumeGroupsTag();
474   static long Get0DElementsGroupsTag();
475
476   // publishing methods
477   SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
478   SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr   theStudy,
479                                      SMESH::SMESH_Mesh_ptr theMesh,
480                                      const char*           theName = 0);
481   SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr         theStudy,
482                                            SMESH::SMESH_Hypothesis_ptr theHyp,
483                                            const char*                 theName = 0);
484   SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr      theStudy,
485                                         SMESH::SMESH_Mesh_ptr    theMesh,
486                                         SMESH::SMESH_subMesh_ptr theSubMesh,
487                                         GEOM::GEOM_Object_ptr    theShapeObject,
488                                         const char*              theName = 0);
489   SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr    theStudy,
490                                       SMESH::SMESH_Mesh_ptr  theMesh,
491                                       SMESH::SMESH_GroupBase_ptr theGroup,
492                                       GEOM::GEOM_Object_ptr  theShapeObject,
493                                       const char*            theName = 0);
494   bool AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
495                             SMESH::SMESH_Mesh_ptr       theMesh,
496                             GEOM::GEOM_Object_ptr       theShapeObject,
497                             SMESH::SMESH_Hypothesis_ptr theHyp);
498   bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy,
499                                  SMESH::SMESH_Mesh_ptr       theMesh,
500                                  GEOM::GEOM_Object_ptr       theShapeObject,
501                                  SMESH::SMESH_Hypothesis_ptr theHyp);
502   SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr   theStudy,
503                                                  SMESH::SMESH_Mesh_ptr theMesh,
504                                                  GEOM::GEOM_Object_ptr theShape);
505   static void SetName(SALOMEDS::SObject_ptr theSObject,
506                       const char*           theName,
507                       const char*           theDefaultName = 0);
508
509   static void SetPixMap(SALOMEDS::SObject_ptr theSObject,
510                         const char*           thePixMap);
511
512   //  Get study context
513   StudyContext* GetCurrentStudyContext();
514
515   // Register an object in a StudyContext; return object id
516   int RegisterObject(CORBA::Object_ptr theObject);
517
518   // Return id of registered object
519   CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
520
521   // Return an object that previously had an oldID
522   template<class TInterface>
523   typename TInterface::_var_type GetObjectByOldId( const int oldID )
524   {
525     if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
526       string ior = myStudyContext->getIORbyOldId( oldID );
527       if ( !ior.empty() )
528         return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
529     }
530     return TInterface::_nil();
531   }
532
533   // Get current study ID
534   int GetCurrentStudyID();
535
536   /*!
537    * \brief Find SObject for an algo
538    */
539   SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
540
541   void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
542   char* GetParameters(CORBA::Object_ptr theObject);
543   char* ParseParameters(const char* theParameters);
544
545
546 private:
547   // Create hypothesis of given type
548   SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
549                                                 const char* theLibName)
550     throw ( SALOME::SALOME_Exception );
551
552   // Create empty mesh on shape
553   SMESH::SMESH_Mesh_ptr createMesh()
554     throw ( SALOME::SALOME_Exception );
555
556   static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
557
558   SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
559                                                 SMESH::DriverMED_ReadStatus& theStatus,
560                                                 const char* theCommandNameForPython,
561                                                 const char* theFileNameForPython);
562
563 private:
564   static GEOM::GEOM_Gen_var      myGeomGen;
565   static CORBA::ORB_var          myOrb;         // ORB reference
566   static PortableServer::POA_var myPoa;         // POA reference
567   static SALOME_NamingService*   myNS;          // Naming Service
568   static SALOME_LifeCycleCORBA*  myLCC;         // Life Cycle CORBA
569   static SMESH_Gen_i*            mySMESHGen;    // Point to last created instance of the class
570   ::SMESH_Gen               myGen;              // SMESH_Gen local implementation
571
572   // hypotheses managing
573   map<string, GenericHypothesisCreator_i*> myHypCreatorMap;
574
575   map<int, StudyContext*>   myStudyContextMap;  // Map of study context objects
576
577   GEOM_Client*              myShapeReader;      // Shape reader
578   SALOMEDS::Study_var       myCurrentStudy;     // Current study
579   CORBA::Boolean            myIsEmbeddedMode;   // Current mode
580
581   // Dump Python: trace of API methods calls
582   std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
583 };
584
585
586 namespace SMESH
587 {
588   template<class T>
589   T
590   DownCast(CORBA::Object_ptr theArg)
591   {
592     return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
593   }
594 }
595
596
597 #endif