1 // Copyright (C) 2007-2021 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)
38 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
40 #include "SMESH_Gen.hxx"
41 #include "SMESH_Mesh_i.hxx"
42 #include "SMESH_Hypothesis_i.hxx"
44 #include <SALOME_Component_i.hxx>
45 #include <SALOME_NamingService.hxx>
46 #include <Utils_CorbaException.hxx>
48 #include <GEOM_Client.hxx>
49 #include <smIdType.hxx>
51 #include <TCollection_AsciiString.hxx>
52 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
53 #include <TColStd_HSequenceOfAsciiString.hxx>
54 #include <NCollection_DataMap.hxx>
60 class SALOME_LifeCycleCORBA;
62 // ===========================================================
63 // Study context - store study-connected objects references
64 // ==========================================================
65 class SMESH_I_EXPORT StudyContext
67 typedef NCollection_DataMap< int, std::string > TInt2StringMap;
68 typedef NCollection_DataMap< int, int > TInt2IntMap;
72 // register object in the internal map and return its id
73 int addObject( const std::string& theIOR );
74 // find the object id in the internal map by the IOR
75 int findId( const std::string& theIOR );
76 // get object's IOR by id
77 std::string getIORbyId( const int theId );
78 // get object's IOR by old id
79 std::string getIORbyOldId( const int theOldId );
80 // maps old object id to the new one (used when restoring data)
81 void mapOldToNew( const int oldId, const int newId );
82 // get old id by a new one
83 int getOldId( const int newId );
88 // get next free object identifier
89 int getNextId() { return mapIdToIOR.Extent() + 1; }
91 TInt2StringMap mapIdToIOR; // persistent-to-transient map
92 TInt2IntMap mapIdToId; // to translate object from persistent to transient form
95 // ===========================================================
96 // SMESH module's engine
97 // ==========================================================
98 class SMESH_I_EXPORT SMESH_Gen_i : public POA_SMESH::SMESH_Gen, public 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 // Set Naming Service object
108 static void SetNS(SALOME_NamingService_Abstract *ns);
109 // Get Naming Service object
110 static SALOME_NamingService_Abstract* GetNS();
111 // Get SALOME_LifeCycleCORBA object
112 static SALOME_LifeCycleCORBA* GetLCC();
113 // Retrieve and get GEOM engine reference
114 static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr );
115 // Retrieve Study depending on Session / Standalone mode
116 virtual GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper ) = 0;
117 SALOMEDS::Study_var getStudyServant() const { return this->getStudyServantVirtual(); }
118 virtual SALOMEDS::Study_var getStudyServantVirtual() const = 0 ;
119 virtual SALOME_ModuleCatalog::ModuleCatalog_var getModuleCatalog() const = 0;
120 SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR,
121 SALOMEDS::SObject_ptr theFatherObject,
122 const int theTag = 0,
123 const char* thePixMap = 0,
124 const bool theSelectable = true);
125 // Get object of the CORBA reference
126 static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
127 // Get CORBA object corresponding to the SALOMEDS::SObject
128 static CORBA::Object_var SObjectToObject( SALOMEDS::SObject_ptr theSObject );
129 // Get the SALOMEDS::SObject corresponding to a CORBA object
130 SALOMEDS::SObject_ptr ObjectToSObject( CORBA::Object_ptr theObject );
131 // Get GEOM Object corresponding to TopoDS_Shape
132 static GEOM::GEOM_Object_ptr ShapeToGeomObject( const TopoDS_Shape& theShape );
133 // Get TopoDS_Shape corresponding to GEOM_Object
134 static TopoDS_Shape GeomObjectToShape( GEOM::GEOM_Object_ptr theGeomObject );
135 // Get GEOM Object by its study entry
136 static GEOM::GEOM_Object_ptr GetGeomObjectByEntry( const std::string& entry );
138 // Default constructor
140 // Standard constructor
141 SMESH_Gen_i( CORBA::ORB_ptr orb,
142 PortableServer::POA_ptr poa,
143 PortableServer::ObjectId* contId,
144 const char* instanceName,
145 const char* interfaceName,
146 bool checkNS = true);
148 virtual ~SMESH_Gen_i();
150 // *****************************************
152 // *****************************************
153 // Set a new Mesh object name
154 void SetName(const char* theIOR,
155 const char* theName);
157 //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
158 void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
161 void SetEmbeddedMode( CORBA::Boolean theMode );
162 // Check embedded mode
163 CORBA::Boolean IsEmbeddedMode();
165 // Set enable publishing in the study
166 void SetEnablePublish( CORBA::Boolean theIsEnablePublish );
168 // Check enable publishing
169 CORBA::Boolean IsEnablePublish();
174 // Do provide info on objects
175 bool hasObjectInfo();
177 // Return an information for a given object
178 char* getObjectInfo(const char* entry);
180 // Create hypothesis/algorithm of given type
181 SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
182 const char* theLibName);
184 SMESH::SMESH_Hypothesis_ptr CreateHypothesisByAverageLength( const char* theHypType,
185 const char* theLibName,
186 CORBA::Double theAverageLength,
187 CORBA::Boolean theQuadDominated);
189 // Return hypothesis of given type holding parameter values of the existing mesh
190 SMESH::SMESH_Hypothesis_ptr
191 GetHypothesisParameterValues (const char* theHypType,
192 const char* theLibName,
193 SMESH::SMESH_Mesh_ptr theMesh,
194 GEOM::GEOM_Object_ptr theGeom,
195 const SMESH::HypInitParams& theWay);
198 * Returns True if a hypothesis is assigned to a sole sub-mesh in a current Study
200 CORBA::Boolean GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr theHyp,
201 SMESH::SMESH_Mesh_out theMesh,
202 GEOM::GEOM_Object_out theShape);
207 * Sets number of segments per diagonal of boundary box of geometry by which
208 * default segment length of appropriate 1D hypotheses is defined
210 void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments );
212 * \brief Sets default number of segments per edge
214 void SetDefaultNbSegments(CORBA::Long theNbSegments);
219 virtual void SetOption(const char*, const char*);
221 Return an option value
223 virtual char* GetOption(const char*);
226 * To load full mesh data from study at hyp modification or not
228 bool ToForgetMeshDataOnHypModif() const { return myToForgetMeshDataOnHypModif; }
231 // Create empty mesh on a shape
232 SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject );
235 SMESH::SMESH_Mesh_ptr CreateEmptyMesh();
237 // Create a mesh and import data from an UNV file
238 SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName );
240 // Create mesh(es) and import data from MED file
241 SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
242 SMESH::DriverMED_ReadStatus& theStatus );
244 // Create mesh(es) and import data from MED file
245 SMESH::mesh_array* CreateMeshesFromSAUV( const char* theFileName,
246 SMESH::DriverMED_ReadStatus& theStatus );
248 // Create a mesh and import data from a STL file
249 SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName );
251 // Create mesh(es) and import data from CGNS file
252 SMESH::mesh_array* CreateMeshesFromCGNS( const char* theFileName,
253 SMESH::DriverMED_ReadStatus& theStatus );
255 // Create a mesh and import data from a GMF file
256 SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
257 CORBA::Boolean theMakeRequiredGroups,
258 SMESH::ComputeError_out theError);
260 // Copy a part of mesh
261 SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
262 const char* meshName,
263 CORBA::Boolean toCopyGroups,
264 CORBA::Boolean toKeepIDs);
266 // Create a mesh by copying definitions of another mesh to a given geometry
267 CORBA::Boolean CopyMeshWithGeom( SMESH::SMESH_Mesh_ptr sourceMesh,
268 GEOM::GEOM_Object_ptr newGeometry,
269 const char* meshName,
270 CORBA::Boolean toCopyGroups,
271 CORBA::Boolean toReuseHypotheses,
272 CORBA::Boolean toCopyElements,
273 SMESH::SMESH_Mesh_out newMesh,
274 SMESH::ListOfGroups_out newGroups,
275 SMESH::submesh_array_out newSubmeshes,
276 SMESH::ListOfHypothesis_out newHypotheses,
277 SMESH::string_array_out invalidEntries);
279 // Compute mesh on a shape
280 CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
281 GEOM::GEOM_Object_ptr theShapeObject );
283 // Cancel Compute mesh on a shape
284 void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
285 GEOM::GEOM_Object_ptr theShapeObject );
288 * \brief Return errors of mesh computation
290 SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
291 GEOM::GEOM_Object_ptr theShapeObject );
294 * Evaluate mesh on a shape and
295 * returns statistic of mesh elements
296 * Result array of number enityties
298 SMESH::smIdType_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
299 GEOM::GEOM_Object_ptr theShapeObject);
301 // Returns true if mesh contains enough data to be computed
302 CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
303 GEOM::GEOM_Object_ptr theShapeObject );
306 * Calculate Mesh as preview till indicated dimension on shape
307 * First, verify list of hypothesis associated with the subShape.
308 * Return mesh preview structure
310 SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
311 GEOM::GEOM_Object_ptr theSubObject,
312 SMESH::Dimension theDimension,
313 SMESH::long_array& theShapesId );
315 // Returns errors of hypotheses definition
316 SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
317 GEOM::GEOM_Object_ptr theSubObject );
319 // Return mesh elements preventing computation of a subshape
320 SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
321 CORBA::Short theSubShapeID );
323 // Create groups of elements preventing computation of a sub-shape
324 SMESH::ListOfGroups* MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
325 CORBA::Short theSubShapeID,
326 const char* theGroupName);
328 // Get sub-shapes unique ID's list
329 SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
330 const SMESH::object_array& theListOfSubShape );
332 // Return geometrical object the given element is built on. Publish it in study.
333 GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
334 SMESH::smIdType theElementID,
335 const char* theGeomName);
337 // Return geometrical object the given element is built on. Don't publish it in study.
338 GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
339 SMESH::smIdType theElementID);
341 // Concatenate the given meshes into one mesh
342 SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::ListOfIDSources& meshesArray,
343 CORBA::Boolean uniteIdenticalGroups,
344 CORBA::Boolean mergeNodesAndElements,
345 CORBA::Double mergeTolerance,
346 CORBA::Boolean commonGroups,
347 SMESH::SMESH_Mesh_ptr meshToAppendTo);
349 // Concatenate the given meshes into one mesh
350 SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::ListOfIDSources& meshesArray,
351 CORBA::Boolean uniteIdenticalGroups,
352 CORBA::Boolean mergeNodesAndElements,
353 CORBA::Double mergeTolerance,
354 SMESH::SMESH_Mesh_ptr meshToAppendTo);
356 // Concatenate the given meshes into one mesh
357 // Create the groups of all elements from initial meshes
358 SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::ListOfIDSources& meshesArray,
359 CORBA::Boolean uniteIdenticalGroups,
360 CORBA::Boolean mergeNodesAndElements,
361 CORBA::Double mergeTolerance,
362 SMESH::SMESH_Mesh_ptr meshToAppendTo);
364 // Get version of MED format being used.
365 char* GetMEDFileVersion();
367 // Get MED version of the file by its name
368 char* GetMEDVersion(const char* theFileName);
370 // Check compatibility of file with MED format being used, read only.
371 CORBA::Boolean CheckCompatibility(const char* theFileName);
373 // Check compatibility of file with MED format being used, for append on write.
374 CORBA::Boolean CheckWriteCompatibility(const char* theFileName);
376 // Get names of meshes defined in file with the specified name
377 SMESH::string_array* GetMeshNames(const char* theFileName);
379 // ****************************************************
380 // Interface inherited methods (from SALOMEDS::Driver)
381 // ****************************************************
384 SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
388 bool Load( SALOMEDS::SComponent_ptr theComponent,
389 const SALOMEDS::TMPFile& theStream,
392 // Save SMESH data in ASCII format
393 SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
396 // Load SMESH data in ASCII format
397 bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
398 const SALOMEDS::TMPFile& theStream,
402 // Create filter manager
403 SMESH::FilterManager_ptr CreateFilterManager();
405 // Return a pattern mesher
406 SMESH::SMESH_Pattern_ptr GetPattern();
408 // Create measurement instance
409 SMESH::Measurements_ptr CreateMeasurements();
411 // Clears study-connected data when it is closed
412 void Close( SALOMEDS::SComponent_ptr theComponent );
414 // Get component data type
415 char* ComponentDataType();
417 // Transform data from transient form to persistent
418 char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
419 const char* IORString,
420 CORBA::Boolean isMultiFile,
421 CORBA::Boolean isASCII );
422 // Transform data from persistent form to transient
423 char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
424 const char* aLocalPersistentID,
425 CORBA::Boolean isMultiFile,
426 CORBA::Boolean isASCII );
428 // Returns true if object can be published in the study
429 bool CanPublishInStudy( CORBA::Object_ptr theIOR );
430 // Publish object in the study
431 SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::SObject_ptr theSObject,
432 CORBA::Object_ptr theObject,
433 const char* theName );
435 // Copy-paste methods - returns true if object can be copied to the clipboard
436 CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr /*theObject*/ ) { return false; }
437 // Copy-paste methods - copy object to the clipboard
438 SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr /*theObject*/, CORBA::Long& /*theObjectID*/ ) { return NULL; }
439 // Copy-paste methods - returns true if object can be pasted from the clipboard
440 CORBA::Boolean CanPaste( const char* /*theComponentName*/, CORBA::Long /*theObjectID*/ ) { return false; }
441 // Copy-paste methods - paste object from the clipboard
442 SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& /*theStream*/,
443 CORBA::Long /*theObjectID*/,
444 SALOMEDS::SObject_ptr /*theObject*/ ) {
445 SALOMEDS::SObject_var aResultSO;
446 return aResultSO._retn();
450 // Version information
453 virtual char* getVersion();
459 virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
460 CORBA::Boolean isMultiFile,
461 CORBA::Boolean& isValidScript);
463 void AddToPythonScript (const TCollection_AsciiString& theString);
465 void RemoveLastFromPythonScript();
469 TCollection_AsciiString DumpPython_impl (Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
470 Resource_DataMapOfAsciiStringAsciiString& theNames,
473 bool isHistoricalDump,
475 TCollection_AsciiString& theSavedTrace);
477 TCollection_AsciiString GetNewPythonLines();
479 void CleanPythonTrace();
481 int CountInPyDump(const TCollection_AsciiString& text);
483 SMESH::MG_ADAPT_ptr CreateMG_ADAPT();
484 SMESH::MG_ADAPT_ptr CreateAdaptationHypothesis();
485 SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType);
487 // *****************************************
489 // *****************************************
492 GEOM_Client* GetShapeReader();
495 static long GetHypothesisRootTag();
496 static long GetAlgorithmsRootTag();
497 static long GetRefOnShapeTag();
498 static long GetRefOnAppliedHypothesisTag();
499 static long GetRefOnAppliedAlgorithmsTag();
500 static long GetSubMeshOnVertexTag();
501 static long GetSubMeshOnEdgeTag();
502 static long GetSubMeshOnFaceTag();
503 static long GetSubMeshOnSolidTag();
504 static long GetSubMeshOnCompoundTag();
505 static long GetSubMeshOnWireTag();
506 static long GetSubMeshOnShellTag();
507 static long GetNodeGroupsTag();
508 static long GetEdgeGroupsTag();
509 static long GetFaceGroupsTag();
510 static long GetVolumeGroupsTag();
511 static long Get0DElementsGroupsTag();
512 static long GetBallElementsGroupsTag();
514 // publishing methods
515 SALOMEDS::SComponent_ptr PublishComponent();
516 SALOMEDS::SObject_ptr PublishMesh (SMESH::SMESH_Mesh_ptr theMesh,
517 const char* theName = 0);
518 SALOMEDS::SObject_ptr PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
519 const char* theName = 0);
520 SALOMEDS::SObject_ptr PublishSubMesh (SMESH::SMESH_Mesh_ptr theMesh,
521 SMESH::SMESH_subMesh_ptr theSubMesh,
522 GEOM::GEOM_Object_ptr theShapeObject,
523 const char* theName = 0);
524 SALOMEDS::SObject_ptr PublishGroup (SMESH::SMESH_Mesh_ptr theMesh,
525 SMESH::SMESH_GroupBase_ptr theGroup,
526 GEOM::GEOM_Object_ptr theShapeObject,
527 const char* theName = 0);
528 void UpdateIcons(SMESH::SMESH_Mesh_ptr theMesh);
529 void HighLightInvalid(CORBA::Object_ptr theObject, bool isInvalid);
530 bool IsInvalid(SALOMEDS::SObject_ptr theObject);
531 bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr theMesh,
532 GEOM::GEOM_Object_ptr theShapeObject,
533 SMESH::SMESH_Hypothesis_ptr theHyp);
534 bool RemoveHypothesisFromShape(SMESH::SMESH_Mesh_ptr theMesh,
535 GEOM::GEOM_Object_ptr theShapeObject,
536 SMESH::SMESH_Hypothesis_ptr theHyp);
537 SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
538 GEOM::GEOM_Object_ptr theShape);
539 void SetName(SALOMEDS::SObject_ptr theSObject,
541 const char* theDefaultName = 0);
543 void SetPixMap(SALOMEDS::SObject_ptr theSObject, const char *thePixMap);
544 void addReference (SALOMEDS::SObject_ptr theSObject, CORBA::Object_ptr theToObject, int theTag = 0);
547 StudyContext* GetStudyContext();
549 // Register an object in a StudyContext; return object id
550 int RegisterObject(CORBA::Object_ptr theObject);
552 // Return id of registered object
553 CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
555 // Return an object that previously had an oldID
556 template<class TInterface>
557 typename TInterface::_var_type GetObjectByOldId( const int oldID )
559 if ( myStudyContext ) {
560 std::string ior = myStudyContext->getIORbyOldId( oldID );
562 return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
564 return TInterface::_nil();
568 * \brief Find SObject for an algo
570 SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
572 void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
573 char* GetParameters(CORBA::Object_ptr theObject);
574 //char* ParseParameters(const char* theParameters);
575 const std::vector< int >& GetLastParamIndices() const { return myLastParamIndex; }
576 const std::vector< std::string >& GetLastParameters() const { return myLastParameters; }
577 const std::string & GetLastObjEntry() const { return myLastObj; }
578 std::vector< std::string > GetAllParameters(const std::string& theObjectEntry) const;
580 // Move objects to the specified position
581 void Move( const SMESH::sobject_list& what,
582 SALOMEDS::SObject_ptr where,
585 CORBA::Boolean IsApplicable ( const char* theAlgoType,
586 const char* theLibName,
587 GEOM::GEOM_Object_ptr theShapeObject,
588 CORBA::Boolean toCheckAll);
590 SMESH::long_array* GetInsideSphere( SMESH::SMESH_IDSource_ptr meshPart,
591 SMESH::ElementType theElemType,
597 SMESH::long_array* GetInsideBox( SMESH::SMESH_IDSource_ptr meshPart,
598 SMESH::ElementType theElemType,
604 CORBA::Double theZ2);
606 SMESH::long_array* GetInsideCylinder( SMESH::SMESH_IDSource_ptr meshPart,
607 SMESH::ElementType theElemType,
615 CORBA::Double theR );
617 SMESH::long_array* GetInside( SMESH::SMESH_IDSource_ptr meshPart,
618 SMESH::ElementType theElemType,
619 GEOM::GEOM_Object_ptr theGeom,
620 CORBA::Double theTolerance );
623 // Get hypothesis creator
624 GenericHypothesisCreator_i* getHypothesisCreator( const char* theHypName,
625 const char* theLibName,
626 std::string& thePlatformLibName);
627 // Create hypothesis of given type
628 SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
629 const char* theLibName);
630 // Create empty mesh on shape
631 SMESH::SMESH_Mesh_ptr createMesh();
634 bool isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh );
636 // Create a sub-mesh on a geometry that is not a sub-shape of the main shape
637 // for the case where a valid sub-shape not found by CopyMeshWithGeom()
638 SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh,
639 GEOM::GEOM_Object_ptr strangerGeom,
642 void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
644 SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
645 SMESH::DriverMED_ReadStatus& theStatus,
646 const char* theCommandNameForPython,
647 const char* theFileNameForPython);
649 std::vector<long> _GetInside(SMESH::SMESH_IDSource_ptr meshPart,
650 SMESH::ElementType ElemType,
651 const TopoDS_Shape& Shape,
652 double* Tolerance = NULL);
655 static GEOM::GEOM_Gen_var myGeomGen;
656 static SALOME_NamingService_Abstract* myNS; // Naming Service
658 static CORBA::ORB_var myOrb; // ORB reference
659 static PortableServer::POA_var myPoa; // POA reference
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 );