|
@@ -0,0 +1,127 @@
|
|
|
+#include "input_physics.hpp"
|
|
|
+
|
|
|
+QtInputPhysics::QtInputPhysics():QWidget(){
|
|
|
+ g_label=new QLabel("Gravity (g) : ");
|
|
|
+ rho_label=new QLabel("Fluid density (ρ) : ");
|
|
|
+ rho_label->setTextFormat(Qt::RichText);
|
|
|
+ phi_label=new QLabel("Porosity of the soil (φ) : ");
|
|
|
+ phi_label->setTextFormat(Qt::RichText);
|
|
|
+ k0_label=new QLabel("Conductivity of the saturated soil (k<sub>0</sub>) : ");
|
|
|
+ k0_label->setTextFormat(Qt::RichText);
|
|
|
+ nivrivsat_label=new QLabel("Water pressure at the bottom of overland water (nivrivsat) : ");
|
|
|
+ g_input=new QLineEdit(QString::number(def_g));
|
|
|
+ rho_input=new QLineEdit(QString::number(def_rho));
|
|
|
+ phi_input=new QLineEdit(QString::number(def_phi));
|
|
|
+ k0_input=new QLineEdit(QString::number(def_k0));
|
|
|
+ nivrivsat_input=new QLineEdit(QString::number(def_nivrivsat));
|
|
|
+ for(size_t i=0;i<max_model_parameters;++i){
|
|
|
+ model_label[i]=new QLabel(this);
|
|
|
+ model_label[i]->setTextFormat(Qt::RichText);
|
|
|
+ model_label[i]->hide();
|
|
|
+ model_input[i]=new QLineEdit(this);
|
|
|
+ model_input[i]->hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ //Input validators
|
|
|
+ double_validator=new QDoubleValidator;
|
|
|
+ positive_double_validator=new QDoubleValidator;;
|
|
|
+ positive_double_validator->setBottom(0);
|
|
|
+
|
|
|
+
|
|
|
+ g_input->setValidator(positive_double_validator);
|
|
|
+ rho_input->setValidator(double_validator);
|
|
|
+ phi_input->setValidator(double_validator);
|
|
|
+ k0_input->setValidator(double_validator);
|
|
|
+ nivrivsat_input->setValidator(double_validator);
|
|
|
+
|
|
|
+ //Boxes
|
|
|
+ phy_common_box=new QGroupBox("Common parameters");
|
|
|
+ phy_model_box=new QGroupBox("Model parameters");
|
|
|
+ phy_model_selection_box=new QComboBox();
|
|
|
+ phy_model_selection_box->addItem("Brooks and Corey");
|
|
|
+
|
|
|
+
|
|
|
+ //Layouts
|
|
|
+ base_layout=new QHBoxLayout();
|
|
|
+ phy_common_layout=new QVBoxLayout();
|
|
|
+ phy_model_layout=new QVBoxLayout();
|
|
|
+
|
|
|
+ //Phy commont layout
|
|
|
+ int vspace=20;
|
|
|
+ phy_common_layout->addWidget(g_label);
|
|
|
+ phy_common_layout->addWidget(g_input);
|
|
|
+ phy_common_layout->addSpacing(vspace);
|
|
|
+ phy_common_layout->addWidget(rho_label);
|
|
|
+ phy_common_layout->addWidget(rho_input);
|
|
|
+ phy_common_layout->addSpacing(vspace);
|
|
|
+ phy_common_layout->addWidget(phi_label);
|
|
|
+ phy_common_layout->addWidget(phi_input);
|
|
|
+ phy_common_layout->addSpacing(vspace);
|
|
|
+ phy_common_layout->addWidget(k0_label);
|
|
|
+ phy_common_layout->addWidget(k0_input);
|
|
|
+ phy_common_layout->addSpacing(vspace);
|
|
|
+ phy_common_layout->addWidget(nivrivsat_label);
|
|
|
+ phy_common_layout->addWidget(nivrivsat_input);
|
|
|
+ phy_common_layout->addStretch();
|
|
|
+
|
|
|
+ //Phy model layout
|
|
|
+ phy_model_layout->addWidget(phy_model_selection_box);
|
|
|
+ for(size_t i=0;i<max_model_parameters;++i){
|
|
|
+ phy_model_layout->addSpacing(vspace);
|
|
|
+ phy_model_layout->addWidget(model_label[i]);
|
|
|
+ phy_model_layout->addWidget(model_input[i]);
|
|
|
+ }
|
|
|
+ phy_model_layout->addStretch();
|
|
|
+
|
|
|
+ //Boxes
|
|
|
+ phy_common_box->setLayout(phy_common_layout);
|
|
|
+ phy_model_box->setLayout(phy_model_layout);
|
|
|
+
|
|
|
+ //Base widget
|
|
|
+ base_layout->addWidget(phy_common_box);
|
|
|
+ base_layout->addWidget(phy_model_box);
|
|
|
+ setLayout(base_layout);
|
|
|
+
|
|
|
+ //Conections
|
|
|
+ connect(phy_model_selection_box,QOverload<int>::of(&QComboBox::activated),this,&QtInputPhysics::modelChoosed);
|
|
|
+
|
|
|
+ //Display model specific interface
|
|
|
+ nb_model_parameters=0;
|
|
|
+ modelChoosed(phy_model_selection_box->currentIndex());
|
|
|
+}
|
|
|
+
|
|
|
+QtInputPhysics::~QtInputPhysics(){
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+QtInputPhysics::modelChoosed(int index){
|
|
|
+ for(size_t i=0;i<nb_model_parameters;++i){
|
|
|
+ model_label[i]->hide();
|
|
|
+ model_input[i]->hide();
|
|
|
+ }
|
|
|
+ switch(index){
|
|
|
+ case 0:
|
|
|
+ //Brooks and Corey
|
|
|
+ nb_model_parameters=4;
|
|
|
+ model_label[0]->setText("Minimal pressure p<sub>sat</sub> such that s(p<sub>sat</sub>)=1");
|
|
|
+ model_input[0]->setValidator(double_validator);
|
|
|
+ model_input[0]->setText(QString::number(BC_psat));
|
|
|
+ model_label[1]->setText("Minimal residual pressure (s<sub>res</sub>)");
|
|
|
+ model_input[1]->setValidator(double_validator);
|
|
|
+ model_input[1]->setText(QString::number(BC_sres));
|
|
|
+ model_label[2]->setText("λ exponent");
|
|
|
+ model_input[2]->setValidator(double_validator);
|
|
|
+ model_input[2]->setText(QString::number(BC_lambda));
|
|
|
+ model_label[3]->setText("α exponent");
|
|
|
+ model_input[3]->setValidator(double_validator);
|
|
|
+ model_input[3]->setText(QString::number(BC_alpha));
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ };
|
|
|
+ for(size_t i=0;i<nb_model_parameters;++i){
|
|
|
+ model_label[i]->show();
|
|
|
+ model_input[i]->show();
|
|
|
+ }
|
|
|
+}
|