]> SALOME platform Git repositories - plugins/hybridplugin.git/blob - src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
Salome HOME
Merge multi-study removal branch.
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2007-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 // ---
21 // File   : HYBRIDPlugin_Hypothesis_i.cxx
22 // Author : Christian VAN WAMBEKE (CEA)
23 // ---
24 //
25 #include "HYBRIDPlugin_Hypothesis_i.hxx"
26
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_PythonDump.hxx"
29 //#include "SMESH_Mesh.hxx"
30 //#include "SMESH_ProxyMesh.hxx"
31 //#include <StdMeshers_QuadToTriaAdaptor.hxx>
32
33 #include "Utils_CorbaException.hxx"
34 #include "utilities.h"
35 #include "SMESH_Mesh_i.hxx"
36 #include "SMESH_Group_i.hxx"
37 #include "SMESH_Gen_i.hxx"
38 #include "SMESH_TypeDefs.hxx"
39 #include "SMESHDS_GroupBase.hxx"
40
41 // SALOME KERNEL includes
42 #include "SALOMEDSClient.hxx"
43 #include <SALOMEDSClient_definitions.hxx>
44 // // IDL headers
45 // #include <SALOMEconfig.h>
46 // #include CORBA_SERVER_HEADER(SALOMEDS)
47
48 //=======================================================================
49 //function : HYBRIDPlugin_Hypothesis_i
50 //=======================================================================
51 HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
52                                                       ::SMESH_Gen*            theGenImpl)
53   : SALOME::GenericObj_i( thePOA ), 
54     SMESH_Hypothesis_i( thePOA )
55 {
56   myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
57                                               theGenImpl);
58 }
59
60 //=======================================================================
61 //function : ~HYBRIDPlugin_Hypothesis_i
62 //=======================================================================
63 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
64 {
65 }
66
67 //=======================================================================
68 //function : SetLayersOnAllWrap
69 //=======================================================================
70
71 void HYBRIDPlugin_Hypothesis_i::SetLayersOnAllWrap(CORBA::Boolean toMesh)
72 {
73   ASSERT(myBaseImpl);
74   this->GetImpl()->SetLayersOnAllWrap(toMesh);
75   SMESH::TPythonDump() << _this() << ".SetLayersOnAllWrap( " << toMesh << " )";
76 }
77
78 //=======================================================================
79 //function : GetLayersOnAllWrap
80 //=======================================================================
81
82 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetLayersOnAllWrap()
83 {
84   ASSERT(myBaseImpl);
85   return this->GetImpl()->GetLayersOnAllWrap();
86 }
87
88 //=======================================================================
89 //function : SetFacesWithLayers
90 //=======================================================================
91
92 void HYBRIDPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
93 {
94   std::vector<int> ids( theVal.length() );
95   for ( size_t i = 0; i < ids.size(); ++i )
96    ids[i] = theVal[i];
97
98   bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids);
99   if (valueChanged)
100     SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )";
101 }
102
103 //=======================================================================
104 //function : GetFacesWithLayers
105 //=======================================================================
106
107 SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithLayers()
108 {
109   const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithLayers();
110   SMESH::long_array_var ids = new SMESH::long_array;
111   ids->length( idsVec.size() );
112   for ( size_t i = 0; i < idsVec.size(); ++i )
113     ids[i] = idsVec[i];
114   return ids._retn();
115 }
116
117 //=======================================================================
118 //function : SetFacesWithImprinting
119 //=======================================================================
120
121 void HYBRIDPlugin_Hypothesis_i::SetFacesWithImprinting(const ::SMESH::long_array& theVal)
122 {
123   std::vector<int> ids( theVal.length() );
124   for ( size_t i = 0; i < ids.size(); ++i )
125    ids[i] = theVal[i];
126
127   bool valueChanged = this->GetImpl()->SetFacesWithImprinting(ids);
128   if (valueChanged)
129     SMESH::TPythonDump() << _this() << ".SetFacesWithImprinting( "<< theVal << " )";
130 }
131
132 //=======================================================================
133 //function : GetFacesWithImprinting
134 //=======================================================================
135
136 SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithImprinting()
137 {
138   const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithImprinting();
139   SMESH::long_array_var ids = new SMESH::long_array;
140   ids->length( idsVec.size() );
141   for ( size_t i = 0; i < idsVec.size(); ++i )
142     ids[i] = idsVec[i];
143   return ids._retn();
144 }
145
146 //=======================================================================
147 //function : SetToMeshHoles
148 //=======================================================================
149
150 void HYBRIDPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
151 {
152   ASSERT(myBaseImpl);
153   this->GetImpl()->SetToMeshHoles(toMesh);
154   SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
155 }
156
157 //=======================================================================
158 //function : GetToMeshHoles
159 //=======================================================================
160
161 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMeshHoles()
162 {
163   ASSERT(myBaseImpl);
164   return this->GetImpl()->GetToMeshHoles();
165 }
166
167 //=======================================================================
168 //function : SetToMakeGroupsOfDomains
169 //=======================================================================
170
171 void HYBRIDPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
172 {
173   ASSERT(myBaseImpl);
174   this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
175   SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
176 }
177
178 //=======================================================================
179 //function : GetToMakeGroupsOfDomains
180 //=======================================================================
181
182 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
183 {
184   ASSERT(myBaseImpl);
185   return this->GetImpl()->GetToMakeGroupsOfDomains();
186 }
187
188 //=======================================================================
189 //function : SetMaximumMemory
190 //=======================================================================
191
192 void HYBRIDPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
193    throw ( SALOME::SALOME_Exception )
194 {
195   if ( MB == 0 )
196     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
197   ASSERT(myBaseImpl);
198   this->GetImpl()->SetMaximumMemory(MB);
199   SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
200 }
201
202 //=======================================================================
203 //function : GetMaximumMemory
204 //=======================================================================
205
206 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMaximumMemory()
207 {
208   ASSERT(myBaseImpl);
209   return this->GetImpl()->GetMaximumMemory();
210 }
211
212 //=======================================================================
213 //function : SetInitialMemory
214 //=======================================================================
215
216 void HYBRIDPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
217   throw ( SALOME::SALOME_Exception )
218 {
219   if ( MB == 0 )
220     THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
221   ASSERT(myBaseImpl);
222   this->GetImpl()->SetInitialMemory(MB);
223   SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
224 }
225
226 //=======================================================================
227 //function : GetInitialMemory
228 //=======================================================================
229
230 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetInitialMemory()
231 {
232   ASSERT(myBaseImpl);
233   return this->GetImpl()->GetInitialMemory();
234 }
235
236 //=======================================================================
237 //function : SetOptimizationLevel
238 //=======================================================================
239
240 void HYBRIDPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
241   throw ( SALOME::SALOME_Exception )
242 {
243   ::HYBRIDPlugin_Hypothesis::OptimizationLevel l =
244       (::HYBRIDPlugin_Hypothesis::OptimizationLevel) level;
245   if ( l < ::HYBRIDPlugin_Hypothesis::None ||
246        l > ::HYBRIDPlugin_Hypothesis::Strong )
247     THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
248     
249   ASSERT(myBaseImpl);
250   this->GetImpl()->SetOptimizationLevel(l);
251   SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
252 }
253
254 //=======================================================================
255 //function : GetOptimizationLevel
256 //=======================================================================
257
258 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
259 {
260   ASSERT(myBaseImpl);
261   return this->GetImpl()->GetOptimizationLevel();
262 }
263
264
265 //=======================================================================
266 //function : SetCollisionMode
267 //=======================================================================
268 void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
269   throw ( SALOME::SALOME_Exception )
270 {
271   ::HYBRIDPlugin_Hypothesis::CollisionMode l =
272       (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
273   if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
274        l > ::HYBRIDPlugin_Hypothesis::Stop )
275     THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
276     
277   ASSERT(myBaseImpl);
278   this->GetImpl()->SetCollisionMode(l);
279   SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
280 }
281
282 //=======================================================================
283 //function : GetCollisionMode
284 //=======================================================================
285 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
286 {
287   ASSERT(myBaseImpl);
288   return this->GetImpl()->GetCollisionMode();
289 }
290
291 //=======================================================================
292 //function : SetWorkingDirectory
293 //=======================================================================
294 void HYBRIDPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
295 {
296   if (!path )
297     THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
298
299   std::string file(path);
300   const char lastChar = *file.rbegin();
301 #ifdef WIN32
302   if ( lastChar != '\\' ) file += '\\';
303 #else
304   if ( lastChar != '/' ) file += '/';
305 #endif
306   file += "HYBRID.log";
307   SMESH_Mesh_i::PrepareForWriting (file.c_str());
308
309   ASSERT(myBaseImpl);
310   this->GetImpl()->SetWorkingDirectory(path);
311   SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
312 }
313
314 //=======================================================================
315 //function : GetWorkingDirectory
316 //=======================================================================
317 char* HYBRIDPlugin_Hypothesis_i::GetWorkingDirectory()
318 {
319   ASSERT(myBaseImpl);
320   return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
321 }
322
323 //=======================================================================
324 //function : SetKeepFiles
325 //=======================================================================
326 void HYBRIDPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
327 {
328   ASSERT(myBaseImpl);
329   this->GetImpl()->SetKeepFiles(toKeep);
330   SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
331 }
332
333 //=======================================================================
334 //function : GetKeepFiles
335 //=======================================================================
336 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetKeepFiles()
337 {
338   ASSERT(myBaseImpl);
339   return this->GetImpl()->GetKeepFiles();
340 }
341
342 //=======================================================================
343 //function : SetVerboseLevel
344 //=======================================================================
345 void HYBRIDPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
346   throw ( SALOME::SALOME_Exception )
347 {
348   if (level < 0 || level > 10 )
349     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
350                                   SALOME::BAD_PARAM );
351   ASSERT(myBaseImpl);
352   this->GetImpl()->SetVerboseLevel(level);
353   SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
354 }
355
356 //=======================================================================
357 //function : GetVerboseLevel
358 //=======================================================================
359 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetVerboseLevel()
360 {
361   ASSERT(myBaseImpl);
362   return this->GetImpl()->GetVerboseLevel();
363 }
364
365 //=======================================================================
366 //function : SetToCreateNewNodes
367 //=======================================================================
368
369 void HYBRIDPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
370 {
371   ASSERT(myBaseImpl);
372   this->GetImpl()->SetToCreateNewNodes(toCreate);
373   SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
374 }
375
376 //=======================================================================
377 //function : GetToCreateNewNodes
378 //=======================================================================
379
380 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToCreateNewNodes()
381 {
382   ASSERT(myBaseImpl);
383   return this->GetImpl()->GetToCreateNewNodes();
384 }
385
386 //=======================================================================
387 //function : SetToUseBoundaryRecoveryVersion
388 //=======================================================================
389
390 void HYBRIDPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
391 {
392   ASSERT(myBaseImpl);
393   this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
394   SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
395 }
396
397 //=======================================================================
398 //function : GetToUseBoundaryRecoveryVersion
399 //=======================================================================
400
401 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
402 {
403   ASSERT(myBaseImpl);
404   return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
405 }
406
407 //=======================================================================
408 //function : SetFEMCorrection
409 //=======================================================================
410
411 void HYBRIDPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
412 {
413   ASSERT(myBaseImpl);
414   this->GetImpl()->SetFEMCorrection(toUseFem);
415   SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
416 }
417
418 //=======================================================================
419 //function : GetFEMCorrection
420 //=======================================================================
421
422 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetFEMCorrection()
423 {
424   ASSERT(myBaseImpl);
425   return this->GetImpl()->GetFEMCorrection();
426 }
427
428 //=======================================================================
429 //function : SetToRemoveCentralPoint
430 //=======================================================================
431
432 void HYBRIDPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
433 {
434   ASSERT(myBaseImpl);
435   this->GetImpl()->SetToRemoveCentralPoint(toRemove);
436   SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
437 }
438
439 //=======================================================================
440 //function : GetToRemoveCentralPoint
441 //=======================================================================
442
443 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToRemoveCentralPoint()
444 {
445   ASSERT(myBaseImpl);
446   return this->GetImpl()->GetToRemoveCentralPoint();
447 }
448
449 //=======================================================================
450 //function : SetTextOption
451 //=======================================================================
452 void HYBRIDPlugin_Hypothesis_i::SetTextOption(const char* option)
453 {
454   ASSERT(myBaseImpl);
455   this->GetImpl()->SetAdvancedOption(option);
456   SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
457 }
458
459 //=======================================================================
460 //function : GetTextOption
461 //=======================================================================
462 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
463 {
464   ASSERT(myBaseImpl);
465   return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
466 }
467
468 //=======================================================================
469 //function : SetAdvancedOption
470 //=======================================================================
471 void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals )
472 {
473   if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals )
474   {
475     GetImpl()->SetAdvancedOption( theOptAndVals );
476     SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )";
477   }
478 }
479
480 //=======================================================================
481 //function : GetAdvancedOption
482 //=======================================================================
483 char* HYBRIDPlugin_Hypothesis_i::GetAdvancedOption()
484 {
485   return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() );
486 }
487
488 //=======================================================================
489 //function : SetToRemoveCentralPoint
490 //=======================================================================
491
492 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
493 {
494   if (gradation <= 1)
495     THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
496   ASSERT(myBaseImpl);
497   if (gradation != GetGradation()) {
498     this->GetImpl()->SetGradation(gradation);
499     SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
500   }
501 }
502
503 //=======================================================================
504 //function : GetToRemoveCentralPoint
505 //=======================================================================
506
507 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
508 {
509   ASSERT(myBaseImpl);
510   return this->GetImpl()->GetGradation();
511 }
512
513 //=======================================================================
514 //function : SetStandardOutputLog
515 //=======================================================================
516 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
517 {
518   ASSERT(myBaseImpl);
519   this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
520   SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
521 }
522
523 //=======================================================================
524 //function : GetStandardOutputLog
525 //=======================================================================
526 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
527 {
528   ASSERT(myBaseImpl);
529   return this->GetImpl()->GetStandardOutputLog();
530 }
531
532 //=======================================================================
533 //function : SetRemoveLogOnSuccess
534 //=======================================================================
535 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
536 {
537   ASSERT(myBaseImpl);
538   this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
539   SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
540 }
541
542 //=======================================================================
543 //function : GetRemoveLogOnSuccess
544 //=======================================================================
545 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
546 {
547   ASSERT(myBaseImpl);
548   return this->GetImpl()->GetRemoveLogOnSuccess();
549 }
550
551 //=======================================================================
552 //function : SetBoundaryLayersGrowth
553 //=======================================================================
554 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
555   throw ( SALOME::SALOME_Exception )
556 {
557   ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
558       (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
559   if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
560        l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
561     THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
562     
563   ASSERT(myBaseImpl);
564   this->GetImpl()->SetBoundaryLayersGrowth(l);
565   SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
566 }
567
568 //=======================================================================
569 //function : GetBoundaryLayersGrowth
570 //=======================================================================
571 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
572 {
573   ASSERT(myBaseImpl);
574   return this->GetImpl()->GetBoundaryLayersGrowth();
575 }
576
577 //=======================================================================
578 //function : SetElementGeneration
579 //=======================================================================
580 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
581   throw ( SALOME::SALOME_Exception )
582 {
583   ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
584       (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
585   if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
586        l > ::HYBRIDPlugin_Hypothesis::Generation_Cartesian_Core )
587     THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
588     
589   ASSERT(myBaseImpl);
590   this->GetImpl()->SetElementGeneration(l);
591   SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
592 }
593
594 //=======================================================================
595 //function : GetElementGeneration
596 //=======================================================================
597 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
598 {
599   ASSERT(myBaseImpl);
600   return this->GetImpl()->GetElementGeneration();
601 }
602
603 //=======================================================================
604 //function : SetAddMultinormals
605 //=======================================================================
606 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
607 {
608   ASSERT(myBaseImpl);
609   this->GetImpl()->SetAddMultinormals(toAddMultinormals);
610   SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
611 }
612
613 //=======================================================================
614 //function : GetAddMultinormals
615 //=======================================================================
616 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
617 {
618   ASSERT(myBaseImpl);
619   return this->GetImpl()->GetAddMultinormals();
620 }
621
622 //=======================================================================
623 //function : SetSmoothNormals
624 //=======================================================================
625 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
626 {
627   ASSERT(myBaseImpl);
628   this->GetImpl()->SetSmoothNormals(toSmoothNormals);
629   SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
630 }
631
632 //=======================================================================
633 //function : GetSmoothNormals
634 //=======================================================================
635 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
636 {
637   ASSERT(myBaseImpl);
638   return this->GetImpl()->GetSmoothNormals();
639 }
640
641 //=======================================================================
642 //function : SetHeightFirstLayer
643 //=======================================================================
644 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
645 {
646   ASSERT(myBaseImpl);
647   this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
648   SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
649 }
650
651 //=======================================================================
652 //function : GetHeightFirstLayer
653 //=======================================================================
654 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
655 {
656   ASSERT(myBaseImpl);
657   return this->GetImpl()->GetHeightFirstLayer();
658 }
659
660 //=======================================================================
661 //function : SetBoundaryLayersProgression
662 //=======================================================================
663 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
664 {
665   ASSERT(myBaseImpl);
666   this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
667   SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
668 }
669
670 //=======================================================================
671 //function : GetBoundaryLayersProgression
672 //=======================================================================
673 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
674 {
675   ASSERT(myBaseImpl);
676   return this->GetImpl()->GetBoundaryLayersProgression();
677 }
678
679 //=======================================================================
680 //function : SetCoreSize
681 //=======================================================================
682 void HYBRIDPlugin_Hypothesis_i::SetCoreSize(CORBA::Double toCoreSize)
683 {
684   ASSERT(myBaseImpl);
685   this->GetImpl()->SetCoreSize(toCoreSize);
686   SMESH::TPythonDump() << _this() << ".SetCoreSize( " << toCoreSize << " )";
687 }
688
689 //=======================================================================
690 //function : GetCoreSize
691 //=======================================================================
692 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetCoreSize()
693 {
694   ASSERT(myBaseImpl);
695   return this->GetImpl()->GetCoreSize();
696 }
697
698 //=======================================================================
699 //function : SetMultinormalsAngle
700 //=======================================================================
701 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
702 {
703   ASSERT(myBaseImpl);
704   this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
705   SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
706 }
707
708 //=======================================================================
709 //function : GetMultinormalsAngle
710 //=======================================================================
711 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
712 {
713   ASSERT(myBaseImpl);
714   return this->GetImpl()->GetMultinormalsAngle();
715 }
716
717 //=======================================================================
718 //function : SetNbOfBoundaryLayers
719 //=======================================================================
720 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
721 {
722   ASSERT(myBaseImpl);
723   this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
724   SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
725 }
726
727 //=======================================================================
728 //function : GetNbOfBoundaryLayers
729 //=======================================================================
730 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
731 {
732   ASSERT(myBaseImpl);
733   return this->GetImpl()->GetNbOfBoundaryLayers();
734 }
735
736 //=======================================================================
737 //function : SetEnforcedVertex
738 //=======================================================================
739
740 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
741     throw (SALOME::SALOME_Exception) {
742   ASSERT(myBaseImpl);
743   return p_SetEnforcedVertex(size, x, y, z);
744 }
745
746 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
747     throw (SALOME::SALOME_Exception) {
748   ASSERT(myBaseImpl);
749   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
750 }
751
752 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
753     throw (SALOME::SALOME_Exception) {
754   ASSERT(myBaseImpl);
755   return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
756 }
757
758 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
759     throw (SALOME::SALOME_Exception) {
760   ASSERT(myBaseImpl);
761   return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
762 }
763
764 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
765     throw (SALOME::SALOME_Exception) {
766   ASSERT(myBaseImpl);
767   
768   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
769     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
770   }
771   
772   std::string theVertexEntry = theVertex->GetStudyEntry();
773   CORBA::Double x = 0, y = 0, z = 0;
774   CORBA::Boolean isCompound = false;
775   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
776   if (theVertexEntry.empty()) {
777     std::string aName;
778     if (theVertex->GetShapeType() == GEOM::VERTEX) {
779       aName = "Vertex_";
780     }
781     if (theVertex->GetShapeType() == GEOM::COMPOUND) {
782       aName = "Compound_";
783       isCompound = true;
784     }
785     aName += theVertex->GetEntry();
786     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
787     if (!theSVertex->_is_nil())
788       theVertexEntry = theSVertex->GetID();
789   }
790   if (theVertexEntry.empty())
791     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
792
793   if (theVertex->GetShapeType() == GEOM::VERTEX) {
794     GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
795     if (CORBA::is_nil(measureOp))
796       return false;
797     
798     measureOp->PointCoordinates (theVertex, x, y, z);
799   }
800
801   std::string theVertexName = theVertex->GetName();
802   
803   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
804 }
805
806 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
807     throw (SALOME::SALOME_Exception) {
808   ASSERT(myBaseImpl);
809   
810   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
811     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
812     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
813   }
814   
815   std::string theVertexEntry = theVertex->GetStudyEntry();
816   CORBA::Double x = 0, y = 0, z = 0;
817   CORBA::Boolean isCompound = false;
818   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
819   if (theVertexEntry.empty()) {
820     std::string aName;
821     if (theVertex->GetShapeType() == GEOM::VERTEX) {
822       aName = "Vertex_";
823     }
824     if (theVertex->GetShapeType() == GEOM::COMPOUND) {
825       aName = "Compound_";
826       isCompound = true;
827     }
828     aName += theVertex->GetEntry();
829     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
830     if (!theSVertex->_is_nil())
831       theVertexEntry = theSVertex->GetID();
832   }
833   if (theVertexEntry.empty())
834     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
835
836   if (theVertex->GetShapeType() == GEOM::VERTEX) {
837     GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
838     if (CORBA::is_nil(measureOp))
839       return false;
840     
841     measureOp->PointCoordinates (theVertex, x, y, z);
842   }
843     
844   std::string theVertexName = theVertex->GetName();
845   
846   return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
847 }
848
849 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
850                                                    const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
851                                                    CORBA::Boolean isCompound)
852     throw (SALOME::SALOME_Exception) {
853   ASSERT(myBaseImpl);
854   bool newValue = false;
855
856   ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
857   ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
858   if (std::string(theVertexEntry).empty()) {
859     coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
860     std::vector<double> coords;
861     coords.push_back(x);
862     coords.push_back(y);
863     coords.push_back(z);
864     if (coordsList.find(coords) == coordsList.end()) {
865       newValue = true;
866     }
867     else {
868       ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
869       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
870 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
871         newValue = true;
872       }
873       else {
874       }
875     }
876
877     if (newValue) {
878       if (std::string(theVertexName).empty()) {
879         if (std::string(theGroupName).empty())
880           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
881         else
882           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
883       }
884       else {
885         if (std::string(theGroupName).empty())
886           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size  << ", \"" << theVertexName << "\")";
887         else
888           SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size  << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
889       }
890     }
891   } 
892   else {
893 //   if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
894     enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
895 //     ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
896     if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
897       newValue = true;
898     }
899     else {
900       ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
901       if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
902 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
903         newValue = true;
904       }
905       else {
906       }
907     }
908
909     if (newValue) {
910       if (std::string(theGroupName).empty())
911         SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
912       else
913         SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
914     }
915   }
916
917   if (newValue)
918     this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
919
920   return newValue;
921 }
922
923 //=======================================================================
924 //function : GetEnforcedVertex
925 //=======================================================================
926
927 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
928   throw (SALOME::SALOME_Exception)
929 {
930   ASSERT(myBaseImpl);
931   try {
932     bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
933     SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
934     return isDone;
935   }
936   catch (const std::invalid_argument& ex) {
937     SALOME::ExceptionStruct ExDescription;
938     ExDescription.text = ex.what();
939     ExDescription.type = SALOME::BAD_PARAM;
940     ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
941     ExDescription.lineNumber = 513;
942     throw SALOME::SALOME_Exception(ExDescription);
943   }
944   catch (SALOME_Exception& ex) {
945     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
946   }
947 }
948
949 //=======================================================================
950 //function : GetEnforcedVertex
951 //=======================================================================
952
953 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
954   throw (SALOME::SALOME_Exception)
955 {
956   ASSERT(myBaseImpl);
957   
958   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
959     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
960     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
961   }
962   
963   std::string theVertexEntry = theVertex->GetStudyEntry();
964   if (theVertexEntry.empty()) {
965     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
966     std::string aName;
967     if (theVertex->GetShapeType() == GEOM::VERTEX)
968       aName = "Vertex_";
969     if (theVertex->GetShapeType() == GEOM::COMPOUND)
970       aName = "Compound_";
971     aName += theVertex->GetEntry();
972     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
973     if (!theSVertex->_is_nil())
974       theVertexEntry = theSVertex->GetID();
975   }
976   if (theVertexEntry.empty())
977     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
978
979   std::string theVertexName = theVertex->GetName();
980   
981   try {
982     bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
983     SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
984     return isDone;
985   }
986   catch (const std::invalid_argument& ex) {
987     SALOME::ExceptionStruct ExDescription;
988     ExDescription.text = ex.what();
989     ExDescription.type = SALOME::BAD_PARAM;
990     ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
991     ExDescription.lineNumber = 538;
992     throw SALOME::SALOME_Exception(ExDescription);
993   }
994   catch (SALOME_Exception& ex) {
995     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
996   }
997 }
998
999 //=======================================================================
1000 //function : GetEnforcedVertices
1001 //=======================================================================
1002
1003 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
1004 {
1005   ASSERT(myBaseImpl);
1006   HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
1007
1008   const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
1009   result->length( enfVertexList.size() );
1010
1011   ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
1012
1013   for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
1014     ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
1015     HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
1016     // Name
1017     enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
1018     // Geom Vertex Entry
1019     enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
1020     // Coords
1021     HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
1022     coords->length(currentVertex->coords.size());
1023     for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
1024       coords[ind] = currentVertex->coords[ind];
1025     enfVertex->coords = coords;
1026     // Group Name
1027     enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
1028     // Size
1029     enfVertex->size = currentVertex->size;
1030     // isCompound
1031     enfVertex->isCompound = currentVertex->isCompound;
1032     
1033     result[i]=enfVertex;
1034     }
1035   
1036 //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1037
1038   return result._retn();
1039 }
1040
1041 //=======================================================================
1042 //function : RemoveEnforcedVertex
1043 //=======================================================================
1044
1045 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
1046   throw (SALOME::SALOME_Exception)
1047 {
1048   ASSERT(myBaseImpl);
1049   try {
1050     bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
1051     SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
1052     return res;
1053   }
1054   catch (const std::invalid_argument& ex) {
1055     SALOME::ExceptionStruct ExDescription;
1056     ExDescription.text = ex.what();
1057     ExDescription.type = SALOME::BAD_PARAM;
1058     ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1059     ExDescription.lineNumber = 625;
1060     throw SALOME::SALOME_Exception(ExDescription);
1061   }
1062   catch (SALOME_Exception& ex) {
1063     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1064   }
1065 }
1066
1067 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1068   throw (SALOME::SALOME_Exception)
1069 {
1070   ASSERT(myBaseImpl);
1071   
1072   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1073     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1074     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1075   }
1076   
1077   std::string theVertexEntry = theVertex->GetStudyEntry();
1078   if (theVertexEntry.empty()) {
1079     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1080     std::string aName;
1081     if (theVertex->GetShapeType() == GEOM::VERTEX)
1082       aName = "Vertex_";
1083     if (theVertex->GetShapeType() == GEOM::COMPOUND)
1084       aName = "Compound_";
1085     aName += theVertex->GetEntry();
1086     SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
1087     if (!theSVertex->_is_nil())
1088       theVertexEntry = theSVertex->GetID();
1089   }
1090   if (theVertexEntry.empty())
1091     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1092   
1093   try {
1094     bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1095     SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1096     return res;
1097   }
1098   catch (const std::invalid_argument& ex) {
1099     SALOME::ExceptionStruct ExDescription;
1100     ExDescription.text = ex.what();
1101     ExDescription.type = SALOME::BAD_PARAM;
1102     ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1103     ExDescription.lineNumber = 648;
1104     throw SALOME::SALOME_Exception(ExDescription);
1105   }
1106   catch (SALOME_Exception& ex) {
1107     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1108   }
1109 }
1110
1111 //=======================================================================
1112 //function : ClearEnforcedVertices
1113 //=======================================================================
1114
1115 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1116 {
1117   ASSERT(myBaseImpl);
1118   this->GetImpl()->ClearEnforcedVertices();
1119   SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1120 }
1121
1122 //=======================================================================
1123 //function : ClearEnforcedMeshes
1124 //=======================================================================
1125
1126 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1127 {
1128   ASSERT(myBaseImpl);
1129   this->GetImpl()->ClearEnforcedMeshes();
1130   SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1131 }
1132
1133 //=======================================================================
1134 //function : GetEnforcedMeshes
1135 //=======================================================================
1136
1137 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1138 {
1139   ASSERT(myBaseImpl);
1140   HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1141
1142   const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1143   result->length( enfMeshList.size() );
1144
1145   ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1146
1147   for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1148     ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1149     HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1150     // Name
1151     enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1152     // Mesh Entry
1153     enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1154     // isCompound
1155     enfMesh->elementType = currentMesh->elementType;
1156     // Group Name
1157     enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1158     
1159     result[i]=enfMesh;
1160     }
1161   
1162 //   SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1163
1164   return result._retn();
1165 }
1166
1167 /*!
1168  * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1169  */
1170 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1171   throw (SALOME::SALOME_Exception)
1172 {
1173 // #if HYBRID_VERSION >= 42
1174   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1175 // #else
1176 //   SALOME::ExceptionStruct ExDescription;
1177 //   ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1178 //   ExDescription.type = SALOME::BAD_PARAM;
1179 //   ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1180 //   ExDescription.lineNumber = 719;
1181 //   throw SALOME::SALOME_Exception(ExDescription);
1182 // #endif
1183 }
1184
1185 /*!
1186  * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1187  */
1188 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1189   throw (SALOME::SALOME_Exception)
1190 {
1191 // #if HYBRID_VERSION >= 42
1192   return p_SetEnforcedMesh(theSource, theType);
1193 // #else
1194 //   SALOME::ExceptionStruct ExDescription;
1195 //   ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1196 //   ExDescription.type = SALOME::BAD_PARAM;
1197 //   ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1198 //   ExDescription.lineNumber = 750;
1199 //   throw SALOME::SALOME_Exception(ExDescription);
1200 // #endif
1201 }
1202
1203 /*!
1204  * \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.
1205  */
1206 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1207   throw (SALOME::SALOME_Exception)
1208 {
1209 // #if HYBRID_VERSION >= 42
1210   return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1211 // #else
1212 //   SALOME::ExceptionStruct ExDescription;
1213 //   ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1214 //   ExDescription.type = SALOME::BAD_PARAM;
1215 //   ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1216 //   ExDescription.lineNumber = 750;
1217 //   throw SALOME::SALOME_Exception(ExDescription);
1218 // #endif
1219 }
1220
1221 /*!
1222  * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1223  */
1224 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1225   throw (SALOME::SALOME_Exception)
1226 {
1227 // #if HYBRID_VERSION >= 42
1228   return p_SetEnforcedMesh(theSource, theType);
1229 // #else
1230 //   SALOME::ExceptionStruct ExDescription;
1231 //   ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1232 //   ExDescription.type = SALOME::BAD_PARAM;
1233 //   ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1234 //   ExDescription.lineNumber = 750;
1235 //   throw SALOME::SALOME_Exception(ExDescription);
1236 // #endif
1237 }
1238
1239 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1240   throw (SALOME::SALOME_Exception)
1241 {
1242   ASSERT(myBaseImpl);
1243   
1244   if (CORBA::is_nil( theSource ))
1245   {
1246     SALOME::ExceptionStruct ExDescription;
1247     ExDescription.text = "The source mesh CORBA object is NULL";
1248     ExDescription.type = SALOME::BAD_PARAM;
1249     ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1250     ExDescription.lineNumber = 840;
1251     throw SALOME::SALOME_Exception(ExDescription);
1252   }
1253   
1254   switch (theType) {
1255     case SMESH::NODE:
1256       break;
1257     case SMESH::EDGE:
1258       break;
1259     case SMESH::FACE:
1260       break;
1261     default:
1262       return false;
1263   }
1264   SMESH::array_of_ElementType_var types = theSource->GetTypes();
1265   if ( types->length() >= 1 && types[types->length()-1] <  theType)
1266   {
1267     return false;
1268 //     SALOME::ExceptionStruct ExDescription;
1269 //     ExDescription.text = "The source mesh has bad type";
1270 //     ExDescription.type = SALOME::BAD_PARAM;
1271 //     ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1272 //     ExDescription.lineNumber = 840;
1273 //     throw SALOME::SALOME_Exception(ExDescription);
1274   }
1275
1276
1277   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1278   SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource);
1279
1280   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1281   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1282   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1283
1284   std::string enfMeshName = theName;
1285   if (enfMeshName.empty())
1286     enfMeshName = SObj->GetName();
1287
1288   if (theMesh_i)
1289   {
1290     try {
1291       bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1292       if (theGroupName && theGroupName[0]) {
1293         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1294                               << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1295       }
1296       else {
1297         SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1298                               << theSource << ".GetMesh(), " << theType << " )";
1299       }
1300
1301       return res;
1302     }
1303     catch (const std::invalid_argument& ex) {
1304       SALOME::ExceptionStruct ExDescription;
1305       ExDescription.text = ex.what();
1306       ExDescription.type = SALOME::BAD_PARAM;
1307       ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1308       ExDescription.lineNumber = 840;
1309       throw SALOME::SALOME_Exception(ExDescription);
1310     }
1311     catch (SALOME_Exception& ex) {
1312       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1313     }
1314   }
1315   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1316   {
1317     try {
1318         bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1319         if (theGroupName && theGroupName[0]) {
1320           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
1321                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1322         }
1323         else {
1324           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
1325                                 << theSource << ", " << theType << " )";
1326         }
1327       return res;
1328     }
1329     catch (const std::invalid_argument& ex) {
1330       SALOME::ExceptionStruct ExDescription;
1331       ExDescription.text = ex.what();
1332       ExDescription.type = SALOME::BAD_PARAM;
1333       ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1334       ExDescription.lineNumber = 840;
1335       throw SALOME::SALOME_Exception(ExDescription);
1336     }
1337     catch (SALOME_Exception& ex) {
1338       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1339     }
1340   }
1341   else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1342   {
1343       try {
1344         bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1345         if (theGroupName && theGroupName[0]) {
1346           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1347                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1348         }
1349         else {
1350           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1351                                 << theSource << ", " << theType << " )";
1352         }
1353         return res;
1354       }
1355       catch (const std::invalid_argument& ex) {
1356         SALOME::ExceptionStruct ExDescription;
1357       ExDescription.text = ex.what();
1358       ExDescription.type = SALOME::BAD_PARAM;
1359       ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1360       ExDescription.lineNumber = 840;
1361       throw SALOME::SALOME_Exception(ExDescription);
1362     }
1363     catch (SALOME_Exception& ex) {
1364       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1365     }
1366   }
1367   return false;
1368 }
1369 //=============================================================================
1370 /*!
1371  *  Get implementation
1372  */
1373 //=============================================================================
1374
1375 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1376 {
1377   return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1378 }
1379
1380 //================================================================================
1381 /*!
1382  * \brief Verify whether hypothesis supports given entity type 
1383  */
1384 //================================================================================  
1385
1386 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1387 {
1388   return type == SMESH::DIM_3D;
1389 }
1390