Salome HOME
Change from double to long to handle the max memory size in the hypothesis creator...
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2004-2015  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 //=======================================================================
48 //function : GHS3DPlugin_Hypothesis_i
49 //=======================================================================
50
51 GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
52                                                     int                     theStudyId,
53                                                     ::SMESH_Gen*            theGenImpl)
54   : SALOME::GenericObj_i( thePOA ), 
55     SMESH_Hypothesis_i( thePOA )
56 {
57   MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" );
58   myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
59                                               theStudyId,
60                                               theGenImpl);
61 }
62
63 //=======================================================================
64 //function : ~GHS3DPlugin_Hypothesis_i
65 //=======================================================================
66
67 GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
68 {
69   MESSAGE( "GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i" );
70 }
71
72 //=======================================================================
73 //function : SetToMeshHoles
74 //=======================================================================
75
76 void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
77 {
78   ASSERT(myBaseImpl);
79   this->GetImpl()->SetToMeshHoles(toMesh);
80   SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
81 }
82
83 //=======================================================================
84 //function : GetToMeshHoles
85 //=======================================================================
86
87 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
88 {
89   ASSERT(myBaseImpl);
90   return this->GetImpl()->GetToMeshHoles();
91 }
92
93 //=======================================================================
94 //function : SetToMakeGroupsOfDomains
95 //=======================================================================
96
97 void GHS3DPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
98 {
99   ASSERT(myBaseImpl);
100   this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
101   SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
102 }
103
104 //=======================================================================
105 //function : GetToMakeGroupsOfDomains
106 //=======================================================================
107
108 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
109 {
110   ASSERT(myBaseImpl);
111   return this->GetImpl()->GetToMakeGroupsOfDomains();
112 }
113
114 //=======================================================================
115 //function : SetMaximumMemory
116 //=======================================================================
117
118 void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB)
119    throw ( SALOME::SALOME_Exception )
120 {
121   if ( MB == 0 )
122     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
123   ASSERT(myBaseImpl);
124   this->GetImpl()->SetMaximumMemory(MB);
125   SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
126 }
127
128 //=======================================================================
129 //function : GetMaximumMemory
130 //=======================================================================
131
132 CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
133 {
134   ASSERT(myBaseImpl);
135   return this->GetImpl()->GetMaximumMemory();
136 }
137
138 //=======================================================================
139 //function : SetInitialMemory
140 //=======================================================================
141
142 void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB)
143   throw ( SALOME::SALOME_Exception )
144 {
145   if ( MB == 0 )
146     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
147   ASSERT(myBaseImpl);
148   this->GetImpl()->SetInitialMemory(MB);
149   SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
150 }
151
152 //=======================================================================
153 //function : GetInitialMemory
154 //=======================================================================
155
156 CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory()
157 {
158   ASSERT(myBaseImpl);
159   return this->GetImpl()->GetInitialMemory();
160 }
161
162 //=======================================================================
163 //function : SetOptimizationLevel
164 //=======================================================================
165
166 void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
167   throw ( SALOME::SALOME_Exception )
168 {
169   ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
170       (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
171   if ( l < ::GHS3DPlugin_Hypothesis::None ||
172        l > ::GHS3DPlugin_Hypothesis::Strong )
173     THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
174     
175   ASSERT(myBaseImpl);
176   this->GetImpl()->SetOptimizationLevel(l);
177   SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
178 }
179
180 //=======================================================================
181 //function : GetOptimizationLevel
182 //=======================================================================
183
184 CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
185 {
186   ASSERT(myBaseImpl);
187   return this->GetImpl()->GetOptimizationLevel();
188 }
189
190 //=======================================================================
191 //function : SetWorkingDirectory
192 //=======================================================================
193
194 void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
195 {
196   if (!path )
197     THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
198
199   string file(path);
200   const char lastChar = *file.rbegin();
201 #ifdef WIN32
202   if ( lastChar != '\\' ) file += '\\';
203 #else
204   if ( lastChar != '/' ) file += '/';
205 #endif
206   file += "GHS3D.log";
207   SMESH_Mesh_i::PrepareForWriting (file.c_str());
208
209   ASSERT(myBaseImpl);
210   this->GetImpl()->SetWorkingDirectory(path);
211   SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
212 }
213
214 //=======================================================================
215 //function : GetWorkingDirectory
216 //=======================================================================
217
218 char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
219 {
220   ASSERT(myBaseImpl);
221   return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
222 }
223
224 //=======================================================================
225 //function : SetKeepFiles
226 //=======================================================================
227
228 void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
229 {
230   ASSERT(myBaseImpl);
231   this->GetImpl()->SetKeepFiles(toKeep);
232   SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
233 }
234
235 //=======================================================================
236 //function : GetKeepFiles
237 //=======================================================================
238
239 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
240 {
241   ASSERT(myBaseImpl);
242   return this->GetImpl()->GetKeepFiles();
243 }
244
245 //=======================================================================
246 //function : SetVerboseLevel
247 //=======================================================================
248
249 void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
250   throw ( SALOME::SALOME_Exception )
251 {
252   if (level < 0 || level > 10 )
253     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
254                                   SALOME::BAD_PARAM );
255   ASSERT(myBaseImpl);
256   this->GetImpl()->SetVerboseLevel(level);
257   SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
258 }
259
260 //=======================================================================
261 //function : GetVerboseLevel
262 //=======================================================================
263
264 CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
265 {
266   ASSERT(myBaseImpl);
267   return this->GetImpl()->GetVerboseLevel();
268 }
269
270 //=======================================================================
271 //function : SetToCreateNewNodes
272 //=======================================================================
273
274 void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
275 {
276   ASSERT(myBaseImpl);
277   this->GetImpl()->SetToCreateNewNodes(toCreate);
278   SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
279 }
280
281 //=======================================================================
282 //function : GetToCreateNewNodes
283 //=======================================================================
284
285 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
286 {
287   ASSERT(myBaseImpl);
288   return this->GetImpl()->GetToCreateNewNodes();
289 }
290
291 //=======================================================================
292 //function : SetToUseBoundaryRecoveryVersion
293 //=======================================================================
294
295 void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
296 {
297   ASSERT(myBaseImpl);
298   this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
299   SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
300 }
301
302 //=======================================================================
303 //function : GetToUseBoundaryRecoveryVersion
304 //=======================================================================
305
306 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
307 {
308   ASSERT(myBaseImpl);
309   return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
310 }
311
312 //=======================================================================
313 //function : SetFEMCorrection
314 //=======================================================================
315
316 void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
317 {
318   ASSERT(myBaseImpl);
319   this->GetImpl()->SetFEMCorrection(toUseFem);
320   SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
321 }
322
323 //=======================================================================
324 //function : GetFEMCorrection
325 //=======================================================================
326
327 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection()
328 {
329   ASSERT(myBaseImpl);
330   return this->GetImpl()->GetFEMCorrection();
331 }
332
333 //=======================================================================
334 //function : SetToRemoveCentralPoint
335 //=======================================================================
336
337 void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
338 {
339   ASSERT(myBaseImpl);
340   this->GetImpl()->SetToRemoveCentralPoint(toRemove);
341   SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
342 }
343
344 //=======================================================================
345 //function : GetToRemoveCentralPoint
346 //=======================================================================
347
348 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
349 {
350   ASSERT(myBaseImpl);
351   return this->GetImpl()->GetToRemoveCentralPoint();
352 }
353
354 //=======================================================================
355 //function : SetTextOption
356 //=======================================================================
357
358 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
359 {
360   ASSERT(myBaseImpl);
361   this->GetImpl()->SetTextOption(option);
362   SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
363 }
364
365 //=======================================================================
366 //function : GetTextOption
367 //=======================================================================
368
369 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
370 {
371   ASSERT(myBaseImpl);
372   return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
373 }
374
375 //=======================================================================
376 //function : SetToRemoveCentralPoint
377 //=======================================================================
378
379 void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
380 {
381   if (gradation <= 1)
382     THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
383   ASSERT(myBaseImpl);
384   if (gradation != GetGradation()) {
385     this->GetImpl()->SetGradation(gradation);
386     SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
387   }
388 }
389
390 //=======================================================================
391 //function : GetToRemoveCentralPoint
392 //=======================================================================
393
394 CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
395 {
396   ASSERT(myBaseImpl);
397   return this->GetImpl()->GetGradation();
398 }
399
400 //=======================================================================
401 //function : 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 (int 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 (int 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 != "") {
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 != "") {
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 != "") {
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