1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESH_Gen_i.hxx
23 // Author : Paul RASCLE, EDF
26 #ifndef _SMESH_GEN_I_HXX_
27 #define _SMESH_GEN_I_HXX_
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)
39 #include "SMESH_Gen.hxx"
40 #include "SMESH_Mesh_i.hxx"
41 #include "SMESH_Hypothesis_i.hxx"
43 #include <SALOME_Component_i.hxx>
44 #include <SALOME_NamingService.hxx>
45 #include <Utils_CorbaException.hxx>
47 #include <GEOM_Client.hxx>
49 #include <TCollection_AsciiString.hxx>
50 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
51 #include <TColStd_HSequenceOfAsciiString.hxx>
52 #include <NCollection_DataMap.hxx>
58 class SALOME_LifeCycleCORBA;
60 // ===========================================================
61 // Study context - stores study-connected objects references
62 // ==========================================================
63 class SMESH_I_EXPORT StudyContext
65 typedef NCollection_DataMap< int, std::string > TInt2StringMap;
66 typedef NCollection_DataMap< int, int > TInt2IntMap;
71 // register object in the internal map and return its id
72 int addObject( std::string theIOR )
74 int nextId = getNextId();
75 mapIdToIOR.Bind( nextId, theIOR );
78 // find the object id in the internal map by the IOR
79 int findId( std::string theIOR )
81 TInt2StringMap::iterator imap;
82 for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
83 if ( *imap == theIOR )
84 return imap.Iterator().Key();
88 // get object's IOR by id
89 std::string getIORbyId( const int theId )
91 if ( mapIdToIOR.IsBound( theId ) )
92 return mapIdToIOR( theId );
95 // get object's IOR by old id
96 std::string getIORbyOldId( const int theOldId )
98 if ( mapIdToId.IsBound( theOldId ) )
99 return getIORbyId( mapIdToId( theOldId ));
100 return std::string();
102 // maps old object id to the new one (used when restoring data)
103 void mapOldToNew( const int oldId, const int newId ) {
104 mapIdToId.Bind( oldId, newId );
106 // get old id by a new one
107 int getOldId( const int newId ) {
108 TInt2IntMap::iterator imap;
109 for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
110 if ( *imap == newId )
111 return imap.Iterator().Key();
117 // get next free object identifier
121 while( mapIdToIOR.IsBound( id ) )
126 TInt2StringMap mapIdToIOR; // persistent-to-transient map
127 TInt2IntMap mapIdToId; // to translate object from persistent to transient form
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
138 // Get last created instance of the class
139 static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
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_var 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 corresponding to TopoDS_Shape
158 GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
159 // Get TopoDS_Shape corresponding to GEOM_Object
160 TopoDS_Shape GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject);
162 // Default constructor
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 );
171 virtual ~SMESH_Gen_i();
173 // *****************************************
175 // *****************************************
176 // Set a new Mesh object name
177 void SetName(const char* theIOR,
178 const char* theName);
180 //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
181 void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
184 void SetEmbeddedMode( CORBA::Boolean theMode );
186 CORBA::Boolean IsEmbeddedMode();
189 void SetCurrentStudy( SALOMEDS::Study_ptr theStudy );
191 SALOMEDS::Study_ptr GetCurrentStudy();
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 );
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 );
207 * Returns True if a hypothesis is assigned to a sole sub-mesh in a current Study
209 CORBA::Boolean GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr theHyp,
210 SMESH::SMESH_Mesh_out theMesh,
211 GEOM::GEOM_Object_out theShape);
216 * Sets number of segments per diagonal of boundary box of geometry by which
217 * default segment length of appropriate 1D hypotheses is defined
219 void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) throw ( SALOME::SALOME_Exception );
221 * \brief Sets default number of segments per edge
223 void SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception );
228 virtual void SetOption(const char*, const char*);
230 Return an option value
232 virtual char* GetOption(const char*);
235 * To load full mesh data from study at hyp modification or not
237 bool ToForgetMeshDataOnHypModif() const { return myToForgetMeshDataOnHypModif; }
240 // Create empty mesh on a shape
241 SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
242 throw ( SALOME::SALOME_Exception );
245 SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
246 throw ( SALOME::SALOME_Exception );
248 // Create a mesh and import data from an UNV file
249 SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
250 throw ( SALOME::SALOME_Exception );
252 // Create mesh(es) and import data from MED file
253 SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
254 SMESH::DriverMED_ReadStatus& theStatus )
255 throw ( SALOME::SALOME_Exception );
257 // Create mesh(es) and import data from MED file
258 SMESH::mesh_array* CreateMeshesFromSAUV( const char* theFileName,
259 SMESH::DriverMED_ReadStatus& theStatus )
260 throw ( SALOME::SALOME_Exception );
262 // Create a mesh and import data from a STL file
263 SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
264 throw ( SALOME::SALOME_Exception );
266 // Create mesh(es) and import data from CGNS file
267 SMESH::mesh_array* CreateMeshesFromCGNS( const char* theFileName,
268 SMESH::DriverMED_ReadStatus& theStatus )
269 throw ( SALOME::SALOME_Exception );
271 // Create a mesh and import data from a GMF file
272 SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
273 CORBA::Boolean theMakeRequiredGroups,
274 SMESH::ComputeError_out theError)
275 throw ( SALOME::SALOME_Exception );
277 // Copy a part of mesh
278 SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
279 const char* meshName,
280 CORBA::Boolean toCopyGroups,
281 CORBA::Boolean toKeepIDs);
283 // Compute mesh on a shape
284 CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
285 GEOM::GEOM_Object_ptr theShapeObject )
286 throw ( SALOME::SALOME_Exception );
288 // Cancel Compute mesh on a shape
289 void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
290 GEOM::GEOM_Object_ptr theShapeObject );
293 * \brief Return errors of mesh computation
295 SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
296 GEOM::GEOM_Object_ptr theShapeObject )
297 throw ( SALOME::SALOME_Exception );
300 * Evaluate mesh on a shape and
301 * returns statistic of mesh elements
302 * Result array of number enityties
304 SMESH::long_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
305 GEOM::GEOM_Object_ptr theShapeObject)
306 throw ( SALOME::SALOME_Exception );
308 // Returns true if mesh contains enough data to be computed
309 CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
310 GEOM::GEOM_Object_ptr theShapeObject )
311 throw ( SALOME::SALOME_Exception );
314 * Calculate Mesh as preview till indicated dimension on shape
315 * First, verify list of hypothesis associated with the subShape.
316 * Return mesh preview structure
318 SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
319 GEOM::GEOM_Object_ptr theSubObject,
320 SMESH::Dimension theDimension,
321 SMESH::long_array& theShapesId )
322 throw ( SALOME::SALOME_Exception );
324 // Returns errors of hypotheses definition
325 SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
326 GEOM::GEOM_Object_ptr theSubObject )
327 throw ( SALOME::SALOME_Exception );
329 // Return mesh elements preventing computation of a subshape
330 SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
331 CORBA::Short theSubShapeID )
332 throw ( SALOME::SALOME_Exception );
334 // Create groups of elements preventing computation of a sub-shape
335 SMESH::ListOfGroups* MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
336 CORBA::Short theSubShapeID,
337 const char* theGroupName)
338 throw ( SALOME::SALOME_Exception );
340 // Get sub-shapes unique ID's list
341 SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
342 const SMESH::object_array& theListOfSubShape )
343 throw ( SALOME::SALOME_Exception );
345 // Return geometrical object the given element is built on. Publish it in study.
346 GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
347 CORBA::Long theElementID,
348 const char* theGeomName)
349 throw ( SALOME::SALOME_Exception );
351 // Return geometrical object the given element is built on. Don't publish it in study.
352 GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
353 CORBA::Long theElementID)
354 throw ( SALOME::SALOME_Exception );
356 // Concatenate the given meshes into one mesh
357 SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::ListOfIDSources& meshesArray,
358 CORBA::Boolean uniteIdenticalGroups,
359 CORBA::Boolean mergeNodesAndElements,
360 CORBA::Double mergeTolerance,
361 CORBA::Boolean commonGroups)
362 throw ( SALOME::SALOME_Exception );
364 // Concatenate the given meshes into one mesh
365 SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::ListOfIDSources& meshesArray,
366 CORBA::Boolean uniteIdenticalGroups,
367 CORBA::Boolean mergeNodesAndElements,
368 CORBA::Double mergeTolerance)
369 throw ( SALOME::SALOME_Exception );
371 // Concatenate the given meshes into one mesh
372 // Create the groups of all elements from initial meshes
373 SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::ListOfIDSources& meshesArray,
374 CORBA::Boolean uniteIdenticalGroups,
375 CORBA::Boolean mergeNodesAndElements,
376 CORBA::Double mergeTolerance)
377 throw ( SALOME::SALOME_Exception );
379 // Get MED version of the file by its name
380 CORBA::Boolean GetMEDVersion(const char* theFileName,
381 SMESH::MED_VERSION& theVersion);
383 // Get names of meshes defined in file with the specified name
384 SMESH::string_array* GetMeshNames(const char* theFileName);
386 // ****************************************************
387 // Interface inherited methods (from SALOMEDS::Driver)
388 // ****************************************************
391 SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
395 bool Load( SALOMEDS::SComponent_ptr theComponent,
396 const SALOMEDS::TMPFile& theStream,
399 // Save SMESH data in ASCII format
400 SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
403 // Load SMESH data in ASCII format
404 bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
405 const SALOMEDS::TMPFile& theStream,
409 // Create filter manager
410 SMESH::FilterManager_ptr CreateFilterManager();
412 // Return a pattern mesher
413 SMESH::SMESH_Pattern_ptr GetPattern();
415 // Create measurement instance
416 SMESH::Measurements_ptr CreateMeasurements();
418 // Clears study-connected data when it is closed
419 void Close( SALOMEDS::SComponent_ptr theComponent );
421 // Get component data type
422 char* ComponentDataType();
424 // Transform data from transient form to persistent
425 char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
426 const char* IORString,
427 CORBA::Boolean isMultiFile,
428 CORBA::Boolean isASCII );
429 // Transform data from persistent form to transient
430 char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
431 const char* aLocalPersistentID,
432 CORBA::Boolean isMultiFile,
433 CORBA::Boolean isASCII );
435 // Returns true if object can be published in the study
436 bool CanPublishInStudy( CORBA::Object_ptr theIOR );
437 // Publish object in the study
438 SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr theStudy,
439 SALOMEDS::SObject_ptr theSObject,
440 CORBA::Object_ptr theObject,
441 const char* theName )
442 throw ( SALOME::SALOME_Exception );
444 // Copy-paste methods - returns true if object can be copied to the clipboard
445 CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr theObject ) { return false; }
446 // Copy-paste methods - copy object to the clipboard
447 SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID ) { return NULL; }
448 // Copy-paste methods - returns true if object can be pasted from the clipboard
449 CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; }
450 // Copy-paste methods - paste object from the clipboard
451 SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream,
452 CORBA::Long theObjectID,
453 SALOMEDS::SObject_ptr theObject ) {
454 SALOMEDS::SObject_var aResultSO;
455 return aResultSO._retn();
459 // Version information
462 virtual char* getVersion();
468 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
469 CORBA::Boolean isPublished,
470 CORBA::Boolean isMultiFile,
471 CORBA::Boolean& isValidScript);
473 void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
475 void RemoveLastFromPythonScript (int theStudyID);
477 void SavePython (SALOMEDS::Study_ptr theStudy);
479 TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy,
480 Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
481 Resource_DataMapOfAsciiStringAsciiString& theNames,
484 bool isHistoricalDump,
486 TCollection_AsciiString& theSavedTrace);
488 TCollection_AsciiString GetNewPythonLines (int theStudyID);
490 void CleanPythonTrace (int theStudyID);
492 // *****************************************
494 // *****************************************
497 GEOM_Client* GetShapeReader();
500 static long GetHypothesisRootTag();
501 static long GetAlgorithmsRootTag();
502 static long GetRefOnShapeTag();
503 static long GetRefOnAppliedHypothesisTag();
504 static long GetRefOnAppliedAlgorithmsTag();
505 static long GetSubMeshOnVertexTag();
506 static long GetSubMeshOnEdgeTag();
507 static long GetSubMeshOnFaceTag();
508 static long GetSubMeshOnSolidTag();
509 static long GetSubMeshOnCompoundTag();
510 static long GetSubMeshOnWireTag();
511 static long GetSubMeshOnShellTag();
512 static long GetNodeGroupsTag();
513 static long GetEdgeGroupsTag();
514 static long GetFaceGroupsTag();
515 static long GetVolumeGroupsTag();
516 static long Get0DElementsGroupsTag();
517 static long GetBallElementsGroupsTag();
519 // publishing methods
520 SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
521 SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr theStudy,
522 SMESH::SMESH_Mesh_ptr theMesh,
523 const char* theName = 0);
524 SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr theStudy,
525 SMESH::SMESH_Hypothesis_ptr theHyp,
526 const char* theName = 0);
527 SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr theStudy,
528 SMESH::SMESH_Mesh_ptr theMesh,
529 SMESH::SMESH_subMesh_ptr theSubMesh,
530 GEOM::GEOM_Object_ptr theShapeObject,
531 const char* theName = 0);
532 SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr theStudy,
533 SMESH::SMESH_Mesh_ptr theMesh,
534 SMESH::SMESH_GroupBase_ptr theGroup,
535 GEOM::GEOM_Object_ptr theShapeObject,
536 const char* theName = 0);
537 bool AddHypothesisToShape(SALOMEDS::Study_ptr theStudy,
538 SMESH::SMESH_Mesh_ptr theMesh,
539 GEOM::GEOM_Object_ptr theShapeObject,
540 SMESH::SMESH_Hypothesis_ptr theHyp);
541 bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy,
542 SMESH::SMESH_Mesh_ptr theMesh,
543 GEOM::GEOM_Object_ptr theShapeObject,
544 SMESH::SMESH_Hypothesis_ptr theHyp);
545 SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr theStudy,
546 SMESH::SMESH_Mesh_ptr theMesh,
547 GEOM::GEOM_Object_ptr theShape);
548 static void SetName(SALOMEDS::SObject_ptr theSObject,
550 const char* theDefaultName = 0);
552 static void SetPixMap(SALOMEDS::SObject_ptr theSObject,
553 const char* thePixMap);
556 StudyContext* GetCurrentStudyContext();
558 // Register an object in a StudyContext; return object id
559 int RegisterObject(CORBA::Object_ptr theObject);
561 // Return id of registered object
562 CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
564 // Return an object that previously had an oldID
565 template<class TInterface>
566 typename TInterface::_var_type GetObjectByOldId( const int oldID )
568 if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
569 std::string ior = myStudyContext->getIORbyOldId( oldID );
571 return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
573 return TInterface::_nil();
576 // Get current study ID
577 int GetCurrentStudyID();
580 * \brief Find SObject for an algo
582 SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
584 void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
585 char* GetParameters(CORBA::Object_ptr theObject);
586 //char* ParseParameters(const char* theParameters);
587 const std::vector< int >& GetLastParamIndices() const { return myLastParamIndex; }
588 const std::vector< std::string >& GetLastParameters() const { return myLastParameters; }
589 const std::string & GetLastObjEntry() const { return myLastObj; }
590 std::vector< std::string > GetAllParameters(const std::string& theObjectEntry) const;
592 // Move objects to the specified position
593 void Move( const SMESH::sobject_list& what,
594 SALOMEDS::SObject_ptr where,
597 CORBA::Boolean IsApplicable ( const char* theAlgoType,
598 const char* theLibName,
599 GEOM::GEOM_Object_ptr theShapeObject,
600 CORBA::Boolean toCheckAll);
602 SMESH::long_array* GetInsideSphere( SMESH::SMESH_IDSource_ptr meshPart,
603 SMESH::ElementType theElemType,
609 SMESH::long_array* GetInsideBox( SMESH::SMESH_IDSource_ptr meshPart,
610 SMESH::ElementType theElemType,
616 CORBA::Double theZ2);
618 SMESH::long_array* GetInsideCylinder( SMESH::SMESH_IDSource_ptr meshPart,
619 SMESH::ElementType theElemType,
627 CORBA::Double theR );
629 SMESH::long_array* GetInside( SMESH::SMESH_IDSource_ptr meshPart,
630 SMESH::ElementType theElemType,
631 GEOM::GEOM_Object_ptr theGeom,
632 CORBA::Double theTolerance );
635 // Get hypothesis creator
636 GenericHypothesisCreator_i* getHypothesisCreator( const char* theHypName,
637 const char* theLibName,
638 std::string& thePlatformLibName)
639 throw ( SALOME::SALOME_Exception );
640 // Create hypothesis of given type
641 SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
642 const char* theLibName);
643 // Create empty mesh on shape
644 SMESH::SMESH_Mesh_ptr createMesh()
645 throw ( SALOME::SALOME_Exception );
647 static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
649 SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
650 SMESH::DriverMED_ReadStatus& theStatus,
651 const char* theCommandNameForPython,
652 const char* theFileNameForPython);
654 void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
655 bool theStudyIsBeingClosed=false);
657 std::vector<long> _GetInside(SMESH::SMESH_IDSource_ptr meshPart,
658 SMESH::ElementType theElemType,
659 TopoDS_Shape& aShape,
660 double* theTolerance = NULL);
663 static GEOM::GEOM_Gen_var myGeomGen;
664 static CORBA::ORB_var myOrb; // ORB reference
665 static PortableServer::POA_var myPoa; // POA reference
666 static SALOME_NamingService* myNS; // Naming Service
667 static SALOME_LifeCycleCORBA* myLCC; // Life Cycle CORBA
668 static SMESH_Gen_i* mySMESHGen; // Point to last created instance of the class
669 ::SMESH_Gen myGen; // SMESH_Gen local implementation
671 // hypotheses managing
672 std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
674 std::map<int, StudyContext*> myStudyContextMap; // Map of study context objects
676 GEOM_Client* myShapeReader; // Shape reader
677 SALOMEDS::Study_var myCurrentStudy; // Current study
678 CORBA::Boolean myIsEmbeddedMode; // Current mode
680 // Default color of groups
681 std::string myDefaultGroupColor;
683 // To load full mesh data from study at hyp modification or not
684 bool myToForgetMeshDataOnHypModif;
686 // Dump Python: trace of API methods calls
687 std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
688 bool myIsHistoricalPythonDump;
689 std::vector< int > myLastParamIndex;
690 std::vector< std::string > myLastParameters;
691 std::string myLastObj;
699 DownCast(CORBA::Object_ptr theArg)
701 return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
705 * \brief Function used in SMESH_CATCH to convert a caught exception to
706 * SALOME::SALOME_Exception
708 inline void throwCorbaException(const char* excText)
710 THROW_SALOME_CORBA_EXCEPTION( excText, SALOME::INTERNAL_ERROR );