Salome HOME
IPAL52478: Too thin viscous layers are constructed
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshOp.cxx
index ab8b437a638ddffa68e6aa84c62aeee6b73c6ad4..1fc82405f9f21577c7432ba1b2b38486c70ee275 100644 (file)
@@ -847,7 +847,7 @@ void SMESHGUI_MeshOp::availableHyps( const int       theDim,
   theDataList.clear();
   theHyps.clear();
   bool isAlgo = ( theHypType == Algo );
-  bool isAux  = ( theHypType == AddHyp );
+  bool isAux  = ( theHypType >= AddHyp );
   QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry, !myIsMesh );
 
   QStringList::const_iterator anIter;
@@ -906,7 +906,7 @@ void SMESHGUI_MeshOp::existingHyps( const int       theDim,
   else
     aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
 
-  const bool isAux   = ( theHypType == AddHyp );
+  const bool isAux   = ( theHypType >= AddHyp );
   const bool allHyps = ( !isMesh && theHypType != Algo && theDim > -1);
 
   if ( theFather->FindSubObject( aPart, aHypRoot ) )
@@ -1489,14 +1489,24 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
   {
     if ( !isAccessibleDim( dim ))
       continue;
-    for ( int dlgType = MainHyp; dlgType < nbDlgHypTypes(dim); dlgType++ )
+
+    // get indices of selected hyps
+    const int nbTypes = nbDlgHypTypes(dim);
+    std::vector<int> hypIndexByType( nbTypes, -1 );
+    for ( int dlgType = MainHyp; dlgType < nbTypes; dlgType++ )
+    {
+      hypIndexByType[ dlgType ] = currentHyp( dim, dlgType );
+    }
+
+    // update hyps
+    for ( int dlgType = MainHyp; dlgType < nbTypes; dlgType++ )
     {
       const int type = Min( dlgType, AddHyp );
       myAvailableHypData[ dim ][ type ].clear();
       QStringList anAvailable, anExisting;
 
       HypothesisData* curAlgo = algoByDim[ dim ];
-      int hypIndex = currentHyp( dim, dlgType );
+      int hypIndex = hypIndexByType[ dlgType ];
 
       SMESH::SMESH_Hypothesis_var curHyp;
       if ( hypIndex >= 0 && hypIndex < myExistingHyps[ dim ][ type ].count() )
@@ -1535,9 +1545,11 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
         defaulHypAvlbl = (type == MainHyp && !curAlgo->IsAuxOrNeedHyp );
       }
       // set list of hypotheses
-      myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
-      myDlg->tab( dim )->setExistingHyps( type, anExisting, defaulHypAvlbl );
-
+      if ( dlgType <= AddHyp )
+      {
+        myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
+        myDlg->tab( dim )->setExistingHyps( type, anExisting, defaulHypAvlbl );
+      }
       // set current existing hypothesis
       if ( !curHyp->_is_nil() && !anExisting.isEmpty() )
         hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
@@ -1548,11 +1560,11 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
         CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
         bool isOptional = true;
         if ( algoByDim[ dim ] &&
-            SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
-            !isOptional )
+             SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
+             !isOptional )
           hypIndex = 0;
       }
-      setCurrentHyp( dim, type, hypIndex );
+      setCurrentHyp( dim, dlgType, hypIndex );
     }
   }
 }