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