1 // Copyright (C) 2011-2020 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 #include "MonEditYACS.h"
22 #include "SalomeApp_Tools.h"
23 #include "HOMARDGUI_Utils.h"
24 #include "HomardQtCommun.h"
25 #include <utilities.h>
29 // -------------------------------------------------------------
30 /* Constructs a MonEditYACS
31 herite de MonCreateYACS
33 // -------------------------------------------------------------
34 MonEditYACS::MonEditYACS ( bool modal,
35 HOMARD::HOMARD_Gen_var myHomardGen,
37 MonCreateYACS(myHomardGen, Name)
39 MESSAGE("Debut de MonEditYACS" << Name.toStdString().c_str());
40 setWindowTitle(QObject::tr("HOM_YACS_EDIT_WINDOW_TITLE"));
42 aYACS = myHomardGen->GetYACS(_Name.toStdString().c_str());
45 // ------------------------------
46 MonEditYACS::~MonEditYACS()
47 // ------------------------------
50 // ------------------------------
51 void MonEditYACS::InitValEdit()
52 // ------------------------------
54 MESSAGE("InitValEdit");
55 LEName->setText(_Name);
56 LEName->setReadOnly(true);
58 _aCaseName = aYACS->GetCaseName();
59 LECaseName->setText(_aCaseName);
60 LECaseName->setReadOnly(true);
61 PBCaseName->setVisible(0);
63 _aScriptFile = aYACS->GetScriptFile();
64 LEScriptFile->setText(_aScriptFile);
66 _aDirName = aYACS->GetDirName();
67 LEDirName->setText(_aDirName);
68 LEDirName->setReadOnly(true);
70 _aMeshFile = aYACS->GetMeshFile();
71 LEMeshFile->setText(_aMeshFile);
73 _Type=aYACS->GetType();
74 if(_Type==1) { RBConstant->setChecked(true); }
75 else { RBVariable->setChecked(true); };
76 RBConstant->setEnabled(false);
77 RBVariable->setEnabled(false);
79 _MaxIter = aYACS->GetMaxIter();
80 SpinBoxMaxIter->setValue(_MaxIter) ;
81 _MaxNode = aYACS->GetMaxNode();
82 SpinBoxMaxNode->setValue(_MaxNode) ;
83 _MaxElem = aYACS->GetMaxElem();
84 SpinBoxMaxElem->setValue(_MaxElem) ;
88 // ---------------------------------------------------
89 bool MonEditYACS:: CreateOrUpdate()
90 //----------------------------------------------------
91 // Edition/modification du schema
93 MESSAGE("CreateOrUpdate");
96 // A. Recuperation et comparaison des valeurs
97 // A.1. Le script de lancement
98 QString aScriptFile=LEScriptFile->text().trimmed();
99 if ( aScriptFile != _aScriptFile )
101 // MESSAGE("modification de ScriptFile : "<<_aScriptFile.toStdString()<<" devient "<<aScriptFile.toStdString());
102 _aScriptFile = aScriptFile ;
103 aYACS->SetScriptFile(CORBA::string_dup(_aScriptFile.toStdString().c_str())) ;
106 // A.2. Le maillage initial
107 QString aMeshFile=LEMeshFile->text().trimmed();
108 if ( aMeshFile != _aMeshFile )
110 // MESSAGE("modification de aMeshFile : "<<_aMeshFile.toStdString()<<" devient "<<aMeshFile.toStdString());
111 _aMeshFile = aMeshFile ;
112 aYACS->SetMeshFile(CORBA::string_dup(_aMeshFile.toStdString().c_str())) ;
115 // A.3. La convergence
116 valeur_i = SpinBoxMaxIter->value() ;
117 if ( valeur_i != _MaxIter )
119 // MESSAGE("modification de MaxIter : "<<_MaxIter<<" devient "<<valeur_i);
120 _MaxIter = valeur_i ;
121 aYACS->SetMaxIter(_MaxIter) ;
124 valeur_i = SpinBoxMaxNode->value() ;
125 if ( valeur_i != _MaxNode )
127 // MESSAGE("modification de MaxNode : "<<_MaxNode<<" devient "<<valeur_i);
128 _MaxNode = valeur_i ;
129 aYACS->SetMaxNode(_MaxNode) ;
132 valeur_i = SpinBoxMaxElem->value() ;
133 if ( valeur_i != _MaxElem )
135 // MESSAGE("modification de MaxElem : "<<_MaxElem<<" devient "<<valeur_i);
136 _MaxElem = valeur_i ;
137 aYACS->SetMaxElem(_MaxElem) ;
143 myHomardGen->InvalideYACS(_Name.toStdString().c_str());
146 HOMARD_UTILS::updateObjBrowser();