1 // Copyright (C) 2007-2019 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 - store 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;
70 // register object in the internal map and return its id
71 int addObject( const std::string& theIOR );
72 // find the object id in the internal map by the IOR
73 int findId( const std::string& theIOR );
74 // get object's IOR by id
75 std::string getIORbyId( const int theId );
76 // get object's IOR by old id
77 std::string getIORbyOldId( const int theOldId );
78 // maps old object id to the new one (used when restoring data)
79 void mapOldToNew( const int oldId, const int newId );
80 // get old id by a new one
81 int getOldId( const int newId );
86 // get next free object identifier
87 int getNextId() { return mapIdToIOR.Extent() + 1; }
89 TInt2StringMap mapIdToIOR; // persistent-to-transient map
90 TInt2IntMap mapIdToId; // to translate object from persistent to transient form
93 // ===========================================================
94 // SMESH module's engine
95 // ==========================================================
96 class SMESH_I_EXPORT SMESH_Gen_i:
97 public virtual POA_SMESH::SMESH_Gen,
98 public virtual Engines_Component_i
101 // Get last created instance of the class
102 static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
104 static CORBA::ORB_var GetORB() { return myOrb;}
105 // Get SMESH module's POA object
106 static PortableServer::POA_var GetPOA() { return myPoa;}
107 // Get Naming Service object
108 static SALOME_NamingService* GetNS();
109 // Get SALOME_LifeCycleCORBA object
110 static SALOME_LifeCycleCORBA* GetLCC();
111 // Retrieve and get GEOM engine reference
112 static GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper );
113 static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr );
114 // Get object of the CORBA reference
115 static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
116 // Get CORBA object corresponding to the SALOMEDS::SObject
117 static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
118 // Get the SALOMEDS::SObject corresponding to a CORBA object
119 static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject);
120 // Get the SALOMEDS::Study from naming service
121 static SALOMEDS::Study_var getStudyServant();
122 // Get GEOM Object corresponding to TopoDS_Shape
123 GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
124 // Get TopoDS_Shape corresponding to GEOM_Object
125 TopoDS_Shape GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject);
127 // Default constructor
129 // Standard constructor
130 SMESH_Gen_i( CORBA::ORB_ptr orb,
131 PortableServer::POA_ptr poa,
132 PortableServer::ObjectId* contId,
133 const char* instanceName,
134 const char* interfaceName );
136 virtual ~SMESH_Gen_i();
138 // *****************************************
140 // *****************************************
141 // Set a new Mesh object name
142 void SetName(const char* theIOR,
143 const char* theName);
145 //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
146 void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
149 void SetEmbeddedMode( CORBA::Boolean theMode );
150 // Check embedded mode
151 CORBA::Boolean IsEmbeddedMode();
153 // Set enable publishing in the study
154 void SetEnablePublish( CORBA::Boolean theIsEnablePublish );
156 // Check enable publishing
157 CORBA::Boolean IsEnablePublish();
162 // Do provide info on objects
163 bool hasObjectInfo();
165 // Return an information for a given object
166 char* getObjectInfo(const char* entry);
168 // Create hypothesis/algorithm of given type
169 SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
170 const char* theLibName)
171 throw ( SALOME::SALOME_Exception );
173 // Return hypothesis of given type holding parameter values of the existing mesh
174 SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char* theHypType,
175 const char* theLibName,
176 SMESH::SMESH_Mesh_ptr theMesh,
177 GEOM::GEOM_Object_ptr theGeom,
178 CORBA::Boolean byMesh)
179 throw ( SALOME::SALOME_Exception );
182 * Returns True if a hypothesis is assigned to a sole sub-mesh in a current Study
184 CORBA::Boolean GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr theHyp,
185 SMESH::SMESH_Mesh_out theMesh,
186 GEOM::GEOM_Object_out theShape);
191 * Sets number of segments per diagonal of boundary box of geometry by which
192 * default segment length of appropriate 1D hypotheses is defined
194 void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments ) throw ( SALOME::SALOME_Exception );
196 * \brief Sets default number of segments per edge
198 void SetDefaultNbSegments(CORBA::Long theNbSegments) throw ( SALOME::SALOME_Exception );
203 virtual void SetOption(const char*, const char*);
205 Return an option value
207 virtual char* GetOption(const char*);
210 * To load full mesh data from study at hyp modification or not
212 bool ToForgetMeshDataOnHypModif() const { return myToForgetMeshDataOnHypModif; }
215 // Create empty mesh on a shape
216 SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
217 throw ( SALOME::SALOME_Exception );
220 SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
221 throw ( SALOME::SALOME_Exception );
223 // Create a mesh and import data from an UNV file
224 SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
225 throw ( SALOME::SALOME_Exception );
227 // Create mesh(es) and import data from MED file
228 SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
229 SMESH::DriverMED_ReadStatus& theStatus )
230 throw ( SALOME::SALOME_Exception );
232 // Create mesh(es) and import data from MED file
233 SMESH::mesh_array* CreateMeshesFromSAUV( const char* theFileName,
234 SMESH::DriverMED_ReadStatus& theStatus )
235 throw ( SALOME::SALOME_Exception );
237 // Create a mesh and import data from a STL file
238 SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
239 throw ( SALOME::SALOME_Exception );
241 // Create mesh(es) and import data from CGNS file
242 SMESH::mesh_array* CreateMeshesFromCGNS( const char* theFileName,
243 SMESH::DriverMED_ReadStatus& theStatus )
244 throw ( SALOME::SALOME_Exception );
246 // Create a mesh and import data from a GMF file
247 SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
248 CORBA::Boolean theMakeRequiredGroups,
249 SMESH::ComputeError_out theError)
250 throw ( SALOME::SALOME_Exception );
252 // Copy a part of mesh
253 SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
254 const char* meshName,
255 CORBA::Boolean toCopyGroups,
256 CORBA::Boolean toKeepIDs)
257 throw ( SALOME::SALOME_Exception );
259 // Create a mesh by copying definitions of another mesh to a given geometry
260 CORBA::Boolean CopyMeshWithGeom( SMESH::SMESH_Mesh_ptr sourceMesh,
261 GEOM::GEOM_Object_ptr newGeometry,
262 const char* meshName,
263 CORBA::Boolean toCopyGroups,
264 CORBA::Boolean toReuseHypotheses,
265 CORBA::Boolean toCopyElements,
266 SMESH::SMESH_Mesh_out newMesh,
267 SMESH::ListOfGroups_out newGroups,
268 SMESH::submesh_array_out newSubmeshes,
269 SMESH::ListOfHypothesis_out newHypotheses,
270 SMESH::string_array_out invalidEntries)
271 throw ( SALOME::SALOME_Exception );
273 // Compute mesh on a shape
274 CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
275 GEOM::GEOM_Object_ptr theShapeObject )
276 throw ( SALOME::SALOME_Exception );
278 // Cancel Compute mesh on a shape
279 void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
280 GEOM::GEOM_Object_ptr theShapeObject );
283 * \brief Return errors of mesh computation
285 SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
286 GEOM::GEOM_Object_ptr theShapeObject )
287 throw ( SALOME::SALOME_Exception );
290 * Evaluate mesh on a shape and
291 * returns statistic of mesh elements
292 * Result array of number enityties
294 SMESH::long_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
295 GEOM::GEOM_Object_ptr theShapeObject)
296 throw ( SALOME::SALOME_Exception );
298 // Returns true if mesh contains enough data to be computed
299 CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
300 GEOM::GEOM_Object_ptr theShapeObject )
301 throw ( SALOME::SALOME_Exception );
304 * Calculate Mesh as preview till indicated dimension on shape
305 * First, verify list of hypothesis associated with the subShape.
306 * Return mesh preview structure
308 SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
309 GEOM::GEOM_Object_ptr theSubObject,
310 SMESH::Dimension theDimension,
311 SMESH::long_array& theShapesId )
312 throw ( SALOME::SALOME_Exception );
314 // Returns errors of hypotheses definition
315 SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
316 GEOM::GEOM_Object_ptr theSubObject )
317 throw ( SALOME::SALOME_Exception );
319 // Return mesh elements preventing computation of a subshape
320 SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
321 CORBA::Short theSubShapeID )
322 throw ( SALOME::SALOME_Exception );
324 // Create groups of elements preventing computation of a sub-shape
325 SMESH::ListOfGroups* MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
326 CORBA::Short theSubShapeID,
327 const char* theGroupName)
328 throw ( SALOME::SALOME_Exception );
330 // Get sub-shapes unique ID's list
331 SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
332 const SMESH::object_array& theListOfSubShape )
333 throw ( SALOME::SALOME_Exception );
335 // Return geometrical object the given element is built on. Publish it in study.
336 GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
337 CORBA::Long theElementID,
338 const char* theGeomName)
339 throw ( SALOME::SALOME_Exception );
341 // Return geometrical object the given element is built on. Don't publish it in study.
342 GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
343 CORBA::Long theElementID)
344 throw ( SALOME::SALOME_Exception );
346 // Concatenate the given meshes into one mesh
347 SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::ListOfIDSources& meshesArray,
348 CORBA::Boolean uniteIdenticalGroups,
349 CORBA::Boolean mergeNodesAndElements,
350 CORBA::Double mergeTolerance,
351 CORBA::Boolean commonGroups,
352 SMESH::SMESH_Mesh_ptr meshToAppendTo)
353 throw ( SALOME::SALOME_Exception );
355 // Concatenate the given meshes into one mesh
356 SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::ListOfIDSources& meshesArray,
357 CORBA::Boolean uniteIdenticalGroups,
358 CORBA::Boolean mergeNodesAndElements,
359 CORBA::Double mergeTolerance,
360 SMESH::SMESH_Mesh_ptr meshToAppendTo)
361 throw ( SALOME::SALOME_Exception );
363 // Concatenate the given meshes into one mesh
364 // Create the groups of all elements from initial meshes
365 SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::ListOfIDSources& meshesArray,
366 CORBA::Boolean uniteIdenticalGroups,
367 CORBA::Boolean mergeNodesAndElements,
368 CORBA::Double mergeTolerance,
369 SMESH::SMESH_Mesh_ptr meshToAppendTo)
370 throw ( SALOME::SALOME_Exception );
372 // Get version of MED format being used.
373 char* GetMEDFileVersion();
375 // Get MED version of the file by its name
376 char* GetMEDVersion(const char* theFileName);
378 // Check compatibility of file with MED format being used, read only.
379 CORBA::Boolean CheckCompatibility(const char* theFileName);
381 // Check compatibility of file with MED format being used, for append on write.
382 CORBA::Boolean CheckWriteCompatibility(const char* theFileName);
384 // Get names of meshes defined in file with the specified name
385 SMESH::string_array* GetMeshNames(const char* theFileName);
387 // ****************************************************
388 // Interface inherited methods (from SALOMEDS::Driver)
389 // ****************************************************
392 SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
396 bool Load( SALOMEDS::SComponent_ptr theComponent,
397 const SALOMEDS::TMPFile& theStream,
400 // Save SMESH data in ASCII format
401 SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
404 // Load SMESH data in ASCII format
405 bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
406 const SALOMEDS::TMPFile& theStream,
410 // Create filter manager
411 SMESH::FilterManager_ptr CreateFilterManager();
413 // Return a pattern mesher
414 SMESH::SMESH_Pattern_ptr GetPattern();
416 // Create measurement instance
417 SMESH::Measurements_ptr CreateMeasurements();
419 // Clears study-connected data when it is closed
420 void Close( SALOMEDS::SComponent_ptr theComponent );
422 // Get component data type
423 char* ComponentDataType();
425 // Transform data from transient form to persistent
426 char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
427 const char* IORString,
428 CORBA::Boolean isMultiFile,
429 CORBA::Boolean isASCII );
430 // Transform data from persistent form to transient
431 char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
432 const char* aLocalPersistentID,
433 CORBA::Boolean isMultiFile,
434 CORBA::Boolean isASCII );
436 // Returns true if object can be published in the study
437 bool CanPublishInStudy( CORBA::Object_ptr theIOR );
438 // Publish object in the study
439 SALOMEDS::SObject_ptr PublishInStudy( 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::Boolean isPublished,
469 CORBA::Boolean isMultiFile,
470 CORBA::Boolean& isValidScript);
472 void AddToPythonScript (const TCollection_AsciiString& theString);
474 void RemoveLastFromPythonScript();
478 TCollection_AsciiString DumpPython_impl (Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
479 Resource_DataMapOfAsciiStringAsciiString& theNames,
482 bool isHistoricalDump,
484 TCollection_AsciiString& theSavedTrace);
486 TCollection_AsciiString GetNewPythonLines();
488 void CleanPythonTrace();
490 // *****************************************
492 // *****************************************
495 GEOM_Client* GetShapeReader();
498 static long GetHypothesisRootTag();
499 static long GetAlgorithmsRootTag();
500 static long GetRefOnShapeTag();
501 static long GetRefOnAppliedHypothesisTag();
502 static long GetRefOnAppliedAlgorithmsTag();
503 static long GetSubMeshOnVertexTag();
504 static long GetSubMeshOnEdgeTag();
505 static long GetSubMeshOnFaceTag();
506 static long GetSubMeshOnSolidTag();
507 static long GetSubMeshOnCompoundTag();
508 static long GetSubMeshOnWireTag();
509 static long GetSubMeshOnShellTag();
510 static long GetNodeGroupsTag();
511 static long GetEdgeGroupsTag();
512 static long GetFaceGroupsTag();
513 static long GetVolumeGroupsTag();
514 static long Get0DElementsGroupsTag();
515 static long GetBallElementsGroupsTag();
517 // publishing methods
518 SALOMEDS::SComponent_ptr PublishComponent();
519 SALOMEDS::SObject_ptr PublishMesh (SMESH::SMESH_Mesh_ptr theMesh,
520 const char* theName = 0);
521 SALOMEDS::SObject_ptr PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
522 const char* theName = 0);
523 SALOMEDS::SObject_ptr PublishSubMesh (SMESH::SMESH_Mesh_ptr theMesh,
524 SMESH::SMESH_subMesh_ptr theSubMesh,
525 GEOM::GEOM_Object_ptr theShapeObject,
526 const char* theName = 0);
527 SALOMEDS::SObject_ptr PublishGroup (SMESH::SMESH_Mesh_ptr theMesh,
528 SMESH::SMESH_GroupBase_ptr theGroup,
529 GEOM::GEOM_Object_ptr theShapeObject,
530 const char* theName = 0);
531 void UpdateIcons(SMESH::SMESH_Mesh_ptr theMesh);
532 void HighLightInvalid(CORBA::Object_ptr theObject, bool isInvalid);
533 bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr theMesh,
534 GEOM::GEOM_Object_ptr theShapeObject,
535 SMESH::SMESH_Hypothesis_ptr theHyp);
536 bool RemoveHypothesisFromShape(SMESH::SMESH_Mesh_ptr theMesh,
537 GEOM::GEOM_Object_ptr theShapeObject,
538 SMESH::SMESH_Hypothesis_ptr theHyp);
539 SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
540 GEOM::GEOM_Object_ptr theShape);
541 static void SetName(SALOMEDS::SObject_ptr theSObject,
543 const char* theDefaultName = 0);
545 static void SetPixMap(SALOMEDS::SObject_ptr theSObject,
546 const char* thePixMap);
549 StudyContext* GetStudyContext();
551 // Register an object in a StudyContext; return object id
552 int RegisterObject(CORBA::Object_ptr theObject);
554 // Return id of registered object
555 CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
557 // Return an object that previously had an oldID
558 template<class TInterface>
559 typename TInterface::_var_type GetObjectByOldId( const int oldID )
561 if ( myStudyContext ) {
562 std::string ior = myStudyContext->getIORbyOldId( oldID );
564 return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
566 return TInterface::_nil();
570 * \brief Find SObject for an algo
572 SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
574 void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
575 char* GetParameters(CORBA::Object_ptr theObject);
576 //char* ParseParameters(const char* theParameters);
577 const std::vector< int >& GetLastParamIndices() const { return myLastParamIndex; }
578 const std::vector< std::string >& GetLastParameters() const { return myLastParameters; }
579 const std::string & GetLastObjEntry() const { return myLastObj; }
580 std::vector< std::string > GetAllParameters(const std::string& theObjectEntry) const;
582 // Move objects to the specified position
583 void Move( const SMESH::sobject_list& what,
584 SALOMEDS::SObject_ptr where,
587 CORBA::Boolean IsApplicable ( const char* theAlgoType,
588 const char* theLibName,
589 GEOM::GEOM_Object_ptr theShapeObject,
590 CORBA::Boolean toCheckAll);
592 SMESH::long_array* GetInsideSphere( SMESH::SMESH_IDSource_ptr meshPart,
593 SMESH::ElementType theElemType,
599 SMESH::long_array* GetInsideBox( SMESH::SMESH_IDSource_ptr meshPart,
600 SMESH::ElementType theElemType,
606 CORBA::Double theZ2);
608 SMESH::long_array* GetInsideCylinder( SMESH::SMESH_IDSource_ptr meshPart,
609 SMESH::ElementType theElemType,
617 CORBA::Double theR );
619 SMESH::long_array* GetInside( SMESH::SMESH_IDSource_ptr meshPart,
620 SMESH::ElementType theElemType,
621 GEOM::GEOM_Object_ptr theGeom,
622 CORBA::Double theTolerance );
625 // Get hypothesis creator
626 GenericHypothesisCreator_i* getHypothesisCreator( const char* theHypName,
627 const char* theLibName,
628 std::string& thePlatformLibName)
629 throw ( SALOME::SALOME_Exception );
630 // Create hypothesis of given type
631 SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
632 const char* theLibName);
633 // Create empty mesh on shape
634 SMESH::SMESH_Mesh_ptr createMesh()
635 throw ( SALOME::SALOME_Exception );
637 // Create a sub-mesh on a geometry that is not a sub-shape of the main shape
638 // for the case where a valid sub-shape not found by CopyMeshWithGeom()
639 SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh,
640 GEOM::GEOM_Object_ptr strangerGeom,
643 void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
645 SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
646 SMESH::DriverMED_ReadStatus& theStatus,
647 const char* theCommandNameForPython,
648 const char* theFileNameForPython);
650 std::vector<long> _GetInside(SMESH::SMESH_IDSource_ptr meshPart,
651 SMESH::ElementType theElemType,
652 TopoDS_Shape& aShape,
653 double* theTolerance = NULL);
656 static GEOM::GEOM_Gen_var myGeomGen;
657 static CORBA::ORB_var myOrb; // ORB reference
658 static PortableServer::POA_var myPoa; // POA reference
659 static SALOME_NamingService* myNS; // Naming Service
660 static SALOME_LifeCycleCORBA* myLCC; // Life Cycle CORBA
661 static SMESH_Gen_i* mySMESHGen; // Point to last created instance of the class
662 ::SMESH_Gen myGen; // SMESH_Gen local implementation
664 // hypotheses managing
665 std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
667 StudyContext* myStudyContext; // study context
669 GEOM_Client* myShapeReader; // Shape reader
670 CORBA::Boolean myIsEmbeddedMode; // Current mode
671 CORBA::Boolean myIsEnablePublish; // Enable publishing
673 // Default color of groups
674 std::string myDefaultGroupColor;
676 // To load full mesh data from study at hyp modification or not
677 bool myToForgetMeshDataOnHypModif;
679 // Dump Python: trace of API methods calls
680 Handle(TColStd_HSequenceOfAsciiString) myPythonScript;
681 bool myIsHistoricalPythonDump;
682 std::vector< int > myLastParamIndex;
683 std::vector< std::string > myLastParameters;
684 std::string myLastObj;
692 DownCast(CORBA::Object_ptr theArg)
694 return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
698 * \brief Function used in SMESH_CATCH to convert a caught exception to
699 * SALOME::SALOME_Exception
701 inline void throwCorbaException(const char* excText)
703 THROW_SALOME_CORBA_EXCEPTION( excText, SALOME::INTERNAL_ERROR );