Salome HOME
Filtrage des options selon les dimensions
authorGERALD NICOLAS <D68518@dsp0864451.atlas.edf.fr>
Fri, 12 Feb 2021 14:40:12 +0000 (15:40 +0100)
committerGERALD NICOLAS <D68518@dsp0864451.atlas.edf.fr>
Fri, 12 Feb 2021 14:40:12 +0000 (15:40 +0100)
src/SMESHGUI/MG_ADAPTGUI.cxx
src/SMESHGUI/MG_ADAPTGUI.hxx

index 9fae601401e488ed1e19503e4fd836a0be561f52..a449cdd0ba018bd22d5209fa4471f6b4961d7d2e 100644 (file)
@@ -487,6 +487,7 @@ SMESHGUI_MgAdaptArguments::SMESHGUI_MgAdaptArguments( QWidget* parent )
   }
 
   meshDim = 0;
+  meshDimBG = 0;
   // Mesh in
   aMeshIn = new QGroupBox( tr( "MeshIn" ), this );
   aMedfile       = new QRadioButton( tr( "MEDFile" ),    aMeshIn );
@@ -701,6 +702,10 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFileBackgroundbutton()
         int typeStepInField = it->second > 2 ?  2 : it->second ;
         timeStepGroupChanged(typeStepInField, false);
       }
+      // Dimension du maillage de fonds
+      MEDCoupling::MCAuto<MEDCoupling::MEDFileData> mfd = MEDCoupling::MEDFileData::New(fileName.toStdString());
+      meshDimBG = mfd->getMeshes()->getMeshAtPos(0)->getMeshDimension() ;
+      valueAdaptation ();
     }
   }
   else
@@ -756,8 +761,9 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFilebuttonClicked()
     else
     {
       meshNameLineEdit->setText(aMeshName);
-      ADAPTATION_MODE aMode = meshDim == 3 ? ADAPTATION_MODE::BOTH : ADAPTATION_MODE::SURFACE; // and when dimesh 3 without 2D mesh?
-      emit meshDimSignal(aMode);
+      valueAdaptation ();
+//       ADAPTATION_MODE aMode = meshDim == 3 ? ADAPTATION_MODE::BOTH : ADAPTATION_MODE::SURFACE; // and when dimesh 3 without 2D mesh?
+//       emit meshDimSignal(aMode);
     }
   }
   else
@@ -776,6 +782,20 @@ void SMESHGUI_MgAdaptArguments::onSelectMedFilebuttonClicked()
 
 }
 
+void SMESHGUI_MgAdaptArguments::valueAdaptation()
+{
+  ADAPTATION_MODE aMode ;
+  if ( meshDimBG < 3 )
+  {
+    aMode = meshDim == 3 ? ADAPTATION_MODE::BOTH : ADAPTATION_MODE::SURFACE;
+  }
+  else
+  {
+    aMode = ADAPTATION_MODE::BOTH;
+  }
+  emit meshDimSignal(aMode);
+}
+
 void SMESHGUI_MgAdaptArguments::onLocalSelected(QString filePath)
 {
   myFieldList = GetListeChamps(filePath, false);
@@ -886,7 +906,6 @@ void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int  theSizeMap )
     valueLabel->hide();
     dvalue->hide();
     sizeMapField->setEnabled(true);
-
   }
   else
   {
@@ -899,6 +918,8 @@ void SMESHGUI_MgAdaptArguments::sizeMapDefChanged( int  theSizeMap )
     dvalue->show();
     sizeMapField->setEnabled(false);
   }
+  meshDimBG = 0;
+  valueAdaptation();
 }
 void SMESHGUI_MgAdaptArguments::timeStepGroupChanged(int timeStepType, bool disableOther, int vmax)
 {
@@ -925,10 +946,10 @@ void SMESHGUI_MgAdaptArguments::clear()
   meshNameLineEdit->clear();
   selectOutMedFileLineEdit->clear();
 }
-med_int SMESHGUI_MgAdaptArguments::getMeshDim() const
-{
-  return meshDim;
-}
+// med_int SMESHGUI_MgAdaptArguments::getMeshDim() const
+// {
+//   return meshDim;
+// }
 QWidget* ItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const
 {
   bool editable = index.data( EDITABLE_ROLE ).toInt();
@@ -1149,7 +1170,7 @@ void MgAdaptAdvWidget::_onWorkingDirectoryPushButton()
 void MgAdaptAdvWidget::onMeshDimChanged(ADAPTATION_MODE aMode)
 {
 /* default adaptation mode
-  * assume that if meshDim == 2 -->adaptation surface
+  * assume that if meshDim == 2 and no 3D backgrounmesh-->adaptation surface
   * if meshDim == 3 and  if there is not 2D mesh -->VOLUME
   * else BOTH
   */
index 3204a11afaf10e55b2d2dde8086cc40d78f70977..5121d11026b0bb31152229201d796fd18c00d384 100644 (file)
@@ -103,8 +103,8 @@ QString lireNomMaillage(QString aFile, med_int& meshDim);
 std::string remove_extension(const std::string& filename);\r
 \r
 enum ADAPTATION_MODE{\r
-  SURFACE, // surface adaption when meshDim == 2\r
-  VOLUME, //\r
+  SURFACE,\r
+  VOLUME,\r
   BOTH\r
 };\r
 //=================================================================================\r
@@ -164,7 +164,6 @@ public:
   SMESHGUI_MgAdaptArguments( QWidget* parent);\r
   ~SMESHGUI_MgAdaptArguments();\r
   void setMode( const Mode, const SIZEMAP );\r
-  med_int getMeshDim() const;\r
 \r
   QString* myFileInDir;\r
   QString* myFileOutDir;\r
@@ -239,12 +238,14 @@ private slots:
   void onLastTimeStep(bool disableOther = false);\r
   void onChosenTimeStep(bool disableOther = false, int vmax = 0);\r
   void visibleTimeStepRankLabel(bool visible);\r
+  void valueAdaptation ();\r
 \r
 private:\r
 \r
   QString getMedFileName(bool avertir);\r
   LightApp_SelectionMgr* selMgr ;\r
   med_int meshDim;\r
+  med_int meshDimBG;\r
   std::map<QString, int> myFieldList;\r
 \r
 };\r