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