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