]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_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    : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
24 // ---
25 //
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
27
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
31
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
35
36 #include <stdexcept>
37 #include <cstring>
38 #include <boost/regex.hpp>
39
40 using namespace std;
41
42 //=============================================================================
43 /*!
44  *  BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
45  *
46  *  Constructor
47  */
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
50                                                      ::SMESH_Gen*            theGenImpl,
51                                                      bool                    theHasGEOM) :
52   SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
53 {
54   myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
55                                              
56                                              theGenImpl,
57                                              theHasGEOM);
58 }
59
60 //=============================================================================
61 /*!
62  *  BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
63  *
64  *  Destructor
65  */
66 //=============================================================================
67 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
68 {
69 }
70
71 //=============================================================================
72
73 //=============================================================================
74 /*!
75  *  BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
76  *
77  *  Set PhysicalMesh
78  */
79
80 //=============================================================================
81 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
82 {
83   ASSERT(myBaseImpl);
84   this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
85   SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
86 }
87
88 //=============================================================================
89 /*!
90  *  BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
91  *
92  *  Get PhysicalMesh
93  */
94 //=============================================================================
95 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
96 {
97   ASSERT(myBaseImpl);
98   return this->GetImpl()->GetPhysicalMesh();
99 }
100
101 //=============================================================================
102 /*!
103  *  BLSURFPlugin_Hypothesis_i::SetGeometricMesh
104  *
105  *  Set GeometricMesh
106  */
107
108 //=============================================================================
109 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
110 {
111   ASSERT(myBaseImpl);
112   this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
113   SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
114 }
115
116 //=============================================================================
117 /*!
118  *  BLSURFPlugin_Hypothesis_i::GetGeometricMesh
119  *
120  *  Get GeometricMesh
121  */
122 //=============================================================================
123 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
124 {
125   ASSERT(myBaseImpl);
126   return this->GetImpl()->GetGeometricMesh();
127 }
128
129 //=============================================================================
130 /*!
131  *  BLSURFPlugin_Hypothesis_i::SetPhySize
132  *
133  *  Set PhySize
134  */
135 //=============================================================================
136 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
137 {
138   ASSERT(myBaseImpl);
139   this->GetImpl()->SetPhySize(theValue, false);
140   SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
141 }
142
143 //=============================================================================
144 /*!
145  *  BLSURFPlugin_Hypothesis_i::SetPhySizeRel
146  *
147  *  Set Relative PhySize
148  */
149 //=============================================================================
150 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
151 {
152   ASSERT(myBaseImpl);
153   this->GetImpl()->SetPhySize(theValue, true);
154   SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
155 }
156
157 //=============================================================================
158 /*!
159  *  BLSURFPlugin_Hypothesis_i::GetPhySize
160  *
161  *  Get PhySize
162  */
163 //=============================================================================
164 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
165 {
166   ASSERT(myBaseImpl);
167   return this->GetImpl()->GetPhySize();
168 }
169
170 //=============================================================================
171 /*!
172  *  BLSURFPlugin_Hypothesis_i::IsPhySizeRel
173  *
174  *  Returns True if PhySize is relative
175  */
176 //=============================================================================
177 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
178 {
179   ASSERT(myBaseImpl);
180   return this->GetImpl()->IsPhySizeRel();
181 }
182
183 //=============================================================================
184 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
185 {
186   if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
187     this->GetImpl()->SetMinSize(theMinSize, false);
188     SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
189   }
190 }
191
192 //=============================================================================
193 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
194 {
195   if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
196     this->GetImpl()->SetMinSize(theMinSize, true);
197     SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
198   }
199 }
200
201 //=============================================================================
202 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
203 {
204   return this->GetImpl()->GetMinSize();
205 }
206
207 //=============================================================================
208 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
209 {
210   return this->GetImpl()->IsMinSizeRel();
211 }
212
213 //=============================================================================
214 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
215 {
216   if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
217     this->GetImpl()->SetMaxSize(theMaxSize, false);
218     SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
219   }
220 }
221
222 //=============================================================================
223 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
224 {
225   if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
226     this->GetImpl()->SetMaxSize(theMaxSize, true);
227     SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
228   }
229 }
230
231 //=============================================================================
232 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
233 {
234   return this->GetImpl()->GetMaxSize();
235 }
236
237 //=============================================================================
238 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
239 {
240   return this->GetImpl()->IsMaxSizeRel();
241 }
242
243
244 //=============================================================================
245 /*!
246  *  BLSURFPlugin_Hypothesis_i::SetUseGradation
247  *
248  *  Set true or false
249  */
250 //=============================================================================
251 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
252 {
253   if ( GetImpl()->GetUseGradation() != bool( theValue ))
254   {
255     this->GetImpl()->SetUseGradation(theValue);
256     std::string theValueStr = theValue ? "True" : "False";
257     SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
258   }
259 }
260
261 //=============================================================================
262 /*!
263  *  BLSURFPlugin_Hypothesis_i::GetUseGradation
264  *
265  *  Get true or false
266  */
267 //=============================================================================
268 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
269 {
270   return this->GetImpl()->GetUseGradation();
271 }
272
273 //=============================================================================
274 /*!
275  *  BLSURFPlugin_Hypothesis_i::SetGradation
276  *
277  *  Set Gradation
278  */
279 //=============================================================================
280 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
281 {
282   this->GetImpl()->SetGradation(theValue);
283
284   if ( theValue < 0 )
285     SetUseGradation( false );
286   else
287     SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
288 }
289
290 //=============================================================================
291 /*!
292  *  BLSURFPlugin_Hypothesis_i::GetGradation
293  *
294  *  Get Gradation
295  */
296 //=============================================================================
297 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
298 {
299   return this->GetImpl()->GetGradation();
300 }
301
302 //=============================================================================
303 /*!
304  *  BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
305  *
306  *  Set true or false
307  */
308 //=============================================================================
309 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
310 {
311   if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
312   {
313     this->GetImpl()->SetUseVolumeGradation(theValue);
314     std::string theValueStr = theValue ? "True" : "False";
315     SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
316   }
317 }
318
319 //=============================================================================
320 /*!
321  *  BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
322  *
323  *  Get true or false
324  */
325 //=============================================================================
326 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
327 {
328   return this->GetImpl()->GetUseVolumeGradation();
329 }
330
331 //=============================================================================
332 /*!
333  *  BLSURFPlugin_Hypothesis_i::SetVolumeGradation
334  *
335  *  Set VolumeGradation
336  */
337 //=============================================================================
338 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
339 {
340   this->GetImpl()->SetVolumeGradation(theValue);
341   if ( theValue < 0 )
342     SetUseVolumeGradation( false );
343   else
344     SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
345 }
346
347 //=============================================================================
348 /*!
349  *  BLSURFPlugin_Hypothesis_i::GetVolumeGradation
350  *
351  *  Get VolumeGradation
352  */
353 //=============================================================================
354 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
355 {
356   return this->GetImpl()->GetVolumeGradation();
357 }
358
359 //=============================================================================
360 /*!
361  *  BLSURFPlugin_Hypothesis_i::SetQuadAllowed
362  *
363  *  Set true or false
364  *
365  *  DEPRACATED, kept for python script compatibility
366  *
367  *  TO be removed in Salome 9
368  */
369 //=============================================================================
370 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
371 {
372   ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
373                   ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
374   this->GetImpl()->SetElementType(theElementType);
375   SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
376 }
377
378 //=============================================================================
379 /*!
380  *  BLSURFPlugin_Hypothesis_i::SetElementType
381  *
382  *  Set ElementType
383  */
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
386 {
387   this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
388   SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
389 }
390 //=============================================================================
391 /*!
392  *  BLSURFPlugin_Hypothesis_i::GetElementType
393  *
394  *  Get ElementType
395  */
396 //=============================================================================
397 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
398 {
399   return this->GetImpl()->GetElementType();
400 }
401
402 //=============================================================================
403 /*!
404  *  BLSURFPlugin_Hypothesis_i::SetAngleMesh
405  *
406  *  Set AngleMesh
407  */
408 //=============================================================================
409 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
410 {
411   this->GetImpl()->SetAngleMesh(theValue);
412   SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
413 }
414
415 //=============================================================================
416 /*!
417  *  BLSURFPlugin_Hypothesis_i::GetAngleMesh
418  *
419  *  Get AngleMesh
420  */
421 //=============================================================================
422 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
423 {
424   return this->GetImpl()->GetAngleMesh();
425 }
426
427 //=============================================================================
428 /*!
429  *  BLSURFPlugin_Hypothesis_i::SetChordalError
430  *
431  *  Set Chordal Error
432  */
433 //=============================================================================
434 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
435 {
436   this->GetImpl()->SetChordalError(theValue);
437   SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
438 }
439
440 //=============================================================================
441 /*!
442  *  BLSURFPlugin_Hypothesis_i::GetChordalError
443  *
444  *  Get Chordal Error
445  */
446 //=============================================================================
447 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
448 {
449   return this->GetImpl()->GetChordalError();
450 }
451
452 //=============================================================================
453 /*!
454  *  BLSURFPlugin_Hypothesis_i::SetAnisotropic
455  *
456  *  Set true or false
457  */
458 //=============================================================================
459 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
460 {
461   this->GetImpl()->SetAnisotropic(theValue);
462   std::string theValueStr = theValue ? "True" : "False";
463   SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
464 }
465
466 //=============================================================================
467 /*!
468  *  BLSURFPlugin_Hypothesis_i::GetAnisotropic
469  *
470  *  Get true or false
471  */
472 //=============================================================================
473 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
474 {
475   return this->GetImpl()->GetAnisotropic();
476 }
477
478 //=============================================================================
479 /*!
480  *  BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
481  *
482  *  Set Anisotropic Ratio
483  */
484 //=============================================================================
485 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
486 {
487   this->GetImpl()->SetAnisotropicRatio(theValue);
488   SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
489 }
490
491 //=============================================================================
492 /*!
493  *  BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
494  *
495  *  Get Anisotropic Ratio
496  */
497 //=============================================================================
498 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
499 {
500   return this->GetImpl()->GetAnisotropicRatio();
501 }
502
503
504 //=============================================================================
505 /*!
506  *  BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
507  *
508  *  Set true or false
509  */
510 //=============================================================================
511 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
512   ASSERT(myBaseImpl);
513   this->GetImpl()->SetRemoveTinyEdges(theValue);
514   std::string theValueStr = theValue ? "True" : "False";
515   SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
516 }
517
518 //=============================================================================
519 /*!
520  *  BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
521  *
522  *  Get true or false
523  */
524 //=============================================================================
525 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
526   ASSERT(myBaseImpl);
527   return this->GetImpl()->GetRemoveTinyEdges();
528 }
529
530 //=============================================================================
531 /*!
532  *  BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
533  *
534  *  Set Tiny Edge Length
535  */
536 //=============================================================================
537 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
538   ASSERT(myBaseImpl);
539   this->GetImpl()->SetTinyEdgeLength(theValue);
540   SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
541 }
542
543 //=============================================================================
544 /*!
545  *  BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
546  *
547  *  Get Tiny Edge Length
548  */
549 //=============================================================================
550 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
551   ASSERT(myBaseImpl);
552   return this->GetImpl()->GetTinyEdgeLength();
553 }
554
555 //=============================================================================
556 /*!
557  *  BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
558  *
559  *  Set true or false
560  */
561 //=============================================================================
562 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
563   ASSERT(myBaseImpl);
564   this->GetImpl()->SetOptimiseTinyEdges(theValue);
565   std::string theValueStr = theValue ? "True" : "False";
566   SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
567 }
568
569 //=============================================================================
570 /*!
571  *  BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
572  *
573  *  Get true or false
574  */
575 //=============================================================================
576 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
577   ASSERT(myBaseImpl);
578   return this->GetImpl()->GetOptimiseTinyEdges();
579 }
580
581 //=============================================================================
582 /*!
583  *  BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
584  *
585  *  Set Tiny Edge OptimisationLength
586  */
587 //=============================================================================
588 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
589   ASSERT(myBaseImpl);
590   this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
591   SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
592 }
593
594 //=============================================================================
595 /*!
596  *  BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
597  *
598  *  Get Tiny Edge OptimisationLength
599  */
600 //=============================================================================
601 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
602   ASSERT(myBaseImpl);
603   return this->GetImpl()->GetTinyEdgeOptimisationLength();
604 }
605
606 //=============================================================================
607 /*!
608  *  BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
609  *
610  *  Set true or false
611  */
612 //=============================================================================
613 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
614   ASSERT(myBaseImpl);
615   this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
616   std::string theValueStr = theValue ? "True" : "False";
617   SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
618 }
619
620 //=============================================================================
621 /*!
622  *  BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
623  *
624  *  Get true or false
625  */
626 //=============================================================================
627 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
628   ASSERT(myBaseImpl);
629   return this->GetImpl()->GetCorrectSurfaceIntersection();
630 }
631
632 //=============================================================================
633 /*!
634  *  BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
635  *
636  *  Set Tiny Edge OptimisationLength
637  */
638 //=============================================================================
639 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
640   ASSERT(myBaseImpl);
641   this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
642   SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
643 }
644
645 //=============================================================================
646 /*!
647  *  BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
648  *
649  *  Get Tiny Edge OptimisationLength
650  */
651 //=============================================================================
652 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
653   ASSERT(myBaseImpl);
654   return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
655 }
656
657 //=============================================================================
658 /*!
659  *  BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
660  *
661  *  Set true or false
662  */
663 //=============================================================================
664 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
665   ASSERT(myBaseImpl);
666   this->GetImpl()->SetBadElementRemoval(theValue);
667   std::string theValueStr = theValue ? "True" : "False";
668   SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
669 }
670
671 //=============================================================================
672 /*!
673  *  BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
674  *
675  *  Get true or false
676  */
677 //=============================================================================
678 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
679   ASSERT(myBaseImpl);
680   return this->GetImpl()->GetBadElementRemoval();
681 }
682
683 //=============================================================================
684 /*!
685  *  BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
686  *
687  *  Set Bad Surface Element Aspect Ratio
688  */
689 //=============================================================================
690 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
691   ASSERT(myBaseImpl);
692   this->GetImpl()->SetBadElementAspectRatio(theValue);
693   SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
694 }
695
696 //=============================================================================
697 /*!
698  *  BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
699  *
700  *  Get Bad Surface Element Aspect Ratio
701  */
702 //=============================================================================
703 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
704   ASSERT(myBaseImpl);
705   return this->GetImpl()->GetBadElementAspectRatio();
706 }
707
708 //=============================================================================
709 /*!
710  *  BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
711  *
712  *  Set true or false
713  */
714 //=============================================================================
715 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
716   ASSERT(myBaseImpl);
717   this->GetImpl()->SetOptimizeMesh(theValue);
718   std::string theValueStr = theValue ? "True" : "False";
719   SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
720 }
721
722 //=============================================================================
723 /*!
724  *  BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
725  *
726  *  Get true or false
727  */
728 //=============================================================================
729 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
730   ASSERT(myBaseImpl);
731   return this->GetImpl()->GetOptimizeMesh();
732 }
733
734 //=============================================================================
735 /*!
736  *  BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
737  *
738  *  Set true or false
739  */
740 //=============================================================================
741 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
742   ASSERT(myBaseImpl);
743   this->GetImpl()->SetQuadraticMesh(theValue);
744   std::string theValueStr = theValue ? "True" : "False";
745   SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
746 }
747
748 //=============================================================================
749 /*!
750  *  BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
751  *
752  *  Get true or false
753  */
754 //=============================================================================
755 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
756   ASSERT(myBaseImpl);
757   return this->GetImpl()->GetQuadraticMesh();
758 }
759
760
761
762
763
764 /*!
765  *  BLSURFPlugin_Hypothesis_i::SetTopology
766  *
767  *  Set topology
768  */
769
770 //=============================================================================
771 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
772   ASSERT(myBaseImpl);
773   this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
774   SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
775 }
776
777 //=============================================================================
778 /*!
779  *  BLSURFPlugin_Hypothesis_i::GetTopology
780  *
781  *  Get Topology
782  */
783 //=============================================================================
784 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
785   ASSERT(myBaseImpl);
786   return this->GetImpl()->GetTopology();
787 }
788
789 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
791   ASSERT(myBaseImpl);
792   if (theVal < 0 || theVal > 100)
793     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
794   this->GetImpl()->SetVerbosity(theVal);
795   SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
796 }
797
798 //=============================================================================
799
800 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
801   ASSERT(myBaseImpl);
802   return (CORBA::Short) this->GetImpl()->GetVerbosity();
803 }
804
805 //=============================================================================
806 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
807 {
808   if ( GetEnforceCadEdgesSize() != toEnforce )
809   {
810     this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
811     SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
812   }
813 }
814 //=============================================================================
815 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
816 {
817   return this->GetImpl()->GetEnforceCadEdgesSize();
818 }
819 //=============================================================================
820
821 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
822 {
823   if ( GetJacobianRectificationRespectGeometry() != allowRectification )
824   {
825     this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
826     SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
827   }
828 }
829 //=============================================================================
830 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
831 {
832   return this->GetImpl()->GetJacobianRectificationRespectGeometry();
833 }
834 //=============================================================================
835
836 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
837 {
838   if ( GetJacobianRectification() != allowRectification )
839   {
840     this->GetImpl()->SetJacobianRectification(allowRectification);
841     SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
842   }
843 }
844 //=============================================================================
845 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
846 {
847   return this->GetImpl()->GetJacobianRectification();
848 }
849 //=============================================================================
850
851 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
852 {
853   if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
854   {
855     this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
856     SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
857   }
858 }
859 //=============================================================================
860 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
861 {
862   return this->GetImpl()->GetUseDeprecatedPatchMesher();
863 }
864 //=============================================================================
865
866 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
867 {
868   if ( GetMaxNumberOfPointsPerPatch() != nb )
869   {
870     try {
871       this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
872
873     } catch (const std::invalid_argument& ex) {
874       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
875     } catch (SALOME_Exception& ex) {
876       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
877     }
878     SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
879   }
880 }
881 //=============================================================================
882 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
883 {
884   return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
885 }
886 //=============================================================================
887
888 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
889 {
890   if ( GetMaxNumberOfThreads() != nb )
891   {
892     try {
893       this->GetImpl()->SetMaxNumberOfThreads(nb);
894
895     } catch (const std::invalid_argument& ex) {
896       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
897     } catch (SALOME_Exception& ex) {
898       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
899     }
900     SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
901   }
902 }
903 //=============================================================================
904 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
905 {
906   return this->GetImpl()->GetMaxNumberOfThreads();
907 }
908 //=============================================================================
909
910 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
911 {
912   if ( GetRespectGeometry() != toRespect )
913   {
914     this->GetImpl()->SetRespectGeometry(toRespect);
915     SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
916   }
917 }
918 //=============================================================================
919 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
920 {
921   return this->GetImpl()->GetRespectGeometry();
922 }
923 //=============================================================================
924
925 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
926 {
927   if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
928   {
929     this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
930     SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
931   }
932 }
933 //=============================================================================
934 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
935 {
936   return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
937 }
938 //=============================================================================
939
940 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
941 {
942   if ( GetClosedGeometry() != isClosed )
943   {
944     this->GetImpl()->SetClosedGeometry(isClosed);
945     SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
946   }
947 }
948 //=============================================================================
949 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
950 {
951   return this->GetImpl()->GetClosedGeometry();
952 }
953 //=============================================================================
954
955 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
956 {
957   if ( GetDebug() != isDebug )
958   {
959     this->GetImpl()->SetDebug(isDebug);
960     SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
961   }
962 }
963 //=============================================================================
964 bool BLSURFPlugin_Hypothesis_i::GetDebug()
965 {
966   return this->GetImpl()->GetDebug();
967 }
968 //=============================================================================
969
970 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
971 {
972   bool isDefault;
973   if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
974   {
975     try
976     {
977       this->GetImpl()->SetPeriodicTolerance(tol);
978
979     } catch (const std::invalid_argument& ex) {
980       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
981     } catch (SALOME_Exception& ex) {
982       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
983     }
984     SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
985   }
986 }
987 //=============================================================================
988 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
989 {
990   try{
991     return this->GetImpl()->GetPeriodicTolerance();
992
993   } catch (const std::invalid_argument& ex) {
994     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995   } catch (SALOME_Exception& ex) {
996     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
997   }
998   return -1;
999 }
1000 //=============================================================================
1001
1002 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1003 {
1004   if ( GetImpl()->GetRequiredEntities() != howToTreat )
1005   {
1006     try {
1007       this->GetImpl()->SetRequiredEntities(howToTreat);
1008
1009     } catch (const std::invalid_argument& ex) {
1010       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1011     } catch (SALOME_Exception& ex) {
1012       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1013     }
1014     SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1015   }
1016 }
1017 //=============================================================================
1018 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1019 {
1020   return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1021 }
1022 //=============================================================================
1023
1024 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1025 {
1026   bool isDefault;
1027   if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1028   {
1029     try
1030     {
1031       this->GetImpl()->SetSewingTolerance(tol);
1032       SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1033
1034     } catch (const std::invalid_argument& ex) {
1035       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1036     } catch (SALOME_Exception& ex) {
1037       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1038     }
1039   }
1040 }
1041 //=============================================================================
1042 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1043 {
1044   try
1045   {
1046     return this->GetImpl()->GetSewingTolerance();
1047
1048   } catch (const std::invalid_argument& ex) {
1049     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1050   } catch (SALOME_Exception& ex) {
1051     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1052   }
1053   return -1;
1054 }
1055 //=============================================================================
1056
1057 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1058 {
1059   if ( GetImpl()->GetTags() != howToTreat )
1060   {
1061     try {
1062       this->GetImpl()->SetTags(howToTreat);
1063     }
1064     catch (const std::invalid_argument& ex) {
1065       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1066     } catch (SALOME_Exception& ex) {
1067       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1068     }
1069   }
1070   SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1071 }
1072 //=============================================================================
1073 char* BLSURFPlugin_Hypothesis_i::GetTags()
1074 {
1075   return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1076 }
1077
1078 //=============================================================================
1079 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1080 {
1081   ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1082   SMESH_Comment hplDump;
1083   hplDump << "[";
1084   for ( size_t i = 0; i < patchList.size(); ++i )
1085   {
1086     hplDump << "[ ";
1087     BLSURFPlugin::THyperPatch tags = hpl[ i ];
1088     for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1089     {
1090       patchList[ i ].insert( tags[ j ]);
1091       hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1092     }
1093     hplDump << ( i+1 < patchList.size() ? "," : "]");
1094   }
1095   if ( GetImpl()->GetHyperPatches() != patchList )
1096   {
1097     GetImpl()->SetHyperPatches( patchList );
1098     SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1099   }
1100 }
1101
1102 //=============================================================================
1103 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1104 {
1105   const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1106   BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1107   resHpl->length( hpl.size() );
1108
1109   ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1110   for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1111   {
1112     const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1113     BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1114     resHp.length( hp.size() );
1115
1116     ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1117     for ( int j = 0; tag != hp.end(); ++tag, ++j )
1118       resHp[ j ] = *tag;
1119   }
1120   return resHpl;
1121 }
1122
1123 //=============================================================================
1124 /*!
1125  *  BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1126  *
1127  *  Set true or false
1128  */
1129 //=============================================================================
1130 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1131   ASSERT(myBaseImpl);
1132   this->GetImpl()->SetPreCADMergeEdges(theValue);
1133   std::string theValueStr = theValue ? "True" : "False";
1134   SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1135 }
1136
1137 //=============================================================================
1138 /*!
1139  *  BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1140  *
1141  *  Get true or false
1142  */
1143 //=============================================================================
1144 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1145   ASSERT(myBaseImpl);
1146   return this->GetImpl()->GetPreCADMergeEdges();
1147 }
1148
1149 //=============================================================================
1150 /*!
1151  *  BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1152  *
1153  *  Set true or false
1154  */
1155 //=============================================================================
1156 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1157   ASSERT(myBaseImpl);
1158   this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1159   std::string theValueStr = theValue ? "True" : "False";
1160   SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1161 }
1162
1163 //=============================================================================
1164 /*!
1165  *  BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1166  *
1167  *  Get true or false
1168  */
1169 //=============================================================================
1170 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1171   ASSERT(myBaseImpl);
1172   return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1173 }
1174
1175 //=============================================================================
1176 /*!
1177  *  BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1178  *
1179  *  Set true or false
1180  */
1181 //=============================================================================
1182 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1183   ASSERT(myBaseImpl);
1184   this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1185   std::string theValueStr = theValue ? "True" : "False";
1186   SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1187 }
1188
1189 //=============================================================================
1190 /*!
1191  *  BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1192  *
1193  *  Get true or false
1194  */
1195 //=============================================================================
1196 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1197   ASSERT(myBaseImpl);
1198   return this->GetImpl()->GetPreCADProcess3DTopology();
1199 }
1200
1201 //=============================================================================
1202 /*!
1203  *  BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1204  *
1205  *  Set true or false
1206  */
1207 //=============================================================================
1208 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1209   ASSERT(myBaseImpl);
1210   this->GetImpl()->SetPreCADDiscardInput(theValue);
1211   std::string theValueStr = theValue ? "True" : "False";
1212   SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1213 }
1214
1215 //=============================================================================
1216 /*!
1217  *  BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1218  *
1219  *  Get true or false
1220  */
1221 //=============================================================================
1222 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1223   ASSERT(myBaseImpl);
1224   return this->GetImpl()->GetPreCADDiscardInput();
1225 }
1226
1227
1228 //=============================================================================
1229
1230 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1231   throw (SALOME::SALOME_Exception) {
1232   ASSERT(myBaseImpl);
1233   try {
1234     std::string name( optionName );
1235     if ( !optionValue || !optionValue[0] )
1236       UnsetOption( optionName );
1237
1238     // basic options (visible in Advanced table)
1239
1240     else if ( name == "enforce_cad_edge_sizes" )
1241       SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1242
1243     else if ( name == "jacobian_rectification_respect_geometry" )
1244       SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1245
1246     else if ( name == "max_number_of_points_per_patch" )
1247       SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1248
1249     else if ( name == "max_number_of_threads" )
1250       SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1251
1252     else if ( name == "rectify_jacobian" )
1253       SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1254
1255     else if ( name == "use_deprecated_patch_mesher" )
1256       SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1257
1258     else if ( name == "respect_geometry" )
1259       SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1260
1261     else if ( name == "tiny_edge_avoid_surface_intersections" )
1262       SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1263
1264     else if ( name == "closed_geometry" )
1265       SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1266
1267     else if ( name == "debug" )
1268       SetDebug( GetImpl()->ToBool( optionValue ));
1269
1270     else if ( name == "discard_input_topology" )
1271       SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1272
1273     else if ( name == "merge_edges" )
1274       SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1275
1276     else if ( name == "periodic_tolerance" )
1277       SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1278
1279     else if ( name == "remove_duplicate_cad_faces" )
1280       SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1281
1282     else if ( name == "required_entities" )
1283       SetRequiredEntities( optionValue );
1284
1285     else if ( name == "sewing_tolerance" )
1286       SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1287
1288     else if ( name == "tags" )
1289       SetTags( optionValue );
1290
1291     // other basic options with specific methods
1292
1293     else if ( name == "correct_surface_intersections" )
1294       SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1295
1296     else if ( name == "optimise_tiny_edges" )
1297       SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1298
1299     else if ( name == "surface_intersections_processing_max_cost" )
1300       SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1301
1302     else if ( name == "volume_gradation" )
1303       SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1304
1305     else if ( name == "tiny_edge_optimisation_length" )
1306       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1307
1308     // advanced options (for backward compatibility)
1309
1310     else if ( name == "create_tag_on_collision" ||
1311               name == "tiny_edge_respect_geometry" )
1312       AddOption( optionName, optionValue );
1313
1314     else {
1315       bool valueChanged;
1316       valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1317                        this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1318       if ( valueChanged )
1319       {
1320         this->GetImpl()->SetOptionValue(optionName, optionValue);
1321         SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1322       }
1323     }
1324   } catch (const std::invalid_argument& ex) {
1325     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1326   } catch (SALOME_Exception& ex) {
1327     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1328   }
1329 }
1330
1331 //=============================================================================
1332
1333 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1334   throw (SALOME::SALOME_Exception) {
1335   ASSERT(myBaseImpl);
1336   bool valueChanged = false;
1337   try {
1338     std::string name( optionName );
1339     if ( !optionValue || !optionValue[0] )
1340       UnsetOption( optionName );
1341
1342     else if ( name == "closed_geometry" )
1343       SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1344
1345     else if ( name == "debug" )
1346       SetDebug( GetImpl()->ToBool( optionValue ));
1347
1348     else if ( name == "discard_input_topology" )
1349       SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1350
1351     else if ( name == "merge_edges" )
1352       SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1353
1354     else if ( name == "periodic_tolerance" )
1355       SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1356
1357     else if ( name == "remove_duplicate_cad_faces" )
1358       SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1359
1360     else if ( name == "required_entities" )
1361       SetRequiredEntities( optionValue );
1362
1363     else if ( name == "sewing_tolerance" )
1364       SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1365
1366     else if ( name == "tags" )
1367       SetTags( optionValue );
1368
1369     // other basic options with specific methods
1370
1371     else if ( name == "correct_surface_intersections" )
1372       SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1373
1374     else if ( name == "optimise_tiny_edges" )
1375       SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1376
1377     else if ( name == "surface_intersections_processing_max_cost" )
1378       SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1379
1380     else if ( name == "volume_gradation" )
1381       SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1382
1383     else if ( name == "tiny_edge_optimisation_length" )
1384       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1385
1386     else if ( name == "process_3d_topology" )
1387       SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1388
1389     // advanced options (for backward compatibility)
1390
1391     else if ( name == "create_tag_on_collision" ||
1392               name == "tiny_edge_respect_geometry" ||
1393               name == "remove_tiny_edges" ||
1394               name == "tiny_edge_length")
1395       AddPreCADOption( optionName, optionValue );
1396
1397     else {
1398       valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1399       if (valueChanged)
1400         this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1401     }
1402   } catch (const std::invalid_argument& ex) {
1403     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1404   } catch (SALOME_Exception& ex) {
1405     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1406   }
1407   if (valueChanged)
1408     SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1409 }
1410
1411 //=============================================================================
1412
1413 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1414   ASSERT(myBaseImpl);
1415   try {
1416     bool isDefault;
1417     return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1418   } catch (const std::invalid_argument& ex) {
1419     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1420   } catch (SALOME_Exception& ex) {
1421     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1422   }
1423   return 0;
1424 }
1425
1426 //=============================================================================
1427
1428 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1429   ASSERT(myBaseImpl);
1430   try {
1431     bool isDefault;
1432     return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1433   } catch (const std::invalid_argument& ex) {
1434     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1435   } catch (SALOME_Exception& ex) {
1436     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1437   }
1438   return 0;
1439 }
1440
1441 //=============================================================================
1442
1443 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1444   ASSERT(myBaseImpl);
1445   if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1446   {
1447     this->GetImpl()->ClearOption(optionName);
1448     SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1449   }
1450 }
1451
1452 //=============================================================================
1453
1454 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1455   ASSERT(myBaseImpl);
1456   if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1457   {
1458     this->GetImpl()->ClearPreCADOption(optionName);
1459     SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1460   }
1461 }
1462
1463 //=============================================================================
1464
1465 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1466   ASSERT(myBaseImpl);
1467   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1468
1469   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1470   result->length(opts.size());
1471   int i=0;
1472
1473   bool isDefault;
1474   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1475   for (; opIt != opts.end(); ++opIt, ++i) {
1476     string name_value_type = opIt->first;
1477     if (!opIt->second.empty()) {
1478       name_value_type += ":";
1479       name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1480       name_value_type += isDefault ? ":0" : ":1";
1481     }
1482     result[i] = CORBA::string_dup(name_value_type.c_str());
1483   }
1484
1485   return result._retn();
1486 }
1487
1488 //=============================================================================
1489
1490 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1491   ASSERT(myBaseImpl);
1492   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1493
1494   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1495   result->length(opts.size());
1496   int i=0;
1497
1498   bool isDefault;
1499   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1500   for (; opIt != opts.end(); ++opIt, ++i) {
1501     string name_value_type = opIt->first;
1502     if (!opIt->second.empty()) {
1503       name_value_type += ":";
1504       name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1505       name_value_type += isDefault ? ":0" : ":1";
1506     }
1507     result[i] = CORBA::string_dup(name_value_type.c_str());
1508   }
1509   return result._retn();
1510 }
1511
1512 //=============================================================================
1513
1514 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1515 {
1516   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1517
1518   const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1519   result->length(custom_opts.size());
1520   int i=0;
1521
1522   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1523   for (; opIt != custom_opts.end(); ++opIt, ++i) {
1524     string name_value_type = opIt->first;
1525     if (!opIt->second.empty()) {
1526       name_value_type += ":";
1527       name_value_type += opIt->second;
1528       name_value_type += ":1"; // user defined
1529     }
1530     result[i] = CORBA::string_dup(name_value_type.c_str());
1531   }
1532   return result._retn();
1533 }
1534
1535 //=============================================================================
1536
1537 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1538   throw (SALOME::SALOME_Exception) {
1539   ASSERT(myBaseImpl);
1540   for (CORBA::ULong i = 0; i < options.length(); ++i) {
1541     string name_value_type = options[i].in();
1542     if(name_value_type.empty())
1543       continue;
1544     size_t colonPos = name_value_type.find(':');
1545     string name, value;
1546     if (colonPos == string::npos) // ':' not found
1547       name = name_value_type;
1548     else {
1549       name = name_value_type.substr(0, colonPos);
1550       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1551         string value_type = name_value_type.substr(colonPos + 1);
1552         colonPos = value_type.find(':');
1553         value = value_type.substr(0, colonPos);
1554         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1555           if ( value_type.substr(colonPos + 1) == "0" ) // is default
1556             value.clear();
1557       }
1558     }
1559     SetOptionValue(name.c_str(), value.c_str());
1560   }
1561 }
1562
1563 //=============================================================================
1564
1565 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1566   throw (SALOME::SALOME_Exception) {
1567   ASSERT(myBaseImpl);
1568   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1569     string name_value_type = options[i].in();
1570     if(name_value_type.empty())
1571       continue;
1572     size_t colonPos = name_value_type.find(':');
1573     string name, value;
1574     if (colonPos == string::npos) // ':' not found
1575       name = name_value_type;
1576     else {
1577       name = name_value_type.substr(0, colonPos);
1578       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1579         string value_type = name_value_type.substr(colonPos + 1);
1580         colonPos = value_type.find(':');
1581         value = value_type.substr(0, colonPos);
1582         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1583           if ( value_type.substr(colonPos + 1) == "0" ) // is default
1584             value.clear();
1585       }
1586     }
1587     SetPreCADOptionValue(name.c_str(), value.c_str());
1588   }
1589 }
1590
1591 //=============================================================================
1592
1593 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1594 {
1595   SMESH::TPythonDump dump;
1596
1597   string optionsAndValues;
1598   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1599     string name_value_type = options[i].in();
1600     if(name_value_type.empty())
1601       continue;
1602     size_t colonPos = name_value_type.find(':');
1603     string name, value;
1604     if (colonPos == string::npos) // ':' not found
1605       name = name_value_type;
1606     else {
1607       name = name_value_type.substr(0, colonPos);
1608       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1609         string value_type = name_value_type.substr(colonPos + 1);
1610         colonPos = value_type.find(':');
1611         value = value_type.substr(0, colonPos);
1612       }
1613     }
1614     AddOption(name.c_str(), value.c_str());
1615
1616     optionsAndValues += name + " " + value + " ";
1617   }
1618
1619   if ( !optionsAndValues.empty() )
1620     dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1621 }
1622
1623 //=============================================================================
1624
1625 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1626   throw (SALOME::SALOME_Exception)
1627 {
1628   if ( !optionsAndValues ) return;
1629
1630   SMESH::TPythonDump dump;
1631
1632   std::istringstream strm( optionsAndValues );
1633   std::istream_iterator<std::string> sIt( strm ), sEnd;
1634   while ( sIt != sEnd )
1635   {
1636     std::string option = *sIt;
1637     if ( ++sIt != sEnd )
1638     {
1639       std::string value = *sIt;
1640       ++sIt;
1641       AddOption( option.c_str(), value.c_str() );
1642     }
1643     else
1644     {
1645       THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1646     }
1647   }
1648   dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1649 }
1650
1651 //=============================================================================
1652
1653 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1654 {
1655   ASSERT(myBaseImpl);
1656   bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1657   if (valueChanged) {
1658     this->GetImpl()->AddOption(optionName, optionValue);
1659     SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1660   }
1661 }
1662
1663 //=============================================================================
1664
1665 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1666 {
1667   ASSERT(myBaseImpl);
1668   bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1669   if (valueChanged) {
1670     this->GetImpl()->AddPreCADOption(optionName, optionValue);
1671     SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1672   }
1673 }
1674
1675 //=============================================================================
1676
1677 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1678 {
1679   ASSERT(myBaseImpl);
1680   return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1681 }
1682
1683 //=============================================================================
1684
1685 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1686 {
1687   ASSERT(myBaseImpl);
1688   return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1689 }
1690
1691 //=============================================================================
1692
1693 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1694   throw (SALOME::SALOME_Exception) {
1695   ASSERT(myBaseImpl);
1696   if ( !entry || !entry[0] )
1697     THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1698   bool valueChanged = false;
1699   try {
1700     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1701     if (valueChanged)
1702       this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1703   } catch (const std::invalid_argument& ex) {
1704     SALOME::ExceptionStruct ExDescription;
1705     ExDescription.text = ex.what();
1706     ExDescription.type = SALOME::BAD_PARAM;
1707     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1708     ExDescription.lineNumber = 0;
1709     throw SALOME::SALOME_Exception(ExDescription);
1710   } catch (SALOME_Exception& ex) {
1711     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1712   }
1713   if (valueChanged)
1714     SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1715 }
1716
1717 //=============================================================================
1718
1719 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1720   throw (SALOME::SALOME_Exception) {
1721   ASSERT(myBaseImpl);
1722   bool valueChanged = false;
1723   std::ostringstream sizeMapFunction;
1724   switch (shapeType) {
1725   case GEOM::FACE:   sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1726   case GEOM::EDGE:   sizeMapFunction << "def f(t): return " << sizeMap ; break;
1727   case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1728   default:;
1729   }
1730   try {
1731     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1732     if (valueChanged)
1733       this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1734   } catch (const std::invalid_argument& ex) {
1735     SALOME::ExceptionStruct ExDescription;
1736     ExDescription.text = ex.what();
1737     ExDescription.type = SALOME::BAD_PARAM;
1738     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1739     ExDescription.lineNumber = 0;
1740     throw SALOME::SALOME_Exception(ExDescription);
1741   } catch (SALOME_Exception& ex) {
1742     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1743   }
1744   if (valueChanged)
1745     SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1746 }
1747
1748 //=============================================================================
1749
1750 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1751   throw (SALOME::SALOME_Exception) {
1752   ASSERT(myBaseImpl);
1753   bool valueChanged = false;
1754   try {
1755     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1756     if ( valueChanged ) {
1757       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1758       if (!boost::regex_match(string(attractor), re))
1759         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1760       this->GetImpl()->SetAttractorEntry(entry, attractor);
1761     }
1762   } catch (const std::invalid_argument& ex) {
1763     SALOME::ExceptionStruct ExDescription;
1764     ExDescription.text = ex.what();
1765     ExDescription.type = SALOME::BAD_PARAM;
1766     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1767     ExDescription.lineNumber = 0;
1768     throw SALOME::SALOME_Exception(ExDescription);
1769   } catch (SALOME_Exception& ex) {
1770     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1771   }
1772   if (valueChanged)
1773     SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1774 }
1775
1776 //=============================================================================
1777
1778 void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO ?? finir
1779   throw (SALOME::SALOME_Exception)
1780 {
1781   ASSERT(myBaseImpl);
1782   //bool valueChanged = false;
1783   try {
1784     this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1785   }
1786   catch (const std::invalid_argument& ex) {
1787     SALOME::ExceptionStruct ExDescription;
1788     ExDescription.text = ex.what();
1789     ExDescription.type = SALOME::BAD_PARAM;
1790     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1791     ExDescription.lineNumber = 0;
1792     throw SALOME::SALOME_Exception(ExDescription);
1793   } catch (SALOME_Exception& ex) {
1794     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1795   }
1796   //if ( valueChanged )
1797   SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1798                        << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1799 }
1800
1801 //=============================================================================
1802
1803 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1804   ASSERT(myBaseImpl);
1805   try {
1806     return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1807   } catch (const std::invalid_argument& ex) {
1808     SALOME::ExceptionStruct ExDescription;
1809     ExDescription.text = ex.what();
1810     ExDescription.type = SALOME::BAD_PARAM;
1811     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1812     ExDescription.lineNumber = 0;
1813     throw SALOME::SALOME_Exception(ExDescription);
1814   } catch (SALOME_Exception& ex) {
1815     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1816   }
1817   return 0;
1818 }
1819
1820 //=============================================================================
1821
1822 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1823   ASSERT(myBaseImpl);
1824   try {
1825     return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1826   } catch (const std::invalid_argument& ex) {
1827     SALOME::ExceptionStruct ExDescription;
1828     ExDescription.text = ex.what();
1829     ExDescription.type = SALOME::BAD_PARAM;
1830     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1831     ExDescription.lineNumber = 0;
1832     throw SALOME::SALOME_Exception(ExDescription);
1833   } catch (SALOME_Exception& ex) {
1834     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1835   }
1836   return 0;
1837 }
1838
1839 // //=============================================================================
1840 // 
1841 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1842 // // A finir pour le dump
1843 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1844 //   throw (SALOME::SALOME_Exception)
1845 // {
1846 //   ASSERT(myBaseImpl);
1847 //   try {
1848 //     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1849 //   }
1850 //   catch (const std::invalid_argument& ex) {
1851 //     SALOME::ExceptionStruct ExDescription;
1852 //     ExDescription.text = ex.what();
1853 //     ExDescription.type = SALOME::BAD_PARAM;
1854 //     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1855 //     ExDescription.lineNumber = 0;
1856 //     throw SALOME::SALOME_Exception(ExDescription);
1857 //   }
1858 //   catch (SALOME_Exception& ex) {
1859 //     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1860 //   }
1861 //   return 0;
1862 // }
1863
1864 //=============================================================================
1865
1866 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1867   ASSERT(myBaseImpl);
1868   this->GetImpl()->ClearEntry(entry);
1869   //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1870 }
1871
1872 //=============================================================================
1873
1874 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1875   ASSERT(myBaseImpl);
1876   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1877
1878   const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1879   result->length(sizeMaps.size());
1880
1881   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1882   for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1883     string entry_sizemap = smIt->first;
1884     if (!smIt->second.empty()) {
1885       entry_sizemap += "|";
1886       entry_sizemap += smIt->second;
1887     }
1888     result[i] = CORBA::string_dup(entry_sizemap.c_str());
1889   }
1890   return result._retn();
1891 }
1892
1893 //=============================================================================
1894
1895 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1896   ASSERT(myBaseImpl);
1897   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1898
1899   const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1900   result->length(attractors.size());
1901
1902   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1903   for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1904     string entry_attractor = atIt->first;
1905     if (!atIt->second.empty()) {
1906       entry_attractor += "|";
1907       entry_attractor += atIt->second;
1908     }
1909     result[i] = CORBA::string_dup(entry_attractor.c_str());
1910   }
1911   return result._retn();
1912 }
1913
1914 //=============================================================================
1915
1916 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1917 {
1918   ASSERT(myBaseImpl);
1919   BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1920
1921   const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1922   result->length( attractors.size() );
1923
1924   ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1925   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1926     string faceEntry = atIt->first;
1927     string attEntry;
1928     double startSize, endSize, infDist, constDist;
1929     if ( !atIt->second->Empty() ) {
1930       attEntry = atIt->second->GetAttractorEntry();
1931       std::vector<double> params = atIt->second->GetParameters();
1932       startSize = params[0];
1933       endSize = params[1];
1934       infDist = params[2];
1935       constDist = params[3];
1936     }
1937     result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1938     result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1939     result[i].startSize = startSize;
1940     result[i].endSize = endSize;
1941     result[i].infDist = infDist;
1942     result[i].constDist = constDist;
1943   }
1944   return result._retn();
1945 }
1946
1947 //=============================================================================
1948
1949 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1950   throw (SALOME::SALOME_Exception) {
1951   ASSERT(myBaseImpl);
1952   for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1953     string entry_sizemap = sizeMaps[i].in();
1954     size_t colonPos = entry_sizemap.find('|');
1955     string entry, sizemap;
1956     if (colonPos == string::npos) // '|' separator not found
1957       entry = entry_sizemap;
1958     else {
1959       entry = entry_sizemap.substr(0, colonPos);
1960       if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1961         sizemap = entry_sizemap.substr(colonPos + 1);
1962     }
1963     this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1964   }
1965 }
1966
1967 //=============================================================================
1968
1969 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1970   ASSERT(myBaseImpl);
1971   this->GetImpl()->ClearSizeMaps();
1972 }
1973
1974 //=============================================================================
1975
1976 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1977   throw (SALOME::SALOME_Exception)
1978 {
1979   ASSERT(myBaseImpl);
1980   string entry;
1981   entry = GeomObj->GetStudyEntry();
1982   SetSizeMapEntry(entry.c_str(), sizeMap);
1983 }
1984
1985 //=============================================================================
1986
1987 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1988   ASSERT(myBaseImpl);
1989   string entry = GeomObj->GetStudyEntry();
1990   GEOM::shape_type shapeType = GeomObj->GetShapeType();
1991   if (shapeType == GEOM::COMPOUND)
1992     shapeType = GeomObj->GetMaxShapeType();
1993   SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1994 }
1995
1996 //=============================================================================
1997 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1998   ASSERT(myBaseImpl);
1999   string entry;
2000   entry = GeomObj->GetStudyEntry();
2001   UnsetEntry(entry.c_str());
2002   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2003 }
2004
2005 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2006   ASSERT(myBaseImpl);
2007   string entry;
2008   entry = GeomObj->GetStudyEntry();
2009   SetAttractorEntry(entry.c_str(), attractor);
2010 }
2011
2012 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2013   ASSERT(myBaseImpl);
2014   string entry;
2015   entry = GeomObj->GetStudyEntry();
2016   UnsetEntry(entry.c_str());
2017   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2018 }
2019
2020 void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)
2021 {
2022   ASSERT(myBaseImpl);
2023   string theFaceEntry;
2024   string theAttEntry;
2025   theFaceEntry = theFace->GetStudyEntry();
2026   theAttEntry  = theAttractor->GetStudyEntry();
2027   
2028   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2029   string aName;
2030   
2031   if (theFaceEntry.empty()) {
2032     aName = "Face_";
2033     aName += theFace->GetEntry();
2034     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2035     if (!theSFace->_is_nil())
2036       theFaceEntry = theSFace->GetID();
2037   }
2038   if (theFaceEntry.empty())
2039     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2040   
2041   if (theAttEntry.empty()) {
2042     if (theAttractor->GetShapeType() == GEOM::VERTEX)
2043       aName = "Vertex_";
2044     if (theAttractor->GetShapeType() == GEOM::EDGE)
2045       aName = "Edge_";
2046     if (theAttractor->GetShapeType() == GEOM::WIRE)
2047       aName = "Wire_";
2048     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2049       aName = "Compound_";
2050     aName += theAttractor->GetEntry();
2051     SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2052     if (!theSAtt->_is_nil())
2053       theAttEntry = theSAtt->GetID();
2054   }
2055   if (theAttEntry.empty())
2056     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2057   
2058   TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2059   TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2060   SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2061 }
2062
2063 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2064                                                    GEOM::GEOM_Object_ptr theAttractor)
2065 {
2066   ASSERT(myBaseImpl);
2067   CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2068   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2069   
2070   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2071   // string aName;
2072   
2073   // if (theFaceEntry.empty()) {
2074   //   aName = "Face_";
2075   //   aName += theFace->GetEntry();
2076   //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2077   //   if (!theSFace->_is_nil())
2078   //     theFaceEntry = theSFace->GetID();
2079   // }
2080   if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2081        !theAttrEntry.in() || !theAttrEntry.in()[0] )
2082     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2083   
2084   GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2085   SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2086                        << theFace << ", " << theAttractor << " )";
2087 }
2088
2089 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2090                                                     const char* attractorEntry)
2091 {
2092   GetImpl()->ClearEntry( faceEntry, attractorEntry );
2093   SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2094                        << faceEntry << "', '" << attractorEntry << "' )";
2095 }
2096
2097
2098 /*
2099   void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2100   {}
2101
2102   void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2103   {}
2104
2105   void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
2106   {}
2107
2108   char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
2109   {}
2110
2111   void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2112   {
2113   ASSERT(myBaseImpl);
2114   this->GetImpl()->UnsetCustomSizeMap(entry);
2115   SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2116   }
2117
2118
2119   BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2120   {}
2121
2122 */
2123
2124 // ///////////////////////
2125 // // ENFORCED VERTICES //
2126 // ///////////////////////
2127
2128
2129 /**
2130  * Returns the list of enforced vertices for a given Face entry
2131  * @return A map of Face entry / List of enforced vertices
2132  *
2133  */
2134 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2135   ASSERT(myBaseImpl);
2136
2137   BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2138
2139   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2140     this->GetImpl()->_GetAllEnforcedVerticesByFace();
2141   resultMap->length(faceEntryEnfVertexListMap.size());
2142
2143   ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2144   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2145   for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2146     BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2147       new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2148     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2149
2150     _enfVertexList = it_entry->second;
2151     BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2152     enfVertexList->length(_enfVertexList.size());
2153
2154     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2155     ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2156     for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2157       currentEnfVertex = (*it_enfVertex);
2158
2159       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2160
2161       // Name
2162       enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2163
2164       // Geom entry
2165       enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2166
2167       // Coords
2168       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2169       coords->length(currentEnfVertex->coords.size());
2170       for (CORBA::ULong i=0;i<coords->length();i++)
2171         coords[i] = currentEnfVertex->coords[i];
2172       enfVertex->coords = coords;
2173
2174       // Group name
2175       enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2176       
2177       // Face entry list
2178       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2179       faceEntryList->length(currentEnfVertex->faceEntries.size());
2180       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2181       for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2182         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2183       enfVertex->faceEntries = faceEntryList;
2184
2185       ostringstream msg;
2186       msg << "Enforced vertex: \n"
2187           << "Name: " << enfVertex->name << "\n";
2188       if (coords->length())
2189         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2190       msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2191           << "Group Name: " << enfVertex->grpName;
2192
2193       enfVertexList[j] = enfVertex;
2194     }
2195     mapElement->enfVertexList = enfVertexList;
2196
2197     resultMap[i] = mapElement;
2198
2199   }
2200   return resultMap._retn();
2201 }
2202
2203 /**
2204  * Returns the list of all enforced vertices
2205  * @return a list of enforced vertices
2206  *
2207  */
2208 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2209   ASSERT(myBaseImpl);
2210   BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2211   const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2212   resultMap->length(enfVertexList.size());
2213
2214   ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2215   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2216   for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2217     currentEnfVertex = (*evlIt);
2218     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2219     // Name
2220     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2221     // Geom entry
2222     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2223     // Coords
2224     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2225     coords->length(currentEnfVertex->coords.size());
2226     for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2227       coords[ind] = currentEnfVertex->coords[ind];
2228     enfVertex->coords = coords;
2229     // Group name
2230     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2231     // Face entry list
2232     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2233     faceEntryList->length(currentEnfVertex->faceEntries.size());
2234     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2235     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2236       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2237     enfVertex->faceEntries = faceEntryList;
2238
2239     ostringstream msg;
2240     msg << "Enforced vertex: \n"
2241         << "Name: " << enfVertex->name << "\n";
2242     if (coords->length())
2243       msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2244     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2245         << "Group Name: " << enfVertex->grpName;
2246
2247     resultMap[i] = enfVertex;
2248   }
2249   return resultMap._retn();
2250
2251 }
2252
2253 /**
2254  * Returns the list of enforced vertices coords for a given Face entry.
2255  * They are the coords of the "manual" enforced vertices.
2256  * @return A map of Face entry / List of enforced vertices coords
2257  *
2258  */
2259 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2260   ASSERT(myBaseImpl);
2261
2262   BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2263
2264   const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2265   resultMap->length(entryCoordsListMap.size());
2266
2267   ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2268   ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2269   for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2270     BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2271     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2272
2273     _coordsList = it_entry->second;
2274     BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2275     coordsList->length(_coordsList.size());
2276
2277     ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2278     for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2279       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2280       coords->length((*it_coords).size());
2281       for (CORBA::ULong i=0;i<coords->length();i++)
2282         coords[i] = (*it_coords)[i];
2283       coordsList[j] = coords;
2284     }
2285     mapElement->coordsList = coordsList;
2286
2287     resultMap[i] = mapElement;
2288
2289   }
2290   return resultMap._retn();
2291 }
2292
2293 /**
2294  * Returns a map of enforced vertices coords / enforced vertex.
2295  * They are the coords of the "manual" enforced vertices.
2296  */
2297 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2298   ASSERT(myBaseImpl);
2299
2300   BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2301   const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2302     this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2303   resultMap->length(coordsEnfVertexMap.size());
2304
2305   ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2306   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2307   for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2308     currentEnfVertex = (it_coords->second);
2309     BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2310     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2311     coords->length(it_coords->first.size());
2312     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2313       coords[ind] = it_coords->first[ind];
2314     mapElement->coords = coords;
2315
2316     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2317     // Name
2318     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2319     // Geom entry
2320     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2321     // Coords
2322     BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2323     coords2->length(currentEnfVertex->coords.size());
2324     for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2325       coords2[ind] = currentEnfVertex->coords[ind];
2326     enfVertex->coords = coords2;
2327     // Group name
2328     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2329     // Face entry list
2330     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2331     faceEntryList->length(currentEnfVertex->faceEntries.size());
2332     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2333     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2334       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2335     enfVertex->faceEntries = faceEntryList;
2336       
2337     mapElement->enfVertex = enfVertex;
2338     ostringstream msg;
2339     msg << "Enforced vertex: \n"
2340         << "Name: " << enfVertex->name << "\n";
2341     if (coords->length())
2342       msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2343     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2344         << "Group Name: " << enfVertex->grpName;
2345
2346     resultMap[i] = mapElement;
2347   }
2348   return resultMap._retn();
2349 }
2350
2351 /**
2352  * Returns the list of enforced vertices entries for a given Face entry.
2353  * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2354  * @return A map of Face entry / List of enforced vertices geom entries
2355  *
2356  */
2357 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2358   ASSERT(myBaseImpl);
2359
2360   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2361
2362   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2363     this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2364   resultMap->length(entryEnfVertexEntryListMap.size());
2365
2366   ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2367   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2368       entryEnfVertexEntryListMap.begin();
2369   for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2370     BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2371       new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2372     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2373
2374     _enfVertexEntryList = it_entry->second;
2375     BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2376     enfVertexEntryList->length(_enfVertexEntryList.size());
2377
2378     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2379     for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2380       enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2381     }
2382     mapElement->enfVertexEntryList = enfVertexEntryList;
2383
2384     resultMap[i] = mapElement;
2385
2386   }
2387   return resultMap._retn();
2388 }
2389
2390 /**
2391  * Returns a map of enforced vertices geom entry / enforced vertex.
2392  * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2393  */
2394 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2395   ASSERT(myBaseImpl);
2396
2397   BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2398   const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2399     this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2400   resultMap->length(enfVertexEntryEnfVertexMap.size());
2401
2402   ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2403   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2404   for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2405     currentEnfVertex = it_enfVertexEntry->second;
2406     BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2407     mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2408
2409     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2410     // Name
2411     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2412     // Geom entry
2413     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2414     // Coords
2415     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2416     coords->length(currentEnfVertex->coords.size());
2417     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2418       coords[ind] = currentEnfVertex->coords[ind];
2419     enfVertex->coords = coords;
2420     // Group name
2421     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2422     // Face entry list
2423     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2424     faceEntryList->length(currentEnfVertex->faceEntries.size());
2425     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2426     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2427       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2428     enfVertex->faceEntries = faceEntryList;
2429
2430     ostringstream msg;
2431     msg << "Enforced vertex: \n"
2432         << "Name: " << enfVertex->name << "\n";
2433     if (coords->length())
2434       msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2435     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2436         << "Group Name: " << enfVertex->grpName;
2437
2438     mapElement->enfVertex = enfVertex;
2439     resultMap[i] = mapElement;
2440   }
2441   return resultMap._retn();
2442 }
2443
2444 /**
2445  * Erase all enforced vertices
2446  */
2447 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2448   ASSERT(myBaseImpl);
2449   this->GetImpl()->ClearAllEnforcedVertices();
2450   SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2451 }
2452
2453 /*!
2454  * Set/get/unset an enforced vertex on face - OBSOLETE
2455  */
2456 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2457                                                   CORBA::Double z) throw (SALOME::SALOME_Exception) {
2458   ASSERT(myBaseImpl);
2459
2460   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2461     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2462   }
2463
2464   string theFaceEntry = theFace->GetStudyEntry();
2465   
2466   if (theFaceEntry.empty()) {
2467     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2468     string aName;
2469     if (theFace->GetShapeType() == GEOM::FACE)
2470       aName = "Face_";
2471     if (theFace->GetShapeType() == GEOM::COMPOUND)
2472       aName = "Compound_";
2473     aName += theFace->GetEntry();
2474     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2475     if (!theSFace->_is_nil())
2476       theFaceEntry = theSFace->GetID();
2477   }
2478   if (theFaceEntry.empty())
2479     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2480   try {
2481     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2482   } catch (SALOME_Exception& ex) {
2483     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2484   }
2485 }
2486
2487 /*!
2488  * Set/get/unset an enforced vertex with name on face
2489  */
2490 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2491                                                        CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2492   ASSERT(myBaseImpl);
2493
2494   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2495     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2496   }
2497
2498   string theFaceEntry = theFace->GetStudyEntry();
2499   
2500   if (theFaceEntry.empty()) {
2501     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2502     string aName;
2503     if (theFace->GetShapeType() == GEOM::FACE)
2504       aName = "Face_";
2505     if (theFace->GetShapeType() == GEOM::COMPOUND)
2506       aName = "Compound_";
2507     aName += theFace->GetEntry();
2508     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2509     if (!theSFace->_is_nil())
2510       theFaceEntry = theSFace->GetID();
2511   }
2512   if (theFaceEntry.empty())
2513     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2514   
2515   try {
2516     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2517   } catch (SALOME_Exception& ex) {
2518     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2519   }
2520 }
2521
2522 /*!
2523  * Set/get/unset an enforced vertex with geom object on face
2524  */
2525 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2526   throw (SALOME::SALOME_Exception) {
2527   ASSERT(myBaseImpl);
2528
2529   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2530     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2531   }
2532
2533   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2534     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2535   }
2536
2537   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2538   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2539   //  if (CORBA::is_nil(measureOp))
2540   //    return false;
2541   //
2542   //  CORBA::Double x, y, z;
2543   //  x = y = z = 0.;
2544   //  measureOp->PointCoordinates(theVertex, x, y, z);
2545
2546   string theFaceEntry = theFace->GetStudyEntry();
2547   string theVertexEntry = theVertex->GetStudyEntry();
2548   
2549   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2550   string aName;
2551   
2552   if (theFaceEntry.empty()) {
2553     if (theFace->GetShapeType() == GEOM::FACE)
2554       aName = "Face_";
2555     if (theFace->GetShapeType() == GEOM::COMPOUND)
2556       aName = "Compound_";
2557     aName += theFace->GetEntry();
2558     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2559     if (!theSFace->_is_nil())
2560       theFaceEntry = theSFace->GetID();
2561   }
2562   if (theFaceEntry.empty())
2563     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2564   
2565   if (theVertexEntry.empty()) {
2566     if (theVertex->GetShapeType() == GEOM::VERTEX)
2567       aName = "Vertex_";
2568     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2569       aName = "Compound_";
2570     aName += theVertex->GetEntry();
2571     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2572     if (!theSVertex->_is_nil())
2573       theVertexEntry = theSVertex->GetID();
2574   }
2575   if (theVertexEntry.empty())
2576     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2577
2578   string theVertexName = theVertex->GetName();
2579   try {
2580     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2581   } catch (SALOME_Exception& ex) {
2582     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2583   }
2584 }
2585
2586 /*!
2587  * Set an enforced vertex with group name on face
2588  */
2589 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2590   throw (SALOME::SALOME_Exception)
2591 {
2592   ASSERT(myBaseImpl);
2593
2594   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2595     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2596   }
2597
2598   string theFaceEntry = theFace->GetStudyEntry();
2599   
2600   if (theFaceEntry.empty()) {
2601     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2602     string aName;
2603     if (theFace->GetShapeType() == GEOM::FACE)
2604       aName = "Face_";
2605     if (theFace->GetShapeType() == GEOM::COMPOUND)
2606       aName = "Compound_";
2607     aName += theFace->GetEntry();
2608     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2609     if (!theSFace->_is_nil())
2610       theFaceEntry = theSFace->GetID();
2611   }
2612   if (theFaceEntry.empty())
2613     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2614   try {
2615     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2616   } catch (SALOME_Exception& ex) {
2617     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2618   }
2619 }
2620
2621 /*!
2622  * Set an enforced vertex with name and group name on face
2623  */
2624 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, 
2625                                                                 const char* theVertexName, const char* theGroupName)
2626   throw (SALOME::SALOME_Exception)
2627 {
2628   ASSERT(myBaseImpl);
2629
2630   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2631     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2632   }
2633
2634   string theFaceEntry = theFace->GetStudyEntry();
2635   
2636   if (theFaceEntry.empty()) {
2637     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2638     string aName;
2639     if (theFace->GetShapeType() == GEOM::FACE)
2640       aName = "Face_";
2641     if (theFace->GetShapeType() == GEOM::COMPOUND)
2642       aName = "Compound_";
2643     aName += theFace->GetEntry();
2644     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2645     if (!theSFace->_is_nil())
2646       theFaceEntry = theSFace->GetID();
2647   }
2648   if (theFaceEntry.empty())
2649     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2650   try {
2651     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2652   } catch (SALOME_Exception& ex) {
2653     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2654   }
2655 }
2656
2657 /*!
2658  * Set an enforced vertex with geom entry and group name on face
2659  */
2660 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2661   throw (SALOME::SALOME_Exception)
2662 {
2663   ASSERT(myBaseImpl);
2664
2665   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2666     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2667   }
2668
2669   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2670     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2671   }
2672
2673   string theFaceEntry = theFace->GetStudyEntry();
2674   string theVertexEntry = theVertex->GetStudyEntry();
2675   
2676   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2677   string aName;
2678   
2679   if (theFaceEntry.empty()) {
2680     if (theFace->GetShapeType() == GEOM::FACE)
2681       aName = "Face_";
2682     if (theFace->GetShapeType() == GEOM::COMPOUND)
2683       aName = "Compound_";
2684     aName += theFace->GetEntry();
2685     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2686     if (!theSFace->_is_nil())
2687       theFaceEntry = theSFace->GetID();
2688   }
2689   if (theFaceEntry.empty())
2690     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2691   
2692   if (theVertexEntry.empty()) {
2693     if (theVertex->GetShapeType() == GEOM::VERTEX)
2694       aName = "Vertex_";
2695     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2696       aName = "Compound_";
2697     aName += theVertex->GetEntry();
2698     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2699     if (!theSVertex->_is_nil())
2700       theVertexEntry = theSVertex->GetID();
2701   }
2702   if (theVertexEntry.empty())
2703     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2704
2705   string theVertexName = theVertex->GetName();
2706   try {
2707     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2708   } catch (SALOME_Exception& ex) {
2709     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2710   }
2711 }
2712
2713 //Enable internal enforced vertices on specific face if requested by user
2714 ///*!
2715 // * Are internal enforced vertices used for a face ?
2716 // */
2717 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2718 //    throw (SALOME::SALOME_Exception) {
2719 //  ASSERT(myBaseImpl);
2720
2721 //  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2722 //    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2723 //  }
2724
2725 //  string theFaceEntry = theFace->GetStudyEntry();
2726   
2727 //  if (theFaceEntry.empty()) {
2728 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2729 //    string aName;
2730 //    if (theFace->GetShapeType() == GEOM::FACE)
2731 //      aName = "Face_";
2732 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
2733 //      aName = "Compound_";
2734 //    aName += theFace->GetEntry();
2735 //    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2736 //    if (!theSFace->_is_nil())
2737 //      theFaceEntry = theSFace->GetID();
2738 //  }
2739 //  if (theFaceEntry.empty())
2740 //    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2741
2742 //  try {
2743 //    return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2744 //  } catch (SALOME_Exception& ex) {
2745 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2746 //  }
2747 //}
2748
2749 /*!
2750  * Get the list of all enforced vertices
2751  */
2752 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2753   throw (SALOME::SALOME_Exception) {
2754   ASSERT(myBaseImpl);
2755
2756   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2757     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2758   }
2759
2760   string theFaceEntry = theFace->GetStudyEntry();
2761   
2762   if (theFaceEntry.empty()) {
2763     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2764     string aName;
2765     if (theFace->GetShapeType() == GEOM::FACE)
2766       aName = "Face_";
2767     if (theFace->GetShapeType() == GEOM::COMPOUND)
2768       aName = "Compound_";
2769     aName += theFace->GetEntry();
2770     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2771     if (!theSFace->_is_nil())
2772       theFaceEntry = theSFace->GetID();
2773   }
2774   if (theFaceEntry.empty())
2775     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2776
2777   try {
2778     return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2779   } catch (SALOME_Exception& ex) {
2780     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2781   }
2782 }
2783
2784 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2785                                                     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2786   ASSERT(myBaseImpl);
2787
2788   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2789     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2790   }
2791
2792   string theFaceEntry = theFace->GetStudyEntry();
2793   
2794   if (theFaceEntry.empty()) {
2795     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2796     string aName;
2797     if (theFace->GetShapeType() == GEOM::FACE)
2798       aName = "Face_";
2799     if (theFace->GetShapeType() == GEOM::COMPOUND)
2800       aName = "Compound_";
2801     aName += theFace->GetEntry();
2802     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2803     if (!theSFace->_is_nil())
2804       theFaceEntry = theSFace->GetID();
2805   }
2806   if (theFaceEntry.empty())
2807     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2808
2809   try {
2810     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2811   } catch (SALOME_Exception& ex) {
2812     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2813   }
2814 }
2815
2816 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2817   throw (SALOME::SALOME_Exception) {
2818   ASSERT(myBaseImpl);
2819
2820   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2821     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2822   }
2823   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2824     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2825   }
2826
2827   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2828   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2829   //  if (CORBA::is_nil(measureOp))
2830   //    return false;
2831   //
2832   //  CORBA::Double x, y, z;
2833   //  x = y = z = 0.;
2834   //  measureOp->PointCoordinates(theVertex, x, y, z);
2835
2836   std::string theFaceEntry = theFace->GetStudyEntry();
2837   std::string theVertexEntry = theVertex->GetStudyEntry();
2838   
2839   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2840   string aName;
2841   
2842   if (theFaceEntry.empty()) {
2843     if (theFace->GetShapeType() == GEOM::FACE)
2844       aName = "Face_";
2845     if (theFace->GetShapeType() == GEOM::COMPOUND)
2846       aName = "Compound_";
2847     aName += theFace->GetEntry();
2848     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2849     if (!theSFace->_is_nil())
2850       theFaceEntry = theSFace->GetID();
2851   }
2852   if (theFaceEntry.empty())
2853     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2854   
2855   if (theVertexEntry.empty()) {
2856     if (theVertex->GetShapeType() == GEOM::VERTEX)
2857       aName = "Vertex_";
2858     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2859       aName = "Compound_";
2860     aName += theVertex->GetEntry();
2861     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2862     if (!theSVertex->_is_nil())
2863       theVertexEntry = theSVertex->GetID();
2864   }
2865   if (theVertexEntry.empty())
2866     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2867   
2868
2869   try {
2870     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2871   } catch (SALOME_Exception& ex) {
2872     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2873   }
2874 }
2875
2876 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2877   ASSERT(myBaseImpl);
2878
2879   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2880     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2881   }
2882
2883   string theFaceEntry = theFace->GetStudyEntry();
2884   
2885   if (theFaceEntry.empty()) {
2886     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2887     string aName;
2888     if (theFace->GetShapeType() == GEOM::FACE)
2889       aName = "Face_";
2890     if (theFace->GetShapeType() == GEOM::COMPOUND)
2891       aName = "Compound_";
2892     aName += theFace->GetEntry();
2893     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2894     if (!theSFace->_is_nil())
2895       theFaceEntry = theSFace->GetID();
2896   }
2897   if (theFaceEntry.empty())
2898     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2899   
2900
2901   try {
2902     return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2903   } catch (SALOME_Exception& ex) {
2904     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2905   }
2906 }
2907
2908 /*!
2909  * Set/get/unset an enforced vertex on face - NEW (no face)
2910  */
2911 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2912 {
2913   ASSERT(myBaseImpl);
2914
2915   try {
2916     return SetEnforcedVertexEntry("", x, y, z);
2917   } catch (SALOME_Exception& ex) {
2918     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2919   }
2920 }
2921
2922 /*!
2923  * Set/get/unset an enforced vertex with name on face
2924  */
2925 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2926 {
2927   try {
2928     return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2929   } catch (SALOME_Exception& ex) {
2930     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2931   }
2932 }
2933
2934 /*!
2935  * Set/get/unset an enforced vertex with geom object on face
2936  */
2937 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2938   throw (SALOME::SALOME_Exception)
2939 {
2940   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2941     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2942   }
2943   string theVertexEntry = theVertex->GetStudyEntry();
2944   
2945   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2946   string aName;
2947   
2948   if (theVertexEntry.empty()) {
2949     if (theVertex->GetShapeType() == GEOM::VERTEX)
2950       aName = "Vertex_";
2951     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2952       aName = "Compound_";
2953     aName += theVertex->GetEntry();
2954     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
2955     if (!theSVertex->_is_nil())
2956       theVertexEntry = theSVertex->GetID();
2957   }
2958   if (theVertexEntry.empty())
2959     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2960
2961   string theVertexName = theVertex->GetName();
2962   try {
2963     return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2964   } catch (SALOME_Exception& ex) {
2965     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2966   }
2967 }
2968
2969 /*!
2970  * Set an enforced vertex with group name on face
2971  */
2972 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2973   throw (SALOME::SALOME_Exception)
2974 {
2975   ASSERT(myBaseImpl);
2976
2977   try {
2978     return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2979   } catch (SALOME_Exception& ex) {
2980     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2981   }
2982 }
2983
2984 /*!
2985  * Set an enforced vertex with name and group name on face
2986  */
2987 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, 
2988                                                                 const char* theVertexName, const char* theGroupName)
2989   throw (SALOME::SALOME_Exception)
2990 {
2991   ASSERT(myBaseImpl);
2992
2993   try {
2994     return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
2995   } catch (SALOME_Exception& ex) {
2996     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2997   }
2998 }
2999
3000 /*!
3001  * Set an enforced vertex with geom entry and group name on face
3002  */
3003 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3004   throw (SALOME::SALOME_Exception)
3005 {
3006   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3007     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3008   }
3009
3010   string theVertexEntry = theVertex->GetStudyEntry();
3011   
3012   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3013   string aName;
3014   
3015   if (theVertexEntry.empty()) {
3016     if (theVertex->GetShapeType() == GEOM::VERTEX)
3017       aName = "Vertex_";
3018     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3019       aName = "Compound_";
3020     aName += theVertex->GetEntry();
3021     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3022     if (!theSVertex->_is_nil())
3023       theVertexEntry = theSVertex->GetID();
3024   }
3025   if (theVertexEntry.empty())
3026     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3027
3028   string theVertexName = theVertex->GetName();
3029   try {
3030     return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3031   } catch (SALOME_Exception& ex) {
3032     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3033   }
3034 }
3035
3036 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3037 {
3038   try {
3039     return UnsetEnforcedVertexEntry("", x, y, z);
3040   } catch (SALOME_Exception& ex) {
3041     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3042   }
3043 }
3044
3045 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3046   throw (SALOME::SALOME_Exception)
3047 {
3048   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3049     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3050   }
3051   std::string theVertexEntry = theVertex->GetStudyEntry();
3052   
3053   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3054   string aName;
3055   
3056   if (theVertexEntry.empty()) {
3057     if (theVertex->GetShapeType() == GEOM::VERTEX)
3058       aName = "Vertex_";
3059     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3060       aName = "Compound_";
3061     aName += theVertex->GetEntry();
3062     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3063     if (!theSVertex->_is_nil())
3064       theVertexEntry = theSVertex->GetID();
3065   }
3066   if (theVertexEntry.empty())
3067     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3068   
3069   try {
3070     return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3071   } catch (SALOME_Exception& ex) {
3072     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3073   }
3074 }
3075
3076 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3077 {
3078   try {
3079     return UnsetEnforcedVerticesEntry("");
3080   } catch (SALOME_Exception& ex) {
3081     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3082   }
3083 }
3084
3085 /*!
3086  * Set/get/unset an enforced vertex on geom object given by entry
3087  */
3088 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3089                                                        CORBA::Double x,
3090                                                        CORBA::Double y,
3091                                                        CORBA::Double z,
3092                                                        const char* theVertexName,
3093                                                        const char* theVertexEntry,
3094                                                        const char* theGroupName)
3095   throw (SALOME::SALOME_Exception)
3096 {
3097   bool newValue = false;
3098   if (string(theVertexEntry).empty()) {
3099     try {
3100       ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3101         this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3102       ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3103       coords.push_back(x);
3104       coords.push_back(y);
3105       coords.push_back(z);
3106       if (coordsList.find(coords) == coordsList.end()) {
3107         newValue = true;
3108       } else {
3109         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3110         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3111           newValue = true;
3112         }
3113       }
3114     } catch (const std::invalid_argument& ex) {
3115       // no enforced vertex for entry
3116       newValue = true;
3117     }
3118     if (newValue) {
3119       if (string(theVertexName).empty()) {
3120         if (string(theGroupName).empty())
3121           SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3122         else
3123           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3124       }
3125       else {
3126         if (string(theGroupName).empty())
3127           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3128         else
3129           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3130                                << theVertexName << "\", \"" << theGroupName << "\")";
3131       }
3132     }
3133   } else {
3134     try {
3135       ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3136       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3137       if ( it == enfVertexEntryList.end()) {
3138         newValue = true;
3139       }
3140       else {
3141         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3142         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3143           newValue = true;
3144         }
3145       }
3146     } catch (const std::invalid_argument& ex) {
3147       // no enforced vertex for entry
3148       newValue = true;
3149     }
3150     if (newValue) {
3151       if (string(theGroupName).empty())
3152         SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3153       else
3154         SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3155     }
3156   }
3157
3158   if (newValue)
3159     this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3160
3161   return newValue;
3162 }
3163
3164 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3165   throw (SALOME::SALOME_Exception)
3166 {
3167   try {
3168     BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3169     ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3170     vertexList->length(_vList.size());
3171     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3172     for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3173       ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3174
3175       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3176
3177       // Name
3178       enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3179       // Geom Vertex Entry
3180       enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3181       // Coords
3182       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3183       coords->length(_enfVertex->coords.size());
3184       for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3185         coords[ind] = _enfVertex->coords[ind];
3186       enfVertex->coords = coords;
3187       // Group Name
3188       enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3189       // Face entry list
3190       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3191       faceEntryList->length(_enfVertex->faceEntries.size());
3192       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3193       for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3194         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3195       enfVertex->faceEntries = faceEntryList;
3196
3197       vertexList[i] = enfVertex;
3198     }
3199     return vertexList._retn();
3200   } catch (const std::invalid_argument& ex) {
3201     SALOME::ExceptionStruct ExDescription;
3202     ExDescription.text = ex.what();
3203     ExDescription.type = SALOME::BAD_PARAM;
3204     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3205     ExDescription.lineNumber = 1385;
3206     throw SALOME::SALOME_Exception(ExDescription);
3207   } catch (const std::exception& ex) {
3208     std::cout << "Exception: " << ex.what() << std::endl;
3209     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3210   }
3211 }
3212
3213 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3214 {
3215   ASSERT(myBaseImpl);
3216
3217   bool res = false;
3218   try {
3219     res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3220
3221     if (string(theVertexEntry).empty())
3222       SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3223                            << ")";
3224     else
3225       SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3226
3227   } catch (const std::invalid_argument& ex) {
3228     return false;
3229   } catch (const std::exception& ex) {
3230     std::cout << "Exception: " << ex.what() << std::endl;
3231     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3232   }
3233
3234   return res;
3235 }
3236 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3237 {
3238   ASSERT(myBaseImpl);
3239
3240   try {
3241     this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3242     SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3243   } catch (const std::invalid_argument& ex) {
3244     return false;
3245   } catch (const std::exception& ex) {
3246     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3247   }
3248
3249   return true;
3250 }
3251
3252 //=============================================================================
3253 /*!
3254  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3255  *
3256  *  Set true or false
3257  */
3258 //=============================================================================
3259 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3260 {
3261   ASSERT(myBaseImpl);
3262   this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3263   std::string theValueStr = theValue ? "True" : "False";
3264   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3265 }
3266
3267 //=============================================================================
3268 /*!
3269  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3270  *
3271  *  Get true or false
3272  */
3273 //=============================================================================
3274 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3275 {
3276   ASSERT(myBaseImpl);
3277   return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3278 }
3279
3280 //=============================================================================
3281 /*!
3282  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3283  *
3284  *  Set group name
3285  */
3286 //=============================================================================
3287 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char*  groupName)
3288 {
3289   ASSERT(myBaseImpl);
3290   this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3291   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3292 }
3293
3294 //=============================================================================
3295 /*!
3296  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3297  *
3298  *  Get group name
3299  */
3300 //=============================================================================
3301 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3302 {
3303   ASSERT(myBaseImpl);
3304   return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3305 }
3306
3307 /*
3308  * Enable internal enforced vertices on specific face if requested by user
3309  *
3310  void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3311  throw (SALOME::SALOME_Exception)
3312  {
3313  try {
3314  SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3315  } catch (SALOME_Exception& ex) {
3316  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3317  }
3318  }
3319
3320  void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3321  throw (SALOME::SALOME_Exception)
3322  {
3323
3324  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3325  THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3326  }
3327
3328  string theFaceEntry = theFace->GetStudyEntry();
3329
3330  if (theFaceEntry.empty()) {
3331  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3332  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3333  string aName;
3334  if (theFace->GetShapeType() == GEOM::FACE)
3335  aName = "Face_";
3336  if (theFace->GetShapeType() == GEOM::COMPOUND)
3337  aName = "Compound_";
3338  aName += theFace->GetEntry();
3339  SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3340  if (!theSFace->_is_nil())
3341  theFaceEntry = theSFace->GetID();
3342  }
3343  if (theFaceEntry.empty())
3344  THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3345
3346  try {
3347  SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3348  } catch (SALOME_Exception& ex) {
3349  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3350  }
3351  }
3352
3353  void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3354  throw (SALOME::SALOME_Exception)
3355  {
3356  ASSERT(myBaseImpl);
3357  try {
3358  this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3359  std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3360  if (string(theGroupName).empty())
3361  SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3362  else
3363  SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3364  } catch (const std::exception& ex) {
3365  std::cout << "Exception: " << ex.what() << std::endl;
3366  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3367  }
3368  }
3369
3370 */
3371
3372 /* TODO GROUPS
3373    char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3374    throw (SALOME::SALOME_Exception)
3375    {
3376    ASSERT(myBaseImpl);
3377    try {
3378    return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3379    }
3380    catch (const std::invalid_argument& ex) {
3381    SALOME::ExceptionStruct ExDescription;
3382    ExDescription.text = ex.what();
3383    ExDescription.type = SALOME::BAD_PARAM;
3384    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3385    ExDescription.lineNumber = 1146;
3386    throw SALOME::SALOME_Exception(ExDescription);
3387    }
3388    catch (SALOME_Exception& ex) {
3389    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3390    }
3391    return 0;
3392    }
3393
3394
3395    void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3396    throw (SALOME::SALOME_Exception)
3397    {
3398    ASSERT(myBaseImpl);
3399    try {
3400    this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3401    }
3402    catch (const std::invalid_argument& ex) {
3403    SALOME::ExceptionStruct ExDescription;
3404    ExDescription.text = ex.what();
3405    ExDescription.type = SALOME::BAD_PARAM;
3406    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3407    ExDescription.lineNumber = 1170;
3408    throw SALOME::SALOME_Exception(ExDescription);
3409    }
3410    catch (SALOME_Exception& ex) {
3411    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3412    }
3413
3414    SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3415    << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3416
3417    }
3418 */
3419 ///////////////////////
3420
3421 ///////////////////////
3422 // PERIODICITY       //
3423 ///////////////////////
3424
3425
3426 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3427 {
3428   std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3429   MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3430   MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3431   MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3432   MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3433   MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3434   MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3435   MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3436   MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3437   MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3438   std::string txtShapeType = MapShapeTypeToString[theShapeType];
3439   return txtShapeType;
3440 }
3441
3442 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3443 {
3444   // Check shape types
3445   bool ok = false;
3446   std::stringstream typesTxt;
3447   for (std::size_t i=0; i<theShapeTypes.size(); i++)
3448   {
3449     GEOM::shape_type theShapeType = theShapeTypes[i];
3450     if (shape->GetShapeType() == theShapeType)
3451       ok = true;
3452     typesTxt << ShapeTypeToString(theShapeType);
3453     if (i < theShapeTypes.size()-1 )
3454       typesTxt << ", ";
3455   }
3456   if (!ok){
3457     std::stringstream msg;
3458     msg << "shape type is not in" << typesTxt.str();
3459     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3460   }
3461 }
3462
3463 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3464 {
3465   // Check shape type
3466   if (shape->GetShapeType() != theShapeType) {
3467     std::stringstream msg;
3468     msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3469     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3470   }
3471 }
3472
3473 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3474 {
3475   // Check shape is published in the object browser
3476   string shapeEntry = shape->GetStudyEntry();
3477
3478   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3479   string aName;
3480
3481   // Publish shape if needed
3482   if (shapeEntry.empty()) {
3483     if (shape->GetShapeType() == theShapeType)
3484       aName = prefix;
3485     aName += shape->GetEntry();
3486     SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3487     if (!theSFace1->_is_nil())
3488       shapeEntry = theSFace1->GetID();
3489   }
3490   if (shapeEntry.empty())
3491     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3492   return shapeEntry;
3493 }
3494
3495 // Format the output of two vectors to use it in MESSAGE and PythonDump
3496 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3497 {
3498   std::stringstream listEntriesTxt;
3499
3500   if (!theSourceVerticesEntries.empty())
3501   {
3502     listEntriesTxt << ", [" ;
3503     size_t i =0;
3504     for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3505     {
3506       if (i>0)
3507         listEntriesTxt << ", ";
3508       listEntriesTxt << *it;
3509     }
3510
3511     listEntriesTxt << "], [" ;
3512     i =0;
3513     for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3514     {
3515       if (i>0)
3516         listEntriesTxt << ", ";
3517       listEntriesTxt << *it;
3518     }
3519     listEntriesTxt << "]" ;
3520   }
3521   return listEntriesTxt.str();
3522 }
3523
3524 /**
3525  * Erase all PreCad periodicity associations
3526  */
3527 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3528   ASSERT(myBaseImpl);
3529   this->GetImpl()->ClearPreCadPeriodicityVectors();
3530   SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3531 }
3532
3533 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3534 {
3535   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3536     this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3537
3538   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3539
3540   return periodicityList._retn();
3541 }
3542
3543 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3544 {
3545   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3546     this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3547
3548   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3549
3550   return periodicityList._retn();
3551 }
3552
3553 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3554 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3555 {
3556   BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3557
3558   periodicityList->length(preCadPeriodicityVector.size());
3559
3560   for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3561   {
3562     ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3563
3564     BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3565     myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3566     myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3567
3568     BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3569     if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3570     {
3571       sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3572       for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3573         sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3574     }
3575
3576     myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3577
3578     BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3579     if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3580     {
3581       targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3582       for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3583         targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3584     }
3585
3586     myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3587
3588     periodicityList[i] = myPreCadPeriodicity;
3589   }
3590
3591
3592   return periodicityList._retn();
3593 }
3594
3595
3596 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3597   throw (SALOME::SALOME_Exception)
3598 {
3599   ASSERT(myBaseImpl);
3600   const GEOM::ListOfGO theSourceVertices;
3601   const GEOM::ListOfGO theTargetVertices;
3602   AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3603 }
3604
3605
3606 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3607                                                                       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3608   throw (SALOME::SALOME_Exception)
3609 {
3610   ASSERT(myBaseImpl);
3611
3612   size_t theLength = theSourceVertices.length();
3613   if (theLength != theTargetVertices.length())
3614     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3615
3616   std::vector<GEOM::shape_type> allowedShapeTypes;
3617   allowedShapeTypes.push_back(GEOM::FACE);
3618   allowedShapeTypes.push_back(GEOM::COMPOUND);
3619
3620   string prefix1 = "Source_face_";
3621   CheckShapeTypes(theFace1, allowedShapeTypes);
3622   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3623
3624   string prefix2 = "Target_face_";
3625   CheckShapeTypes(theFace2, allowedShapeTypes);
3626   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3627
3628   string prefix3 = "Source_vertex_";
3629   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3630   theSourceVerticesEntries->length(theLength);
3631   GEOM::GEOM_Object_ptr theVtx_i;
3632   string theEntry_i;
3633   for (size_t ind = 0; ind < theLength; ind++) {
3634     theVtx_i = theSourceVertices[ind];
3635     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3636     theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3637   }
3638
3639   string prefix4 = "Target_vertex_";
3640   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3641   theTargetVerticesEntries->length(theLength);
3642   for (size_t ind = 0; ind < theLength; ind++) {
3643     theVtx_i = theTargetVertices[ind];
3644     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3645     theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3646   }
3647
3648   string theFace2Name = theFace2->GetName();
3649   try {
3650     AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3651                                    theSourceVerticesEntries, theTargetVerticesEntries);
3652   } catch (SALOME_Exception& ex) {
3653     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3654   }
3655 }
3656
3657
3658 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3659                                                                const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3660   throw (SALOME::SALOME_Exception)
3661 {
3662
3663   ASSERT(myBaseImpl);
3664
3665   // Convert BLSURFPlugin::TEntryList to vector<string>
3666   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3667   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3668     theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3669     theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3670   }
3671
3672   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3673
3674
3675   this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3676                                              theSourceVerticesEntries, theTargetVerticesEntries);
3677
3678   SMESH::TPythonDump pd;
3679   if (!theSourceVerticesEntries.empty())
3680   {
3681     pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3682     pd << listEntriesTxt.c_str();
3683     pd << ")";
3684   }
3685   else
3686     pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3687 }
3688
3689 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3690   throw (SALOME::SALOME_Exception)
3691 {
3692   ASSERT(myBaseImpl);
3693   const GEOM::ListOfGO theSourceVertices;
3694   const GEOM::ListOfGO theTargetVertices;
3695   AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3696 }
3697
3698 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3699                                                                       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3700   throw (SALOME::SALOME_Exception)
3701 {
3702   ASSERT(myBaseImpl);
3703
3704   size_t theLength = theSourceVertices.length();
3705   if (theLength != theTargetVertices.length())
3706     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3707
3708   std::vector<GEOM::shape_type> allowedShapeTypes;
3709   allowedShapeTypes.push_back(GEOM::EDGE);
3710   allowedShapeTypes.push_back(GEOM::COMPOUND);
3711
3712   string prefix1 = "Source_edge_";
3713   CheckShapeTypes(theEdge1, allowedShapeTypes);
3714   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3715
3716   string prefix2 = "Target_edge_";
3717   CheckShapeTypes(theEdge2, allowedShapeTypes);
3718   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3719
3720   string prefix3 = "Source_vertex_";
3721   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3722   theSourceVerticesEntries->length(theLength);
3723   GEOM::GEOM_Object_ptr theVtx_i;
3724   string theEntry_i;
3725   for (size_t ind = 0; ind < theLength; ind++) {
3726     theVtx_i = theSourceVertices[ind];
3727     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3728     theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3729   }
3730
3731   string prefix4 = "Target_vertex_";
3732   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3733   theTargetVerticesEntries->length(theLength);
3734   for (size_t ind = 0; ind < theLength; ind++) {
3735     theVtx_i = theTargetVertices[ind];
3736     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3737     theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3738   }
3739
3740   string theEdge2Name = theEdge2->GetName();
3741   try {
3742     AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3743                                    theSourceVerticesEntries, theTargetVerticesEntries);
3744   } catch (SALOME_Exception& ex) {
3745     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3746   }
3747 }
3748
3749
3750 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3751                                                                const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3752   throw (SALOME::SALOME_Exception)
3753 {
3754
3755   ASSERT(myBaseImpl);
3756
3757   // Convert BLSURFPlugin::TEntryList to vector<string>
3758   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3759   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3760     theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3761     theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3762   }
3763
3764   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3765
3766   this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3767                                              theSourceVerticesEntries, theTargetVerticesEntries);
3768
3769   SMESH::TPythonDump pd;
3770   if (!theSourceVerticesEntries.empty())
3771   {
3772     pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3773     pd << listEntriesTxt.c_str();
3774     pd << ")";
3775   }
3776   else
3777     pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3778
3779 }
3780
3781
3782 //================================================================================
3783 /*!
3784  * \brief Sets the file for export resulting mesh in GMF format
3785  * \param theFileName - full name of the file (.mesh, .meshb)
3786  * 
3787  * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3788  */
3789 //================================================================================  
3790 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3791 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3792   ASSERT(myBaseImpl);
3793   bool valueChanged/*, modeChanged*/ = false;
3794   try {
3795     valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3796     //     modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3797     if (valueChanged)// or (!valueChanged && modeChanged))
3798       this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3799   } catch (const std::exception& ex) {
3800     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3801   }
3802   if (valueChanged)// or (!valueChanged && modeChanged))
3803     SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3804 }
3805
3806 //================================================================================
3807 /*!
3808  * \brief Gets the file name for export resulting mesh in GMF format
3809  * \retval char* - The file name
3810  * 
3811  * Returns the GMF file name
3812  */
3813 //================================================================================  
3814 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3815   ASSERT(myBaseImpl);
3816   return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3817 }
3818
3819 // //================================================================================
3820 // /*!
3821 //  * \brief Gets the file mode for export resulting mesh in GMF format
3822 //  * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3823 //  * 
3824 //  * Returns the GMF file mode
3825 //  */
3826 // //================================================================================  
3827 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3828 //   ASSERT(myBaseImpl);
3829 //   return this->GetImpl()->GetGMFFileMode();
3830 // }
3831
3832 //=============================================================================
3833 /*!
3834  *  BLSURFPlugin_Hypothesis_i::GetImpl
3835  *
3836  *  Get implementation
3837  */
3838 //=============================================================================
3839 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3840   return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3841 }
3842
3843 //================================================================================
3844 /*!
3845  * \brief Verify whether hypothesis supports given entity type
3846  * \param type - dimension (see SMESH::Dimension enumeration)
3847  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3848  *
3849  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3850  */
3851 //================================================================================
3852 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3853   return type == SMESH::DIM_2D;
3854 }
3855
3856
3857 //================================================================================
3858 /*!
3859  * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3860  */
3861 //================================================================================
3862
3863 bool
3864 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
3865                                                std::vector< int >         & subIDArray ) const
3866 {
3867   typedef ::BLSURFPlugin_Hypothesis BH;
3868   const BH* impl = static_cast<const BH*>( myBaseImpl );
3869
3870   {
3871     const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
3872     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3873     for ( ; entry2size != sizeMap.cend(); ++entry2size )
3874       entryArray.push_back( entry2size->first );
3875   }
3876   {
3877     const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
3878     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3879     for ( ; entry2size != sizeMap.cend(); ++entry2size )
3880       entryArray.push_back( entry2size->first );
3881   }
3882   {
3883     const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
3884     BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
3885     for ( ; entry2size != classAttractors.cend(); ++entry2size )
3886       entryArray.push_back( entry2size->first );
3887   }
3888   {
3889     const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
3890     BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
3891     for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
3892     {
3893       entryArray.push_back( entry2evList->first );
3894
3895       const BH::TEnfVertexList& evList = entry2evList->second;
3896       BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
3897       for ( ; evIt != evList.cend(); ++evIt )
3898       {
3899         const BH::TEnfVertex* ev = *evIt;
3900         entryArray.push_back( ev->geomEntry );
3901         entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
3902       }
3903     }
3904   }
3905   // { // duplicated data of faceEntryEnfVertexListMap
3906   //   const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
3907   //   const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
3908   //   const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV  //   const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert  // }
3909   {
3910     const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
3911     BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
3912     for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
3913     {
3914       entryArray.push_back( pcp->shape1Entry );
3915       entryArray.push_back( pcp->shape2Entry );
3916       entryArray.insert( entryArray.end(),
3917                          pcp->theSourceVerticesEntries.cbegin(),
3918                          pcp->theSourceVerticesEntries.cend() );
3919       entryArray.insert( entryArray.end(),
3920                          pcp->theTargetVerticesEntries.cbegin(),
3921                          pcp->theTargetVerticesEntries.cend() );
3922     }
3923   }
3924   {
3925     const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
3926     BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
3927     for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
3928     {
3929       entryArray.push_back( pcp->shape1Entry );
3930       entryArray.push_back( pcp->shape2Entry );
3931       entryArray.insert( entryArray.end(),
3932                          pcp->theSourceVerticesEntries.cbegin(),
3933                          pcp->theSourceVerticesEntries.cend() );
3934       entryArray.insert( entryArray.end(),
3935                          pcp->theTargetVerticesEntries.cbegin(),
3936                          pcp->theTargetVerticesEntries.cend() );
3937     }
3938   }
3939   {
3940     const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
3941     BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
3942     for ( ; idSet != hyperPatchList.cend(); ++idSet )
3943     {
3944       subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
3945     }
3946   }
3947   return true;
3948 }
3949
3950 //================================================================================
3951 /*!
3952  * \brief Set new geometry instead of that returned by getObjectsDependOn()
3953  */
3954 //================================================================================
3955
3956 bool
3957 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
3958                                                std::vector< int >         & subIDArray )
3959 {
3960   typedef ::BLSURFPlugin_Hypothesis BH;
3961   BH* impl = static_cast<BH*>( myBaseImpl );
3962
3963   size_t iEnt = 0;
3964   {
3965     BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
3966     BH::TSizeMap sizeMap;
3967     sizeMap.swap( sizeMapNew );
3968     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3969     for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
3970       if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
3971         sizeMapNew[ entryArray[ iEnt ]] =  entry2size->second;
3972   }
3973   {
3974     BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
3975     BH::TSizeMap sizeMap;
3976     sizeMap.swap( sizeMapNew );
3977     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3978     for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
3979       if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
3980         sizeMapNew[ entryArray[ iEnt ]] =  entry2size->second;
3981   }
3982   {
3983     BH::TAttractorMap& attrMapNew =
3984       const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
3985     BH::TAttractorMap attrMap;
3986     attrMap.swap( attrMapNew );
3987     BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
3988     for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
3989       if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
3990         attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
3991       else
3992         delete entry2size->second;
3993   }
3994   {
3995     BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
3996       const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
3997     BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
3998     faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
3999
4000     BH::TEnfVertexList& enfVertexList =
4001       const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4002     enfVertexList.clear(); // avoid removal
4003
4004     impl->ClearAllEnforcedVertices();
4005
4006     BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4007     for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4008     {
4009       const BH::TEntry& entry = entryArray[ iEnt++ ];
4010       bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4011
4012       BH::TEnfVertexList& evList = entry2evList->second;
4013       BH::TEnfVertexList::iterator evIt = evList.begin();
4014       for ( ; evIt != evList.end(); ++evIt )
4015       {
4016         BH::TEnfVertex* ev = *evIt;
4017         bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4018         ev->geomEntry = entryArray[ iEnt++ ];
4019         BH::TEntryList faceEntriesNew;
4020         BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4021         for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4022         {
4023           if ( !entryArray[ iEnt ].empty() )
4024             faceEntriesNew.insert( entryArray[ iEnt ]);
4025         }
4026         if ( ok )
4027         {
4028           ev->faceEntries.swap( faceEntriesNew );
4029           impl->AddEnforcedVertex( entry, ev );
4030         }
4031         else
4032         {
4033           delete ev;
4034         }
4035       }
4036     }
4037   }
4038   {
4039     BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4040       const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4041     BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4042     for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4043     {
4044       pcp->shape1Entry = entryArray[ iEnt++ ];
4045       pcp->shape2Entry = entryArray[ iEnt++ ];
4046       for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4047         pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4048
4049       for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4050         pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4051     }
4052   }
4053   {
4054     BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4055       const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4056     BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4057     for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4058     {
4059       pcp->shape1Entry = entryArray[ iEnt++ ];
4060       pcp->shape2Entry = entryArray[ iEnt++ ];
4061       for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4062         pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4063
4064       for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4065         pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4066     }
4067   }
4068
4069   size_t iID = 0;
4070   {
4071     BH::THyperPatchList& hyperPatchListNew =
4072       const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4073     BH::THyperPatchList hyperPatchList;
4074     hyperPatchList.swap( hyperPatchListNew );
4075     BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4076     for ( ; idSet != hyperPatchList.end(); ++idSet )
4077     {
4078       BH::THyperPatchTags& ids = *idSet;
4079       BH::THyperPatchTags idsNew;
4080       BH::THyperPatchTags::iterator i = ids.begin();
4081       for ( ; i != ids.end(); ++i, ++iID )
4082         if ( subIDArray[ iID ] > 0 )
4083           idsNew.insert( subIDArray[ iID ]);
4084       if ( !idsNew.empty() )
4085         hyperPatchListNew.push_back( idsNew );
4086     }
4087   }
4088
4089   return ( iEnt == entryArray.size() && iID == subIDArray.size() );
4090 }