Salome HOME
Copyright update 2022
[modules/homard.git] / src / HOMARDGUI / MonEditYACS.cxx
index b168f2a2c9ddca22e1ad85de48c15803cb8698ce..3f1f92b7cdaa403b8596aa8ecd2dbe842813c447 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2011-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,8 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-using namespace std;
-
 #include "MonEditYACS.h"
 
 #include "SalomeApp_Tools.h"
@@ -26,6 +24,7 @@ using namespace std;
 #include "HomardQtCommun.h"
 #include <utilities.h>
 
+using namespace std;
 
 // -------------------------------------------------------------
 /* Constructs a MonEditYACS
@@ -56,55 +55,94 @@ void MonEditYACS::InitValEdit()
   LEName->setText(_Name);
   LEName->setReadOnly(true);
 
-  QString _aCaseName = aYACS->GetCaseName();
+  _aCaseName = aYACS->GetCaseName();
   LECaseName->setText(_aCaseName);
   LECaseName->setReadOnly(true);
   PBCaseName->setVisible(0);
 
-  QString aScriptFile = aYACS->GetScriptFile();
-  LEScriptFile->setText(aScriptFile);
+  _aScriptFile = aYACS->GetScriptFile();
+  LEScriptFile->setText(_aScriptFile);
 
-  QString aDirName = aYACS->GetDirName();
-  LEDirName->setText(aDirName);
+  _aDirName = aYACS->GetDirName();
+  LEDirName->setText(_aDirName);
+  LEDirName->setReadOnly(true);
 
-  QString aMeshFile = aYACS->GetMeshFile();
-  LEMeshFile->setText(aMeshFile);
+  _aMeshFile = aYACS->GetMeshFile();
+  LEMeshFile->setText(_aMeshFile);
 
-  int Type=aYACS->GetType();
-  if(Type==1) { RBConstant->setChecked(true); }
-  else        { RBVariable->setChecked(true); };
+  _Type=aYACS->GetType();
+  if(_Type==1) { RBConstant->setChecked(true); }
+  else         { RBVariable->setChecked(true); };
   RBConstant->setEnabled(false);
   RBVariable->setEnabled(false);
+
+  _MaxIter = aYACS->GetMaxIter();
+  SpinBoxMaxIter->setValue(_MaxIter) ;
+  _MaxNode = aYACS->GetMaxNode();
+  SpinBoxMaxNode->setValue(_MaxNode) ;
+  _MaxElem = aYACS->GetMaxElem();
+  SpinBoxMaxElem->setValue(_MaxElem) ;
 //
-  adjustSize();
 }
 
 // ---------------------------------------------------
 bool MonEditYACS:: CreateOrUpdate()
 //----------------------------------------------------
-//  Modification du schema
+//  Edition/modification du schema
 {
   MESSAGE("CreateOrUpdate");
-
-  // Les donnees
+  bool chgt = false ;
+  int valeur_i ;
+  // A. Recuperation et comparaison des valeurs
+  // A.1. Le script de lancement
   QString aScriptFile=LEScriptFile->text().trimmed();
   if ( aScriptFile != _aScriptFile )
   {
+//     MESSAGE("modification de ScriptFile : "<<_aScriptFile.toStdString()<<" devient "<<aScriptFile.toStdString());
     _aScriptFile = aScriptFile ;
     aYACS->SetScriptFile(CORBA::string_dup(_aScriptFile.toStdString().c_str())) ;
+    chgt = true ;
   }
-  QString aDirName=LEDirName->text().trimmed();
-  if ( aDirName != _aDirName )
-  {
-    _aDirName = aDirName ;
-    aYACS->SetDirName(CORBA::string_dup(_aDirName.toStdString().c_str())) ;
-  }
+  // A.2. Le maillage initial
   QString aMeshFile=LEMeshFile->text().trimmed();
   if ( aMeshFile != _aMeshFile )
   {
+//     MESSAGE("modification de aMeshFile : "<<_aMeshFile.toStdString()<<" devient "<<aMeshFile.toStdString());
     _aMeshFile = aMeshFile ;
     aYACS->SetMeshFile(CORBA::string_dup(_aMeshFile.toStdString().c_str())) ;
+    chgt = true ;
+  }
+  // A.3. La convergence
+  valeur_i = SpinBoxMaxIter->value() ;
+  if ( valeur_i != _MaxIter )
+  {
+//     MESSAGE("modification de MaxIter : "<<_MaxIter<<" devient "<<valeur_i);
+    _MaxIter = valeur_i ;
+    aYACS->SetMaxIter(_MaxIter) ;
+    chgt = true ;
+  }
+  valeur_i = SpinBoxMaxNode->value() ;
+  if ( valeur_i != _MaxNode )
+  {
+//     MESSAGE("modification de MaxNode : "<<_MaxNode<<" devient "<<valeur_i);
+    _MaxNode = valeur_i ;
+    aYACS->SetMaxNode(_MaxNode) ;
+    chgt = true ;
+  }
+  valeur_i = SpinBoxMaxElem->value() ;
+  if ( valeur_i != _MaxElem )
+  {
+//     MESSAGE("modification de MaxElem : "<<_MaxElem<<" devient "<<valeur_i);
+    _MaxElem = valeur_i ;
+    aYACS->SetMaxElem(_MaxElem) ;
+    chgt = true ;
+  }
+// B. Si changement
+  if ( chgt )
+  {
+    myHomardGen->InvalideYACS(_Name.toStdString().c_str());
   }
 
+  HOMARD_UTILS::updateObjBrowser();
   return true ;
 }