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
120 return mapIdToIOR.Extent() + 1;
123 TInt2StringMap mapIdToIOR; // persistent-to-transient map
124 TInt2IntMap mapIdToId; // to translate object from persistent to transient form
127 // ===========================================================
128 // SMESH module's engine
129 // ==========================================================
130 class SMESH_I_EXPORT SMESH_Gen_i:
131 public virtual POA_SMESH::SMESH_Gen,
132 public virtual Engines_Component_i
135 // Get last created instance of the class
136 static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
138 static CORBA::ORB_var GetORB() { return myOrb;}
139 // Get SMESH module's POA object
140 static PortableServer::POA_var GetPOA() { return myPoa;}
141 // Get Naming Service object
142 static SALOME_NamingService* GetNS();
143 // Get SALOME_LifeCycleCORBA object
144 static SALOME_LifeCycleCORBA* GetLCC();
145 // Retrieve and get GEOM engine reference
146 static GEOM::GEOM_Gen_var GetGeomEngine();
147 // Get object of the CORBA reference
148 static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
149 // Get CORBA object corresponding to the SALOMEDS::SObject
150 static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
151 // Get the SALOMEDS::SObject corresponding to a CORBA object
152 static SALOMEDS::SObject_ptr ObjectToSObject(SALOMEDS::Study_ptr theStudy,
153 CORBA::Object_ptr theObject);
154 // Get GEOM Object corresponding to TopoDS_Shape
155 GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
156 // Get TopoDS_Shape corresponding to GEOM_Object
157 TopoDS_Shape GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject);
159 // Default constructor
161 // Standard constructor
162 SMESH_Gen_i( CORBA::ORB_ptr orb,
163 PortableServer::POA_ptr poa,
164 PortableServer::ObjectId* contId,
165 const char* instanceName,
166 const char* interfaceName );
168 virtual ~SMESH_Gen_i();
170 // *****************************************
172 // *****************************************
173 // Set a new Mesh object name
174 void SetName(const char* theIOR,
175 const char* theName);
177 //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
178 void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
181 void SetEmbeddedMode( CORBA::Boolean theMode );
183 CORBA::Boolean IsEmbeddedMode();
186 void SetCurrentStudy( SALOMEDS::Study_ptr theStudy );
188 SALOMEDS::Study_ptr GetCurrentStudy();
190 // Create hypothesis/algorothm of given type
191 SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
192 const char* theLibName)
193 throw ( SALOME::SALOME_Exception );
195 // Return hypothesis of given type holding parameter values of the existing mesh
196 SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char* theHypType,
197 const char* theLibName,
198 SMESH::SMESH_Mesh_ptr theMesh,
199 GEOM::GEOM_Object_ptr theGeom,
200 CORBA::Boolean byMesh)
201 throw ( SALOME::SALOME_Exception );
204 * Returns True if a hypothesis is assigned to a sole sub-mesh in a current Study
206 CORBA::Boolean GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr theHyp,
207 SMESH::SMESH_Mesh_out theMesh,
208 GEOM::GEOM_Object_out theShape);
213 * Sets number of segments per diagonal of boundary box of geometry by which
214 * default segment length of appropriate 1D hypotheses is defined
216 void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) throw ( SALOME::SALOME_Exception );
218 * \brief Sets default number of segments per edge
220 void SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception );
225 virtual void SetOption(const char*, const char*);
227 Return an option value
229 virtual char* GetOption(const char*);
232 * To load full mesh data from study at hyp modification or not
234 bool ToForgetMeshDataOnHypModif() const { return myToForgetMeshDataOnHypModif; }
237 // Create empty mesh on a shape
238 SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
239 throw ( SALOME::SALOME_Exception );
242 SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
243 throw ( SALOME::SALOME_Exception );
245 // Create a mesh and import data from an UNV file
246 SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
247 throw ( SALOME::SALOME_Exception );
249 // Create mesh(es) and import data from MED file
250 SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
251 SMESH::DriverMED_ReadStatus& theStatus )
252 throw ( SALOME::SALOME_Exception );
254 // Create mesh(es) and import data from MED file
255 SMESH::mesh_array* CreateMeshesFromSAUV( const char* theFileName,
256 SMESH::DriverMED_ReadStatus& theStatus )
257 throw ( SALOME::SALOME_Exception );
259 // Create a mesh and import data from a STL file
260 SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
261 throw ( SALOME::SALOME_Exception );
263 // Create mesh(es) and import data from CGNS file
264 SMESH::mesh_array* CreateMeshesFromCGNS( const char* theFileName,
265 SMESH::DriverMED_ReadStatus& theStatus )
266 throw ( SALOME::SALOME_Exception );
268 // Create a mesh and import data from a GMF file
269 SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
270 CORBA::Boolean theMakeRequiredGroups,
271 SMESH::ComputeError_out theError)
272 throw ( SALOME::SALOME_Exception );
274 // Copy a part of mesh
275 SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
276 const char* meshName,
277 CORBA::Boolean toCopyGroups,
278 CORBA::Boolean toKeepIDs)
279 throw ( SALOME::SALOME_Exception );
281 // Create a mesh by copying definitions of another mesh to a given geometry
282 CORBA::Boolean CopyMeshWithGeom( SMESH::SMESH_Mesh_ptr sourceMesh,
283 GEOM::GEOM_Object_ptr newGeometry,
284 const char* meshName,
285 CORBA::Boolean toCopyGroups,
286 CORBA::Boolean toReuseHypotheses,
287 CORBA::Boolean toCopyElements,
288 SMESH::SMESH_Mesh_out newMesh,
289 SMESH::ListOfGroups_out newGroups,
290 SMESH::submesh_array_out newSubmeshes,
291 SMESH::ListOfHypothesis_out newHypotheses,
292 SMESH::string_array_out invalidEntries)
293 throw ( SALOME::SALOME_Exception );
295 // Compute mesh on a shape
296 CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
297 GEOM::GEOM_Object_ptr theShapeObject )
298 throw ( SALOME::SALOME_Exception );
300 // Cancel Compute mesh on a shape
301 void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
302 GEOM::GEOM_Object_ptr theShapeObject );
305 * \brief Return errors of mesh computation
307 SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
308 GEOM::GEOM_Object_ptr theShapeObject )
309 throw ( SALOME::SALOME_Exception );
312 * Evaluate mesh on a shape and
313 * returns statistic of mesh elements
314 * Result array of number enityties
316 SMESH::long_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
317 GEOM::GEOM_Object_ptr theShapeObject)
318 throw ( SALOME::SALOME_Exception );
320 // Returns true if mesh contains enough data to be computed
321 CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
322 GEOM::GEOM_Object_ptr theShapeObject )
323 throw ( SALOME::SALOME_Exception );
326 * Calculate Mesh as preview till indicated dimension on shape
327 * First, verify list of hypothesis associated with the subShape.
328 * Return mesh preview structure
330 SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
331 GEOM::GEOM_Object_ptr theSubObject,
332 SMESH::Dimension theDimension,
333 SMESH::long_array& theShapesId )
334 throw ( SALOME::SALOME_Exception );
336 // Returns errors of hypotheses definition
337 SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
338 GEOM::GEOM_Object_ptr theSubObject )
339 throw ( SALOME::SALOME_Exception );
341 // Return mesh elements preventing computation of a subshape
342 SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
343 CORBA::Short theSubShapeID )
344 throw ( SALOME::SALOME_Exception );
346 // Create groups of elements preventing computation of a sub-shape
347 SMESH::ListOfGroups* MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
348 CORBA::Short theSubShapeID,
349 const char* theGroupName)
350 throw ( SALOME::SALOME_Exception );
352 // Get sub-shapes unique ID's list
353 SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
354 const SMESH::object_array& theListOfSubShape )
355 throw ( SALOME::SALOME_Exception );
357 // Return geometrical object the given element is built on. Publish it in study.
358 GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
359 CORBA::Long theElementID,
360 const char* theGeomName)
361 throw ( SALOME::SALOME_Exception );
363 // Return geometrical object the given element is built on. Don't publish it in study.
364 GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
365 CORBA::Long theElementID)
366 throw ( SALOME::SALOME_Exception );
368 // Concatenate the given meshes into one mesh
369 SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::ListOfIDSources& meshesArray,
370 CORBA::Boolean uniteIdenticalGroups,
371 CORBA::Boolean mergeNodesAndElements,
372 CORBA::Double mergeTolerance,
373 CORBA::Boolean commonGroups)
374 throw ( SALOME::SALOME_Exception );
376 // Concatenate the given meshes into one mesh
377 SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::ListOfIDSources& meshesArray,
378 CORBA::Boolean uniteIdenticalGroups,
379 CORBA::Boolean mergeNodesAndElements,
380 CORBA::Double mergeTolerance)
381 throw ( SALOME::SALOME_Exception );
383 // Concatenate the given meshes into one mesh
384 // Create the groups of all elements from initial meshes
385 SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::ListOfIDSources& meshesArray,
386 CORBA::Boolean uniteIdenticalGroups,
387 CORBA::Boolean mergeNodesAndElements,
388 CORBA::Double mergeTolerance)
389 throw ( SALOME::SALOME_Exception );
391 // Get MED version of the file by its name
392 CORBA::Boolean GetMEDVersion(const char* theFileName,
393 SMESH::MED_VERSION& theVersion);
395 // Get names of meshes defined in file with the specified name
396 SMESH::string_array* GetMeshNames(const char* theFileName);
398 // ****************************************************
399 // Interface inherited methods (from SALOMEDS::Driver)
400 // ****************************************************
403 SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
407 bool Load( SALOMEDS::SComponent_ptr theComponent,
408 const SALOMEDS::TMPFile& theStream,
411 // Save SMESH data in ASCII format
412 SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
415 // Load SMESH data in ASCII format
416 bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
417 const SALOMEDS::TMPFile& theStream,
421 // Create filter manager
422 SMESH::FilterManager_ptr CreateFilterManager();
424 // Return a pattern mesher
425 SMESH::SMESH_Pattern_ptr GetPattern();
427 // Create measurement instance
428 SMESH::Measurements_ptr CreateMeasurements();
430 // Clears study-connected data when it is closed
431 void Close( SALOMEDS::SComponent_ptr theComponent );
433 // Get component data type
434 char* ComponentDataType();
436 // Transform data from transient form to persistent
437 char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
438 const char* IORString,
439 CORBA::Boolean isMultiFile,
440 CORBA::Boolean isASCII );
441 // Transform data from persistent form to transient
442 char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
443 const char* aLocalPersistentID,
444 CORBA::Boolean isMultiFile,
445 CORBA::Boolean isASCII );
447 // Returns true if object can be published in the study
448 bool CanPublishInStudy( CORBA::Object_ptr theIOR );
449 // Publish object in the study
450 SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr theStudy,
451 SALOMEDS::SObject_ptr theSObject,
452 CORBA::Object_ptr theObject,
453 const char* theName )
454 throw ( SALOME::SALOME_Exception );
456 // Copy-paste methods - returns true if object can be copied to the clipboard
457 CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr theObject ) { return false; }
458 // Copy-paste methods - copy object to the clipboard
459 SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID ) { return NULL; }
460 // Copy-paste methods - returns true if object can be pasted from the clipboard
461 CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; }
462 // Copy-paste methods - paste object from the clipboard
463 SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream,
464 CORBA::Long theObjectID,
465 SALOMEDS::SObject_ptr theObject ) {
466 SALOMEDS::SObject_var aResultSO;
467 return aResultSO._retn();
471 // Version information
474 virtual char* getVersion();
480 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
481 CORBA::Boolean isPublished,
482 CORBA::Boolean isMultiFile,
483 CORBA::Boolean& isValidScript);
485 void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString);
487 void RemoveLastFromPythonScript (int theStudyID);
489 void SavePython (SALOMEDS::Study_ptr theStudy);
491 TCollection_AsciiString DumpPython_impl (SALOMEDS::Study_ptr theStudy,
492 Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
493 Resource_DataMapOfAsciiStringAsciiString& theNames,
496 bool isHistoricalDump,
498 TCollection_AsciiString& theSavedTrace);
500 TCollection_AsciiString GetNewPythonLines (int theStudyID);
502 void CleanPythonTrace (int theStudyID);
504 // *****************************************
506 // *****************************************
509 GEOM_Client* GetShapeReader();
512 static long GetHypothesisRootTag();
513 static long GetAlgorithmsRootTag();
514 static long GetRefOnShapeTag();
515 static long GetRefOnAppliedHypothesisTag();
516 static long GetRefOnAppliedAlgorithmsTag();
517 static long GetSubMeshOnVertexTag();
518 static long GetSubMeshOnEdgeTag();
519 static long GetSubMeshOnFaceTag();
520 static long GetSubMeshOnSolidTag();
521 static long GetSubMeshOnCompoundTag();
522 static long GetSubMeshOnWireTag();
523 static long GetSubMeshOnShellTag();
524 static long GetNodeGroupsTag();
525 static long GetEdgeGroupsTag();
526 static long GetFaceGroupsTag();
527 static long GetVolumeGroupsTag();
528 static long Get0DElementsGroupsTag();
529 static long GetBallElementsGroupsTag();
531 // publishing methods
532 SALOMEDS::SComponent_ptr PublishComponent(SALOMEDS::Study_ptr theStudy);
533 SALOMEDS::SObject_ptr PublishMesh (SALOMEDS::Study_ptr theStudy,
534 SMESH::SMESH_Mesh_ptr theMesh,
535 const char* theName = 0);
536 SALOMEDS::SObject_ptr PublishHypothesis (SALOMEDS::Study_ptr theStudy,
537 SMESH::SMESH_Hypothesis_ptr theHyp,
538 const char* theName = 0);
539 SALOMEDS::SObject_ptr PublishSubMesh (SALOMEDS::Study_ptr theStudy,
540 SMESH::SMESH_Mesh_ptr theMesh,
541 SMESH::SMESH_subMesh_ptr theSubMesh,
542 GEOM::GEOM_Object_ptr theShapeObject,
543 const char* theName = 0);
544 SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr theStudy,
545 SMESH::SMESH_Mesh_ptr theMesh,
546 SMESH::SMESH_GroupBase_ptr theGroup,
547 GEOM::GEOM_Object_ptr theShapeObject,
548 const char* theName = 0);
549 void HighLightInvalid(CORBA::Object_ptr theObject, bool isInvalid);
550 bool AddHypothesisToShape(SALOMEDS::Study_ptr theStudy,
551 SMESH::SMESH_Mesh_ptr theMesh,
552 GEOM::GEOM_Object_ptr theShapeObject,
553 SMESH::SMESH_Hypothesis_ptr theHyp);
554 bool RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy,
555 SMESH::SMESH_Mesh_ptr theMesh,
556 GEOM::GEOM_Object_ptr theShapeObject,
557 SMESH::SMESH_Hypothesis_ptr theHyp);
558 SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr theStudy,
559 SMESH::SMESH_Mesh_ptr theMesh,
560 GEOM::GEOM_Object_ptr theShape);
561 static void SetName(SALOMEDS::SObject_ptr theSObject,
563 const char* theDefaultName = 0);
565 static void SetPixMap(SALOMEDS::SObject_ptr theSObject,
566 const char* thePixMap);
569 StudyContext* GetCurrentStudyContext();
571 // Register an object in a StudyContext; return object id
572 int RegisterObject(CORBA::Object_ptr theObject);
574 // Return id of registered object
575 CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
577 // Return an object that previously had an oldID
578 template<class TInterface>
579 typename TInterface::_var_type GetObjectByOldId( const int oldID )
581 if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
582 std::string ior = myStudyContext->getIORbyOldId( oldID );
584 return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
586 return TInterface::_nil();
589 // Get current study ID
590 int GetCurrentStudyID();
593 * \brief Find SObject for an algo
595 SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
597 void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
598 char* GetParameters(CORBA::Object_ptr theObject);
599 //char* ParseParameters(const char* theParameters);
600 const std::vector< int >& GetLastParamIndices() const { return myLastParamIndex; }
601 const std::vector< std::string >& GetLastParameters() const { return myLastParameters; }
602 const std::string & GetLastObjEntry() const { return myLastObj; }
603 std::vector< std::string > GetAllParameters(const std::string& theObjectEntry) const;
605 // Move objects to the specified position
606 void Move( const SMESH::sobject_list& what,
607 SALOMEDS::SObject_ptr where,
610 CORBA::Boolean IsApplicable ( const char* theAlgoType,
611 const char* theLibName,
612 GEOM::GEOM_Object_ptr theShapeObject,
613 CORBA::Boolean toCheckAll);
615 SMESH::long_array* GetInsideSphere( SMESH::SMESH_IDSource_ptr meshPart,
616 SMESH::ElementType theElemType,
622 SMESH::long_array* GetInsideBox( SMESH::SMESH_IDSource_ptr meshPart,
623 SMESH::ElementType theElemType,
629 CORBA::Double theZ2);
631 SMESH::long_array* GetInsideCylinder( SMESH::SMESH_IDSource_ptr meshPart,
632 SMESH::ElementType theElemType,
640 CORBA::Double theR );
642 SMESH::long_array* GetInside( SMESH::SMESH_IDSource_ptr meshPart,
643 SMESH::ElementType theElemType,
644 GEOM::GEOM_Object_ptr theGeom,
645 CORBA::Double theTolerance );
648 // Get hypothesis creator
649 GenericHypothesisCreator_i* getHypothesisCreator( const char* theHypName,
650 const char* theLibName,
651 std::string& thePlatformLibName)
652 throw ( SALOME::SALOME_Exception );
653 // Create hypothesis of given type
654 SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
655 const char* theLibName);
656 // Create empty mesh on shape
657 SMESH::SMESH_Mesh_ptr createMesh()
658 throw ( SALOME::SALOME_Exception );
660 // Create a sub-mesh on a geometry that is not a sub-shape of the main shape
661 // for the case where a valid sub-shape not found by CopyMeshWithGeom()
662 SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh,
663 GEOM::GEOM_Object_ptr strangerGeom,
666 void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
668 static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
670 SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
671 SMESH::DriverMED_ReadStatus& theStatus,
672 const char* theCommandNameForPython,
673 const char* theFileNameForPython);
675 void setCurrentStudy( SALOMEDS::Study_ptr theStudy,
676 bool theStudyIsBeingClosed=false);
678 std::vector<long> _GetInside(SMESH::SMESH_IDSource_ptr meshPart,
679 SMESH::ElementType theElemType,
680 TopoDS_Shape& aShape,
681 double* theTolerance = NULL);
684 static GEOM::GEOM_Gen_var myGeomGen;
685 static CORBA::ORB_var myOrb; // ORB reference
686 static PortableServer::POA_var myPoa; // POA reference
687 static SALOME_NamingService* myNS; // Naming Service
688 static SALOME_LifeCycleCORBA* myLCC; // Life Cycle CORBA
689 static SMESH_Gen_i* mySMESHGen; // Point to last created instance of the class
690 ::SMESH_Gen myGen; // SMESH_Gen local implementation
692 // hypotheses managing
693 std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
695 std::map<int, StudyContext*> myStudyContextMap; // Map of study context objects
697 GEOM_Client* myShapeReader; // Shape reader
698 SALOMEDS::Study_var myCurrentStudy; // Current study
699 CORBA::Boolean myIsEmbeddedMode; // Current mode
701 // Default color of groups
702 std::string myDefaultGroupColor;
704 // To load full mesh data from study at hyp modification or not
705 bool myToForgetMeshDataOnHypModif;
707 // Dump Python: trace of API methods calls
708 std::map < int, Handle(TColStd_HSequenceOfAsciiString) > myPythonScripts;
709 bool myIsHistoricalPythonDump;
710 std::vector< int > myLastParamIndex;
711 std::vector< std::string > myLastParameters;
712 std::string myLastObj;
720 DownCast(CORBA::Object_ptr theArg)
722 return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
726 * \brief Function used in SMESH_CATCH to convert a caught exception to
727 * SALOME::SALOME_Exception
729 inline void throwCorbaException(const char* excText)
731 THROW_SALOME_CORBA_EXCEPTION( excText, SALOME::INTERNAL_ERROR );