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