]> SALOME platform Git repositories - plugins/hybridplugin.git/blob - src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx
Salome HOME
Patch for MacOS (from SALOME forum)
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis.cxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //=============================================================================
21 // File      : HYBRIDPlugin_Hypothesis.cxx
22 // Created   : Wed Apr  2 12:36:29 2008
23 // Author    : Edward AGAPOV (eap)
24 //=============================================================================
25 //
26 #include "HYBRIDPlugin_Hypothesis.hxx"
27
28 #include <SMESHDS_Mesh.hxx>
29
30 #include <TopExp_Explorer.hxx>
31
32 #ifdef WIN32
33 #include <process.h>
34 #define getpid _getpid
35 #endif
36
37 //=======================================================================
38 //function : HYBRIDPlugin_Hypothesis
39 //=======================================================================
40
41 HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
42   : SMESH_Hypothesis(hypId, studyId, gen),
43   myToMeshHoles(DefaultMeshHoles()),
44   myLayersOnAllWrap(DefaultLayersOnAllWrap()),
45   myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
46   myMaximumMemory(-1),
47   myInitialMemory(-1),
48   myOptimizationLevel(DefaultOptimizationLevel()),
49   myCollisionMode(DefaultCollisionMode()),
50   myBoundaryLayersGrowth(DefaultBoundaryLayersGrowth()),
51   myElementGeneration(DefaultElementGeneration()),
52   myKeepFiles(DefaultKeepFiles()),
53   myWorkingDirectory(DefaultWorkingDirectory()),
54   myVerboseLevel(DefaultVerboseLevel()),
55   myToCreateNewNodes(DefaultToCreateNewNodes()),
56   myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
57   myToUseFemCorrection(DefaultToUseFEMCorrection()),
58   myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
59   myLogInStandardOutput(DefaultStandardOutputLog()),
60   myGradation(DefaultGradation()),
61   myAddMultinormals(DefaultAddMultinormals()),
62   mySmoothNormals(DefaultSmoothNormals()),
63   myHeightFirstLayer(DefaultHeightFirstLayer()),
64   myBoundaryLayersProgression(DefaultBoundaryLayersProgression()),
65   myMultinormalsAngle(DefaultMultinormalsAngle()),
66   myNbOfBoundaryLayers(DefaultNbOfBoundaryLayers()),
67   _enfVertexList(DefaultHYBRIDEnforcedVertexList()),
68   _enfVertexCoordsSizeList(DefaultHYBRIDEnforcedVertexCoordsValues()),
69   _enfVertexEntrySizeList(DefaultHYBRIDEnforcedVertexEntryValues()),
70   _coordsEnfVertexMap(DefaultCoordsHYBRIDEnforcedVertexMap()),
71   _geomEntryEnfVertexMap(DefaultGeomEntryHYBRIDEnforcedVertexMap()),
72   _enfMeshList(DefaultHYBRIDEnforcedMeshList()),
73   _entryEnfMeshMap(DefaultEntryHYBRIDEnforcedMeshListMap()),
74   _enfNodes(TIDSortedNodeGroupMap()),
75   _enfEdges(TIDSortedElemGroupMap()),
76   _enfTriangles(TIDSortedElemGroupMap()),
77   _nodeIDToSizeMap(DefaultID2SizeMap()),
78   _groupsToRemove(DefaultGroupsToRemove())
79 {
80   _name = "HYBRID_Parameters";
81   _param_algo_dim = 3;
82 }
83
84 //=======================================================================
85 //function : SetLayersOnAllWrap
86 //=======================================================================
87
88 void HYBRIDPlugin_Hypothesis::SetLayersOnAllWrap(bool toMesh)
89 {
90   if ( myLayersOnAllWrap != toMesh ) {
91     myLayersOnAllWrap = toMesh;
92     NotifySubMeshesHypothesisModification();
93   }
94 }
95
96 //=======================================================================
97 //function : GetLayersOnAllWrap
98 //=======================================================================
99
100 bool HYBRIDPlugin_Hypothesis::GetLayersOnAllWrap(bool checkFreeOption) const
101 {
102   return myLayersOnAllWrap;
103 }
104
105 //=======================================================================
106 //function : SetFacesWithLayers
107 //purpose  : Set IDs of faces to grow the layers on
108 //=======================================================================
109
110 bool HYBRIDPlugin_Hypothesis::SetFacesWithLayers(const std::vector<int>& theVal)
111 {
112   if ( myFacesWithLayers != theVal )
113   {
114     myFacesWithLayers = theVal;
115     NotifySubMeshesHypothesisModification();
116     return true;
117   }
118   return false;
119 }
120
121 //=======================================================================
122 //function : GetFacesWithLayers
123 //purpose  : Return IDs of faces to grow the layers on
124 //=======================================================================
125
126 const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithLayers() const
127 {
128   return myFacesWithLayers;
129 }
130
131 //=======================================================================
132 //function : SetToMeshHoles
133 //=======================================================================
134
135 void HYBRIDPlugin_Hypothesis::SetToMeshHoles(bool toMesh)
136 {
137   if ( myToMeshHoles != toMesh ) {
138     myToMeshHoles = toMesh;
139     NotifySubMeshesHypothesisModification();
140   }
141 }
142
143 //=======================================================================
144 //function : GetToMeshHoles
145 //=======================================================================
146
147 bool HYBRIDPlugin_Hypothesis::GetToMeshHoles(bool checkFreeOption) const
148 {
149   if (checkFreeOption && !myTextOption.empty()) {
150     if ( myTextOption.find("-c 0"))
151       return true;
152     if ( myTextOption.find("-c 1"))
153       return false;
154   }
155   return myToMeshHoles;
156 }
157
158 //=======================================================================
159 //function : SetToMakeGroupsOfDomains
160 //=======================================================================
161
162 void HYBRIDPlugin_Hypothesis::SetToMakeGroupsOfDomains(bool toMakeGroups)
163 {
164   if ( myToMakeGroupsOfDomains != toMakeGroups ) {
165     myToMakeGroupsOfDomains = toMakeGroups;
166     NotifySubMeshesHypothesisModification();
167   }
168 }
169
170 //=======================================================================
171 //function : GetToMakeGroupsOfDomains
172 //=======================================================================
173
174 bool HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains() const
175 {
176   return myToMakeGroupsOfDomains;
177 }
178
179 //=======================================================================
180 //function : GetToMakeGroupsOfDomains
181 //=======================================================================
182
183 bool HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains(const HYBRIDPlugin_Hypothesis* hyp)
184 {
185   bool res;
186   if ( hyp ) res = /*hyp->GetToMeshHoles(true) &&*/ hyp->GetToMakeGroupsOfDomains();
187   else       res = /*DefaultMeshHoles()        &&*/ DefaultToMakeGroupsOfDomains();
188   return res;
189 }
190
191 //=======================================================================
192 //function : SetMaximumMemory
193 //=======================================================================
194
195 void HYBRIDPlugin_Hypothesis::SetMaximumMemory(double MB)
196 {
197   if ( myMaximumMemory != MB ) {
198     myMaximumMemory = MB;
199     NotifySubMeshesHypothesisModification();
200   }
201 }
202
203 //=======================================================================
204 //function : GetMaximumMemory
205 //           * automatic memory adjustment mode. Default is zero
206 //=======================================================================
207
208 double HYBRIDPlugin_Hypothesis::GetMaximumMemory() const
209 {
210   return myMaximumMemory;
211 }
212
213 //=======================================================================
214 //function : SetInitialMemory
215 //=======================================================================
216
217 void HYBRIDPlugin_Hypothesis::SetInitialMemory(double MB)
218 {
219   if ( myInitialMemory != MB ) {
220     myInitialMemory = MB;
221     NotifySubMeshesHypothesisModification();
222   }
223 }
224
225 //=======================================================================
226 //function : GetInitialMemory
227 //=======================================================================
228
229 double HYBRIDPlugin_Hypothesis::GetInitialMemory() const
230 {
231   return myInitialMemory;
232 }
233
234 //=======================================================================
235 //function : SetOptimizationLevel
236 //=======================================================================
237
238 void HYBRIDPlugin_Hypothesis::SetOptimizationLevel(OptimizationLevel level)
239 {
240   if ( myOptimizationLevel != level ) {
241     myOptimizationLevel = level;
242     NotifySubMeshesHypothesisModification();
243   }
244 }
245
246 //=======================================================================
247 //function : GetOptimizationLevel
248 //=======================================================================
249 HYBRIDPlugin_Hypothesis::OptimizationLevel HYBRIDPlugin_Hypothesis::GetOptimizationLevel() const
250 {
251   return (OptimizationLevel) myOptimizationLevel;
252 }
253
254 //=======================================================================
255 //function : SetCollisionMode
256 //=======================================================================
257 void HYBRIDPlugin_Hypothesis::SetCollisionMode(CollisionMode mode)
258 {
259   if ( myCollisionMode != mode ) {
260     myCollisionMode = mode;
261     NotifySubMeshesHypothesisModification();
262   }
263 }
264
265 //=======================================================================
266 //function : GetCollisionMode
267 //=======================================================================
268 HYBRIDPlugin_Hypothesis::CollisionMode HYBRIDPlugin_Hypothesis::GetCollisionMode() const
269 {
270   return (CollisionMode) myCollisionMode;
271 }
272
273 //=======================================================================
274 //function : SetBoundaryLayersGrowth
275 //=======================================================================
276 void HYBRIDPlugin_Hypothesis::SetBoundaryLayersGrowth(BoundaryLayersGrowth mode)
277 {
278   if ( myBoundaryLayersGrowth != mode ) {
279     myBoundaryLayersGrowth = mode;
280     NotifySubMeshesHypothesisModification();
281   }
282 }
283
284 //=======================================================================
285 //function : GetBoundaryLayersGrowth
286 //=======================================================================
287 HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth HYBRIDPlugin_Hypothesis::GetBoundaryLayersGrowth() const
288 {
289   return (BoundaryLayersGrowth) myBoundaryLayersGrowth;
290 }
291
292 //=======================================================================
293 //function : SetElementGeneration
294 //=======================================================================
295 void HYBRIDPlugin_Hypothesis::SetElementGeneration(ElementGeneration mode)
296 {
297   if ( myElementGeneration != mode ) {
298     myElementGeneration = mode;
299     NotifySubMeshesHypothesisModification();
300   }
301 }
302
303 //=======================================================================
304 //function : GetElementGeneration
305 //=======================================================================
306 HYBRIDPlugin_Hypothesis::ElementGeneration HYBRIDPlugin_Hypothesis::GetElementGeneration() const
307 {
308   return (ElementGeneration) myElementGeneration;
309 }
310
311 //=======================================================================
312 //function : SetAddMultinormals
313 //=======================================================================
314 void HYBRIDPlugin_Hypothesis::SetAddMultinormals(bool toAddMultinormals)
315 {
316   if ( myAddMultinormals != toAddMultinormals ) {
317     myAddMultinormals = toAddMultinormals;
318     NotifySubMeshesHypothesisModification();
319   }
320 }
321
322 //=======================================================================
323 //function : GetAddMultinormals
324 //=======================================================================
325
326 bool HYBRIDPlugin_Hypothesis::GetAddMultinormals() const
327 {
328   return myAddMultinormals;
329 }
330
331 //=======================================================================
332 //function : SetSmoothNormals
333 //=======================================================================
334
335 void HYBRIDPlugin_Hypothesis::SetSmoothNormals(bool toSmoothNormals)
336 {
337   if ( mySmoothNormals != toSmoothNormals ) {
338     mySmoothNormals = toSmoothNormals;
339     NotifySubMeshesHypothesisModification();
340   }
341 }
342
343 //=======================================================================
344 //function : GetSmoothNormals
345 //=======================================================================
346
347 bool HYBRIDPlugin_Hypothesis::GetSmoothNormals() const
348 {
349   return mySmoothNormals;
350 }
351
352 //=======================================================================
353 //function : SetHeightFirstLayer
354 //=======================================================================
355
356 void HYBRIDPlugin_Hypothesis::SetHeightFirstLayer(double toHeightFirstLayer)
357 {
358   if ( myHeightFirstLayer != toHeightFirstLayer ) {
359     myHeightFirstLayer = toHeightFirstLayer;
360     NotifySubMeshesHypothesisModification();
361   }
362 }
363
364 //=======================================================================
365 //function : GetHeightFirstLayer
366 //=======================================================================
367
368 double HYBRIDPlugin_Hypothesis::GetHeightFirstLayer() const
369 {
370   return myHeightFirstLayer;
371 }
372
373 //=======================================================================
374 //function : SetBoundaryLayersProgression
375 //=======================================================================
376
377 void HYBRIDPlugin_Hypothesis::SetBoundaryLayersProgression(double toBoundaryLayersProgression)
378 {
379   if ( myBoundaryLayersProgression != toBoundaryLayersProgression ) {
380     myBoundaryLayersProgression = toBoundaryLayersProgression;
381     NotifySubMeshesHypothesisModification();
382   }
383 }
384
385 //=======================================================================
386 //function : GetBoundaryLayersProgression
387 //=======================================================================
388
389 double HYBRIDPlugin_Hypothesis::GetBoundaryLayersProgression() const
390 {
391   return myBoundaryLayersProgression;
392 }
393
394 //=======================================================================
395 //function : SetMultinormalsAngle
396 //=======================================================================
397
398 void HYBRIDPlugin_Hypothesis::SetMultinormalsAngle(double toMultinormalsAngle)
399 {
400   if ( myMultinormalsAngle != toMultinormalsAngle ) {
401     myMultinormalsAngle = toMultinormalsAngle;
402     NotifySubMeshesHypothesisModification();
403   }
404 }
405
406 //=======================================================================
407 //function : GetMultinormalsAngle
408 //=======================================================================
409
410 double HYBRIDPlugin_Hypothesis::GetMultinormalsAngle() const
411 {
412   return myMultinormalsAngle;
413 }
414
415 //=======================================================================
416 //function : SetNbOfBoundaryLayers
417 //=======================================================================
418
419 void HYBRIDPlugin_Hypothesis::SetNbOfBoundaryLayers(short toNbOfBoundaryLayers)
420 {
421   if ( myNbOfBoundaryLayers != toNbOfBoundaryLayers ) {
422     myNbOfBoundaryLayers = toNbOfBoundaryLayers;
423     NotifySubMeshesHypothesisModification();
424   }
425 }
426
427 //=======================================================================
428 //function : GetMultinormalsAngle
429 //=======================================================================
430
431 short HYBRIDPlugin_Hypothesis::GetNbOfBoundaryLayers() const
432 {
433   return myNbOfBoundaryLayers;
434 }
435
436
437 /////////////////////////////////////////////////////////////////////////
438
439
440 //=======================================================================
441 //function : SetWorkingDirectory
442 //=======================================================================
443
444 void HYBRIDPlugin_Hypothesis::SetWorkingDirectory(const std::string& path)
445 {
446   if ( myWorkingDirectory != path ) {
447     myWorkingDirectory = path;
448     NotifySubMeshesHypothesisModification();
449   }
450 }
451
452 //=======================================================================
453 //function : GetWorkingDirectory
454 //=======================================================================
455
456 std::string HYBRIDPlugin_Hypothesis::GetWorkingDirectory() const
457 {
458   return myWorkingDirectory;
459 }
460
461 //=======================================================================
462 //function : SetKeepFiles
463 //=======================================================================
464
465 void HYBRIDPlugin_Hypothesis::SetKeepFiles(bool toKeep)
466 {
467   if ( myKeepFiles != toKeep ) {
468     myKeepFiles = toKeep;
469     NotifySubMeshesHypothesisModification();
470   }
471 }
472
473 //=======================================================================
474 //function : GetKeepFiles
475 //=======================================================================
476
477 bool HYBRIDPlugin_Hypothesis::GetKeepFiles() const
478 {
479   return myKeepFiles;
480 }
481
482 //=======================================================================
483 //function : SetVerboseLevel
484 //=======================================================================
485
486 void HYBRIDPlugin_Hypothesis::SetVerboseLevel(short level)
487 {
488   if ( myVerboseLevel != level ) {
489     myVerboseLevel = level;
490     NotifySubMeshesHypothesisModification();
491   }
492 }
493
494 //=======================================================================
495 //function : GetVerboseLevel
496 //=======================================================================
497
498 short HYBRIDPlugin_Hypothesis::GetVerboseLevel() const
499 {
500   return myVerboseLevel;
501 }
502
503 //=======================================================================
504 //function : SetToCreateNewNodes
505 //=======================================================================
506
507 void HYBRIDPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate)
508 {
509   if ( myToCreateNewNodes != toCreate ) {
510     myToCreateNewNodes = toCreate;
511     NotifySubMeshesHypothesisModification();
512   }
513 }
514
515 //=======================================================================
516 //function : GetToCreateNewNodes
517 //=======================================================================
518
519 bool HYBRIDPlugin_Hypothesis::GetToCreateNewNodes() const
520 {
521   return myToCreateNewNodes;
522 }
523
524 //=======================================================================
525 //function : SetToUseBoundaryRecoveryVersion
526 //=======================================================================
527
528 void HYBRIDPlugin_Hypothesis::SetToUseBoundaryRecoveryVersion(bool toUse)
529 {
530   if ( myToUseBoundaryRecoveryVersion != toUse ) {
531     myToUseBoundaryRecoveryVersion = toUse;
532     NotifySubMeshesHypothesisModification();
533   }
534 }
535
536 //=======================================================================
537 //function : GetToUseBoundaryRecoveryVersion
538 //=======================================================================
539
540 bool HYBRIDPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const
541 {
542   return myToUseBoundaryRecoveryVersion;
543 }
544
545 //=======================================================================
546 //function : SetFEMCorrection
547 //=======================================================================
548
549 void HYBRIDPlugin_Hypothesis::SetFEMCorrection(bool toUseFem)
550 {
551   if ( myToUseFemCorrection != toUseFem ) {
552     myToUseFemCorrection = toUseFem;
553     NotifySubMeshesHypothesisModification();
554   }
555 }
556
557 //=======================================================================
558 //function : GetFEMCorrection
559 //=======================================================================
560
561 bool HYBRIDPlugin_Hypothesis::GetFEMCorrection() const
562 {
563   return myToUseFemCorrection;
564 }
565
566 //=======================================================================
567 //function : SetToRemoveCentralPoint
568 //=======================================================================
569
570 void HYBRIDPlugin_Hypothesis::SetToRemoveCentralPoint(bool toRemove)
571 {
572   if ( myToRemoveCentralPoint != toRemove ) {
573     myToRemoveCentralPoint = toRemove;
574     NotifySubMeshesHypothesisModification();
575   }
576 }
577
578 //=======================================================================
579 //function : GetToRemoveCentralPoint
580 //=======================================================================
581
582 bool HYBRIDPlugin_Hypothesis::GetToRemoveCentralPoint() const
583 {
584   return myToRemoveCentralPoint;
585 }
586
587 //=======================================================================
588 //function : SetAdvancedOption
589 //=======================================================================
590
591 void HYBRIDPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
592 {
593   if ( myTextOption != option ) {
594     myTextOption = option;
595     NotifySubMeshesHypothesisModification();
596   }
597 }
598
599 //=======================================================================
600 //function : GetAdvancedOption
601 //=======================================================================
602
603 std::string HYBRIDPlugin_Hypothesis::GetAdvancedOption() const
604 {
605   return myTextOption;
606 }
607
608 //=======================================================================
609 //function : SetGradation
610 //=======================================================================
611
612 void HYBRIDPlugin_Hypothesis::SetGradation(double gradation)
613 {
614   if ( myGradation != gradation ) {
615     myGradation = gradation;
616     NotifySubMeshesHypothesisModification();
617   }
618 }
619
620 //=======================================================================
621 //function : GetGradation
622 //=======================================================================
623
624 double HYBRIDPlugin_Hypothesis::GetGradation() const
625 {
626   return myGradation;
627 }
628
629 //=======================================================================
630 //function : SetStandardOutputLog
631 //=======================================================================
632
633 void HYBRIDPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
634 {
635   if ( myLogInStandardOutput != logInStandardOutput ) {
636     myLogInStandardOutput = logInStandardOutput;
637     NotifySubMeshesHypothesisModification();
638   }
639 }
640
641 //=======================================================================
642 //function : GetStandardOutputLog
643 //=======================================================================
644
645 bool HYBRIDPlugin_Hypothesis::GetStandardOutputLog() const
646 {
647   return myLogInStandardOutput;
648 }
649
650 //=======================================================================
651 //function : SetRemoveLogOnSuccess
652 //=======================================================================
653
654 void HYBRIDPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
655 {
656   if ( myRemoveLogOnSuccess != removeLogOnSuccess ) {
657     myRemoveLogOnSuccess = removeLogOnSuccess;
658     NotifySubMeshesHypothesisModification();
659   }
660 }
661
662 //=======================================================================
663 //function : GetRemoveLogOnSuccess
664 //=======================================================================
665
666 bool HYBRIDPlugin_Hypothesis::GetRemoveLogOnSuccess() const
667 {
668   return myRemoveLogOnSuccess;
669 }
670
671 //=======================================================================
672 //function : SetEnforcedVertex
673 //=======================================================================
674
675 bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName,
676                                                double size, double x, double y, double z, bool isCompound)
677 {
678   bool toNotify = false;
679   bool toCreate = true;
680
681   THYBRIDEnforcedVertex *oldEnVertex;
682   THYBRIDEnforcedVertex *newEnfVertex = new THYBRIDEnforcedVertex();
683   newEnfVertex->name = theName;
684   newEnfVertex->geomEntry = theEntry;
685   newEnfVertex->coords.clear();
686   if (!isCompound) {
687     newEnfVertex->coords.push_back(x);
688     newEnfVertex->coords.push_back(y);
689     newEnfVertex->coords.push_back(z);
690   }
691   newEnfVertex->groupName = theGroupName;
692   newEnfVertex->size = size;
693   newEnfVertex->isCompound = isCompound;
694   
695   
696   // update _enfVertexList
697   THYBRIDEnforcedVertexList::iterator it = _enfVertexList.find(newEnfVertex);
698   if (it != _enfVertexList.end()) {
699     toCreate = false;
700     oldEnVertex = (*it);
701     if (oldEnVertex->name != theName) {
702       oldEnVertex->name = theName;
703       toNotify = true;
704     }
705     if (oldEnVertex->groupName != theGroupName) {
706       oldEnVertex->groupName = theGroupName;
707       toNotify = true;
708     }
709     if (oldEnVertex->size != size) {
710       oldEnVertex->size = size;
711       toNotify = true;
712     }
713     if (toNotify) {
714       // update map coords / enf vertex if needed
715       if (oldEnVertex->coords.size()) {
716         _coordsEnfVertexMap[oldEnVertex->coords] = oldEnVertex;
717         _enfVertexCoordsSizeList[oldEnVertex->coords] = size;
718       }
719
720       // update map geom entry / enf vertex if needed
721       if (oldEnVertex->geomEntry != "") {
722         _geomEntryEnfVertexMap[oldEnVertex->geomEntry] = oldEnVertex;
723         _enfVertexEntrySizeList[oldEnVertex->geomEntry] = size;
724       }
725     }
726   }
727
728 //   //////// CREATE ////////////
729   if (toCreate) {
730     toNotify = true;
731     _enfVertexList.insert(newEnfVertex);
732     if (theEntry == "") {
733       _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
734       _enfVertexCoordsSizeList[newEnfVertex->coords] = size;
735     }
736     else {
737       _geomEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
738       _enfVertexEntrySizeList[newEnfVertex->geomEntry] = size;
739     }
740   }
741
742   if (toNotify)
743     NotifySubMeshesHypothesisModification();
744
745   return toNotify;
746 }
747
748
749 //=======================================================================
750 //function : SetEnforcedMesh
751 //=======================================================================
752 bool HYBRIDPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
753 {
754   TIDSortedElemSet theElemSet;
755   SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
756   while ( eIt->more() )
757     theElemSet.insert( eIt->next() );
758   bool added = SetEnforcedElements( theElemSet, elementType, groupName);
759   if (added) {
760     THYBRIDEnforcedMesh* newEnfMesh = new THYBRIDEnforcedMesh();
761     newEnfMesh->persistID   = theMesh.GetMeshDS()->GetPersistentId();
762     newEnfMesh->name        = name;
763     newEnfMesh->entry       = entry;
764     newEnfMesh->elementType = elementType;
765     newEnfMesh->groupName   = groupName;
766     
767     THYBRIDEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
768     if (it == _enfMeshList.end()) {
769       _entryEnfMeshMap[entry].insert(newEnfMesh);
770       _enfMeshList.insert(newEnfMesh);
771     }
772     else {
773       delete newEnfMesh;
774     }
775   }
776   return added;
777 }
778
779 //=======================================================================
780 //function : SetEnforcedGroup
781 //=======================================================================
782 bool HYBRIDPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
783 {
784   TIDSortedElemSet theElemSet;
785     if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
786     for ( CORBA::ULong i = 0; i < theIDs->length(); i++) {
787       CORBA::Long ind = theIDs[i];
788       if (elementType == SMESH::NODE)
789       {
790         const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
791         if (node)
792           theElemSet.insert( node );
793       }
794       else
795       {
796         const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
797         if (elem)
798           theElemSet.insert( elem );
799       }
800     }
801
802 //   SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
803 //   while ( it->more() ) 
804 //     theElemSet.insert( it->next() );
805
806   bool added = SetEnforcedElements( theElemSet, elementType, groupName);
807   if (added) {
808     THYBRIDEnforcedMesh* newEnfMesh = new THYBRIDEnforcedMesh();
809     newEnfMesh->name = name;
810     newEnfMesh->entry = entry;
811     newEnfMesh->elementType = elementType;
812     newEnfMesh->groupName = groupName;
813     
814     THYBRIDEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
815     if (it == _enfMeshList.end()) {
816       _entryEnfMeshMap[entry].insert(newEnfMesh);
817       _enfMeshList.insert(newEnfMesh);
818     }
819   }
820   return added;
821 }
822
823 //=======================================================================
824 //function : SetEnforcedElements
825 //=======================================================================
826 bool HYBRIDPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
827 {
828   TIDSortedElemSet::const_iterator it = theElemSet.begin();
829   const SMDS_MeshElement* elem;
830   const SMDS_MeshNode* node;
831   bool added = true;
832   std::pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
833   std::pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
834
835   for (;it != theElemSet.end();++it)
836   {
837     elem = (*it);
838     switch (elementType) {
839       case SMESH::NODE:
840         node = dynamic_cast<const SMDS_MeshNode*>(elem);
841         if (node) {
842           nodeRet = _enfNodes.insert(make_pair(node,groupName));
843           added = added && nodeRet.second;
844           std::string msg = added ? "yes":"no";
845         }
846         else {
847           SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
848           for (;nodeIt->more();) {
849             node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
850             nodeRet = _enfNodes.insert(make_pair(node,groupName));
851             added = added && nodeRet.second;
852           }
853 //          added = true;s
854         }
855         break;
856       case SMESH::EDGE:
857         if (elem->GetType() == SMDSAbs_Edge) {
858           elemRet = _enfEdges.insert(make_pair(elem,groupName));
859           added = added && elemRet.second;
860         }
861         else if (elem->GetType() > SMDSAbs_Edge) {
862           SMDS_ElemIteratorPtr it = elem->edgesIterator();
863           for (;it->more();) {
864             const SMDS_MeshElement* anEdge = it->next();
865             elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
866             added = added && elemRet.second;
867           }
868         }
869         break;
870       case SMESH::FACE:
871         if (elem->GetType() == SMDSAbs_Face)
872         {
873           if (elem->NbCornerNodes() == 3) {
874             elemRet = _enfTriangles.insert(make_pair(elem,groupName));
875             added = added && elemRet.second;
876           }
877         }
878         else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
879           SMDS_ElemIteratorPtr it = elem->facesIterator();
880           for (;it->more();) {
881             const SMDS_MeshElement* aFace = it->next();
882             if (aFace->NbCornerNodes() == 3) {
883               elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
884               added = added && elemRet.second;
885             }
886           }
887         }
888         break;
889       default:
890         break;
891     };
892   }
893   if (added)
894     NotifySubMeshesHypothesisModification();
895   return added;
896 }
897
898
899 //=======================================================================
900 //function : GetEnforcedVertex
901 //=======================================================================
902
903 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* HYBRIDPlugin_Hypothesis::GetEnforcedVertex(double x, double y, double z)
904   throw (std::invalid_argument)
905 {
906   std::vector<double> coord(3);
907   coord[0] = x;
908   coord[1] = y;
909   coord[2] = z;
910   if (_coordsEnfVertexMap.count(coord)>0)
911     return _coordsEnfVertexMap[coord];
912   std::ostringstream msg ;
913   msg << "No enforced vertex at " << x << ", " << y << ", " << z;
914   throw std::invalid_argument(msg.str());
915 }
916
917 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* HYBRIDPlugin_Hypothesis::GetEnforcedVertex(const std::string theEntry)
918   throw (std::invalid_argument)
919 {
920   if (_geomEntryEnfVertexMap.count(theEntry)>0)
921     return _geomEntryEnfVertexMap[theEntry];
922   
923   std::ostringstream msg ;
924   msg << "No enforced vertex with entry " << theEntry;
925   throw std::invalid_argument(msg.str());
926 }
927
928 //=======================================================================
929 //function : RemoveEnforcedVertex
930 //=======================================================================
931
932 bool HYBRIDPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, const std::string theEntry)
933   throw (std::invalid_argument)
934 {
935   bool toNotify = false;
936   std::ostringstream msg;
937   THYBRIDEnforcedVertex *oldEnfVertex;
938   std::vector<double> coords(3);
939   coords[0] = x;
940   coords[1] = y;
941   coords[2] = z;
942   
943   // check that enf vertex with given enf vertex entry exists
944   TGeomEntryHYBRIDEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry);
945   if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) {
946     // Success
947     oldEnfVertex = it_enfVertexEntry->second;
948     _geomEntryEnfVertexMap.erase(it_enfVertexEntry);
949   } else {
950     // Fail
951     // check that enf vertex with given coords exists
952     TCoordsHYBRIDEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
953     if (it_coords_enf != _coordsEnfVertexMap.end()) {
954       // Success
955       oldEnfVertex = it_coords_enf->second;
956       _coordsEnfVertexMap.erase(it_coords_enf);
957       _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords));
958     } else {
959       // Fail
960       throw std::invalid_argument(msg.str());
961     }
962   }
963
964
965   // update _enfVertexList
966   THYBRIDEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
967   if (it != _enfVertexList.end()) {
968     if ((*it)->groupName != "")
969       _groupsToRemove.insert((*it)->groupName);
970     _enfVertexList.erase(it);
971     toNotify = true;
972   }
973
974   if (toNotify)
975     NotifySubMeshesHypothesisModification();
976
977   return toNotify;
978 }
979
980 //=======================================================================
981 //function : ClearEnforcedVertices
982 //=======================================================================
983 void HYBRIDPlugin_Hypothesis::ClearEnforcedVertices()
984 {
985   THYBRIDEnforcedVertexList::const_iterator it = _enfVertexList.begin();
986   for(;it != _enfVertexList.end();++it) {
987     if ((*it)->groupName != "")
988       _groupsToRemove.insert((*it)->groupName);
989   }
990   _enfVertexList.clear();
991   _coordsEnfVertexMap.clear();
992   _geomEntryEnfVertexMap.clear();
993   _enfVertexCoordsSizeList.clear();
994   _enfVertexEntrySizeList.clear();
995   NotifySubMeshesHypothesisModification();
996 }
997
998 //=======================================================================
999 //function : ClearEnforcedMeshes
1000 //=======================================================================
1001 void HYBRIDPlugin_Hypothesis::ClearEnforcedMeshes()
1002 {
1003   THYBRIDEnforcedMeshList::const_iterator it = _enfMeshList.begin();
1004   for(;it != _enfMeshList.end();++it) {
1005     if ((*it)->groupName != "")
1006       _groupsToRemove.insert((*it)->groupName);
1007   }
1008   _enfNodes.clear();
1009   _enfEdges.clear();
1010   _enfTriangles.clear();
1011   _nodeIDToSizeMap.clear();
1012   _enfMeshList.clear();
1013   _entryEnfMeshMap.clear();
1014   NotifySubMeshesHypothesisModification();
1015 }
1016
1017 //================================================================================
1018 /*!
1019  * \brief At mesh loading, restore enforced elements by just loaded enforced meshes
1020  */
1021 //================================================================================
1022
1023 void HYBRIDPlugin_Hypothesis::RestoreEnfElemsByMeshes()
1024 {
1025   THYBRIDEnforcedMeshList::const_iterator it = _enfMeshList.begin();
1026   for(;it != _enfMeshList.end();++it) {
1027     THYBRIDEnforcedMesh* enfMesh = *it;
1028     if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
1029       SetEnforcedMesh( *mesh,
1030                        enfMesh->elementType,
1031                        enfMesh->name,
1032                        enfMesh->entry,
1033                        enfMesh->groupName );
1034     enfMesh->persistID = -1; // not to restore again
1035   }
1036 }
1037
1038 //=======================================================================
1039 //function : SetGroupsToRemove
1040 //=======================================================================
1041
1042 void HYBRIDPlugin_Hypothesis::ClearGroupsToRemove()
1043 {
1044   _groupsToRemove.clear();
1045 }
1046
1047
1048 //=======================================================================
1049 //function : DefaultLayersOnAllWrap
1050 //=======================================================================
1051
1052 bool HYBRIDPlugin_Hypothesis::DefaultLayersOnAllWrap()
1053 {
1054   return true;
1055 }
1056
1057 //=======================================================================
1058 //function : DefaultMeshHoles
1059 //=======================================================================
1060
1061 bool HYBRIDPlugin_Hypothesis::DefaultMeshHoles()
1062 {
1063   return false; // PAL19680
1064 }
1065
1066 //=======================================================================
1067 //function : DefaultToMakeGroupsOfDomains
1068 //=======================================================================
1069
1070 bool HYBRIDPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
1071 {
1072   return false; // issue 0022172
1073 }
1074
1075 //=======================================================================
1076 //function : DefaultMaximumMemory
1077 //=======================================================================
1078
1079 #if defined(WIN32)
1080 #include <windows.h>
1081 #elif !defined(__APPLE__)
1082 #include <sys/sysinfo.h>
1083 #endif
1084
1085 double  HYBRIDPlugin_Hypothesis::DefaultMaximumMemory()
1086 {
1087 #if defined(WIN32)
1088   // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
1089   MEMORYSTATUSEX statex;
1090   statex.dwLength = sizeof (statex);
1091   int err = GlobalMemoryStatusEx (&statex);
1092   if (err != 0) {
1093     int totMB = 
1094       statex.ullTotalPhys / 1024 / 1024 +
1095       statex.ullTotalPageFile / 1024 / 1024 +
1096       statex.ullTotalVirtual / 1024 / 1024;
1097     return ( 0.7 * totMB );
1098   }
1099 #elif !defined(__APPLE__)
1100   struct sysinfo si;
1101   int err = sysinfo( &si );
1102   if ( err == 0 ) {
1103     int ramMB = si.totalram * si.mem_unit / 1024 / 1024;
1104     return ( 0.7 * ramMB );
1105   }
1106 #endif
1107   return 1024;
1108 }
1109
1110 //=======================================================================
1111 //function : DefaultInitialMemory
1112 //=======================================================================
1113
1114 double  HYBRIDPlugin_Hypothesis::DefaultInitialMemory()
1115 {
1116   return DefaultMaximumMemory();
1117 }
1118
1119 //=======================================================================
1120 //function : DefaultCollisionMode
1121 //=======================================================================
1122 short  HYBRIDPlugin_Hypothesis::DefaultCollisionMode()
1123 {
1124   return Decrease;
1125 }
1126
1127 //=======================================================================
1128 //function : DefaultBoundaryLayersGrowth
1129 //=======================================================================
1130 short  HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersGrowth()
1131 {
1132   return Layer_Growth_Inward;
1133 }
1134
1135 //=======================================================================
1136 //function : DefaultElementGeneration
1137 //=======================================================================
1138 short  HYBRIDPlugin_Hypothesis::DefaultElementGeneration()
1139 {
1140   return Generation_Tetra_Dominant;
1141 }
1142
1143 //=======================================================================
1144 //function : DefaultOptimizationLevel
1145 //=======================================================================
1146 short  HYBRIDPlugin_Hypothesis::DefaultOptimizationLevel()
1147 {
1148   return Medium;
1149 }
1150
1151 //=======================================================================
1152 //function : DefaultWorkingDirectory
1153 //=======================================================================
1154
1155 std::string HYBRIDPlugin_Hypothesis::DefaultWorkingDirectory()
1156 {
1157   std::string aTmpDir;
1158
1159   char *Tmp_dir = getenv("SALOME_TMP_DIR");
1160   if(Tmp_dir != NULL) {
1161     aTmpDir = Tmp_dir;
1162   }
1163   else {
1164 #ifdef WIN32
1165     aTmpDir = "C:\\";
1166 #else
1167     aTmpDir = "/tmp/";
1168 #endif
1169   }
1170   return aTmpDir;
1171 }
1172
1173 //=======================================================================
1174 //function : DefaultKeepFiles
1175 //=======================================================================
1176
1177 bool   HYBRIDPlugin_Hypothesis::DefaultKeepFiles()
1178 {
1179   return false;
1180 }
1181
1182 //=======================================================================
1183 //function : DefaultRemoveLogOnSuccess
1184 //=======================================================================
1185
1186 bool   HYBRIDPlugin_Hypothesis::DefaultRemoveLogOnSuccess()
1187 {
1188   return false;
1189 }
1190
1191
1192 //=======================================================================
1193 //function : DefaultVerboseLevel
1194 //=======================================================================
1195
1196 short  HYBRIDPlugin_Hypothesis::DefaultVerboseLevel()
1197 {
1198   return 10;
1199 }
1200
1201 //=======================================================================
1202 //function : DefaultToCreateNewNodes
1203 //=======================================================================
1204
1205 bool HYBRIDPlugin_Hypothesis::DefaultToCreateNewNodes()
1206 {
1207   return true;
1208 }
1209
1210 //=======================================================================
1211 //function : DefaultToUseBoundaryRecoveryVersion
1212 //=======================================================================
1213
1214 bool HYBRIDPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion()
1215 {
1216   return false;
1217 }
1218
1219 //=======================================================================
1220 //function : DefaultToUseFEMCorrection
1221 //=======================================================================
1222
1223 bool HYBRIDPlugin_Hypothesis::DefaultToUseFEMCorrection()
1224 {
1225   return false;
1226 }
1227
1228 //=======================================================================
1229 //function : DefaultToRemoveCentralPoint
1230 //=======================================================================
1231
1232 bool HYBRIDPlugin_Hypothesis::DefaultToRemoveCentralPoint()
1233 {
1234   return false;
1235 }
1236
1237 //=======================================================================
1238 //function : DefaultGradation
1239 //=======================================================================
1240
1241 double HYBRIDPlugin_Hypothesis::DefaultGradation()
1242 {
1243   return 1.05;
1244 }
1245
1246 //=======================================================================
1247 //function : DefaultStandardOutputLog
1248 //=======================================================================
1249
1250 bool HYBRIDPlugin_Hypothesis::DefaultStandardOutputLog()
1251 {
1252   return false;
1253 }
1254
1255 // //=======================================================================
1256 // //function : DefaultID2SizeMap
1257 // //=======================================================================
1258 // 
1259 // HYBRIDPlugin_Hypothesis::TID2SizeMap HYBRIDPlugin_Hypothesis::DefaultID2SizeMap()
1260 // {
1261 //   return HYBRIDPlugin_Hypothesis::TID2SizeMap();
1262 // }
1263
1264 //=======================================================================
1265 //function : DefaultAddMultinormals
1266 //=======================================================================
1267 bool HYBRIDPlugin_Hypothesis::DefaultAddMultinormals()
1268 {
1269   return false;
1270 }
1271
1272 //=======================================================================
1273 //function : DefaultSmoothNormals
1274 //=======================================================================
1275 bool HYBRIDPlugin_Hypothesis::DefaultSmoothNormals()
1276 {
1277   return false;
1278 }
1279
1280 //=======================================================================
1281 //function : DefaultHeightFirstLayer
1282 //=======================================================================
1283 double HYBRIDPlugin_Hypothesis::DefaultHeightFirstLayer()
1284 {
1285   return 0.0; //or epsilon?
1286 }
1287
1288 //=======================================================================
1289 //function : DefaultBoundaryLayersProgression
1290 //=======================================================================
1291 double HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersProgression()
1292 {
1293   return 1.0;
1294 }
1295
1296 //=======================================================================
1297 //function : DefaultMultinormalsAngle
1298 //=======================================================================
1299 double HYBRIDPlugin_Hypothesis::DefaultMultinormalsAngle()
1300 {
1301   return 30.0;
1302 }
1303
1304 //=======================================================================
1305 //function : DefaultNbOfBoundaryLayers
1306 //=======================================================================
1307 short HYBRIDPlugin_Hypothesis::DefaultNbOfBoundaryLayers()
1308 {
1309   return 1;
1310 }
1311
1312 //=======================================================================
1313 //function : SaveTo
1314 //=======================================================================
1315
1316 std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
1317 {
1318   save << (int) myBoundaryLayersGrowth << " ";
1319   save << (int) myElementGeneration << " ";
1320   save << (int) myAddMultinormals << " ";
1321   save << (int) mySmoothNormals << " ";
1322   save << (int) myLayersOnAllWrap << " ";
1323
1324   save << myNbOfBoundaryLayers << " ";
1325   save << myHeightFirstLayer << " ";
1326   save << myBoundaryLayersProgression << " ";
1327   save << myMultinormalsAngle << " ";
1328
1329   save << (int) myKeepFiles << " ";
1330   save << myWorkingDirectory << " ";
1331   save << myVerboseLevel << " ";
1332   if (!myTextOption.empty()) {
1333     save << "__OPTIONS_BEGIN__ ";
1334     save << myTextOption << " ";
1335     save << "__OPTIONS_END__ ";
1336   }
1337
1338
1339   THYBRIDEnforcedVertexList::iterator it  = _enfVertexList.begin();
1340   if (it != _enfVertexList.end()) {
1341     save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
1342     for ( ; it != _enfVertexList.end(); ++it ) {
1343       THYBRIDEnforcedVertex *enfVertex = (*it);
1344       save << " " << "__BEGIN_VERTEX__";
1345       if (!enfVertex->name.empty()) {
1346         save << " " << "__BEGIN_NAME__";
1347         save << " " << enfVertex->name;
1348         save << " " << "__END_NAME__";
1349       }
1350       if (!enfVertex->geomEntry.empty()) {
1351         save << " " << "__BEGIN_ENTRY__";
1352         save << " " << enfVertex->geomEntry;
1353         save << " " << enfVertex->isCompound;
1354         save << " " << "__END_ENTRY__";
1355       }
1356       if (!enfVertex->groupName.empty()) {
1357         save << " " << "__BEGIN_GROUP__";
1358         save << " " << enfVertex->groupName;
1359         save << " " << "__END_GROUP__";
1360       }
1361       if (enfVertex->coords.size()) {
1362         save << " " << "__BEGIN_COORDS__";
1363         for ( size_t i = 0; i < enfVertex->coords.size(); i++ )
1364           save << " " << enfVertex->coords[i];
1365         save << " " << "__END_COORDS__";
1366       }
1367       save << " " << "__BEGIN_SIZE__";
1368       save << " " << enfVertex->size;
1369       save << " " << "__END_SIZE__";
1370       save << " " << "__END_VERTEX__";
1371     }
1372     save << " " << "__ENFORCED_VERTICES_END__ ";
1373   }
1374
1375   THYBRIDEnforcedMeshList::iterator it_mesh  = _enfMeshList.begin();
1376   if (it_mesh != _enfMeshList.end()) {
1377     save << " " << "__ENFORCED_MESHES_BEGIN__ ";
1378     for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
1379       THYBRIDEnforcedMesh *enfMesh = (*it_mesh);
1380       save << " " << "__BEGIN_ENF_MESH__";
1381
1382       save << " " << "__BEGIN_NAME__";
1383       save << " " << enfMesh->name;
1384       save << " " << "__END_NAME__";
1385
1386       save << " " << "__BEGIN_ENTRY__";
1387       save << " " << enfMesh->entry;
1388       save << " " << "__END_ENTRY__";
1389
1390       save << " " << "__BEGIN_ELEM_TYPE__";
1391       save << " " << (int)enfMesh->elementType;
1392       save << " " << "__END_ELEM_TYPE__";
1393
1394       if (!enfMesh->groupName.empty()) {
1395         save << " " << "__BEGIN_GROUP__";
1396         save << " " << enfMesh->groupName;
1397         save << " " << "__END_GROUP__";
1398       }
1399       save << " " << "__PERSIST_ID__";
1400       save << " " << enfMesh->persistID;
1401       save << " " << "__END_ENF_MESH__";
1402       std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
1403     }
1404     save << " "  << "__ENFORCED_MESHES_END__ ";
1405   }
1406
1407   save << " " << myFacesWithLayers.size();
1408   for ( size_t i = 0; i < myFacesWithLayers.size(); ++i )
1409     save << " " << myFacesWithLayers[i];
1410
1411   return save;
1412 }
1413
1414 //=======================================================================
1415 //function : LoadFrom
1416 //=======================================================================
1417
1418 std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
1419 {
1420   bool isOK = true;
1421   int i;
1422   double d;
1423
1424   isOK = static_cast<bool>(load >> i);
1425   if (isOK)
1426     myBoundaryLayersGrowth = (short) i;
1427   else
1428     load.clear(ios::badbit | load.rdstate());
1429
1430   isOK = static_cast<bool>(load >> i);
1431   if (isOK)
1432     myElementGeneration = (short) i;
1433   else
1434     load.clear(ios::badbit | load.rdstate());
1435
1436   isOK = static_cast<bool>(load >> i);
1437   if (isOK)
1438     myAddMultinormals = (bool) i;
1439   else
1440     load.clear(ios::badbit | load.rdstate());
1441
1442   isOK = static_cast<bool>(load >> i);
1443   if (isOK)
1444     mySmoothNormals = (bool) i;
1445   else
1446     load.clear(ios::badbit | load.rdstate());
1447
1448   isOK = static_cast<bool>(load >> i);
1449   if (isOK)
1450     myLayersOnAllWrap = (bool) i;
1451   else
1452     load.clear(ios::badbit | load.rdstate());
1453
1454   isOK = static_cast<bool>(load >> i);
1455   if (isOK)
1456     myNbOfBoundaryLayers = (short) i;
1457   else
1458     load.clear(ios::badbit | load.rdstate());
1459
1460   isOK = static_cast<bool>(load >> d);
1461   if (isOK)
1462     myHeightFirstLayer = d;
1463   else
1464     load.clear(ios::badbit | load.rdstate());
1465
1466   isOK = static_cast<bool>(load >> d);
1467   if (isOK)
1468     myBoundaryLayersProgression = d;
1469   else
1470     load.clear(ios::badbit | load.rdstate());
1471
1472   isOK = static_cast<bool>(load >> d);
1473   if (isOK)
1474     myMultinormalsAngle = d;
1475   else
1476     load.clear(ios::badbit | load.rdstate());
1477
1478   isOK = static_cast<bool>(load >> i);
1479   if (isOK)
1480     myKeepFiles = (bool) i;
1481   else
1482     load.clear(ios::badbit | load.rdstate());
1483
1484   isOK = static_cast<bool>(load >> myWorkingDirectory);
1485   if (isOK) {
1486     if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
1487       myKeepFiles = false;
1488       myWorkingDirectory.clear();
1489     }
1490     else if ( myWorkingDirectory == "1" ) {
1491       myKeepFiles = true;
1492       myWorkingDirectory.clear();
1493     }
1494   }
1495   else
1496     load.clear(ios::badbit | load.rdstate());
1497
1498   isOK = static_cast<bool>(load >> i);
1499   if (isOK)
1500     myVerboseLevel = (short) i;
1501   else
1502     load.clear(ios::badbit | load.rdstate());
1503
1504
1505   std::string separator;
1506   bool hasOptions = false;
1507   bool hasEnforcedVertices = false;
1508   bool hasEnforcedMeshes = false;
1509   isOK = static_cast<bool>(load >> separator);
1510
1511   if ( isOK && ( separator == "0" || separator == "1" ))
1512   {
1513     myToMakeGroupsOfDomains = ( separator == "1" );
1514     isOK = static_cast<bool>(load >> separator);
1515   }
1516
1517   if (isOK) {
1518     if (separator == "__OPTIONS_BEGIN__")
1519       hasOptions = true;
1520     else if (separator == "__ENFORCED_VERTICES_BEGIN__")
1521       hasEnforcedVertices = true;
1522     else if (separator == "__ENFORCED_MESHES_BEGIN__")
1523       hasEnforcedMeshes = true;
1524   }
1525
1526   if (hasOptions) {
1527     std::string txt;
1528     while (isOK) {
1529       isOK = static_cast<bool>(load >> txt);
1530       if (isOK) {
1531         if (txt == "__OPTIONS_END__") {
1532           if (!myTextOption.empty()) {
1533             // Remove last space
1534             myTextOption.erase(myTextOption.end()-1);
1535           }
1536           isOK = false;
1537           break;
1538         }
1539         myTextOption += txt;
1540         myTextOption += " ";
1541       }
1542     }
1543   }
1544
1545   if (hasOptions) {
1546     isOK = static_cast<bool>(load >> separator);
1547     if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
1548       hasEnforcedVertices = true;
1549     if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
1550       hasEnforcedMeshes = true;
1551   }
1552
1553   if (hasEnforcedVertices) {
1554     std::string txt, name, entry, groupName;
1555     double size, coords[3];
1556     bool isCompound;
1557     bool hasCoords = false;
1558     isOK = static_cast<bool>(load >> txt);  // __BEGIN_VERTEX__
1559     while (isOK) {
1560       if (txt == "__ENFORCED_VERTICES_END__")
1561         isOK = false;
1562
1563       THYBRIDEnforcedVertex *enfVertex = new THYBRIDEnforcedVertex();
1564       while (isOK) {
1565         isOK = static_cast<bool>(load >> txt);
1566         if (txt == "__END_VERTEX__") {
1567           enfVertex->name = name;
1568           enfVertex->geomEntry = entry;
1569           enfVertex->isCompound = isCompound;
1570           enfVertex->groupName = groupName;
1571           enfVertex->coords.clear();
1572           if (hasCoords)
1573             enfVertex->coords.assign(coords,coords+3);
1574
1575           _enfVertexList.insert(enfVertex);
1576
1577           if (enfVertex->coords.size())
1578             _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
1579           if (!enfVertex->geomEntry.empty())
1580             _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
1581
1582           name.clear();
1583           entry.clear();
1584           groupName.clear();
1585           hasCoords = false;
1586           isOK = false;
1587         }
1588
1589         if (txt == "__BEGIN_NAME__") {  // __BEGIN_NAME__
1590           while (isOK && (txt != "__END_NAME__")) {
1591             isOK = static_cast<bool>(load >> txt);
1592             if (txt != "__END_NAME__") {
1593               if (!name.empty())
1594                 name += " ";
1595               name += txt;
1596             }
1597           }
1598         }
1599
1600         if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
1601           isOK = static_cast<bool>(load >> entry);
1602           isOK = static_cast<bool>(load >> isCompound);
1603           isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1604           if (txt != "__END_ENTRY__")
1605             throw std::exception();
1606         }
1607
1608         if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
1609           while (isOK && (txt != "__END_GROUP__")) {
1610             isOK = static_cast<bool>(load >> txt);
1611             if (txt != "__END_GROUP__") {
1612               if (!groupName.empty())
1613                 groupName += " ";
1614               groupName += txt;
1615             }
1616           }
1617         }
1618
1619         if (txt == "__BEGIN_COORDS__") {  // __BEGIN_COORDS__
1620           hasCoords = true;
1621           isOK = static_cast<bool>(load >> coords[0] >> coords[1] >> coords[2]);
1622           isOK = static_cast<bool>(load >> txt); // __END_COORDS__
1623           if (txt != "__END_COORDS__")
1624             throw std::exception();
1625         }
1626
1627         if (txt == "__BEGIN_SIZE__") {  // __BEGIN_ENTRY__
1628           isOK = static_cast<bool>(load >> size);
1629           isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1630           if (txt != "__END_SIZE__") {
1631             throw std::exception();
1632           }
1633         }
1634       }
1635       isOK = static_cast<bool>(load >> txt);  // __BEGIN_VERTEX__
1636     }
1637   }
1638
1639   if (hasEnforcedVertices) {
1640     isOK = static_cast<bool>(load >> separator);
1641     if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
1642       hasEnforcedMeshes = true;
1643   }
1644
1645   if (hasEnforcedMeshes) {
1646     std::string txt, name, entry, groupName;
1647     int elementType = -1, persistID = -1;
1648     isOK = static_cast<bool>(load >> txt);  // __BEGIN_ENF_MESH__
1649     while (isOK) {
1650       //                if (isOK) {
1651       if (txt == "__ENFORCED_MESHES_END__")
1652         isOK = false;
1653
1654       THYBRIDEnforcedMesh *enfMesh = new THYBRIDEnforcedMesh();
1655       while (isOK) {
1656         isOK = static_cast<bool>(load >> txt);
1657         if (txt == "__END_ENF_MESH__") {
1658           enfMesh->name = name;
1659           enfMesh->entry = entry;
1660           enfMesh->elementType = (SMESH::ElementType)elementType;
1661           enfMesh->groupName = groupName;
1662           enfMesh->persistID = persistID;
1663
1664           _enfMeshList.insert(enfMesh);
1665           std::cout << "Restoring of enforced mesh " <<name  << " done" << std::endl;
1666
1667           name.clear();
1668           entry.clear();
1669           elementType = -1;
1670           groupName.clear();
1671           persistID = -1;
1672           isOK = false;
1673         }
1674
1675         if (txt == "__BEGIN_NAME__") {  // __BEGIN_NAME__
1676           while (isOK && (txt != "__END_NAME__")) {
1677             isOK = static_cast<bool>(load >> txt);
1678             if (txt != "__END_NAME__") {
1679               if (!name.empty())
1680                 name += " ";
1681               name += txt;
1682             }
1683           }
1684         }
1685
1686         if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
1687           isOK = static_cast<bool>(load >> entry);
1688           isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1689           if (txt != "__END_ENTRY__")
1690             throw std::exception();
1691         }
1692
1693         if (txt == "__BEGIN_ELEM_TYPE__") {  // __BEGIN_ELEM_TYPE__
1694           isOK = static_cast<bool>(load >> elementType);
1695           isOK = static_cast<bool>(load >> txt); // __END_ELEM_TYPE__
1696           if (txt != "__END_ELEM_TYPE__")
1697             throw std::exception();
1698         }
1699
1700         if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
1701           while (isOK && (txt != "__END_GROUP__")) {
1702             isOK = static_cast<bool>(load >> txt);
1703             if (txt != "__END_GROUP__") {
1704               if (!groupName.empty())
1705                 groupName += " ";
1706               groupName += txt;
1707             }
1708           } // while
1709         } // if
1710
1711         if (txt == "__PERSIST_ID__") {
1712           isOK = static_cast<bool>(load >> persistID);
1713         }
1714         std::cout << "isOK: " << isOK << std::endl;
1715       } // while
1716       //                } // if
1717       isOK = static_cast<bool>(load >> txt);  // __BEGIN_ENF_MESH__
1718     } // while
1719   } // if
1720
1721   if ( hasEnforcedMeshes )
1722     isOK = static_cast<bool>(load >> separator);
1723
1724   if ( isOK )
1725   {
1726     i = atoi( separator.c_str() );
1727     isOK = ( i >= 0 );
1728     if ( isOK )
1729     {
1730       myFacesWithLayers.reserve( i );
1731       while (( myFacesWithLayers.size() < myFacesWithLayers.capacity() ) &&
1732              ( isOK = static_cast<bool>(load >> i)) )
1733         myFacesWithLayers.push_back( i );
1734     }
1735   }
1736   return load;
1737 }
1738
1739 //=======================================================================
1740 //function : SetParametersByMesh
1741 //=======================================================================
1742
1743 bool HYBRIDPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&)
1744 {
1745   return false;
1746 }
1747
1748
1749 //================================================================================
1750 /*!
1751  * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
1752  */
1753 //================================================================================
1754
1755 bool HYBRIDPlugin_Hypothesis::SetParametersByDefaults(const TDefaults&  dflts,
1756                                                      const SMESH_Mesh* /*theMesh*/)
1757 {
1758   myToMakeGroupsOfDomains = ( !dflts._shape || dflts._shape->IsNull() );
1759   return true;
1760 }
1761
1762 //================================================================================
1763 /*!
1764  * \brief Return command to run hybrid mesher excluding file prefix (-f)
1765  */
1766 //================================================================================
1767
1768 std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp,
1769                                                   SMESH_Mesh&                    mesh)
1770 {
1771   SMESH_Comment cmd = GetExeName();
1772   // check if any option is overridden by hyp->myTextOption
1773   bool p_h     = ( hyp && hyp->myTextOption.find("-h") != std::string::npos );
1774   bool p_v     = ( hyp && hyp->myTextOption.find("-v") != std::string::npos );
1775   bool p_i     = ( hyp && hyp->myTextOption.find("-i") != std::string::npos );
1776   bool p_o     = ( hyp && hyp->myTextOption.find("-o") != std::string::npos );
1777   bool p_mnot  = ( hyp && hyp->myTextOption.find("--max_number_of_threads ") != std::string::npos );
1778   bool p_blsi  = ( hyp && hyp->myTextOption.find("--boundary_layer_surface_tags ") != std::string::npos );
1779   bool p_blii  = ( hyp && hyp->myTextOption.find("--boundary_layer_imprint_tags ") != std::string::npos );
1780   bool p_blsd  = ( hyp && hyp->myTextOption.find("--normal_direction ") != std::string::npos );
1781   bool p_hotfl = ( hyp && hyp->myTextOption.find("--boundary_layer_global_initial_height ") != std::string::npos );
1782   bool p_nobl  = ( hyp && hyp->myTextOption.find("--number_of_boundary_layers ") != std::string::npos );
1783   bool p_blgp  = ( hyp && hyp->myTextOption.find("--boundary_layer_geometric_progression ") != std::string::npos );
1784   bool p_eg    = ( hyp && hyp->myTextOption.find("--element_generation ") != std::string::npos );
1785   bool p_cm    = ( hyp && hyp->myTextOption.find("--collision_mode ") != std::string::npos );
1786   bool p_am    = ( hyp && hyp->myTextOption.find("--add_multinormals ") != std::string::npos );
1787   bool p_mat   = ( hyp && hyp->myTextOption.find("--multinormal_angle_threshold ") != std::string::npos );
1788   bool p_sn    = ( hyp && hyp->myTextOption.find("--smooth_normals ") != std::string::npos );
1789
1790   //missing options :
1791   //- global_physical_size
1792   //- boundary_layer_size_mode
1793   //- boundary_layer_initial_height_on_surface_tags
1794   //- boundary_layer_max_element_angle
1795
1796   bool nolayers = false;
1797   bool layersOnAllWrap = hyp ? hyp->myLayersOnAllWrap : DefaultLayersOnAllWrap();
1798
1799   //help mode
1800   if ( p_h ) {
1801     cmd << " --help ";
1802 #ifdef WIN32
1803     cmd << " < NUL";
1804 #endif
1805     std::cout << "!!!!! CommandToRun help only !!!! " << cmd << std::endl;
1806     return cmd;
1807   }
1808
1809   if ( !p_v && hyp )
1810     cmd << " --verbose " << hyp->myVerboseLevel;
1811
1812   if ( !p_mnot && hyp )
1813     cmd << " --max_number_of_threads " << 8; //TODO getenv NB CPU
1814
1815   //no layers?
1816   if ( !p_nobl && hyp ) {
1817     if ( hyp->myNbOfBoundaryLayers < 1 ) nolayers = true;
1818   }
1819   if ( !p_hotfl && hyp ) {
1820     if ( hyp->myHeightFirstLayer < 1e-50 ) nolayers = true;
1821   }
1822     
1823   if ( !p_blsd && hyp ) {
1824     if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) {
1825       const char* value[] = { "-1" , "1" }; // -1 == inside
1826       cmd << " --normal_direction " << value[ hyp->myBoundaryLayersGrowth ];
1827     }
1828   }
1829   
1830   if ( !p_hotfl && hyp ) {
1831     cmd << " --boundary_layer_global_initial_height " << hyp->myHeightFirstLayer;
1832   }
1833   
1834   if ( !p_nobl && hyp ) {
1835     cmd << " --number_of_boundary_layers " << ( nolayers ? 0 :  hyp->myNbOfBoundaryLayers );
1836   }
1837
1838   if ( !p_blgp && hyp ) {
1839     cmd << " --boundary_layer_geometric_progression " << hyp->myBoundaryLayersProgression;
1840   }
1841
1842   if ( !nolayers && hyp )
1843   {
1844     cmd << " --boundary_layer_size_mode " << ( layersOnAllWrap ? "global" : "local" );
1845     cmd << " --boundary_layer_surface_tags ";
1846     if ( layersOnAllWrap )
1847     {
1848       cmd << " 3 ";
1849     }
1850     else
1851     {
1852       const std::vector<int>& faceIDs = hyp->GetFacesWithLayers();
1853       const bool      hasEnforcedTria = !HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(hyp).empty();
1854       for ( size_t i = 0; i < faceIDs.size(); ++i )
1855         cmd << faceIDs[i] << ",";
1856       if ( hasEnforcedTria )
1857         cmd << EnforcedTag();
1858       cmd << " --boundary_layer_initial_height_on_surface_tags ";
1859       for ( size_t i = 0; i < faceIDs.size() + hasEnforcedTria; ++i )
1860         cmd << hyp->myHeightFirstLayer << ",";
1861     }
1862   }
1863
1864   if ( !p_eg && hyp ) {
1865     if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 1 ) {
1866       const char* value[] = { "tetra-dominant" , "hexa-dominant" };
1867       cmd << " --element_generation " << value[ hyp->myElementGeneration ];
1868     }
1869   }
1870   
1871   if ( !p_cm && hyp ) {
1872     if ( hyp->myCollisionMode >= 0 && hyp->myCollisionMode <= 1 ) {
1873       const char* value[] = { "decrease" , "stop" };
1874       cmd << " --collision_mode " << value[ hyp->myCollisionMode ];
1875     }
1876   }
1877   
1878   if ( !p_am && hyp ) {
1879     int res = hyp->myAddMultinormals ? 0 : 1 ;
1880     const char* value[] = { "yes" , "no" };
1881     cmd << " --add_multinormals " << value[ res ];
1882   }
1883   
1884   if ( !p_mat && hyp ) {
1885     cmd << " --multinormal_angle_threshold " << hyp->myMultinormalsAngle;
1886   }
1887   
1888   if ( !p_sn && hyp ) {
1889     int res = hyp->mySmoothNormals ? 0 : 1 ;
1890     const char* value[] = { "yes" , "no" };
1891     cmd << " --smooth_normals " << value[ res ];
1892   }
1893   
1894 #ifdef WIN32
1895   cmd << " < NUL";
1896 #endif
1897   //std::cout << "!!!!!CommandToRun end " << cmd << std::endl;
1898     
1899   return cmd;
1900 }
1901
1902 //================================================================================
1903 /*!
1904  * \brief Return a unique file name
1905  */
1906 //================================================================================
1907
1908 std::string HYBRIDPlugin_Hypothesis::GetFileName(const HYBRIDPlugin_Hypothesis* hyp)
1909 {
1910   std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
1911   const char lastChar = *aTmpDir.rbegin();
1912 #ifdef WIN32
1913   if(lastChar != '\\') aTmpDir+='\\';
1914 #else
1915   if(lastChar != '/') aTmpDir+='/';
1916 #endif
1917
1918   SMESH_Comment aGenericName = aTmpDir;
1919   aGenericName << "HYBRID_";
1920   aGenericName << getpid();
1921   aGenericName << "_";
1922   aGenericName << Abs((Standard_Integer)(long) aGenericName.c_str());
1923
1924   return aGenericName;
1925 }
1926
1927 //================================================================================
1928 /*
1929  * Return the name of executable
1930  */
1931 //================================================================================
1932
1933 std::string HYBRIDPlugin_Hypothesis::GetExeName()
1934 {
1935   //call mg-hybrid.bash is script which assumes new project version(s) mg-hybrid.exe in the prerequisite base and special? licence.
1936 #ifdef WIN32
1937   return "mg-hybrid.exe";
1938 #else
1939   return "mg-hybrid.bash";
1940 #endif
1941 }
1942
1943 //================================================================================
1944 /*!
1945 * \brief Return the enforced vertices
1946 */
1947 //================================================================================
1948
1949 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList HYBRIDPlugin_Hypothesis::GetEnforcedVertices(const HYBRIDPlugin_Hypothesis* hyp)
1950 {
1951   return hyp ? hyp->_GetEnforcedVertices():DefaultHYBRIDEnforcedVertexList();
1952 }
1953
1954 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues HYBRIDPlugin_Hypothesis::GetEnforcedVerticesCoordsSize (const HYBRIDPlugin_Hypothesis* hyp)
1955 {  
1956   return hyp ? hyp->_GetEnforcedVerticesCoordsSize(): DefaultHYBRIDEnforcedVertexCoordsValues();
1957 }
1958
1959 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexEntryValues HYBRIDPlugin_Hypothesis::GetEnforcedVerticesEntrySize (const HYBRIDPlugin_Hypothesis* hyp)
1960 {  
1961   return hyp ? hyp->_GetEnforcedVerticesEntrySize(): DefaultHYBRIDEnforcedVertexEntryValues();
1962 }
1963
1964 HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap HYBRIDPlugin_Hypothesis::GetEnforcedVerticesByCoords (const HYBRIDPlugin_Hypothesis* hyp)
1965 {  
1966   return hyp ? hyp->_GetEnforcedVerticesByCoords(): DefaultCoordsHYBRIDEnforcedVertexMap();
1967 }
1968
1969 HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap HYBRIDPlugin_Hypothesis::GetEnforcedVerticesByEntry (const HYBRIDPlugin_Hypothesis* hyp)
1970 {  
1971   return hyp ? hyp->_GetEnforcedVerticesByEntry(): DefaultGeomEntryHYBRIDEnforcedVertexMap();
1972 }
1973
1974 HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap HYBRIDPlugin_Hypothesis::GetEnforcedNodes(const HYBRIDPlugin_Hypothesis* hyp)
1975 {
1976   return hyp ? hyp->_GetEnforcedNodes():DefaultIDSortedNodeGroupMap();
1977 }
1978
1979 HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap HYBRIDPlugin_Hypothesis::GetEnforcedEdges(const HYBRIDPlugin_Hypothesis* hyp)
1980 {
1981   return hyp ? hyp->_GetEnforcedEdges():DefaultIDSortedElemGroupMap();
1982 }
1983
1984 HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(const HYBRIDPlugin_Hypothesis* hyp)
1985 {
1986   return hyp ? hyp->_GetEnforcedTriangles():DefaultIDSortedElemGroupMap();
1987 }
1988
1989 HYBRIDPlugin_Hypothesis::TID2SizeMap HYBRIDPlugin_Hypothesis::GetNodeIDToSizeMap(const HYBRIDPlugin_Hypothesis* hyp)
1990 {
1991   return hyp ? hyp->_GetNodeIDToSizeMap(): DefaultID2SizeMap();
1992 }
1993
1994 HYBRIDPlugin_Hypothesis::TSetStrings HYBRIDPlugin_Hypothesis::GetGroupsToRemove(const HYBRIDPlugin_Hypothesis* hyp)
1995 {
1996   return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove();
1997 }