Salome HOME
Merge from V6_main (04/10/2012)
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2004-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File      : GHS3DPlugin_Hypothesis_i.cxx
21 // Created   : Wed Apr  2 13:53:01 2008
22 // Author    : Edward AGAPOV (eap)
23 //
24 #include "GHS3DPlugin_Hypothesis_i.hxx"
25
26 #include "SMESH_Gen.hxx"
27 #include "SMESH_PythonDump.hxx"
28 //#include "SMESH_Mesh.hxx"
29 //#include "SMESH_ProxyMesh.hxx"
30 //#include <StdMeshers_QuadToTriaAdaptor.hxx>
31
32 #include "Utils_CorbaException.hxx"
33 #include "utilities.h"
34 #include "SMESH_Mesh_i.hxx"
35 #include "SMESH_Group_i.hxx"
36 #include "SMESH_Gen_i.hxx"
37 #include "SMESH_TypeDefs.hxx"
38 #include "SMESHDS_GroupBase.hxx"
39
40 // SALOME KERNEL includes
41 #include "SALOMEDSClient.hxx"
42 #include <SALOMEDSClient_definitions.hxx>
43 // // IDL headers
44 // #include <SALOMEconfig.h>
45 // #include CORBA_SERVER_HEADER(SALOMEDS)
46
47 #ifndef GHS3D_VERSION
48 #define GHS3D_VERSION 41
49 #endif
50 //=======================================================================
51 //function : GHS3DPlugin_Hypothesis_i
52 //=======================================================================
53
54 GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
55                                                     int                     theStudyId,
56                                                     ::SMESH_Gen*            theGenImpl)
57   : SALOME::GenericObj_i( thePOA ), 
58     SMESH_Hypothesis_i( thePOA )
59 {
60   MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" );
61   myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
62                                               theStudyId,
63                                               theGenImpl);
64 }
65
66 //=======================================================================
67 //function : ~GHS3DPlugin_Hypothesis_i
68 //=======================================================================
69
70 GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
71 {
72   MESSAGE( "GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i" );
73 }
74
75 //=======================================================================
76 //function : SetToMeshHoles
77 //=======================================================================
78
79 void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
80 {
81   ASSERT(myBaseImpl);
82   this->GetImpl()->SetToMeshHoles(toMesh);
83   SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
84 }
85
86 //=======================================================================
87 //function : GetToMeshHoles
88 //=======================================================================
89
90 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
91 {
92   ASSERT(myBaseImpl);
93   return this->GetImpl()->GetToMeshHoles();
94 }
95
96 //=======================================================================
97 //function : SetMaximumMemory
98 //=======================================================================
99
100 void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Short MB)
101    throw ( SALOME::SALOME_Exception )
102 {
103   if ( MB == 0 )
104     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
105   ASSERT(myBaseImpl);
106   this->GetImpl()->SetMaximumMemory(MB);
107   SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
108 }
109
110 //=======================================================================
111 //function : GetMaximumMemory
112 //=======================================================================
113
114 CORBA::Short GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
115 {
116   ASSERT(myBaseImpl);
117   return this->GetImpl()->GetMaximumMemory();
118 }
119
120 //=======================================================================
121 //function : SetInitialMemory
122 //=======================================================================
123
124 void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Short MB)
125   throw ( SALOME::SALOME_Exception )
126 {
127   if ( MB == 0 )
128     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
129   ASSERT(myBaseImpl);
130   this->GetImpl()->SetInitialMemory(MB);
131   SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
132 }
133
134 //=======================================================================
135 //function : GetInitialMemory
136 //=======================================================================
137
138 CORBA::Short GHS3DPlugin_Hypothesis_i::GetInitialMemory()
139 {
140   ASSERT(myBaseImpl);
141   return this->GetImpl()->GetInitialMemory();
142 }
143
144 //=======================================================================
145 //function : SetOptimizationLevel
146 //=======================================================================
147
148 void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
149   throw ( SALOME::SALOME_Exception )
150 {
151   ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
152       (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
153   if ( l < ::GHS3DPlugin_Hypothesis::None ||
154        l > ::GHS3DPlugin_Hypothesis::Strong )
155     THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
156     
157   ASSERT(myBaseImpl);
158   this->GetImpl()->SetOptimizationLevel(l);
159   SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
160 }
161
162 //=======================================================================
163 //function : GetOptimizationLevel
164 //=======================================================================
165
166 CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
167 {
168   ASSERT(myBaseImpl);
169   return this->GetImpl()->GetOptimizationLevel();
170 }
171
172 //=======================================================================
173 //function : SetWorkingDirectory
174 //=======================================================================
175
176 void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
177 {
178   if (!path )
179     THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
180
181   string file(path);
182   const char lastChar = *file.rbegin();
183 #ifdef WIN32
184   if ( lastChar != '\\' ) file += '\\';
185 #else
186   if ( lastChar != '/' ) file += '/';
187 #endif
188   file += "GHS3D.log";
189   SMESH_Mesh_i::PrepareForWriting (file.c_str());
190
191   ASSERT(myBaseImpl);
192   this->GetImpl()->SetWorkingDirectory(path);
193   SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
194 }
195
196 //=======================================================================
197 //function : GetWorkingDirectory
198 //=======================================================================
199
200 char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
201 {
202   ASSERT(myBaseImpl);
203   return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
204 }
205
206 //=======================================================================
207 //function : SetKeepFiles
208 //=======================================================================
209
210 void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
211 {
212   ASSERT(myBaseImpl);
213   this->GetImpl()->SetKeepFiles(toKeep);
214   SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
215 }
216
217 //=======================================================================
218 //function : GetKeepFiles
219 //=======================================================================
220
221 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
222 {
223   ASSERT(myBaseImpl);
224   return this->GetImpl()->GetKeepFiles();
225 }
226
227 //=======================================================================
228 //function : SetVerboseLevel
229 //=======================================================================
230
231 void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
232   throw ( SALOME::SALOME_Exception )
233 {
234   if (level < 0 || level > 10 )
235     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
236                                   SALOME::BAD_PARAM );
237   ASSERT(myBaseImpl);
238   this->GetImpl()->SetVerboseLevel(level);
239   SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
240 }
241
242 //=======================================================================
243 //function : GetVerboseLevel
244 //=======================================================================
245
246 CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
247 {
248   ASSERT(myBaseImpl);
249   return this->GetImpl()->GetVerboseLevel();
250 }
251
252 //=======================================================================
253 //function : SetToCreateNewNodes
254 //=======================================================================
255
256 void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
257 {
258   ASSERT(myBaseImpl);
259   this->GetImpl()->SetToCreateNewNodes(toCreate);
260   SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
261 }
262
263 //=======================================================================
264 //function : GetToCreateNewNodes
265 //=======================================================================
266
267 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
268 {
269   ASSERT(myBaseImpl);
270   return this->GetImpl()->GetToCreateNewNodes();
271 }
272
273 //=======================================================================
274 //function : SetToUseBoundaryRecoveryVersion
275 //=======================================================================
276
277 void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
278 {
279   ASSERT(myBaseImpl);
280   this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
281   SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
282 }
283
284 //=======================================================================
285 //function : GetToUseBoundaryRecoveryVersion
286 //=======================================================================
287
288 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
289 {
290   ASSERT(myBaseImpl);
291   return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
292 }
293
294 //=======================================================================
295 //function : SetFEMCorrection
296 //=======================================================================
297
298 void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
299 {
300   ASSERT(myBaseImpl);
301   this->GetImpl()->SetFEMCorrection(toUseFem);
302   SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
303 }
304
305 //=======================================================================
306 //function : GetFEMCorrection
307 //=======================================================================
308
309 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection()
310 {
311   ASSERT(myBaseImpl);
312   return this->GetImpl()->GetFEMCorrection();
313 }
314
315 //=======================================================================
316 //function : SetToRemoveCentralPoint
317 //=======================================================================
318
319 void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
320 {
321   ASSERT(myBaseImpl);
322   this->GetImpl()->SetToRemoveCentralPoint(toRemove);
323   SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
324 }
325
326 //=======================================================================
327 //function : GetToRemoveCentralPoint
328 //=======================================================================
329
330 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
331 {
332   ASSERT(myBaseImpl);
333   return this->GetImpl()->GetToRemoveCentralPoint();
334 }
335
336 //=======================================================================
337 //function : SetTextOption
338 //=======================================================================
339
340 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
341 {
342   ASSERT(myBaseImpl);
343   this->GetImpl()->SetTextOption(option);
344   SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
345 }
346
347 //=======================================================================
348 //function : GetTextOption
349 //=======================================================================
350
351 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
352 {
353   ASSERT(myBaseImpl);
354   return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
355 }
356
357 //=======================================================================
358 //function : SetToRemoveCentralPoint
359 //=======================================================================
360
361 void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
362 {
363   if (gradation <= 1)
364     THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
365   ASSERT(myBaseImpl);
366   if (gradation != GetGradation()) {
367     this->GetImpl()->SetGradation(gradation);
368     SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
369   }
370 }
371
372 //=======================================================================
373 //function : GetToRemoveCentralPoint
374 //=======================================================================
375
376 CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
377 {
378   ASSERT(myBaseImpl);
379   return this->GetImpl()->GetGradation();
380 }
381
382 //=======================================================================
383 //function : SetEnforcedVertex
384 //=======================================================================
385
386 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
387     throw (SALOME::SALOME_Exception) {
388   ASSERT(myBaseImpl);
389   MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
390   return p_SetEnforcedVertex(size, x, y, z);
391 }
392
393 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
394     throw (SALOME::SALOME_Exception) {
395   ASSERT(myBaseImpl);
396   MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
397   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
398 }
399
400 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
401     throw (SALOME::SALOME_Exception) {
402   ASSERT(myBaseImpl);
403   MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
404   return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
405 }
406
407 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
408     throw (SALOME::SALOME_Exception) {
409   ASSERT(myBaseImpl);
410   MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
411   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
412 }
413
414 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
415     throw (SALOME::SALOME_Exception) {
416   ASSERT(myBaseImpl);
417   
418   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
419     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
420     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
421   }
422   
423   string theVertexEntry = theVertex->GetStudyEntry();
424   CORBA::Double x = 0, y = 0, z = 0;
425   CORBA::Boolean isCompound = false;
426   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
427   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
428   if (theVertexEntry.empty()) {
429     string aName;
430     if (theVertex->GetShapeType() == GEOM::VERTEX) {
431       aName = "Vertex_";
432     }
433     if (theVertex->GetShapeType() == GEOM::COMPOUND) {
434       aName = "Compound_";
435       isCompound = true;
436     }
437     aName += theVertex->GetEntry();
438     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
439     if (!theSVertex->_is_nil())
440       theVertexEntry = theSVertex->GetID();
441   }
442   if (theVertexEntry.empty())
443     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
444
445   if (theVertex->GetShapeType() == GEOM::VERTEX) {
446     GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
447     if (CORBA::is_nil(measureOp))
448       return false;
449     
450     measureOp->PointCoordinates (theVertex, x, y, z);
451     MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
452   }
453
454   string theVertexName = theVertex->GetName();
455   MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
456   
457   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
458 }
459
460 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
461     throw (SALOME::SALOME_Exception) {
462   ASSERT(myBaseImpl);
463   
464   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
465     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
466     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
467   }
468   
469   string theVertexEntry = theVertex->GetStudyEntry();
470   CORBA::Double x = 0, y = 0, z = 0;
471   CORBA::Boolean isCompound = false;
472   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
473   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
474   if (theVertexEntry.empty()) {
475     string aName;
476     if (theVertex->GetShapeType() == GEOM::VERTEX) {
477       aName = "Vertex_";
478     }
479     if (theVertex->GetShapeType() == GEOM::COMPOUND) {
480       aName = "Compound_";
481       isCompound = true;
482     }
483     aName += theVertex->GetEntry();
484     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
485     if (!theSVertex->_is_nil())
486       theVertexEntry = theSVertex->GetID();
487   }
488   if (theVertexEntry.empty())
489     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
490
491   if (theVertex->GetShapeType() == GEOM::VERTEX) {
492     GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
493     if (CORBA::is_nil(measureOp))
494       return false;
495     
496     measureOp->PointCoordinates (theVertex, x, y, z);
497     MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
498   }
499     
500   string theVertexName = theVertex->GetName();
501   MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
502   
503   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
504 }
505
506 bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
507                                                    const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
508                                                    CORBA::Boolean isCompound)
509     throw (SALOME::SALOME_Exception) {
510   ASSERT(myBaseImpl);
511   MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
512   bool newValue = false;
513
514   ::GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap coordsList;
515   ::GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap enfVertexEntryList;
516   if (string(theVertexEntry).empty()) {
517     coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
518     std::vector<double> coords;
519     coords.push_back(x);
520     coords.push_back(y);
521     coords.push_back(z);
522     if (coordsList.find(coords) == coordsList.end()) {
523       MESSAGE("Coords not found: add it in coordsList");
524       newValue = true;
525     }
526     else {
527       MESSAGE("Coords already found, compare names");
528       ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
529       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
530         MESSAGE("The names or size are different: update");
531 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
532         newValue = true;
533       }
534       else {
535         MESSAGE("The names and size are identical");
536       }
537     }
538
539     if (newValue) {
540       if (string(theVertexName).empty()) {
541         if (string(theGroupName).empty())
542           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
543         else
544           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
545       }
546       else {
547         if (string(theGroupName).empty())
548           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size  << ", \"" << theVertexName << "\")";
549         else
550           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size  << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
551       }
552     }
553   } 
554   else {
555 //   if (isCompound || (!isCompound && !string(theVertexEntry).empty())) {
556     enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
557 //     ::BLSURFPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
558     if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
559       MESSAGE("Geom entry not found: add it in enfVertexEntryList");
560       newValue = true;
561     }
562     else {
563       MESSAGE("Geom entry already found, compare names");
564       ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
565       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
566         MESSAGE("The names or size are different: update");
567 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
568         newValue = true;
569       }
570       else {
571         MESSAGE("The names and size are identical");
572       }
573     }
574
575     if (newValue) {
576       if (string(theGroupName).empty())
577         SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
578       else
579         SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
580     }
581   }
582
583   if (newValue)
584     this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
585
586   MESSAGE("IDL : SetEnforcedVertexEntry END");
587   return newValue;
588 }
589
590 //=======================================================================
591 //function : GetEnforcedVertex
592 //=======================================================================
593
594 CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
595   throw (SALOME::SALOME_Exception)
596 {
597   ASSERT(myBaseImpl);
598   try {
599     bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
600     SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
601     return isDone;
602   }
603   catch (const std::invalid_argument& ex) {
604     SALOME::ExceptionStruct ExDescription;
605     ExDescription.text = ex.what();
606     ExDescription.type = SALOME::BAD_PARAM;
607     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
608     ExDescription.lineNumber = 513;
609     throw SALOME::SALOME_Exception(ExDescription);
610   }
611   catch (SALOME_Exception& ex) {
612     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
613   }
614 }
615
616 //=======================================================================
617 //function : GetEnforcedVertex
618 //=======================================================================
619
620 CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
621   throw (SALOME::SALOME_Exception)
622 {
623   ASSERT(myBaseImpl);
624   
625   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
626     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
627     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
628   }
629   
630   string theVertexEntry = theVertex->GetStudyEntry();
631   if (theVertexEntry.empty()) {
632     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
633     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
634     string aName;
635     if (theVertex->GetShapeType() == GEOM::VERTEX)
636       aName = "Vertex_";
637     if (theVertex->GetShapeType() == GEOM::COMPOUND)
638       aName = "Compound_";
639     aName += theVertex->GetEntry();
640     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
641     if (!theSVertex->_is_nil())
642       theVertexEntry = theSVertex->GetID();
643   }
644   if (theVertexEntry.empty())
645     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
646
647   string theVertexName = theVertex->GetName();
648   
649   try {
650     bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
651     SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
652     return isDone;
653   }
654   catch (const std::invalid_argument& ex) {
655     SALOME::ExceptionStruct ExDescription;
656     ExDescription.text = ex.what();
657     ExDescription.type = SALOME::BAD_PARAM;
658     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
659     ExDescription.lineNumber = 538;
660     throw SALOME::SALOME_Exception(ExDescription);
661   }
662   catch (SALOME_Exception& ex) {
663     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
664   }
665 }
666
667 //=======================================================================
668 //function : GetEnforcedVertices
669 //=======================================================================
670
671 GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVertices()
672 {
673   ASSERT(myBaseImpl);
674   GHS3DPlugin::GHS3DEnforcedVertexList_var result = new GHS3DPlugin::GHS3DEnforcedVertexList();
675
676   const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
677   result->length( enfVertexList.size() );
678
679   ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator it = enfVertexList.begin();
680
681   for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
682     ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* currentVertex = (*it);
683     GHS3DPlugin::GHS3DEnforcedVertex_var enfVertex = new GHS3DPlugin::GHS3DEnforcedVertex();
684     // Name
685     enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
686     // Geom Vertex Entry
687     enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
688     // Coords
689     GHS3DPlugin::TCoords_var coords = new GHS3DPlugin::TCoords();
690     coords->length(currentVertex->coords.size());
691     for (int ind = 0; ind < currentVertex->coords.size(); ind++)
692       coords[ind] = currentVertex->coords[ind];
693     enfVertex->coords = coords;
694     // Group Name
695     enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
696     // Size
697     enfVertex->size = currentVertex->size;
698     // isCompound
699     enfVertex->isCompound = currentVertex->isCompound;
700     
701     result[i]=enfVertex;
702     }
703   
704 //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
705
706   return result._retn();
707 }
708
709 //=======================================================================
710 //function : RemoveEnforcedVertex
711 //=======================================================================
712
713 bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
714   throw (SALOME::SALOME_Exception)
715 {
716   ASSERT(myBaseImpl);
717   try {
718     bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
719     SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
720     return res;
721   }
722   catch (const std::invalid_argument& ex) {
723     SALOME::ExceptionStruct ExDescription;
724     ExDescription.text = ex.what();
725     ExDescription.type = SALOME::BAD_PARAM;
726     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
727     ExDescription.lineNumber = 625;
728     throw SALOME::SALOME_Exception(ExDescription);
729   }
730   catch (SALOME_Exception& ex) {
731     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
732   }
733 }
734
735 bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
736   throw (SALOME::SALOME_Exception)
737 {
738   ASSERT(myBaseImpl);
739   
740   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
741     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
742     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
743   }
744   
745   string theVertexEntry = theVertex->GetStudyEntry();
746   if (theVertexEntry.empty()) {
747     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
748     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
749     string aName;
750     if (theVertex->GetShapeType() == GEOM::VERTEX)
751       aName = "Vertex_";
752     if (theVertex->GetShapeType() == GEOM::COMPOUND)
753       aName = "Compound_";
754     aName += theVertex->GetEntry();
755     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
756     if (!theSVertex->_is_nil())
757       theVertexEntry = theSVertex->GetID();
758   }
759   if (theVertexEntry.empty())
760     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
761   
762   try {
763     bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
764     SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
765     return res;
766   }
767   catch (const std::invalid_argument& ex) {
768     SALOME::ExceptionStruct ExDescription;
769     ExDescription.text = ex.what();
770     ExDescription.type = SALOME::BAD_PARAM;
771     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
772     ExDescription.lineNumber = 648;
773     throw SALOME::SALOME_Exception(ExDescription);
774   }
775   catch (SALOME_Exception& ex) {
776     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
777   }
778 }
779
780 //=======================================================================
781 //function : ClearEnforcedVertices
782 //=======================================================================
783
784 void GHS3DPlugin_Hypothesis_i::ClearEnforcedVertices()
785 {
786   ASSERT(myBaseImpl);
787   this->GetImpl()->ClearEnforcedVertices();
788   SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
789 }
790
791 //=======================================================================
792 //function : ClearEnforcedMeshes
793 //=======================================================================
794
795 void GHS3DPlugin_Hypothesis_i::ClearEnforcedMeshes()
796 {
797   ASSERT(myBaseImpl);
798   this->GetImpl()->ClearEnforcedMeshes();
799   SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
800 }
801
802 //=======================================================================
803 //function : GetEnforcedMeshes
804 //=======================================================================
805
806 GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes()
807 {
808   ASSERT(myBaseImpl);
809   GHS3DPlugin::GHS3DEnforcedMeshList_var result = new GHS3DPlugin::GHS3DEnforcedMeshList();
810
811   const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
812   result->length( enfMeshList.size() );
813
814   ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::const_iterator it = enfMeshList.begin();
815
816   for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
817     ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* currentMesh = (*it);
818     GHS3DPlugin::GHS3DEnforcedMesh_var enfMesh = new GHS3DPlugin::GHS3DEnforcedMesh();
819     // Name
820     enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
821     // Mesh Entry
822     enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
823     // isCompound
824     enfMesh->elementType = currentMesh->elementType;
825     // Group Name
826     enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
827     
828     result[i]=enfMesh;
829     }
830   
831 //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
832
833   return result._retn();
834 }
835
836 /*!
837  * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
838  */
839 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
840   throw (SALOME::SALOME_Exception)
841 {
842 #if GHS3D_VERSION >= 42
843   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
844 #else
845   SALOME::ExceptionStruct ExDescription;
846   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
847   ExDescription.type = SALOME::BAD_PARAM;
848   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
849   ExDescription.lineNumber = 719;
850   throw SALOME::SALOME_Exception(ExDescription);
851 #endif
852 }
853
854 /*!
855  * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
856  */
857 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
858   throw (SALOME::SALOME_Exception)
859 {
860 //   MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
861 #if GHS3D_VERSION >= 42
862   return p_SetEnforcedMesh(theSource, theType);
863 #else
864   SALOME::ExceptionStruct ExDescription;
865   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
866   ExDescription.type = SALOME::BAD_PARAM;
867   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
868   ExDescription.lineNumber = 750;
869   throw SALOME::SALOME_Exception(ExDescription);
870 #endif
871 }
872
873 /*!
874  * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
875  */
876 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
877   throw (SALOME::SALOME_Exception)
878 {
879 #if GHS3D_VERSION >= 42
880   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
881 #else
882   SALOME::ExceptionStruct ExDescription;
883   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
884   ExDescription.type = SALOME::BAD_PARAM;
885   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
886   ExDescription.lineNumber = 750;
887   throw SALOME::SALOME_Exception(ExDescription);
888 #endif
889 }
890
891 /*!
892  * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
893  */
894 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
895   throw (SALOME::SALOME_Exception)
896 {
897 #if GHS3D_VERSION >= 42
898   return p_SetEnforcedMesh(theSource, theType);
899 #else
900   SALOME::ExceptionStruct ExDescription;
901   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
902   ExDescription.type = SALOME::BAD_PARAM;
903   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
904   ExDescription.lineNumber = 750;
905   throw SALOME::SALOME_Exception(ExDescription);
906 #endif
907 }
908
909 bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
910   throw (SALOME::SALOME_Exception)
911 {
912   MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
913   ASSERT(myBaseImpl);
914   
915   if (CORBA::is_nil( theSource ))
916   {
917     SALOME::ExceptionStruct ExDescription;
918     ExDescription.text = "The source mesh CORBA object is NULL";
919     ExDescription.type = SALOME::BAD_PARAM;
920     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
921     ExDescription.lineNumber = 840;
922     throw SALOME::SALOME_Exception(ExDescription);
923   }
924   
925   switch (theType) {
926     case SMESH::NODE:
927       MESSAGE("Required type is NODE");
928       break;
929     case SMESH::EDGE:
930       MESSAGE("Required type is EDGE");
931       break;
932     case SMESH::FACE:
933       MESSAGE("Required type is FACE");
934       break;
935     default:
936         MESSAGE("Incompatible required type: " << theType);
937         return false;
938   }
939 //   MESSAGE("Required type is "<<theType);
940   SMESH::array_of_ElementType_var types = theSource->GetTypes();
941   MESSAGE("Available types:");
942   for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
943   if ( types->length() >= 1 && types[types->length()-1] <  theType)
944   {
945     MESSAGE("Required type not available");
946     return false;
947 //     SALOME::ExceptionStruct ExDescription;
948 //     ExDescription.text = "The source mesh has bad type";
949 //     ExDescription.type = SALOME::BAD_PARAM;
950 //     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
951 //     ExDescription.lineNumber = 840;
952 //     throw SALOME::SALOME_Exception(ExDescription);
953   }
954   
955
956   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
957   SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
958
959   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
960   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
961   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
962
963   string enfMeshName = theName;
964   if (enfMeshName.empty())
965           enfMeshName = SObj->GetName();
966
967   if (theMesh_i)
968   {
969     try {
970         bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
971                 if (theGroupName != "") {
972                   SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
973                                                                 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
974                 }
975                 else {
976                   SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
977                                                                 << theSource << ".GetMesh(), " << theType << " )";
978                 }
979
980       return res;
981     }
982     catch (const std::invalid_argument& ex) {
983       SALOME::ExceptionStruct ExDescription;
984       ExDescription.text = ex.what();
985       ExDescription.type = SALOME::BAD_PARAM;
986       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
987       ExDescription.lineNumber = 840;
988       throw SALOME::SALOME_Exception(ExDescription);
989     }
990     catch (SALOME_Exception& ex) {
991       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
992     }
993   }
994   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
995   {
996     MESSAGE("The source is a group")
997     try {
998         bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
999         if (theGroupName != "") {
1000           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
1001                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1002         }
1003         else {
1004           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
1005                                 << theSource << ", " << theType << " )";
1006         }
1007       return res;
1008     }
1009     catch (const std::invalid_argument& ex) {
1010       SALOME::ExceptionStruct ExDescription;
1011       ExDescription.text = ex.what();
1012       ExDescription.type = SALOME::BAD_PARAM;
1013       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
1014       ExDescription.lineNumber = 840;
1015       throw SALOME::SALOME_Exception(ExDescription);
1016     }
1017     catch (SALOME_Exception& ex) {
1018       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1019     }
1020   }
1021   else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1022   {
1023     MESSAGE("The source is a group on geom")
1024     try {
1025         bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1026         if (theGroupName != "") {
1027           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
1028                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1029         }
1030         else {
1031           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
1032                                 << theSource << ", " << theType << " )";
1033         }
1034       return res;
1035     }
1036     catch (const std::invalid_argument& ex) {
1037       SALOME::ExceptionStruct ExDescription;
1038       ExDescription.text = ex.what();
1039       ExDescription.type = SALOME::BAD_PARAM;
1040       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
1041       ExDescription.lineNumber = 840;
1042       throw SALOME::SALOME_Exception(ExDescription);
1043     }
1044     catch (SALOME_Exception& ex) {
1045       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1046     }
1047   }
1048   return false;
1049 }
1050 //=============================================================================
1051 /*!
1052  *  Get implementation
1053  */
1054 //=============================================================================
1055
1056 ::GHS3DPlugin_Hypothesis* GHS3DPlugin_Hypothesis_i::GetImpl()
1057 {
1058   return (::GHS3DPlugin_Hypothesis*)myBaseImpl;
1059 }
1060
1061 //================================================================================
1062 /*!
1063  * \brief Verify whether hypothesis supports given entity type 
1064  */
1065 //================================================================================  
1066
1067 CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1068 {
1069   return type == SMESH::DIM_3D;
1070 }
1071