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