Salome HOME
#17845 [EDF] Modifications of Automatic meshing
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshOp.cxx
index e232e408f20d6a09593c8c86e26d556523eb942a..8ee061cd71400c8d44b125d2d585a1ca2785b60a 100644 (file)
@@ -294,8 +294,8 @@ void SMESHGUI_MeshOp::commitOperation()
 //================================================================================
 /*!
  * \brief Creates selection filter
 * \param theId - identifier of current selection widget
 * \retval SUIT_SelectionFilter* - pointer to the created filter or null
 \param theId - identifier of current selection widget
 \retval SUIT_SelectionFilter* - pointer to the created filter or null
  *
  * Creates selection filter in accordance with identifier of current selection widget
  */
@@ -1103,12 +1103,18 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString&              aHypType,
     initParams.way = isSubMesh ? BY_MESH : BY_GEOM;
   }
 
-  SMESH::SMESH_Hypothesis_var hyp =
-    SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
-                                                           aServerLib.toUtf8().data(),
-                                                           aMesh,
-                                                           aGeomVar,
-                                                           initParams );
+  SMESH::SMESH_Hypothesis_var hyp;
+  if ( initParams.way == BY_AVERAGE_LENGTH )
+    hyp = SMESHGUI::GetSMESHGen()->CreateHypothesisByAverageLength( aHypType.toUtf8().data(),
+                                                                    aServerLib.toUtf8().data(),
+                                                                    initParams.averageLength,
+                                                                    initParams.quadDominated );
+  else
+    hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
+                                                                 aServerLib.toUtf8().data(),
+                                                                 aMesh,
+                                                                 aGeomVar,
+                                                                 initParams );
   if ( hyp->_is_nil() && initParams.way == BY_MESH )
   {
     initParams.way = BY_GEOM;
@@ -1898,7 +1904,7 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
   HypothesesSet::SetType setType = aHypoSet->getPreferredHypType();
   if ( !aHypoSet->getAlgoAvailable( setType ))
   {
-    setType = setType == HypothesesSet::ALT ? HypothesesSet::MAIN : HypothesesSet::ALT;
+    setType = ( setType == HypothesesSet::ALT ) ? HypothesesSet::MAIN : HypothesesSet::ALT;
     if ( !aHypoSet->getAlgoAvailable( setType ))
       return;
   }
@@ -2059,18 +2065,20 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
       GEOM::GEOM_Gen_var           geomGen = SMESH::GetGEOMGen();
       GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
       GEOM::ListOfGO_var        geomGroups = op->GetExistingSubObjects( aGeomVar,
-                                                                        /*groupsOnly=*/true );
+                                                                        /*groupsOnly=*/false );
       SMESH::SMESH_GroupOnGeom_var meshGroup;
       for ( CORBA::ULong iG = 0; iG < geomGroups->length(); ++iG )
       {
         SMESH::ElementType elemType = SMESHGUI_GroupOnShapeOp::ElementType( geomGroups[ iG ] );
         if ( elemType == SMESH::ALL )
           continue;
+        if ( elemType == SMESH::ELEM0D )
+          elemType = SMESH::NODE;
 
         CORBA::String_var name = geomGroups[ iG ]->GetName();
         meshGroup = aMesh->CreateGroupFromGEOM( elemType, name, geomGroups[ iG ]);
-        if ( elemType != SMESH::NODE )
-          meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]);
+        // if ( elemType != SMESH::NODE )
+        //   meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]);
       }
     }
 
@@ -2938,9 +2946,19 @@ void SMESHGUI_MeshOp::updateHypoSets()
       }
       currentHypoSet->setAlgoAvailable( sType, isAvailable );
     }
+    if ( currentHypoSet->hasAlgo( HypothesesSet::MAIN ) &&
+         currentHypoSet->hasAlgo( HypothesesSet::ALT ))
+    {
+      HypothesesSet::SetType setType = HypothesesSet::getPreferredHypType();
+      if ( !currentHypoSet->getAlgoAvailable( setType ))
+        continue; // not add if a preferred type not available currently
+    }
+
     if ( currentHypoSet->getAlgoAvailable( HypothesesSet::MAIN ) ||
          currentHypoSet->getAlgoAvailable( HypothesesSet::ALT ))
+    {
       aFilteredHypothesesSetsList.append( *inHypoSetName );
+    }
   }
   myDlg->setHypoSets( aFilteredHypothesesSetsList );
 }