Version: 9.16.0
SMESH_Gen_i.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22// File : SMESH_Gen_i.hxx
23// Author : Paul RASCLE, EDF
24// Module : SMESH
25
26#ifndef _SMESH_GEN_I_HXX_
27#define _SMESH_GEN_I_HXX_
28
29#include "SMESH.hxx"
30
31#include <SALOMEconfig.h>
32#include CORBA_SERVER_HEADER(SMESH_Gen)
33#include CORBA_SERVER_HEADER(SMESH_Mesh)
34#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
35#include CORBA_CLIENT_HEADER(GEOM_Gen)
36#include CORBA_CLIENT_HEADER(SALOMEDS)
37#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
38#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
39
40#include "SMESH_Gen.hxx"
41#include "SMESH_Mesh_i.hxx"
43
44#include <SALOME_Component_i.hxx>
45#include <SALOME_NamingService.hxx>
46#include <Utils_CorbaException.hxx>
47
48#include <GEOM_Client.hxx>
49#include <smIdType.hxx>
50
51#include <TCollection_AsciiString.hxx>
52#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
53#include <TColStd_HSequenceOfAsciiString.hxx>
54#include <NCollection_DataMap.hxx>
55
56#include <map>
57#include <sstream>
58
59class SMESH_Mesh_i;
60class SALOME_LifeCycleCORBA;
61
62// ===========================================================
63// Study context - store study-connected objects references
64// ==========================================================
66{
67 typedef NCollection_DataMap< int, std::string > TInt2StringMap;
68 typedef NCollection_DataMap< int, int > TInt2IntMap;
69public:
70 // constructor
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 );
84 // clear data
85 void Clear();
86
87private:
88 // get next free object identifier
89 int getNextId() { return mapIdToIOR.Extent() + 1; }
90
91 TInt2StringMap mapIdToIOR; // persistent-to-transient map
92 TInt2IntMap mapIdToId; // to translate object from persistent to transient form
93};
94
95// ===========================================================
96// SMESH module's engine
97// ==========================================================
98class SMESH_I_EXPORT SMESH_Gen_i : public POA_SMESH::SMESH_Gen, public Engines_Component_i
99{
100public:
101 // Get last created instance of the class
102 static SMESH_Gen_i* GetSMESHGen() { return mySMESHGen;}
103 // Get ORB object
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 );
137
138 // Default constructor
139 SMESH_Gen_i();
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);
147 // Destructor
148 virtual ~SMESH_Gen_i();
149
150 // *****************************************
151 // Interface methods
152 // *****************************************
153 // Set a new Mesh object name
154 void SetName(const char* theIOR,
155 const char* theName);
156
157 //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc );
158 void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo );
159
160 // Set embedded mode
161 void SetEmbeddedMode( CORBA::Boolean theMode );
162 // Check embedded mode
163 CORBA::Boolean IsEmbeddedMode();
164
165 // Set enable publishing in the study
166 void SetEnablePublish( CORBA::Boolean theIsEnablePublish );
167
168 // Check enable publishing
169 CORBA::Boolean IsEnablePublish();
170
171 // Update study
172 void UpdateStudy();
173
174 // Do provide info on objects
175 bool hasObjectInfo();
176
177 // Return an information for a given object
178 char* getObjectInfo(const char* entry);
179
180 // Create hypothesis/algorithm of given type
181 SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
182 const char* theLibName);
183
184 SMESH::SMESH_Hypothesis_ptr CreateHypothesisByAverageLength( const char* theHypType,
185 const char* theLibName,
186 CORBA::Double theAverageLength,
187 CORBA::Boolean theQuadDominated);
188
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);
196
197 /*
198 * Returns True if a hypothesis is assigned to a sole sub-mesh in a current Study
199 */
200 CORBA::Boolean GetSoleSubMeshUsingHyp( SMESH::SMESH_Hypothesis_ptr theHyp,
201 SMESH::SMESH_Mesh_out theMesh,
202 GEOM::GEOM_Object_out theShape);
203
204 // Preferences
205 // ------------
210 void SetBoundaryBoxSegmentation( CORBA::Long theNbSegments );
214 void SetDefaultNbSegments(CORBA::Long theNbSegments);
215
219 virtual void SetOption(const char*, const char*);
223 virtual char* GetOption(const char*);
224
228 bool ToForgetMeshDataOnHypModif() const { return myToForgetMeshDataOnHypModif; }
229
230
231 // Create empty mesh on a shape
232 SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject );
233
234 // Create empty parallel mesh on a shape
235 SMESH::SMESH_ParallelMesh_ptr CreateParallelMesh( GEOM::GEOM_Object_ptr theShapeObject );
236
237 // Create empty mesh
238 SMESH::SMESH_Mesh_ptr CreateEmptyMesh();
239
240 SMESH::SMESH_Mesh_ptr ReloadMeshFromFile(SMESH::SMESH_Mesh_ptr theMesh);
241
242 // Create a mesh and import data from an UNV file
243 SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName );
244
245 SMESH::SMESH_Mesh_ptr ReloadMeshesFromUNV(const char* theFileName,
246 SMESH::SMESH_Mesh_ptr sourceMesh);
247
248 // Create mesh(es) and import data from MED file
249 SMESH::mesh_array* CreateMeshesFromMED( const char* theFileName,
250 SMESH::DriverMED_ReadStatus& theStatus );
251
252 SMESH::mesh_array* ReloadMeshesFromMED(const char* theFileName,
253 SMESH::SMESH_Mesh_ptr sourceMesh,
254 SMESH::DriverMED_ReadStatus& theStatus);
255
256 // Create mesh(es) and import data from MAIL file
257 SMESH::mesh_array* CreateMeshesFromMAIL( const char* theFileName,
258 SMESH::DriverMED_ReadStatus& theStatus );
259
260 // Create mesh(es) and import data from INP (abaqus) file
261 SMESH::mesh_array* CreateMeshesFromINP( const char* theFileName,
262 SMESH::DriverMED_ReadStatus& theStatus ) override;
263
264 // Create mesh(es) and import data from CDB (ansys) file
265 SMESH::mesh_array* CreateMeshesFromCDB( const char* theFileName,
266 SMESH::DriverMED_ReadStatus& theStatus ) override;
267
268 // Create mesh(es) and import data from ASC (systus) file
269 SMESH::mesh_array* CreateMeshesFromASC( const char* theFileName,
270 SMESH::DriverMED_ReadStatus& theStatus ) override;
271
272 // Create mesh(es) and import data from GEOF (zset) file
273 SMESH::mesh_array* CreateMeshesFromGEOF( const char* theFileName,
274 SMESH::DriverMED_ReadStatus& theStatus ) override;
275
276 // Create a mesh and import data from a STL file
277 SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName );
278
279 SMESH::SMESH_Mesh_ptr ReloadMeshesFromSTL(const char* theFileName,
280 SMESH::SMESH_Mesh_ptr sourceMesh);
281
282 // Create mesh(es) and import data from CGNS file
283 SMESH::mesh_array* CreateMeshesFromCGNS( const char* theFileName,
284 SMESH::DriverMED_ReadStatus& theStatus );
285
286 SMESH::mesh_array* ReloadMeshesFromCGNS(const char* theFileName,
287 SMESH::SMESH_Mesh_ptr sourceMesh,
288 SMESH::DriverMED_ReadStatus& theStatus);
289
290 // Create a mesh and import data from a GMF file
291 SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
292 CORBA::Boolean theMakeRequiredGroups,
293 SMESH::ComputeError_out theError);
294
295 SMESH::SMESH_Mesh_ptr ReloadMeshesFromGMF(const char* theFileName,
296 SMESH::SMESH_Mesh_ptr sourceMesh,
297 CORBA::Boolean theMakeRequiredGroups,
298 SMESH::ComputeError_out theError);
299
300 // Create a mesh and import data from any file supported by meshio library
301 SMESH::mesh_array* CreateMeshesFromMESHIO(const char* theFileName,
303 const char* selectedFilter = nullptr,
304 const char* converter = nullptr);
305
306 SMESH::mesh_array* ReloadMeshesFromMESHIO(const char* theFileName,
307 SMESH::SMESH_Mesh_ptr sourceMesh,
309 const char* converter = nullptr);
310
311 // Create dual mesh of a tetrahedron mesh
312 SMESH::SMESH_Mesh_ptr CreateDualMesh(SMESH::SMESH_IDSource_ptr meshPart,
313 const char* meshName,
314 CORBA::Boolean adapt_to_shape);
315
316 // Copy a part of mesh
317 SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
318 const char* meshName,
319 CORBA::Boolean toCopyGroups,
320 CORBA::Boolean toKeepIDs);
321
322 // Create a mesh by copying definitions of another mesh to a given geometry
323 CORBA::Boolean CopyMeshWithGeom( SMESH::SMESH_Mesh_ptr sourceMesh,
324 GEOM::GEOM_Object_ptr newGeometry,
325 const char* meshName,
326 CORBA::Boolean toCopyGroups,
327 CORBA::Boolean toReuseHypotheses,
328 CORBA::Boolean toCopyElements,
329 SMESH::SMESH_Mesh_out newMesh,
330 SMESH::ListOfGroups_out newGroups,
331 SMESH::submesh_array_out newSubmeshes,
332 SMESH::ListOfHypothesis_out newHypotheses,
333 SMESH::string_array_out invalidEntries);
334
335 // Compute mesh on a shape
336 CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
337 GEOM::GEOM_Object_ptr theShapeObject );
338
339 // Cancel Compute mesh on a shape
340 void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
341 GEOM::GEOM_Object_ptr theShapeObject );
342
346 SMESH::compute_error_array* GetComputeErrors(SMESH::SMESH_Mesh_ptr theMesh,
347 GEOM::GEOM_Object_ptr theShapeObject );
348
354 SMESH::smIdType_array* Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
355 GEOM::GEOM_Object_ptr theShapeObject);
356
357 // Returns true if mesh contains enough data to be computed
358 CORBA::Boolean IsReadyToCompute( SMESH::SMESH_Mesh_ptr theMesh,
359 GEOM::GEOM_Object_ptr theShapeObject );
360
366 SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh,
367 GEOM::GEOM_Object_ptr theSubObject,
368 SMESH::Dimension theDimension,
369 SMESH::long_array& theShapesId );
370
371 // Returns errors of hypotheses definition
372 SMESH::algo_error_array* GetAlgoState( SMESH::SMESH_Mesh_ptr theMesh,
373 GEOM::GEOM_Object_ptr theSubObject );
374
375 // Return mesh elements preventing computation of a subshape
376 SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
377 CORBA::Short theSubShapeID );
378
379 // Create groups of elements preventing computation of a sub-shape
380 SMESH::ListOfGroups* MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
381 CORBA::Short theSubShapeID,
382 const char* theGroupName);
383
384 // Get sub-shapes unique ID's list
385 SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
386 const SMESH::object_array& theListOfSubShape );
387
388 // Return geometrical object the given element is built on. Publish it in study.
389 GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
390 SMESH::smIdType theElementID,
391 const char* theGeomName);
392
393 // Return geometrical object the given element is built on. Don't publish it in study.
394 GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
395 SMESH::smIdType theElementID);
396
397 // Concatenate the given meshes into one mesh
398 SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::ListOfIDSources& meshesArray,
399 CORBA::Boolean uniteIdenticalGroups,
400 CORBA::Boolean mergeNodesAndElements,
401 CORBA::Double mergeTolerance,
402 CORBA::Boolean commonGroups,
403 SMESH::SMESH_Mesh_ptr meshToAppendTo);
404
405 // Concatenate the given meshes into one mesh
406 SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::ListOfIDSources& meshesArray,
407 CORBA::Boolean uniteIdenticalGroups,
408 CORBA::Boolean mergeNodesAndElements,
409 CORBA::Double mergeTolerance,
410 SMESH::SMESH_Mesh_ptr meshToAppendTo);
411
412 // Concatenate the given meshes into one mesh
413 // Create the groups of all elements from initial meshes
414 SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::ListOfIDSources& meshesArray,
415 CORBA::Boolean uniteIdenticalGroups,
416 CORBA::Boolean mergeNodesAndElements,
417 CORBA::Double mergeTolerance,
418 SMESH::SMESH_Mesh_ptr meshToAppendTo);
419
420 // Get version of MED format being used.
421 char* GetMEDFileVersion();
422
423 // Get MED version of the file by its name
424 char* GetMEDVersion(const char* theFileName);
425
426 // Check compatibility of file with MED format being used, read only.
427 CORBA::Boolean CheckCompatibility(const char* theFileName);
428
429 // Check compatibility of file with MED format being used, for append on write.
430 CORBA::Boolean CheckWriteCompatibility(const char* theFileName);
431
432 // Get names of meshes defined in file with the specified name
433 SMESH::string_array* GetMeshNames(const char* theFileName);
434
435 // ****************************************************
436 // Interface inherited methods (from SALOMEDS::Driver)
437 // ****************************************************
438
439 // Save SMESH data
440 SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent,
441 const char* theURL,
442 bool isMultiFile );
443 // Load SMESH data
444 bool Load( SALOMEDS::SComponent_ptr theComponent,
445 const SALOMEDS::TMPFile& theStream,
446 const char* theURL,
447 bool isMultiFile );
448 // Save SMESH data in ASCII format
449 SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent,
450 const char* theURL,
451 bool isMultiFile );
452 // Load SMESH data in ASCII format
453 bool LoadASCII( SALOMEDS::SComponent_ptr theComponent,
454 const SALOMEDS::TMPFile& theStream,
455 const char* theURL,
456 bool isMultiFile );
457
458 // Create filter manager
459 SMESH::FilterManager_ptr CreateFilterManager();
460
461 // Return a pattern mesher
462 SMESH::SMESH_Pattern_ptr GetPattern();
463
464 // Create measurement instance
465 SMESH::Measurements_ptr CreateMeasurements();
466
467 // Clears study-connected data when it is closed
468 void Close( SALOMEDS::SComponent_ptr theComponent );
469
470 // Get component data type
471 char* ComponentDataType();
472
473 // Transform data from transient form to persistent
474 char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject,
475 const char* IORString,
476 CORBA::Boolean isMultiFile,
477 CORBA::Boolean isASCII );
478 // Transform data from persistent form to transient
479 char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject,
480 const char* aLocalPersistentID,
481 CORBA::Boolean isMultiFile,
482 CORBA::Boolean isASCII );
483
484 // Returns true if object can be published in the study
485 bool CanPublishInStudy( CORBA::Object_ptr theIOR );
486 // Publish object in the study
487 SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::SObject_ptr theSObject,
488 CORBA::Object_ptr theObject,
489 const char* theName );
490
491 // Copy-paste methods - returns true if object can be copied to the clipboard
492 CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr /*theObject*/ ) { return false; }
493 // Copy-paste methods - copy object to the clipboard
494 SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr /*theObject*/, CORBA::Long& /*theObjectID*/ ) { return NULL; }
495 // Copy-paste methods - returns true if object can be pasted from the clipboard
496 CORBA::Boolean CanPaste( const char* /*theComponentName*/, CORBA::Long /*theObjectID*/ ) { return false; }
497 // Copy-paste methods - paste object from the clipboard
498 SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& /*theStream*/,
499 CORBA::Long /*theObjectID*/,
500 SALOMEDS::SObject_ptr /*theObject*/ ) {
501 SALOMEDS::SObject_var aResultSO;
502 return aResultSO._retn();
503 }
504
505 // ============
506 // Version information
507 // ============
508
509 virtual char* getVersion();
510
511 // ============
512 // Dump python
513 // ============
514
515 virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
516 CORBA::Boolean isMultiFile,
517 CORBA::Boolean& isValidScript);
518
519 // Internal method used by C++ TPythonDump class destructor
520 void AddToPythonScript (const TCollection_AsciiString& theString);
521
522 // CORBA interface method (idl interfaced) for Python plugins
523 virtual void AddToPythonScript (const char* theCommand);
524
525 void PausePythonDumpRecording();
526
527 void ResumePythonDumpRecording();
528
529 void RemoveLastFromPythonScript();
530
531 void SavePython();
532
533 TCollection_AsciiString DumpPython_impl (Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
534 Resource_DataMapOfAsciiStringAsciiString& theNames,
535 bool isPublished,
536 bool isMultiFile,
537 bool isHistoricalDump,
538 bool& aValidScript,
539 TCollection_AsciiString& theSavedTrace);
540
541 TCollection_AsciiString GetNewPythonLines();
542
543 void CleanPythonTrace();
544
545 int CountInPyDump(const TCollection_AsciiString& text);
546
547 SMESH::MG_ADAPT_ptr CreateMG_ADAPT();
548 SMESHHOMARD::HOMARD_Gen_ptr CreateHOMARD_ADAPT();
549 SMESH::MG_ADAPT_ptr CreateAdaptationHypothesis();
550 //SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType);
551 SALOME::GenericObj_ptr Adaptation( const char* adaptationType);
552
553 // *****************************************
554 // Internal methods
555 // *****************************************
556public:
557 // Get shape reader
558 GEOM_Client* GetShapeReader();
559
560 // Tags definition
561 static long GetHypothesisRootTag();
562 static long GetAlgorithmsRootTag();
563 static long GetRefOnShapeTag();
564 static long GetRefOnAppliedHypothesisTag();
565 static long GetRefOnAppliedAlgorithmsTag();
566 static long GetSubMeshOnVertexTag();
567 static long GetSubMeshOnEdgeTag();
568 static long GetSubMeshOnFaceTag();
569 static long GetSubMeshOnSolidTag();
570 static long GetSubMeshOnCompoundTag();
571 static long GetSubMeshOnWireTag();
572 static long GetSubMeshOnShellTag();
573 static long GetNodeGroupsTag();
574 static long GetEdgeGroupsTag();
575 static long GetFaceGroupsTag();
576 static long GetVolumeGroupsTag();
577 static long Get0DElementsGroupsTag();
578 static long GetBallElementsGroupsTag();
579
580 // publishing methods
581 SALOMEDS::SComponent_ptr PublishComponent();
582 SALOMEDS::SObject_ptr PublishMesh (SMESH::SMESH_Mesh_ptr theMesh,
583 const char* theName = 0,
584 const char* thePixMap = 0);
585 SALOMEDS::SObject_ptr PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
586 const char* theName = 0);
587 SALOMEDS::SObject_ptr PublishSubMesh (SMESH::SMESH_Mesh_ptr theMesh,
588 SMESH::SMESH_subMesh_ptr theSubMesh,
589 GEOM::GEOM_Object_ptr theShapeObject,
590 const char* theName = 0);
591 SALOMEDS::SObject_ptr PublishGroup (SMESH::SMESH_Mesh_ptr theMesh,
592 SMESH::SMESH_GroupBase_ptr theGroup,
593 GEOM::GEOM_Object_ptr theShapeObject,
594 const char* theName = 0);
595 void UpdateIcons(SMESH::SMESH_Mesh_ptr theMesh);
596 void UpdateGroupIcon(SMESH::SMESH_GroupBase_ptr theGroup);
597 void HighLightInvalid(CORBA::Object_ptr theObject, bool isInvalid);
598 bool IsInvalid(SALOMEDS::SObject_ptr theObject);
599 bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr theMesh,
600 GEOM::GEOM_Object_ptr theShapeObject,
601 SMESH::SMESH_Hypothesis_ptr theHyp);
602 bool RemoveHypothesisFromShape(SMESH::SMESH_Mesh_ptr theMesh,
603 GEOM::GEOM_Object_ptr theShapeObject,
604 SMESH::SMESH_Hypothesis_ptr theHyp);
605 SALOMEDS::SObject_ptr GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
606 GEOM::GEOM_Object_ptr theShape);
607 void SetName(SALOMEDS::SObject_ptr theSObject,
608 const char* theName,
609 const char* theDefaultName = 0);
610
611 void SetPixMap(SALOMEDS::SObject_ptr theSObject, const char *thePixMap);
612 void addReference (SALOMEDS::SObject_ptr theSObject, CORBA::Object_ptr theToObject, int theTag = 0);
613
614 // Get study context
615 StudyContext* GetStudyContext();
616
617 // Register an object in a StudyContext; return object id
618 int RegisterObject(CORBA::Object_ptr theObject);
619
620 // Return id of registered object
621 CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
622
623 // Return an object that previously had an oldID
624 template<class TInterface>
625 typename TInterface::_var_type GetObjectByOldId( const int oldID )
626 {
627 if ( myStudyContext ) {
628 std::string ior = myStudyContext->getIORbyOldId( oldID );
629 if ( !ior.empty() )
630 return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
631 }
632 return TInterface::_nil();
633 }
634
638 SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
639
640 void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
641 char* GetParameters(CORBA::Object_ptr theObject);
642 //char* ParseParameters(const char* theParameters);
643 const std::vector< int >& GetLastParamIndices() const { return myLastParamIndex; }
644 const std::vector< std::string >& GetLastParameters() const { return myLastParameters; }
645 const std::string & GetLastObjEntry() const { return myLastObj; }
646 std::vector< std::string > GetAllParameters(const std::string& theObjectEntry) const;
647
648 // Move objects to the specified position
649 void Move( const SMESH::sobject_list& what,
650 SALOMEDS::SObject_ptr where,
651 CORBA::Long row );
652
653 CORBA::Boolean IsApplicable ( const char* theAlgoType,
654 const char* theLibName,
655 GEOM::GEOM_Object_ptr theShapeObject,
656 CORBA::Boolean toCheckAll);
657
658 SMESH::long_array* GetInsideSphere( SMESH::SMESH_IDSource_ptr meshPart,
659 SMESH::ElementType theElemType,
660 CORBA::Double theX,
661 CORBA::Double theY,
662 CORBA::Double theZ,
663 CORBA::Double theR);
664
665 SMESH::long_array* GetInsideBox( SMESH::SMESH_IDSource_ptr meshPart,
666 SMESH::ElementType theElemType,
667 CORBA::Double theX1,
668 CORBA::Double theY1,
669 CORBA::Double theZ1,
670 CORBA::Double theX2,
671 CORBA::Double theY2,
672 CORBA::Double theZ2);
673
674 SMESH::long_array* GetInsideCylinder( SMESH::SMESH_IDSource_ptr meshPart,
675 SMESH::ElementType theElemType,
676 CORBA::Double theX,
677 CORBA::Double theY,
678 CORBA::Double theZ,
679 CORBA::Double theDX,
680 CORBA::Double theDY,
681 CORBA::Double theDZ,
682 CORBA::Double theH,
683 CORBA::Double theR );
684
685 SMESH::long_array* GetInside( SMESH::SMESH_IDSource_ptr meshPart,
686 SMESH::ElementType theElemType,
687 GEOM::GEOM_Object_ptr theGeom,
688 CORBA::Double theTolerance );
689
690private:
691
692 SMESH::mesh_array* CreateMeshesFromMEDConverterInMedcoupling( const char* theFileName,
693 SMESH::DriverMED_ReadStatus& theStatus, const std::string& converterPyFuncName);
694
695 // Get hypothesis creator
696 GenericHypothesisCreator_i* getHypothesisCreator( const char* theHypName,
697 const char* theLibName,
698 std::string& thePlatformLibName);
699 // Create hypothesis of given type
700 SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
701 const char* theLibName);
702 // Create empty mesh on shape
703 SMESH::SMESH_Mesh_ptr createMesh();
704 SMESH::SMESH_ParallelMesh_ptr createParallelMesh();
705
706 // Check mesh icon
707 bool isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh );
708
709 // Create a sub-mesh on a geometry that is not a sub-shape of the main shape
710 // for the case where a valid sub-shape not found by CopyMeshWithGeom()
711 SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh,
712 GEOM::GEOM_Object_ptr strangerGeom,
713 const char* name );
714
715 void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
716
717 std::vector<long> _GetInside(SMESH::SMESH_IDSource_ptr meshPart,
718 SMESH::ElementType ElemType,
719 const TopoDS_Shape& Shape,
720 double* Tolerance = NULL);
721
722protected:
723 static GEOM::GEOM_Gen_var myGeomGen;
724 static SALOME_NamingService_Abstract* myNS; // Naming Service
725private:
726 static CORBA::ORB_var myOrb; // ORB reference
727 static PortableServer::POA_var myPoa; // POA reference
728 static SALOME_LifeCycleCORBA* myLCC; // Life Cycle CORBA
729 static SMESH_Gen_i* mySMESHGen; // Point to last created instance of the class
730 ::SMESH_Gen myGen; // SMESH_Gen local implementation
731
732 // hypotheses managing
733 std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
734
735 StudyContext* myStudyContext; // study context
736
737 GEOM_Client* myShapeReader; // Shape reader
738 CORBA::Boolean myIsEmbeddedMode; // Current mode
739 CORBA::Boolean myIsEnablePublish; // Enable publishing
740
741 // Default color of groups
743
744 // To load full mesh data from study at hyp modification or not
746
747 // Dump Python: trace of API methods calls
748 Handle(TColStd_HSequenceOfAsciiString) myPythonScript;
750 std::vector< int > myLastParamIndex;
751 std::vector< std::string > myLastParameters;
752 std::string myLastObj;
753};
754
755
756namespace SMESH
757{
758 template<class T>
759 T
760 DownCast(CORBA::Object_ptr theArg)
761 {
762 return dynamic_cast<T>(SMESH_Gen_i::GetServant(theArg).in());
763 }
764
769 inline void throwCorbaException(const char* excText)
770 {
771 THROW_SALOME_CORBA_EXCEPTION( excText, SALOME::INTERNAL_ERROR );
772 }
773}
774
775
776#endif
#define SMESH_I_EXPORT
Definition: SMESH.hxx:39
Definition: SMESH_Hypothesis_i.hxx:144
Definition: SMESH_Gen_i.hxx:99
::SMESH_Gen myGen
Definition: SMESH_Gen_i.hxx:730
std::string myLastObj
Definition: SMESH_Gen_i.hxx:752
virtual SALOME_ModuleCatalog::ModuleCatalog_var getModuleCatalog() const =0
CORBA::Boolean myIsEnablePublish
Definition: SMESH_Gen_i.hxx:739
static PortableServer::POA_var myPoa
Definition: SMESH_Gen_i.hxx:727
static PortableServer::POA_var GetPOA()
Definition: SMESH_Gen_i.hxx:106
CORBA::Boolean CanPaste(const char *, CORBA::Long)
Definition: SMESH_Gen_i.hxx:496
SALOMEDS::Study_var getStudyServant() const
Definition: SMESH_Gen_i.hxx:117
Handle(TColStd_HSequenceOfAsciiString) myPythonScript
const std::string & GetLastObjEntry() const
Definition: SMESH_Gen_i.hxx:645
StudyContext * myStudyContext
Definition: SMESH_Gen_i.hxx:735
bool ToForgetMeshDataOnHypModif() const
To load full mesh data from study at hyp modification or not.
Definition: SMESH_Gen_i.hxx:228
static CORBA::ORB_var GetORB()
Definition: SMESH_Gen_i.hxx:104
virtual GEOM::GEOM_Gen_var GetGeomEngine(bool isShaper)=0
static SMESH_Gen_i * GetSMESHGen()
Definition: SMESH_Gen_i.hxx:102
CORBA::Boolean myIsEmbeddedMode
Definition: SMESH_Gen_i.hxx:738
CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr)
Definition: SMESH_Gen_i.hxx:492
std::map< std::string, GenericHypothesisCreator_i * > myHypCreatorMap
Definition: SMESH_Gen_i.hxx:733
SALOMEDS::TMPFile * CopyFrom(SALOMEDS::SObject_ptr, CORBA::Long &)
Definition: SMESH_Gen_i.hxx:494
const std::vector< std::string > & GetLastParameters() const
Definition: SMESH_Gen_i.hxx:644
static SMESH_Gen_i * mySMESHGen
Definition: SMESH_Gen_i.hxx:729
bool myToForgetMeshDataOnHypModif
Definition: SMESH_Gen_i.hxx:745
std::vector< int > myLastParamIndex
Definition: SMESH_Gen_i.hxx:750
static SALOME_NamingService_Abstract * myNS
Definition: SMESH_Gen_i.hxx:724
TInterface::_var_type GetObjectByOldId(const int oldID)
Definition: SMESH_Gen_i.hxx:625
static CORBA::ORB_var myOrb
Definition: SMESH_Gen_i.hxx:726
static GEOM::GEOM_Gen_var myGeomGen
Definition: SMESH_Gen_i.hxx:723
GEOM_Client * myShapeReader
Definition: SMESH_Gen_i.hxx:737
static SALOME_LifeCycleCORBA * myLCC
Definition: SMESH_Gen_i.hxx:728
std::vector< std::string > myLastParameters
Definition: SMESH_Gen_i.hxx:751
static PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject)
GetServant [ static ].
Definition: SMESH_Gen_i.cxx:191
std::string myDefaultGroupColor
Definition: SMESH_Gen_i.hxx:742
virtual SALOMEDS::Study_var getStudyServantVirtual() const =0
SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile &, CORBA::Long, SALOMEDS::SObject_ptr)
Definition: SMESH_Gen_i.hxx:498
bool myIsHistoricalPythonDump
Definition: SMESH_Gen_i.hxx:749
const std::vector< int > & GetLastParamIndices() const
Definition: SMESH_Gen_i.hxx:643
Definition: SMESH_Gen.hxx:68
Definition: SMESH_Mesh_i.hxx:57
Definition: SMESH_Gen_i.hxx:66
NCollection_DataMap< int, int > TInt2IntMap
Definition: SMESH_Gen_i.hxx:68
TInt2StringMap mapIdToIOR
Definition: SMESH_Gen_i.hxx:91
int getNextId()
Definition: SMESH_Gen_i.hxx:89
NCollection_DataMap< int, std::string > TInt2StringMap
Definition: SMESH_Gen_i.hxx:67
StudyContext()
Definition: SMESH_Gen_i.hxx:71
TInt2IntMap mapIdToId
Definition: SMESH_Gen_i.hxx:92
bool CheckCompatibility(const std::string &fileName, bool isForAppend)
: Check read or write(append) Compatibility of a med file
Definition: MED_Factory.cxx:114
bool GetMEDVersion(const std::string &fileName, int &major, int &minor, int &release)
Definition: MED_Factory.cxx:150
Definition: SMESH_ControlsClassifier.cxx:39
T DownCast(CORBA::Object_ptr theArg)
Definition: SMESH_Gen_i.hxx:760
sequence< AlgoStateError > algo_error_array
Definition: SMESH_Gen.idl:96
bool IsApplicable(const QString &aHypType, GEOM::GEOM_Object_ptr theGeomObject, const bool toCheckAll)
Definition: SMESHGUI_HypothesesUtils.cxx:617
sequence< GEOM::GEOM_Object > object_array
Definition: SMESH_Gen.idl:46
SMESH::SMESH_Pattern_var GetPattern()
Definition: SMESHGUI_PatternUtils.cxx:34
sequence< SMESH_IDSource > ListOfIDSources
Definition: SMESH_Mesh.idl:41
sequence< ComputeError > compute_error_array
Definition: SMESH_Gen.idl:125
sequence< smIdType > smIdType_array
Definition: SMESH_Mesh.idl:45
Dimension
Definition: SMESH_Hypothesis.idl:35
void throwCorbaException(const char *excText)
Function used in SMESH_CATCH to convert a caught exception to SALOME::SALOME_Exception.
Definition: SMESH_Gen_i.hxx:769
ElementType
Enumeration for element type, like in SMDS.
Definition: SMESH_Mesh.idl:128
sequence< string > string_array
Definition: SMESH_Mesh.idl:46
sequence< SMESH_GroupBase > ListOfGroups
Definition: SMESH_Mesh.idl:39
sequence< SMESH_Mesh > mesh_array
Definition: SMESH_Gen.idl:47
CORBA::Object_var SObjectToObject(_PTR(SObject) theSObject)
Definition: SMESHGUI_Utils.cxx:180
sequence< SALOMEDS::SObject > sobject_list
Definition: SMESH_Gen.idl:45
SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const QString &aHypType, const QString &aHypName, const bool)
Definition: SMESHGUI_HypothesesUtils.cxx:588
void SetName(_PTR(SObject) theSObject, const QString &theName)
Definition: SMESHGUI_Utils.cxx:134
DriverMED_ReadStatus
Enumeration for mesh read status (used by SMESH_Gen::CreateMeshesFrom*() methods)
Definition: SMESH_Mesh.idl:231
sequence< long > long_array
Definition: SMESH_Mesh.idl:44
Way to initialize hypothesis.
Definition: SMESH_Gen.idl:131
Structure containing mesh edit preview data.
Definition: SMESH_Mesh.idl:279