1 // Copyright (C) 2007-2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //=============================================================================
21 // File : HYBRIDPlugin_Hypothesis.cxx
22 // Created : Wed Apr 2 12:36:29 2008
23 // Author : Edward AGAPOV (eap)
24 //=============================================================================
26 #include "HYBRIDPlugin_Hypothesis.hxx"
28 #include <SMESHDS_Mesh.hxx>
30 #include <TopExp_Explorer.hxx>
34 #define getpid _getpid
39 struct GET_DEFAULT // struct used to get default value from GetOptionValue()
42 operator bool* () { return &isDefault; }
46 //=======================================================================
47 //function : HYBRIDPlugin_Hypothesis
48 //=======================================================================
50 HYBRIDPlugin_Hypothesis::HYBRIDPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
51 : SMESH_Hypothesis(hypId, gen),
52 myNbOfBoundaryLayers(DefaultNbOfBoundaryLayers()),
53 myHeightFirstLayer(DefaultHeightFirstLayer()),
54 myHeightIsRelative(DefaultHeightIsRelative()),
55 myBoundaryLayersGrowth(DefaultBoundaryLayersGrowth()),
56 myBoundaryLayersMaxElemAngle(DefaultBoundaryLayersMaxElemAngle()),
57 myBoundaryLayersProgression(DefaultBoundaryLayersProgression()),
58 myElementGeneration(DefaultElementGeneration()),
59 myCoreSize(DefaultCoreSize()),
60 myLayersOnAllWrap(DefaultLayersOnAllWrap()),
61 myCollisionMode(DefaultCollisionMode()),
62 myAddMultinormals(DefaultAddMultinormals()),
63 mySmoothNormals(DefaultSmoothNormals()),
64 myMultinormalsAngle(DefaultMultinormalsAngle()),
65 myGradation(DefaultGradation()),
66 myWorkingDirectory(DefaultWorkingDirectory()),
67 myVerboseLevel(DefaultVerboseLevel()),
68 myLogInStandardOutput(DefaultStandardOutputLog()),
69 myRemoveLogOnSuccess(DefaultRemoveLogOnSuccess()),
70 myKeepFiles(DefaultKeepFiles()),
71 myOptimizationLevel(DefaultOptimizationLevel()),
72 myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
73 myToMeshHoles(DefaultMeshHoles()),
76 myToCreateNewNodes(DefaultToCreateNewNodes()),
77 myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
78 myToUseFemCorrection(DefaultToUseFEMCorrection()),
79 myToRemoveCentralPoint(DefaultToRemoveCentralPoint())
81 _name = "HYBRID_Parameters";
84 const char* boolOptionNames[] = { "add_multinormals", // no
85 "smooth_normals", // no
88 const char* intOptionNames[] = { "max_number_of_threads", // 4
91 const char* doubleOptionNames[] = { //"global_physical_size", // 0.0 = not set -- myCoreSize
93 //"boundary_layer_max_element_angle", // 165.0 -- myBoundaryLayersMaxElemAngle
94 "multinormal_angle_threshold", // 30.0
97 const char* charOptionNames[] = { "collision_mode", // stop/decrease
102 while (boolOptionNames[i][0])
104 _boolOptions.insert( boolOptionNames[i] );
105 _option2value[boolOptionNames[i++]].clear();
108 while (intOptionNames[i][0])
109 _option2value[intOptionNames[i++]].clear();
112 while (doubleOptionNames[i][0]) {
113 _doubleOptions.insert(doubleOptionNames[i]);
114 _option2value[doubleOptionNames[i++]].clear();
117 while (charOptionNames[i][0]) {
118 _charOptions.insert(charOptionNames[i]);
119 _option2value[charOptionNames[i++]].clear();
122 // default values to be used while MG meshing
124 _defaultOptionValues["add_multinormals" ] = "no";
125 _defaultOptionValues["smooth_normals" ] = "no";
126 _defaultOptionValues["max_number_of_threads" ] = "4";
127 //_defaultOptionValues["global_physical_size" ] = "0";
128 _defaultOptionValues["gradation" ] = "2";
129 //_defaultOptionValues["boundary_layer_max_element_angle"] = "165";
130 _defaultOptionValues["multinormal_angle_threshold" ] = "30";
131 _defaultOptionValues["collision_mode" ] = "stop";
134 // check validity of option names of _defaultOptionValues
135 TOptionValues::iterator n2v = _defaultOptionValues.begin();
136 for ( ; n2v != _defaultOptionValues.end(); ++n2v )
137 ASSERT( _option2value.count( n2v->first ));
138 ASSERT( _option2value.size() == _defaultOptionValues.size() );
142 //=======================================================================
143 //function : SetHeightIsRelative
144 //=======================================================================
146 void HYBRIDPlugin_Hypothesis::SetHeightIsRelative(bool isRelative)
148 if ( myHeightIsRelative != isRelative ) {
149 myHeightIsRelative = isRelative;
150 NotifySubMeshesHypothesisModification();
154 //=======================================================================
155 //function : SetBoundaryLayersMaxElemAngle
156 //=======================================================================
158 void HYBRIDPlugin_Hypothesis::SetBoundaryLayersMaxElemAngle( double angle )
160 if ( myBoundaryLayersMaxElemAngle != angle ) {
161 myBoundaryLayersMaxElemAngle = angle;
162 NotifySubMeshesHypothesisModification();
167 //=======================================================================
168 //function : SetLayersOnAllWrap
169 //=======================================================================
171 void HYBRIDPlugin_Hypothesis::SetLayersOnAllWrap(bool toMesh)
173 if ( myLayersOnAllWrap != toMesh ) {
174 myLayersOnAllWrap = toMesh;
175 NotifySubMeshesHypothesisModification();
179 //=======================================================================
180 //function : GetLayersOnAllWrap
181 //=======================================================================
183 bool HYBRIDPlugin_Hypothesis::GetLayersOnAllWrap(bool /*checkFreeOption*/) const
185 return myLayersOnAllWrap;
188 //=======================================================================
189 //function : SetFacesWithLayers
190 //purpose : Set IDs of faces to grow the layers on
191 //=======================================================================
193 bool HYBRIDPlugin_Hypothesis::SetFacesWithLayers(const std::vector<int>& theVal)
195 if ( myFacesWithLayers != theVal )
197 myFacesWithLayers = theVal;
198 NotifySubMeshesHypothesisModification();
204 //=======================================================================
205 //function : GetFacesWithLayers
206 //purpose : Return IDs of faces to grow the layers on
207 //=======================================================================
209 const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithLayers() const
211 return myFacesWithLayers;
214 //=======================================================================
215 //function : SetFacesWithImprinting
216 //purpose : Set IDs of faces to grow the layers on
217 //=======================================================================
219 bool HYBRIDPlugin_Hypothesis::SetFacesWithImprinting(const std::vector<int>& theVal)
221 if ( myFacesWithImprinting != theVal )
223 myFacesWithImprinting = theVal;
224 NotifySubMeshesHypothesisModification();
230 //=======================================================================
231 //function : GetFacesWithImprinting
232 //purpose : Return IDs of faces to grow the layers on
233 //=======================================================================
235 const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithImprinting() const
237 return myFacesWithImprinting;
240 //=======================================================================
241 //function : SetFacesWithSnapping
242 //purpose : Set IDs of faces that already have surface layers
243 //=======================================================================
245 bool HYBRIDPlugin_Hypothesis::SetFacesWithSnapping(const std::vector<int>& theVal)
247 if ( myFacesWithSnapping != theVal )
249 myFacesWithSnapping = theVal;
250 NotifySubMeshesHypothesisModification();
256 //=======================================================================
257 //function : GetFacesWithSnapping
258 //purpose : Return IDs of faces that already have surface layers
259 //=======================================================================
261 const std::vector<int>& HYBRIDPlugin_Hypothesis::GetFacesWithSnapping() const
263 return myFacesWithSnapping;
266 //=======================================================================
267 //function : SetToMeshHoles
268 //=======================================================================
270 void HYBRIDPlugin_Hypothesis::SetToMeshHoles(bool toMesh)
272 if ( myToMeshHoles != toMesh ) {
273 myToMeshHoles = toMesh;
274 NotifySubMeshesHypothesisModification();
278 //=======================================================================
279 //function : GetToMeshHoles
280 //=======================================================================
282 bool HYBRIDPlugin_Hypothesis::GetToMeshHoles(bool /*checkFreeOption*/) const
284 return myToMeshHoles;
287 //=======================================================================
288 //function : SetToMakeGroupsOfDomains
289 //=======================================================================
291 void HYBRIDPlugin_Hypothesis::SetToMakeGroupsOfDomains(bool toMakeGroups)
293 if ( myToMakeGroupsOfDomains != toMakeGroups ) {
294 myToMakeGroupsOfDomains = toMakeGroups;
295 NotifySubMeshesHypothesisModification();
299 //=======================================================================
300 //function : GetToMakeGroupsOfDomains
301 //=======================================================================
303 bool HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains() const
305 return myToMakeGroupsOfDomains;
308 //=======================================================================
309 //function : GetToMakeGroupsOfDomains
310 //=======================================================================
312 bool HYBRIDPlugin_Hypothesis::GetToMakeGroupsOfDomains(const HYBRIDPlugin_Hypothesis* hyp)
315 if ( hyp ) res = /*hyp->GetToMeshHoles(true) &&*/ hyp->GetToMakeGroupsOfDomains();
316 else res = /*DefaultMeshHoles() &&*/ DefaultToMakeGroupsOfDomains();
320 //=======================================================================
321 //function : SetMaximumMemory
322 //=======================================================================
324 void HYBRIDPlugin_Hypothesis::SetMaximumMemory(double MB)
326 if ( myMaximumMemory != MB ) {
327 myMaximumMemory = MB;
328 NotifySubMeshesHypothesisModification();
332 //=======================================================================
333 //function : GetMaximumMemory
334 // * automatic memory adjustment mode. Default is zero
335 //=======================================================================
337 double HYBRIDPlugin_Hypothesis::GetMaximumMemory() const
339 return myMaximumMemory;
342 //=======================================================================
343 //function : SetInitialMemory
344 //=======================================================================
346 void HYBRIDPlugin_Hypothesis::SetInitialMemory(double MB)
348 if ( myInitialMemory != MB ) {
349 myInitialMemory = MB;
350 NotifySubMeshesHypothesisModification();
354 //=======================================================================
355 //function : GetInitialMemory
356 //=======================================================================
358 double HYBRIDPlugin_Hypothesis::GetInitialMemory() const
360 return myInitialMemory;
363 //=======================================================================
364 //function : SetOptimizationLevel
365 //=======================================================================
367 void HYBRIDPlugin_Hypothesis::SetOptimizationLevel(OptimizationLevel level)
369 if ( myOptimizationLevel != level ) {
370 myOptimizationLevel = level;
371 NotifySubMeshesHypothesisModification();
375 //=======================================================================
376 //function : GetOptimizationLevel
377 //=======================================================================
378 HYBRIDPlugin_Hypothesis::OptimizationLevel HYBRIDPlugin_Hypothesis::GetOptimizationLevel() const
380 return (OptimizationLevel) myOptimizationLevel;
383 //=======================================================================
384 //function : SetCollisionMode
385 //=======================================================================
386 void HYBRIDPlugin_Hypothesis::SetCollisionMode(CollisionMode mode)
388 SetOptionValue( "collision_mode", mode == Decrease ? "decrease" : "stop" );
389 myCollisionMode = mode;
392 //=======================================================================
393 //function : GetCollisionMode
394 //=======================================================================
395 HYBRIDPlugin_Hypothesis::CollisionMode HYBRIDPlugin_Hypothesis::GetCollisionMode() const
397 return (CollisionMode) myCollisionMode;
400 //=======================================================================
401 //function : SetBoundaryLayersGrowth
402 //=======================================================================
403 void HYBRIDPlugin_Hypothesis::SetBoundaryLayersGrowth(BoundaryLayersGrowth mode)
405 if ( myBoundaryLayersGrowth != mode ) {
406 myBoundaryLayersGrowth = mode;
407 NotifySubMeshesHypothesisModification();
411 //=======================================================================
412 //function : GetBoundaryLayersGrowth
413 //=======================================================================
414 HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth HYBRIDPlugin_Hypothesis::GetBoundaryLayersGrowth() const
416 return (BoundaryLayersGrowth) myBoundaryLayersGrowth;
419 //=======================================================================
420 //function : SetElementGeneration
421 //=======================================================================
422 void HYBRIDPlugin_Hypothesis::SetElementGeneration(ElementGeneration mode)
424 if ( myElementGeneration != mode ) {
425 myElementGeneration = mode;
426 NotifySubMeshesHypothesisModification();
430 //=======================================================================
431 //function : GetElementGeneration
432 //=======================================================================
433 HYBRIDPlugin_Hypothesis::ElementGeneration HYBRIDPlugin_Hypothesis::GetElementGeneration() const
435 return (ElementGeneration) myElementGeneration;
438 //=======================================================================
439 //function : SetAddMultinormals
440 //=======================================================================
441 void HYBRIDPlugin_Hypothesis::SetAddMultinormals(bool toAddMultinormals)
443 SetOptionValue( "add_multinormals", toAddMultinormals ? "yes" : "no" );
444 myAddMultinormals = toAddMultinormals;
447 //=======================================================================
448 //function : GetAddMultinormals
449 //=======================================================================
451 bool HYBRIDPlugin_Hypothesis::GetAddMultinormals() const
453 return myAddMultinormals;
456 //=======================================================================
457 //function : SetSmoothNormals
458 //=======================================================================
460 void HYBRIDPlugin_Hypothesis::SetSmoothNormals(bool toSmoothNormals)
462 SetOptionValue( "smooth_normals", toSmoothNormals ? "yes" : "no" );
463 mySmoothNormals = toSmoothNormals;
466 //=======================================================================
467 //function : GetSmoothNormals
468 //=======================================================================
470 bool HYBRIDPlugin_Hypothesis::GetSmoothNormals() const
472 return mySmoothNormals;
475 //=======================================================================
476 //function : SetHeightFirstLayer
477 //=======================================================================
479 void HYBRIDPlugin_Hypothesis::SetHeightFirstLayer(double toHeightFirstLayer)
481 if ( myHeightFirstLayer != toHeightFirstLayer ) {
482 myHeightFirstLayer = toHeightFirstLayer;
483 NotifySubMeshesHypothesisModification();
487 //=======================================================================
488 //function : GetHeightFirstLayer
489 //=======================================================================
491 double HYBRIDPlugin_Hypothesis::GetHeightFirstLayer() const
493 return myHeightFirstLayer;
496 //=======================================================================
497 //function : SetBoundaryLayersProgression
498 //=======================================================================
500 void HYBRIDPlugin_Hypothesis::SetBoundaryLayersProgression(double toBoundaryLayersProgression)
502 if ( myBoundaryLayersProgression != toBoundaryLayersProgression ) {
503 myBoundaryLayersProgression = toBoundaryLayersProgression;
504 NotifySubMeshesHypothesisModification();
508 //=======================================================================
509 //function : GetBoundaryLayersProgression
510 //=======================================================================
512 double HYBRIDPlugin_Hypothesis::GetBoundaryLayersProgression() const
514 return myBoundaryLayersProgression;
517 //=======================================================================
518 //function : SetCoreSize
519 //=======================================================================
521 void HYBRIDPlugin_Hypothesis::SetCoreSize(double toCoreSize)
523 if ( myCoreSize != toCoreSize ) {
524 myCoreSize = toCoreSize;
525 NotifySubMeshesHypothesisModification();
529 //=======================================================================
530 //function : GetCoreSize
531 //=======================================================================
533 double HYBRIDPlugin_Hypothesis::GetCoreSize() const
538 //=======================================================================
539 //function : SetMultinormalsAngle
540 //=======================================================================
542 void HYBRIDPlugin_Hypothesis::SetMultinormalsAngle(double toMultinormalsAngle)
544 SetOptionValue( "multinormal_angle_threshold", SMESH_Comment( toMultinormalsAngle ));
545 myMultinormalsAngle = toMultinormalsAngle;
548 //=======================================================================
549 //function : GetMultinormalsAngle
550 //=======================================================================
552 double HYBRIDPlugin_Hypothesis::GetMultinormalsAngle() const
554 return myMultinormalsAngle;
557 //=======================================================================
558 //function : SetNbOfBoundaryLayers
559 //=======================================================================
561 void HYBRIDPlugin_Hypothesis::SetNbOfBoundaryLayers(short toNbOfBoundaryLayers)
563 if ( myNbOfBoundaryLayers != toNbOfBoundaryLayers ) {
564 myNbOfBoundaryLayers = toNbOfBoundaryLayers;
565 NotifySubMeshesHypothesisModification();
569 //=======================================================================
570 //function : GetCoreSize
571 //=======================================================================
573 short HYBRIDPlugin_Hypothesis::GetNbOfBoundaryLayers() const
575 return myNbOfBoundaryLayers;
579 /////////////////////////////////////////////////////////////////////////
582 //=======================================================================
583 //function : SetWorkingDirectory
584 //=======================================================================
586 void HYBRIDPlugin_Hypothesis::SetWorkingDirectory(const std::string& path)
588 if ( myWorkingDirectory != path ) {
589 myWorkingDirectory = path;
590 NotifySubMeshesHypothesisModification();
594 //=======================================================================
595 //function : GetWorkingDirectory
596 //=======================================================================
598 std::string HYBRIDPlugin_Hypothesis::GetWorkingDirectory() const
600 return myWorkingDirectory;
603 //=======================================================================
604 //function : SetKeepFiles
605 //=======================================================================
607 void HYBRIDPlugin_Hypothesis::SetKeepFiles(bool toKeep)
609 if ( myKeepFiles != toKeep ) {
610 myKeepFiles = toKeep;
611 NotifySubMeshesHypothesisModification();
615 //=======================================================================
616 //function : GetKeepFiles
617 //=======================================================================
619 bool HYBRIDPlugin_Hypothesis::GetKeepFiles() const
624 //=======================================================================
625 //function : SetVerboseLevel
626 //=======================================================================
628 void HYBRIDPlugin_Hypothesis::SetVerboseLevel(short level)
630 if ( myVerboseLevel != level ) {
631 myVerboseLevel = level;
632 NotifySubMeshesHypothesisModification();
636 //=======================================================================
637 //function : GetVerboseLevel
638 //=======================================================================
640 short HYBRIDPlugin_Hypothesis::GetVerboseLevel() const
642 return myVerboseLevel;
645 //=======================================================================
646 //function : SetToCreateNewNodes
647 //=======================================================================
649 void HYBRIDPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate)
651 if ( myToCreateNewNodes != toCreate ) {
652 myToCreateNewNodes = toCreate;
653 NotifySubMeshesHypothesisModification();
657 //=======================================================================
658 //function : GetToCreateNewNodes
659 //=======================================================================
661 bool HYBRIDPlugin_Hypothesis::GetToCreateNewNodes() const
663 return myToCreateNewNodes;
666 //=======================================================================
667 //function : SetToUseBoundaryRecoveryVersion
668 //=======================================================================
670 void HYBRIDPlugin_Hypothesis::SetToUseBoundaryRecoveryVersion(bool toUse)
672 if ( myToUseBoundaryRecoveryVersion != toUse ) {
673 myToUseBoundaryRecoveryVersion = toUse;
674 NotifySubMeshesHypothesisModification();
678 //=======================================================================
679 //function : GetToUseBoundaryRecoveryVersion
680 //=======================================================================
682 bool HYBRIDPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const
684 return myToUseBoundaryRecoveryVersion;
687 //=======================================================================
688 //function : SetFEMCorrection
689 //=======================================================================
691 void HYBRIDPlugin_Hypothesis::SetFEMCorrection(bool toUseFem)
693 if ( myToUseFemCorrection != toUseFem ) {
694 myToUseFemCorrection = toUseFem;
695 NotifySubMeshesHypothesisModification();
699 //=======================================================================
700 //function : GetFEMCorrection
701 //=======================================================================
703 bool HYBRIDPlugin_Hypothesis::GetFEMCorrection() const
705 return myToUseFemCorrection;
708 //=======================================================================
709 //function : SetToRemoveCentralPoint
710 //=======================================================================
712 void HYBRIDPlugin_Hypothesis::SetToRemoveCentralPoint(bool toRemove)
714 if ( myToRemoveCentralPoint != toRemove ) {
715 myToRemoveCentralPoint = toRemove;
716 NotifySubMeshesHypothesisModification();
720 //=======================================================================
721 //function : GetToRemoveCentralPoint
722 //=======================================================================
724 bool HYBRIDPlugin_Hypothesis::GetToRemoveCentralPoint() const
726 return myToRemoveCentralPoint;
729 //=======================================================================
730 //function : SetAdvancedOption
731 //=======================================================================
733 void HYBRIDPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
735 size_t wsPos = option.find(' ');
736 if ( wsPos == std::string::npos )
738 SetOptionValue( option, "" );
742 std::string opt( option, 0, wsPos );
743 std::string val( option, wsPos + 1 );
744 SetOptionValue( opt, val );
748 //=======================================================================
749 //function : GetAdvancedOption
750 //=======================================================================
752 std::string HYBRIDPlugin_Hypothesis::GetAdvancedOption() const
756 TOptionValues::const_iterator o2v = _option2value.begin();
757 for ( ; o2v != _option2value.end(); ++o2v )
758 if ( !o2v->second.empty() )
762 txt << o2v->first << " " << o2v->second;
764 for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
768 txt << o2v->first << " " << o2v->second;
773 //=======================================================================
774 //function : SetGradation
775 //=======================================================================
777 void HYBRIDPlugin_Hypothesis::SetGradation(double gradation)
779 SetOptionValue( "gradation", SMESH_Comment( gradation ));
780 myGradation = gradation;
783 //=======================================================================
784 //function : GetGradation
785 //=======================================================================
787 double HYBRIDPlugin_Hypothesis::GetGradation() const
792 //=======================================================================
793 //function : SetStandardOutputLog
794 //=======================================================================
796 void HYBRIDPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
798 if ( myLogInStandardOutput != logInStandardOutput ) {
799 myLogInStandardOutput = logInStandardOutput;
800 NotifySubMeshesHypothesisModification();
804 //=======================================================================
805 //function : GetStandardOutputLog
806 //=======================================================================
808 bool HYBRIDPlugin_Hypothesis::GetStandardOutputLog() const
810 return myLogInStandardOutput;
813 //=======================================================================
814 //function : SetRemoveLogOnSuccess
815 //=======================================================================
817 void HYBRIDPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
819 if ( myRemoveLogOnSuccess != removeLogOnSuccess ) {
820 myRemoveLogOnSuccess = removeLogOnSuccess;
821 NotifySubMeshesHypothesisModification();
825 //=======================================================================
826 //function : GetRemoveLogOnSuccess
827 //=======================================================================
829 bool HYBRIDPlugin_Hypothesis::GetRemoveLogOnSuccess() const
831 return myRemoveLogOnSuccess;
834 //=======================================================================
835 //function : SetEnforcedVertex
836 //=======================================================================
838 bool HYBRIDPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName,
839 double size, double x, double y, double z, bool isCompound)
841 bool toNotify = false;
842 bool toCreate = true;
844 THYBRIDEnforcedVertex *oldEnVertex;
845 THYBRIDEnforcedVertex *newEnfVertex = new THYBRIDEnforcedVertex();
846 newEnfVertex->name = theName;
847 newEnfVertex->geomEntry = theEntry;
848 newEnfVertex->coords.clear();
850 newEnfVertex->coords.push_back(x);
851 newEnfVertex->coords.push_back(y);
852 newEnfVertex->coords.push_back(z);
854 newEnfVertex->groupName = theGroupName;
855 newEnfVertex->size = size;
856 newEnfVertex->isCompound = isCompound;
859 // update _enfVertexList
860 THYBRIDEnforcedVertexList::iterator it = _enfVertexList.find(newEnfVertex);
861 if (it != _enfVertexList.end()) {
864 if (oldEnVertex->name != theName) {
865 oldEnVertex->name = theName;
868 if (oldEnVertex->groupName != theGroupName) {
869 oldEnVertex->groupName = theGroupName;
872 if (oldEnVertex->size != size) {
873 oldEnVertex->size = size;
877 // update map coords / enf vertex if needed
878 if (oldEnVertex->coords.size()) {
879 _coordsEnfVertexMap[oldEnVertex->coords] = oldEnVertex;
880 _enfVertexCoordsSizeList[oldEnVertex->coords] = size;
883 // update map geom entry / enf vertex if needed
884 if (oldEnVertex->geomEntry != "") {
885 _geomEntryEnfVertexMap[oldEnVertex->geomEntry] = oldEnVertex;
886 _enfVertexEntrySizeList[oldEnVertex->geomEntry] = size;
891 // //////// CREATE ////////////
894 _enfVertexList.insert(newEnfVertex);
895 if (theEntry == "") {
896 _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
897 _enfVertexCoordsSizeList[newEnfVertex->coords] = size;
900 _geomEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
901 _enfVertexEntrySizeList[newEnfVertex->geomEntry] = size;
906 NotifySubMeshesHypothesisModification();
912 //=======================================================================
913 //function : SetEnforcedMesh
914 //=======================================================================
915 bool HYBRIDPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
917 TIDSortedElemSet theElemSet;
918 SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
919 while ( eIt->more() )
920 theElemSet.insert( eIt->next() );
921 bool added = SetEnforcedElements( theElemSet, elementType, groupName);
923 THYBRIDEnforcedMesh* newEnfMesh = new THYBRIDEnforcedMesh();
924 newEnfMesh->persistID = theMesh.GetMeshDS()->GetPersistentId();
925 newEnfMesh->name = name;
926 newEnfMesh->entry = entry;
927 newEnfMesh->elementType = elementType;
928 newEnfMesh->groupName = groupName;
930 THYBRIDEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
931 if (it == _enfMeshList.end()) {
932 _entryEnfMeshMap[entry].insert(newEnfMesh);
933 _enfMeshList.insert(newEnfMesh);
942 //=======================================================================
943 //function : SetEnforcedGroup
944 //=======================================================================
945 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)
947 TIDSortedElemSet theElemSet;
948 if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
949 for ( CORBA::ULong i = 0; i < theIDs->length(); i++) {
950 CORBA::Long ind = theIDs[i];
951 if (elementType == SMESH::NODE)
953 const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
955 theElemSet.insert( node );
959 const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
961 theElemSet.insert( elem );
965 // SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
966 // while ( it->more() )
967 // theElemSet.insert( it->next() );
969 bool added = SetEnforcedElements( theElemSet, elementType, groupName);
971 THYBRIDEnforcedMesh* newEnfMesh = new THYBRIDEnforcedMesh();
972 newEnfMesh->name = name;
973 newEnfMesh->entry = entry;
974 newEnfMesh->elementType = elementType;
975 newEnfMesh->groupName = groupName;
977 THYBRIDEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
978 if (it == _enfMeshList.end()) {
979 _entryEnfMeshMap[entry].insert(newEnfMesh);
980 _enfMeshList.insert(newEnfMesh);
986 //=======================================================================
987 //function : SetEnforcedElements
988 //=======================================================================
989 bool HYBRIDPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
991 TIDSortedElemSet::const_iterator it = theElemSet.begin();
992 const SMDS_MeshElement* elem;
993 const SMDS_MeshNode* node;
995 std::pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
996 std::pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
998 for (;it != theElemSet.end();++it)
1001 switch (elementType) {
1003 node = dynamic_cast<const SMDS_MeshNode*>(elem);
1005 nodeRet = _enfNodes.insert(make_pair(node,groupName));
1006 added = added && nodeRet.second;
1007 std::string msg = added ? "yes":"no";
1010 SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
1011 for (;nodeIt->more();) {
1012 node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
1013 nodeRet = _enfNodes.insert(make_pair(node,groupName));
1014 added = added && nodeRet.second;
1020 if (elem->GetType() == SMDSAbs_Edge) {
1021 elemRet = _enfEdges.insert(make_pair(elem,groupName));
1022 added = added && elemRet.second;
1026 if (elem->GetType() == SMDSAbs_Face)
1028 if (elem->NbCornerNodes() == 3) {
1029 elemRet = _enfTriangles.insert(make_pair(elem,groupName));
1030 added = added && elemRet.second;
1039 NotifySubMeshesHypothesisModification();
1044 //=======================================================================
1045 //function : GetEnforcedVertex
1046 //=======================================================================
1048 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* HYBRIDPlugin_Hypothesis::GetEnforcedVertex(double x, double y, double z)
1050 std::vector<double> coord(3);
1054 if (_coordsEnfVertexMap.count(coord)>0)
1055 return _coordsEnfVertexMap[coord];
1056 std::ostringstream msg ;
1057 msg << "No enforced vertex at " << x << ", " << y << ", " << z;
1058 throw std::invalid_argument(msg.str());
1061 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* HYBRIDPlugin_Hypothesis::GetEnforcedVertex(const std::string theEntry)
1063 if (_geomEntryEnfVertexMap.count(theEntry)>0)
1064 return _geomEntryEnfVertexMap[theEntry];
1066 std::ostringstream msg ;
1067 msg << "No enforced vertex with entry " << theEntry;
1068 throw std::invalid_argument(msg.str());
1071 //=======================================================================
1072 //function : RemoveEnforcedVertex
1073 //=======================================================================
1075 bool HYBRIDPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, const std::string theEntry)
1077 bool toNotify = false;
1078 std::ostringstream msg;
1079 THYBRIDEnforcedVertex *oldEnfVertex;
1080 std::vector<double> coords(3);
1085 // check that enf vertex with given enf vertex entry exists
1086 TGeomEntryHYBRIDEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry);
1087 if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) {
1089 oldEnfVertex = it_enfVertexEntry->second;
1090 _geomEntryEnfVertexMap.erase(it_enfVertexEntry);
1093 // check that enf vertex with given coords exists
1094 TCoordsHYBRIDEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
1095 if (it_coords_enf != _coordsEnfVertexMap.end()) {
1097 oldEnfVertex = it_coords_enf->second;
1098 _coordsEnfVertexMap.erase(it_coords_enf);
1099 _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords));
1102 throw std::invalid_argument(msg.str());
1107 // update _enfVertexList
1108 THYBRIDEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
1109 if (it != _enfVertexList.end()) {
1110 if ((*it)->groupName != "")
1111 _groupsToRemove.insert((*it)->groupName);
1112 _enfVertexList.erase(it);
1117 NotifySubMeshesHypothesisModification();
1122 //=======================================================================
1123 //function : ClearEnforcedVertices
1124 //=======================================================================
1125 void HYBRIDPlugin_Hypothesis::ClearEnforcedVertices()
1127 THYBRIDEnforcedVertexList::const_iterator it = _enfVertexList.begin();
1128 for(;it != _enfVertexList.end();++it) {
1129 if ((*it)->groupName != "")
1130 _groupsToRemove.insert((*it)->groupName);
1132 _enfVertexList.clear();
1133 _coordsEnfVertexMap.clear();
1134 _geomEntryEnfVertexMap.clear();
1135 _enfVertexCoordsSizeList.clear();
1136 _enfVertexEntrySizeList.clear();
1137 NotifySubMeshesHypothesisModification();
1140 //=======================================================================
1141 //function : ClearEnforcedMeshes
1142 //=======================================================================
1143 void HYBRIDPlugin_Hypothesis::ClearEnforcedMeshes()
1145 THYBRIDEnforcedMeshList::const_iterator it = _enfMeshList.begin();
1146 for(;it != _enfMeshList.end();++it) {
1147 if ((*it)->groupName != "")
1148 _groupsToRemove.insert((*it)->groupName);
1152 _enfTriangles.clear();
1153 _nodeIDToSizeMap.clear();
1154 _enfMeshList.clear();
1155 _entryEnfMeshMap.clear();
1156 NotifySubMeshesHypothesisModification();
1159 //================================================================================
1161 * \brief At mesh loading, restore enforced elements by just loaded enforced meshes
1163 //================================================================================
1165 void HYBRIDPlugin_Hypothesis::RestoreEnfElemsByMeshes()
1167 THYBRIDEnforcedMeshList::const_iterator it = _enfMeshList.begin();
1168 for(;it != _enfMeshList.end();++it) {
1169 THYBRIDEnforcedMesh* enfMesh = *it;
1170 if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
1171 SetEnforcedMesh( *mesh,
1172 enfMesh->elementType,
1175 enfMesh->groupName );
1176 enfMesh->persistID = -1; // not to restore again
1180 //=======================================================================
1181 //function : SetGroupsToRemove
1182 //=======================================================================
1184 void HYBRIDPlugin_Hypothesis::ClearGroupsToRemove()
1186 _groupsToRemove.clear();
1190 //=======================================================================
1191 //function : DefaultLayersOnAllWrap
1192 //=======================================================================
1194 bool HYBRIDPlugin_Hypothesis::DefaultLayersOnAllWrap()
1199 //=======================================================================
1200 //function : DefaultMeshHoles
1201 //=======================================================================
1203 bool HYBRIDPlugin_Hypothesis::DefaultMeshHoles()
1205 return false; // PAL19680
1208 //=======================================================================
1209 //function : DefaultToMakeGroupsOfDomains
1210 //=======================================================================
1212 bool HYBRIDPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
1214 return false; // issue 0022172
1217 //=======================================================================
1218 //function : DefaultMaximumMemory
1219 //=======================================================================
1222 #include <windows.h>
1223 #elif !defined(__APPLE__)
1224 #include <sys/sysinfo.h>
1227 double HYBRIDPlugin_Hypothesis::DefaultMaximumMemory()
1230 // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
1231 MEMORYSTATUSEX statex;
1232 statex.dwLength = sizeof (statex);
1233 int err = GlobalMemoryStatusEx (&statex);
1236 statex.ullTotalPhys / 1024 / 1024 +
1237 statex.ullTotalPageFile / 1024 / 1024 +
1238 statex.ullTotalVirtual / 1024 / 1024;
1239 return ( 0.7 * totMB );
1241 #elif !defined(__APPLE__)
1243 int err = sysinfo( &si );
1245 int ramMB = si.totalram * si.mem_unit / 1024 / 1024;
1246 return ( 0.7 * ramMB );
1252 //=======================================================================
1253 //function : DefaultInitialMemory
1254 //=======================================================================
1256 double HYBRIDPlugin_Hypothesis::DefaultInitialMemory()
1258 return DefaultMaximumMemory();
1261 //=======================================================================
1262 //function : DefaultCollisionMode
1263 //=======================================================================
1264 short HYBRIDPlugin_Hypothesis::DefaultCollisionMode()
1269 //=======================================================================
1270 //function : DefaultBoundaryLayersGrowth
1271 //=======================================================================
1272 short HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersGrowth()
1274 return Layer_Growth_Inward;
1277 //=======================================================================
1278 //function : DefaultElementGeneration
1279 //=======================================================================
1280 short HYBRIDPlugin_Hypothesis::DefaultElementGeneration()
1282 return Generation_Tetra_Dominant;
1285 //=======================================================================
1286 //function : DefaultOptimizationLevel
1287 //=======================================================================
1288 short HYBRIDPlugin_Hypothesis::DefaultOptimizationLevel()
1293 //=======================================================================
1294 //function : DefaultWorkingDirectory
1295 //=======================================================================
1297 std::string HYBRIDPlugin_Hypothesis::DefaultWorkingDirectory()
1299 std::string aTmpDir;
1301 char *Tmp_dir = getenv("SALOME_TMP_DIR");
1302 if(Tmp_dir != NULL) {
1315 //=======================================================================
1316 //function : DefaultKeepFiles
1317 //=======================================================================
1319 bool HYBRIDPlugin_Hypothesis::DefaultKeepFiles()
1324 //=======================================================================
1325 //function : DefaultRemoveLogOnSuccess
1326 //=======================================================================
1328 bool HYBRIDPlugin_Hypothesis::DefaultRemoveLogOnSuccess()
1334 //=======================================================================
1335 //function : DefaultVerboseLevel
1336 //=======================================================================
1338 short HYBRIDPlugin_Hypothesis::DefaultVerboseLevel()
1343 //=======================================================================
1344 //function : DefaultToCreateNewNodes
1345 //=======================================================================
1347 bool HYBRIDPlugin_Hypothesis::DefaultToCreateNewNodes()
1352 //=======================================================================
1353 //function : DefaultToUseBoundaryRecoveryVersion
1354 //=======================================================================
1356 bool HYBRIDPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion()
1361 //=======================================================================
1362 //function : DefaultToUseFEMCorrection
1363 //=======================================================================
1365 bool HYBRIDPlugin_Hypothesis::DefaultToUseFEMCorrection()
1370 //=======================================================================
1371 //function : DefaultToRemoveCentralPoint
1372 //=======================================================================
1374 bool HYBRIDPlugin_Hypothesis::DefaultToRemoveCentralPoint()
1379 //=======================================================================
1380 //function : DefaultGradation
1381 //=======================================================================
1383 double HYBRIDPlugin_Hypothesis::DefaultGradation()
1388 //=======================================================================
1389 //function : DefaultStandardOutputLog
1390 //=======================================================================
1392 bool HYBRIDPlugin_Hypothesis::DefaultStandardOutputLog()
1397 // //=======================================================================
1398 // //function : DefaultID2SizeMap
1399 // //=======================================================================
1401 // HYBRIDPlugin_Hypothesis::TID2SizeMap HYBRIDPlugin_Hypothesis::DefaultID2SizeMap()
1403 // return HYBRIDPlugin_Hypothesis::TID2SizeMap();
1406 //=======================================================================
1407 //function : DefaultAddMultinormals
1408 //=======================================================================
1409 bool HYBRIDPlugin_Hypothesis::DefaultAddMultinormals()
1414 //=======================================================================
1415 //function : DefaultSmoothNormals
1416 //=======================================================================
1417 bool HYBRIDPlugin_Hypothesis::DefaultSmoothNormals()
1422 //=======================================================================
1423 //function : DefaultHeightFirstLayer
1424 //=======================================================================
1425 double HYBRIDPlugin_Hypothesis::DefaultHeightFirstLayer()
1427 return 0.0; //or epsilon?
1430 //=======================================================================
1431 //function : DefaultBoundaryLayersProgression
1432 //=======================================================================
1433 double HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersProgression()
1438 //=======================================================================
1439 //function : DefaultCoreSize
1440 //=======================================================================
1441 double HYBRIDPlugin_Hypothesis::DefaultCoreSize()
1446 //=======================================================================
1447 //function : DefaultMultinormalsAngle
1448 //=======================================================================
1449 double HYBRIDPlugin_Hypothesis::DefaultMultinormalsAngle()
1454 //=======================================================================
1455 //function : DefaultNbOfBoundaryLayers
1456 //=======================================================================
1457 short HYBRIDPlugin_Hypothesis::DefaultNbOfBoundaryLayers()
1462 //=======================================================================
1464 //=======================================================================
1466 std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
1468 save << (int) myBoundaryLayersGrowth << " ";
1469 save << (int) myElementGeneration << " ";
1470 save << (int) myAddMultinormals << " ";
1471 save << (int) mySmoothNormals << " ";
1472 save << (int) myLayersOnAllWrap << " ";
1474 save << myNbOfBoundaryLayers << " ";
1475 save << myHeightFirstLayer << " ";
1476 save << myBoundaryLayersProgression << " ";
1477 save << myMultinormalsAngle << " ";
1479 save << (int) myKeepFiles << " ";
1480 save << myWorkingDirectory << " ";
1481 save << myVerboseLevel << " ";
1482 save << myCoreSize << " ";
1484 // if (!myTextOption.empty()) {
1485 // save << "__OPTIONS_BEGIN__ ";
1486 // save << myTextOption << " ";
1487 // save << "__OPTIONS_END__ ";
1491 THYBRIDEnforcedVertexList::iterator it = _enfVertexList.begin();
1492 if (it != _enfVertexList.end()) {
1493 save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
1494 for ( ; it != _enfVertexList.end(); ++it ) {
1495 THYBRIDEnforcedVertex *enfVertex = (*it);
1496 save << " " << "__BEGIN_VERTEX__";
1497 if (!enfVertex->name.empty()) {
1498 save << " " << "__BEGIN_NAME__";
1499 save << " " << enfVertex->name;
1500 save << " " << "__END_NAME__";
1502 if (!enfVertex->geomEntry.empty()) {
1503 save << " " << "__BEGIN_ENTRY__";
1504 save << " " << enfVertex->geomEntry;
1505 save << " " << enfVertex->isCompound;
1506 save << " " << "__END_ENTRY__";
1508 if (!enfVertex->groupName.empty()) {
1509 save << " " << "__BEGIN_GROUP__";
1510 save << " " << enfVertex->groupName;
1511 save << " " << "__END_GROUP__";
1513 if (enfVertex->coords.size()) {
1514 save << " " << "__BEGIN_COORDS__";
1515 for ( size_t i = 0; i < enfVertex->coords.size(); i++ )
1516 save << " " << enfVertex->coords[i];
1517 save << " " << "__END_COORDS__";
1519 save << " " << "__BEGIN_SIZE__";
1520 save << " " << enfVertex->size;
1521 save << " " << "__END_SIZE__";
1522 save << " " << "__END_VERTEX__";
1524 save << " " << "__ENFORCED_VERTICES_END__ ";
1527 THYBRIDEnforcedMeshList::iterator it_mesh = _enfMeshList.begin();
1528 if (it_mesh != _enfMeshList.end()) {
1529 save << " " << "__ENFORCED_MESHES_BEGIN__ ";
1530 for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
1531 THYBRIDEnforcedMesh *enfMesh = (*it_mesh);
1532 save << " " << "__BEGIN_ENF_MESH__";
1534 save << " " << "__BEGIN_NAME__";
1535 save << " " << enfMesh->name;
1536 save << " " << "__END_NAME__";
1538 save << " " << "__BEGIN_ENTRY__";
1539 save << " " << enfMesh->entry;
1540 save << " " << "__END_ENTRY__";
1542 save << " " << "__BEGIN_ELEM_TYPE__";
1543 save << " " << (int)enfMesh->elementType;
1544 save << " " << "__END_ELEM_TYPE__";
1546 if (!enfMesh->groupName.empty()) {
1547 save << " " << "__BEGIN_GROUP__";
1548 save << " " << enfMesh->groupName;
1549 save << " " << "__END_GROUP__";
1551 save << " " << "__PERSIST_ID__";
1552 save << " " << enfMesh->persistID;
1553 save << " " << "__END_ENF_MESH__";
1554 std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
1556 save << " " << "__ENFORCED_MESHES_END__ ";
1559 save << " " << myFacesWithLayers.size();
1560 for ( size_t i = 0; i < myFacesWithLayers.size(); ++i )
1561 save << " " << myFacesWithLayers[i];
1563 save << " " << myFacesWithImprinting.size();
1564 for ( size_t i = 0; i < myFacesWithImprinting.size(); ++i )
1565 save << " " << myFacesWithImprinting[i];
1567 save << " " << myFacesWithSnapping.size();
1568 for ( size_t i = 0; i < myFacesWithSnapping.size(); ++i )
1569 save << " " << myFacesWithSnapping[i];
1571 // New options in 2.9.6 (issue #17784)
1573 save << " " << myHeightIsRelative;
1574 save << " " << myBoundaryLayersMaxElemAngle;
1575 save << " " << myCollisionMode;
1576 save << " " << myGradation;
1577 save << " " << myOptimizationLevel;
1579 save << " " << _option2value.size();
1580 TOptionValues::iterator o2v = _option2value.begin();
1581 for ( ; o2v != _option2value.end(); ++o2v )
1582 save << " -" << o2v->first << " -" << o2v->second;
1584 save << " " << _customOption2value.size();
1585 for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
1586 save << " -" << o2v->first << " -" << o2v->second;
1591 //=======================================================================
1592 //function : LoadFrom
1593 //=======================================================================
1595 std::istream & HYBRIDPlugin_Hypothesis::LoadFrom(std::istream & load)
1601 isOK = static_cast<bool>(load >> i);
1603 myBoundaryLayersGrowth = (short) i;
1605 load.clear(ios::badbit | load.rdstate());
1607 isOK = static_cast<bool>(load >> i);
1609 myElementGeneration = (short) i;
1611 load.clear(ios::badbit | load.rdstate());
1613 isOK = static_cast<bool>(load >> i);
1615 myAddMultinormals = (bool) i;
1617 load.clear(ios::badbit | load.rdstate());
1619 isOK = static_cast<bool>(load >> i);
1621 mySmoothNormals = (bool) i;
1623 load.clear(ios::badbit | load.rdstate());
1625 isOK = static_cast<bool>(load >> i);
1627 myLayersOnAllWrap = (bool) i;
1629 load.clear(ios::badbit | load.rdstate());
1631 isOK = static_cast<bool>(load >> i);
1633 myNbOfBoundaryLayers = (short) i;
1635 load.clear(ios::badbit | load.rdstate());
1637 isOK = static_cast<bool>(load >> d);
1639 myHeightFirstLayer = d;
1641 load.clear(ios::badbit | load.rdstate());
1643 isOK = static_cast<bool>(load >> d);
1645 myBoundaryLayersProgression = d;
1647 load.clear(ios::badbit | load.rdstate());
1649 isOK = static_cast<bool>(load >> d);
1651 myMultinormalsAngle = d;
1653 load.clear(ios::badbit | load.rdstate());
1655 isOK = static_cast<bool>(load >> i);
1657 myKeepFiles = (bool) i;
1659 load.clear(ios::badbit | load.rdstate());
1661 isOK = static_cast<bool>(load >> myWorkingDirectory);
1663 if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
1664 myKeepFiles = false;
1665 myWorkingDirectory.clear();
1667 else if ( myWorkingDirectory == "1" ) {
1669 myWorkingDirectory.clear();
1673 load.clear(ios::badbit | load.rdstate());
1675 isOK = static_cast<bool>(load >> i);
1677 myVerboseLevel = (short) i;
1679 load.clear(ios::badbit | load.rdstate());
1681 isOK = static_cast<bool>(load >> d);
1685 load.clear(ios::badbit | load.rdstate());
1687 std::string separator;
1688 bool hasOptions = false;
1689 bool hasEnforcedVertices = false;
1690 bool hasEnforcedMeshes = false;
1691 isOK = static_cast<bool>(load >> separator);
1694 if (separator == "__OPTIONS_BEGIN__")
1696 else if (separator == "__ENFORCED_VERTICES_BEGIN__")
1697 hasEnforcedVertices = true;
1698 else if (separator == "__ENFORCED_MESHES_BEGIN__")
1699 hasEnforcedMeshes = true;
1705 isOK = static_cast<bool>(load >> txt);
1707 if (txt == "__OPTIONS_END__") {
1711 // myTextOption += txt;
1717 isOK = static_cast<bool>(load >> separator);
1718 if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
1719 hasEnforcedVertices = true;
1720 if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
1721 hasEnforcedMeshes = true;
1724 if (hasEnforcedVertices) {
1725 std::string txt, name, entry, groupName;
1726 double size, coords[3];
1728 bool hasCoords = false;
1729 isOK = static_cast<bool>(load >> txt); // __BEGIN_VERTEX__
1731 if (txt == "__ENFORCED_VERTICES_END__")
1734 THYBRIDEnforcedVertex *enfVertex = new THYBRIDEnforcedVertex();
1736 isOK = static_cast<bool>(load >> txt);
1737 if (txt == "__END_VERTEX__") {
1738 enfVertex->name = name;
1739 enfVertex->geomEntry = entry;
1740 enfVertex->isCompound = isCompound;
1741 enfVertex->groupName = groupName;
1742 enfVertex->coords.clear();
1744 enfVertex->coords.assign(coords,coords+3);
1746 _enfVertexList.insert(enfVertex);
1748 if (enfVertex->coords.size())
1749 _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
1750 if (!enfVertex->geomEntry.empty())
1751 _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
1760 if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
1761 while (isOK && (txt != "__END_NAME__")) {
1762 isOK = static_cast<bool>(load >> txt);
1763 if (txt != "__END_NAME__") {
1771 if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
1772 isOK = static_cast<bool>(load >> entry);
1773 isOK = static_cast<bool>(load >> isCompound);
1774 isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1775 if (txt != "__END_ENTRY__")
1776 throw std::exception();
1779 if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
1780 while (isOK && (txt != "__END_GROUP__")) {
1781 isOK = static_cast<bool>(load >> txt);
1782 if (txt != "__END_GROUP__") {
1783 if (!groupName.empty())
1790 if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
1792 isOK = static_cast<bool>(load >> coords[0] >> coords[1] >> coords[2]);
1793 isOK = static_cast<bool>(load >> txt); // __END_COORDS__
1794 if (txt != "__END_COORDS__")
1795 throw std::exception();
1798 if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
1799 isOK = static_cast<bool>(load >> size);
1800 isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1801 if (txt != "__END_SIZE__") {
1802 throw std::exception();
1806 isOK = static_cast<bool>(load >> txt); // __BEGIN_VERTEX__
1810 if (hasEnforcedVertices) {
1811 isOK = static_cast<bool>(load >> separator);
1812 if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
1813 hasEnforcedMeshes = true;
1816 if (hasEnforcedMeshes) {
1817 std::string txt, name, entry, groupName;
1818 int elementType = -1, persistID = -1;
1819 isOK = static_cast<bool>(load >> txt); // __BEGIN_ENF_MESH__
1822 if (txt == "__ENFORCED_MESHES_END__")
1825 THYBRIDEnforcedMesh *enfMesh = new THYBRIDEnforcedMesh();
1827 isOK = static_cast<bool>(load >> txt);
1828 if (txt == "__END_ENF_MESH__") {
1829 enfMesh->name = name;
1830 enfMesh->entry = entry;
1831 enfMesh->elementType = (SMESH::ElementType)elementType;
1832 enfMesh->groupName = groupName;
1833 enfMesh->persistID = persistID;
1835 _enfMeshList.insert(enfMesh);
1836 std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
1846 if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
1847 while (isOK && (txt != "__END_NAME__")) {
1848 isOK = static_cast<bool>(load >> txt);
1849 if (txt != "__END_NAME__") {
1857 if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
1858 isOK = static_cast<bool>(load >> entry);
1859 isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1860 if (txt != "__END_ENTRY__")
1861 throw std::exception();
1864 if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
1865 isOK = static_cast<bool>(load >> elementType);
1866 isOK = static_cast<bool>(load >> txt); // __END_ELEM_TYPE__
1867 if (txt != "__END_ELEM_TYPE__")
1868 throw std::exception();
1871 if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
1872 while (isOK && (txt != "__END_GROUP__")) {
1873 isOK = static_cast<bool>(load >> txt);
1874 if (txt != "__END_GROUP__") {
1875 if (!groupName.empty())
1882 if (txt == "__PERSIST_ID__") {
1883 isOK = static_cast<bool>(load >> persistID);
1885 std::cout << "isOK: " << isOK << std::endl;
1888 isOK = static_cast<bool>(load >> txt); // __BEGIN_ENF_MESH__
1892 if ( hasEnforcedMeshes )
1893 isOK = static_cast<bool>(load >> separator);
1897 i = atoi( separator.c_str() );
1901 myFacesWithLayers.reserve( i );
1902 while (( myFacesWithLayers.size() < myFacesWithLayers.capacity() ) &&
1903 ( isOK = static_cast<bool>(load >> i)) )
1904 myFacesWithLayers.push_back( i );
1908 isOK = static_cast<bool>(load >> separator);
1911 i = atoi( separator.c_str() );
1915 myFacesWithImprinting.reserve( i );
1916 while (( myFacesWithImprinting.size() < myFacesWithImprinting.capacity() ) &&
1917 ( isOK = static_cast<bool>(load >> i)) )
1918 myFacesWithImprinting.push_back( i );
1922 isOK = static_cast<bool>(load >> separator);
1925 i = atoi( separator.c_str() );
1929 myFacesWithSnapping.reserve( i );
1930 while (( myFacesWithSnapping.size() < myFacesWithSnapping.capacity() ) &&
1931 ( isOK = static_cast<bool>(load >> i)) )
1932 myFacesWithSnapping.push_back( i );
1936 // New options in 2.9.6 (issue #17784)
1938 if ( static_cast<bool>(load >> i))
1940 myHeightIsRelative = (bool) i;
1941 load >> myBoundaryLayersMaxElemAngle;
1942 load >> myCollisionMode;
1943 load >> myGradation;
1944 load >> myOptimizationLevel;
1946 std::string option, value;
1947 if ( static_cast<bool>( load >> i ) && i >= 0 )
1949 for ( int nbRead = 0; nbRead < i; ++nbRead )
1951 load >> option >> value;
1952 _option2value[ std::string( option, 1 )] = std::string( value, 1 );
1955 if ( static_cast<bool>( load >> i ) && i >= 0 )
1957 for ( int nbRead = 0; nbRead < i; ++nbRead )
1959 load >> option >> value;
1960 _customOption2value[ std::string( option, 1 )] = std::string( value, 1 );
1968 //=======================================================================
1969 //function : SetParametersByMesh
1970 //=======================================================================
1972 bool HYBRIDPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&)
1977 //================================================================================
1979 * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
1981 //================================================================================
1983 bool HYBRIDPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts,
1984 const SMESH_Mesh* /*theMesh*/)
1986 myToMakeGroupsOfDomains = ( !dflts._shape || dflts._shape->IsNull() );
1990 //================================================================================
1992 * \brief Return command to run hybrid mesher excluding file prefix (-f)
1994 //================================================================================
1996 std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp)
1998 SMESH_Comment cmd = GetExeName();
1999 // check if any option is overridden by hyp->_option2value
2000 bool p_h = ( hyp && hyp->HasOptionDefined("-h"));
2001 bool p_v = ( hyp && hyp->HasOptionDefined("-v"));
2002 bool p_blsd = ( hyp && hyp->HasOptionDefined("--normal_direction"));
2003 bool p_hotfl = ( hyp && hyp->HasOptionDefined("--boundary_layer_global_initial_height"));
2004 bool p_nobl = ( hyp && hyp->HasOptionDefined("--number_of_boundary_layers"));
2005 bool p_blgp = ( hyp && hyp->HasOptionDefined("--boundary_layer_geometric_progression"));
2006 bool p_eg = ( hyp && hyp->HasOptionDefined("--element_generation"));
2007 bool p_cs = ( hyp && hyp->HasOptionDefined("--global_physical_size"));
2009 bool nolayers = false;
2010 bool layersOnAllWrap = hyp ? hyp->myLayersOnAllWrap : DefaultLayersOnAllWrap();
2018 std::cout << "!!!!! CommandToRun help only !!!! " << cmd << std::endl;
2023 cmd << " --verbose " << hyp->myVerboseLevel;
2026 if ( !p_nobl && hyp ) {
2027 if ( hyp->myNbOfBoundaryLayers < 1 ) nolayers = true;
2029 if ( !p_hotfl && hyp ) {
2030 if ( hyp->myHeightFirstLayer < 1e-50 ) nolayers = true;
2033 if ( !p_blsd && hyp ) {
2034 if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) {
2035 const char* value[] = { "-1" , "1" }; // -1 == inside
2036 cmd << " --normal_direction " << value[ hyp->myBoundaryLayersGrowth ];
2040 if ( !p_hotfl && hyp ) {
2041 cmd << " --boundary_layer_global_initial_height " << hyp->myHeightFirstLayer;
2043 if ( hyp && hyp->GetHeightIsRelative() )
2044 cmd << " --boundary_layer_height_relative_to_local_surface_size yes";
2046 if ( !p_nobl && hyp ) {
2047 cmd << " --number_of_boundary_layers " << ( nolayers ? 0 : hyp->myNbOfBoundaryLayers );
2050 if ( !p_blgp && hyp ) {
2051 cmd << " --boundary_layer_geometric_progression " << hyp->myBoundaryLayersProgression;
2054 if ( !nolayers && hyp )
2056 cmd << " --boundary_layer_size_mode " << ( layersOnAllWrap ? "global" : "local" );
2058 if ( hyp->GetBoundaryLayersMaxElemAngle() != hyp->DefaultBoundaryLayersMaxElemAngle() )
2059 cmd << " --boundary_layer_max_element_angle "
2060 << SMESH_Comment( hyp->GetBoundaryLayersMaxElemAngle() );
2062 if ( !layersOnAllWrap )
2064 // faces with layers
2065 const std::vector<int>& faceLayersIDs = hyp->GetFacesWithLayers();
2066 if ( !faceLayersIDs.empty() )
2067 cmd << " --boundary_layer_surface_tags ";
2068 for ( size_t i = 0; i < faceLayersIDs.size(); ++i )
2069 cmd << faceLayersIDs[i] << ",";
2070 if ( !faceLayersIDs.empty() )
2071 cmd << " --boundary_layer_initial_height_on_surface_tags ";
2072 for ( size_t i = 0; i < faceLayersIDs.size(); ++i )
2073 cmd << hyp->myHeightFirstLayer << ",";
2075 // faces with imprinting
2076 const std::vector<int>& faceImprintingIDs = hyp->GetFacesWithImprinting();
2077 if ( !faceImprintingIDs.empty() )
2078 cmd << " --boundary_layer_imprinting yes --boundary_layer_imprinting_tags ";
2079 for ( size_t i = 0; i < faceImprintingIDs.size(); ++i )
2080 cmd << faceImprintingIDs[i] << ",";
2082 // faces with snapping
2083 const std::vector<int>& faceSnappingIDs = hyp->GetFacesWithSnapping();
2084 if ( !faceSnappingIDs.empty() )
2085 cmd << " --boundary_layer_snapping yes --boundary_layer_snapping_tags ";
2086 for ( size_t i = 0; i < faceSnappingIDs.size(); ++i )
2087 cmd << faceSnappingIDs[i] << ",";
2091 if ( !p_eg && hyp ) {
2092 if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 3 ) {
2093 const char* value[] = { "tetra_dominant" , "hexa_dominant", "cartesian_core", "extrusion_only" };
2094 cmd << " --element_generation " << value[ hyp->myElementGeneration ];
2098 if ( !p_cs && hyp ) {
2099 if ( hyp->myCoreSize > 0 ) {
2100 cmd << " --global_physical_size " << hyp->myCoreSize;
2107 std::string option, value;
2109 const TOptionValues* options[] = { & hyp->_option2value, & hyp->_customOption2value };
2110 for ( int iOp = 0; iOp < 2; ++iOp )
2112 TOptionValues::const_iterator o2v = options[iOp]->begin();
2113 for ( ; o2v != options[iOp]->end(); ++o2v )
2115 option = o2v->first;
2116 value = hyp->GetOptionValue( option, &isDefault );
2120 if ( value.empty() )
2122 if ( hyp->_defaultOptionValues.count( option ))
2123 continue; // non-custom option with no value
2125 if ( option[0] != '-' )
2129 cmd << option << " " << value;
2137 //std::cout << "!!!!!CommandToRun end " << cmd << std::endl;
2142 //================================================================================
2144 * \brief Return a unique file name
2146 //================================================================================
2148 std::string HYBRIDPlugin_Hypothesis::GetFileName(const HYBRIDPlugin_Hypothesis* hyp)
2150 std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
2151 const char lastChar = *aTmpDir.rbegin();
2153 if(lastChar != '\\') aTmpDir+='\\';
2155 if(lastChar != '/') aTmpDir+='/';
2158 SMESH_Comment aGenericName = aTmpDir;
2159 aGenericName << "HYBRID_";
2160 aGenericName << getpid();
2161 aGenericName << "_";
2162 aGenericName << Abs((Standard_Integer)(long) aGenericName.c_str());
2164 return aGenericName;
2167 //================================================================================
2169 * Return the name of executable
2171 //================================================================================
2173 std::string HYBRIDPlugin_Hypothesis::GetExeName()
2175 //call mg-hybrid.bash is script which assumes new project version(s) mg-hybrid.exe in the prerequisite base and special? licence.
2177 return "mg-hybrid.exe";
2179 return "mg-hybrid.bash";
2183 //=============================================================================
2184 void HYBRIDPlugin_Hypothesis::SetOptionValue(const std::string& optionName,
2185 const std::string& optionValue)
2187 TOptionValues::iterator op_val = _option2value.find(optionName);
2188 if (op_val == _option2value.end())
2190 op_val = _customOption2value.find( optionName );
2191 if ( op_val == _customOption2value.end() || op_val->second != optionValue )
2192 NotifySubMeshesHypothesisModification();
2193 _customOption2value[ optionName ] = optionValue;
2197 if (op_val->second != optionValue)
2199 const char* ptr = optionValue.c_str();
2200 // strip white spaces
2201 while (ptr[0] == ' ')
2203 int i = strlen(ptr);
2204 while (i != 0 && ptr[i - 1] == ' ')
2208 std::string typeName;
2211 } else if (_charOptions.count(optionName)) {
2212 // do not check strings
2213 } else if (_doubleOptions.count(optionName)) {
2214 // check if value is double
2215 ToDbl(ptr, &typeOk);
2217 } else if (_boolOptions.count(optionName)) {
2218 // check if value is bool
2219 ToBool(ptr, &typeOk);
2222 // check if value is int
2223 ToInt(ptr, &typeOk);
2224 typeName = "integer";
2226 if ( typeOk ) // check some specific values ?
2231 std::string msg = "Advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
2232 throw std::invalid_argument(msg);
2234 std::string value( ptr, i );
2235 if ( _defaultOptionValues[ optionName ] == value )
2238 op_val->second = value;
2240 NotifySubMeshesHypothesisModification();
2244 //=============================================================================
2245 //! Return option value. If isDefault provided, it can be a default value,
2246 // then *isDefault == true. If isDefault is not provided, the value will be
2247 // empty if it equals a default one.
2248 std::string HYBRIDPlugin_Hypothesis::GetOptionValue(const std::string& optionName,
2249 bool* isDefault) const
2251 TOptionValues::const_iterator op_val = _option2value.find(optionName);
2252 if (op_val == _option2value.end())
2254 op_val = _customOption2value.find(optionName);
2255 if (op_val == _customOption2value.end())
2257 std::string msg = "Unknown MG-Tetra option: <" + optionName + ">";
2258 throw std::invalid_argument(msg);
2261 std::string val = op_val->second;
2262 if ( isDefault ) *isDefault = ( val.empty() );
2264 if ( val.empty() && isDefault )
2266 op_val = _defaultOptionValues.find( optionName );
2267 if (op_val != _defaultOptionValues.end())
2268 val = op_val->second;
2274 //=============================================================================
2275 bool HYBRIDPlugin_Hypothesis::HasOptionDefined( const std::string& optionName ) const
2277 bool isDefault = false;
2280 GetOptionValue( optionName, &isDefault );
2282 catch ( std::invalid_argument& )
2289 //=============================================================================
2290 void HYBRIDPlugin_Hypothesis::ClearOption(const std::string& optionName)
2292 TOptionValues::iterator op_val = _customOption2value.find(optionName);
2293 if (op_val != _customOption2value.end())
2294 _customOption2value.erase(op_val);
2296 op_val = _option2value.find(optionName);
2297 if (op_val != _option2value.end())
2298 op_val->second.clear();
2302 //=============================================================================
2303 HYBRIDPlugin_Hypothesis::TOptionValues HYBRIDPlugin_Hypothesis::GetOptionValues() const
2306 TOptionValues::const_iterator op_val = _option2value.begin();
2307 for ( ; op_val != _option2value.end(); ++op_val )
2308 vals.insert( make_pair( op_val->first, GetOptionValue( op_val->first, GET_DEFAULT() )));
2313 //================================================================================
2315 * \brief Converts a string to a bool
2317 //================================================================================
2319 bool HYBRIDPlugin_Hypothesis::ToBool(const std::string& str, bool* isOk )
2321 std::string s = str;
2322 if ( isOk ) *isOk = true;
2324 for ( size_t i = 0; i <= s.size(); ++i )
2325 s[i] = tolower( s[i] );
2327 if ( s == "1" || s == "true" || s == "active" || s == "yes" )
2330 if ( s == "0" || s == "false" || s == "inactive" || s == "no" )
2336 std::string msg = "Not a Boolean value:'" + str + "'";
2337 throw std::invalid_argument(msg);
2342 //================================================================================
2344 * \brief Converts a string to a real value
2346 //================================================================================
2348 double HYBRIDPlugin_Hypothesis::ToDbl(const std::string& str, bool* isOk )
2350 if ( str.empty() ) throw std::invalid_argument("Empty value provided");
2353 double val = strtod(&str[0], &endPtr);
2354 bool ok = (&str[0] != endPtr);
2356 if ( isOk ) *isOk = ok;
2360 std::string msg = "Not a real value:'" + str + "'";
2361 throw std::invalid_argument(msg);
2366 //================================================================================
2368 * \brief Converts a string to a integer value
2370 //================================================================================
2372 int HYBRIDPlugin_Hypothesis::ToInt(const std::string& str, bool* isOk )
2374 if ( str.empty() ) throw std::invalid_argument("Empty value provided");
2377 int val = (int)strtol( &str[0], &endPtr, 10);
2378 bool ok = (&str[0] != endPtr);
2380 if ( isOk ) *isOk = ok;
2384 std::string msg = "Not an integer value:'" + str + "'";
2385 throw std::invalid_argument(msg);
2391 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList HYBRIDPlugin_Hypothesis::GetEnforcedVertices(const HYBRIDPlugin_Hypothesis* hyp)
2393 return hyp ? hyp->_GetEnforcedVertices():THYBRIDEnforcedVertexList();
2396 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues HYBRIDPlugin_Hypothesis::GetEnforcedVerticesCoordsSize (const HYBRIDPlugin_Hypothesis* hyp)
2398 return hyp ? hyp->_GetEnforcedVerticesCoordsSize(): THYBRIDEnforcedVertexCoordsValues();
2401 HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexEntryValues HYBRIDPlugin_Hypothesis::GetEnforcedVerticesEntrySize (const HYBRIDPlugin_Hypothesis* hyp)
2403 return hyp ? hyp->_GetEnforcedVerticesEntrySize():THYBRIDEnforcedVertexEntryValues();
2406 HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap HYBRIDPlugin_Hypothesis::GetEnforcedVerticesByCoords (const HYBRIDPlugin_Hypothesis* hyp)
2408 return hyp ? hyp->_GetEnforcedVerticesByCoords():TCoordsHYBRIDEnforcedVertexMap();
2411 HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap HYBRIDPlugin_Hypothesis::GetEnforcedVerticesByEntry (const HYBRIDPlugin_Hypothesis* hyp)
2413 return hyp ? hyp->_GetEnforcedVerticesByEntry():TGeomEntryHYBRIDEnforcedVertexMap();
2416 HYBRIDPlugin_Hypothesis::TIDSortedNodeGroupMap HYBRIDPlugin_Hypothesis::GetEnforcedNodes(const HYBRIDPlugin_Hypothesis* hyp)
2418 return hyp ? hyp->_GetEnforcedNodes():TIDSortedNodeGroupMap();
2421 HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap HYBRIDPlugin_Hypothesis::GetEnforcedEdges(const HYBRIDPlugin_Hypothesis* hyp)
2423 return hyp ? hyp->_GetEnforcedEdges():TIDSortedElemGroupMap();
2426 HYBRIDPlugin_Hypothesis::TIDSortedElemGroupMap HYBRIDPlugin_Hypothesis::GetEnforcedTriangles(const HYBRIDPlugin_Hypothesis* hyp)
2428 return hyp ? hyp->_GetEnforcedTriangles():TIDSortedElemGroupMap();
2431 HYBRIDPlugin_Hypothesis::TID2SizeMap HYBRIDPlugin_Hypothesis::GetNodeIDToSizeMap(const HYBRIDPlugin_Hypothesis* hyp)
2433 return hyp ? hyp->_GetNodeIDToSizeMap():TID2SizeMap();
2436 HYBRIDPlugin_Hypothesis::TSetStrings HYBRIDPlugin_Hypothesis::GetGroupsToRemove(const HYBRIDPlugin_Hypothesis* hyp)
2438 return hyp ? hyp->_GetGroupsToRemove():TSetStrings();