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