Parcourir la source

Begining of the interface

Jean Fromentin il y a 3 ans
Parent
commit
36c4b136cd

+ 26 - 2
Makefile

@@ -1,2 +1,26 @@
-all:
-	g++ src/*.cpp src/qt/*.cpp `pkg-config --cflags --libs Qt5Widgets` -fPIC -o test
+QT_FLAG		=`pkg-config --cflags --libs Qt5Widgets`
+QT_LIB		=`pkg-config --libs Qt5Widgets`
+QT_MOC		= moc
+GPP		= g++
+FLAGS 		= -fPIC $(QT_FLAG)
+
+QT_FILES	= mainwindow input input_physics input_time input_geometry
+QT_MOC_FILES	= input_physics
+EXE		= RichardsFastSlow
+
+QT_OBJS		= $(addprefix obj/qt/,$(addsuffix .o,$(QT_FILES)))
+QT_MOCS		= $(addprefix moc/,$(addsuffix .cpp,$(QT_MOC_FILES)))
+
+all : $(EXE)
+
+$(EXE) : src/main.cpp $(QT_MOCS) $(QT_OBJS)
+	$(GPP) $(FLAGS) $^ $(QT_LIB) -o $@
+
+obj/qt/%.o : src/qt/%.cpp src/qt/%.hpp
+	$(GPP) $(FLAGS) -c $< -o $@
+
+moc/%.cpp : src/qt/%.hpp
+	$(QT_MOC) $< -o $@
+
+clean:
+	-$(RM) $(EXE) moc/* obj/*.o obj/qt/*.o src/*~ src/qt/*~

BIN
RichardsFastSlow


BIN
doc/html/tabs.css


+ 14 - 31
doc/latex/longtable_doxygen.sty

@@ -1,34 +1,17 @@
-%%
-%% This is file `longtable.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% longtable.dtx  (with options: `package')
-%% 
-%% This is a generated file.
-%% 
-%% The source is maintained by the LaTeX Project team and bug
-%% reports for it can be opened at http://latex-project.org/bugs.html
-%% (but please observe conditions on bug reports sent to that address!)
-%% 
-%% Copyright 1993-2016
-%% The LaTeX3 Project and any individual authors listed elsewhere
-%% in this file.
-%% 
-%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
-%% --------------------------------------------------------------------------
-%% 
-%% It may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3c
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%%    http://www.latex-project.org/lppl.txt
-%% and version 1.3c or later is part of all distributions of LaTeX
-%% version 2005/12/01 or later.
-%% 
-%% This file may only be distributed together with a copy of the LaTeX
-%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
+\doxysection{File List}
+Here is a list of all files with brief descriptions\+:\begin{DoxyCompactList}
+\item\contentsline{section}{\mbox{\hyperlink{avx__matrix_8cpp}{avx\+\_\+matrix.\+cpp}} }{\pageref{avx__matrix_8cpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{avx__matrix_8hpp}{avx\+\_\+matrix.\+hpp}} }{\pageref{avx__matrix_8hpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{coeffs_8cpp}{coeffs.\+cpp}} }{\pageref{coeffs_8cpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{coeffs_8hpp}{coeffs.\+hpp}} }{\pageref{coeffs_8hpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{config_8hpp}{config.\+hpp}} }{\pageref{config_8hpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{main_8cpp}{main.\+cpp}} }{\pageref{main_8cpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{polygon_8cpp}{polygon.\+cpp}} }{\pageref{polygon_8cpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{polygon_8hpp}{polygon.\+hpp}} }{\pageref{polygon_8hpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{rationnal_8cpp}{rationnal.\+cpp}} }{\pageref{rationnal_8cpp}}{}
+\item\contentsline{section}{\mbox{\hyperlink{rationnal_8hpp}{rationnal.\+hpp}} }{\pageref{rationnal_8hpp}}{}
+\end{DoxyCompactList}
+ Bundle'
 %% without such generated files.
 %% 
 %% The list of all files belonging to the LaTeX `Tools Bundle' is

+ 119 - 0
moc/input_physics.cpp

@@ -0,0 +1,119 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'input_physics.hpp'
+**
+** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include <memory>
+#include "../src/qt/input_physics.hpp"
+#include <QtCore/qbytearray.h>
+#include <QtCore/qmetatype.h>
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'input_physics.hpp' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 67
+#error "This file was generated using the moc from 5.15.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+struct qt_meta_stringdata_QtInputPhysics_t {
+    QByteArrayData data[4];
+    char stringdata0[35];
+};
+#define QT_MOC_LITERAL(idx, ofs, len) \
+    Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
+    qptrdiff(offsetof(qt_meta_stringdata_QtInputPhysics_t, stringdata0) + ofs \
+        - idx * sizeof(QByteArrayData)) \
+    )
+static const qt_meta_stringdata_QtInputPhysics_t qt_meta_stringdata_QtInputPhysics = {
+    {
+QT_MOC_LITERAL(0, 0, 14), // "QtInputPhysics"
+QT_MOC_LITERAL(1, 15, 12), // "modelChoosed"
+QT_MOC_LITERAL(2, 28, 0), // ""
+QT_MOC_LITERAL(3, 29, 5) // "index"
+
+    },
+    "QtInputPhysics\0modelChoosed\0\0index"
+};
+#undef QT_MOC_LITERAL
+
+static const uint qt_meta_data_QtInputPhysics[] = {
+
+ // content:
+       8,       // revision
+       0,       // classname
+       0,    0, // classinfo
+       1,   14, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+       0,    0, // constructors
+       0,       // flags
+       0,       // signalCount
+
+ // slots: name, argc, parameters, tag, flags
+       1,    1,   19,    2, 0x08 /* Private */,
+
+ // slots: parameters
+    QMetaType::Void, QMetaType::Int,    3,
+
+       0        // eod
+};
+
+void QtInputPhysics::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
+{
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        auto *_t = static_cast<QtInputPhysics *>(_o);
+        (void)_t;
+        switch (_id) {
+        case 0: _t->modelChoosed((*reinterpret_cast< int(*)>(_a[1]))); break;
+        default: ;
+        }
+    }
+}
+
+QT_INIT_METAOBJECT const QMetaObject QtInputPhysics::staticMetaObject = { {
+    QMetaObject::SuperData::link<QWidget::staticMetaObject>(),
+    qt_meta_stringdata_QtInputPhysics.data,
+    qt_meta_data_QtInputPhysics,
+    qt_static_metacall,
+    nullptr,
+    nullptr
+} };
+
+
+const QMetaObject *QtInputPhysics::metaObject() const
+{
+    return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
+}
+
+void *QtInputPhysics::qt_metacast(const char *_clname)
+{
+    if (!_clname) return nullptr;
+    if (!strcmp(_clname, qt_meta_stringdata_QtInputPhysics.stringdata0))
+        return static_cast<void*>(this);
+    return QWidget::qt_metacast(_clname);
+}
+
+int QtInputPhysics::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QWidget::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        if (_id < 1)
+            qt_static_metacall(this, _c, _id, _a);
+        _id -= 1;
+    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
+        if (_id < 1)
+            *reinterpret_cast<int*>(_a[0]) = -1;
+        _id -= 1;
+    }
+    return _id;
+}
+QT_WARNING_POP
+QT_END_MOC_NAMESPACE

BIN
obj/qt/input.o


BIN
obj/qt/input_geometry.o


BIN
obj/qt/input_physics.o


BIN
obj/qt/input_time.o


BIN
obj/qt/mainwindow.o


+ 39 - 0
src/geometry.cpp

@@ -0,0 +1,39 @@
+#include "geometry.hpp"
+
+double inf = numeric_limits<double>::infinity();
+
+Geometry::Geometry(double _lX,size_t _nX,size_t _nZ,Func _hsoil,Func _dhsoil,Func _hbot,Func _dhbot){
+  lX=_lX;
+  nX=_nX;
+  dX=lX/nX;
+  hsoil=new double[nX];
+  dhsoil=new double[nX];
+  hbot=new double[nX];
+  dhbot=new double[nX];
+  double hs_max=-inf,hb_min=inf;
+  double v;
+  for(size_t k=0;k<nX;++k){
+    double x=k*dX;
+    v=hsoil[k]=_hsoil(x);
+    hs_max=max(v,hs_max);
+    dhsoil[k]=_dhsoil(x);
+    v=hbot[k]=_hbot(x);
+    hb_min=min(v,hb_min);
+    dhbot[k]=_dhbot(x);
+  }
+  double dZ_avg=(hs_max-hb_min)/_nZ;
+  nZ=new size_t[nX];
+  dZ=new double[nX];
+  Z=new double*[nX];
+  for(size_t k=0;k<nX;++k){
+    double d=hsoil[k]-hbot[k];
+    size_t n=d/dZ_avg;
+    double dz=d/n;
+    dZ[k]=dz;
+    nZ[k]=n;
+    Z[k]=new double[n];
+    for(size_t j=0;j<n;++j){
+      Z[k][j]=hbot[k]+j*dz;
+    }
+  }
+}

+ 52 - 0
src/geometry.hpp

@@ -0,0 +1,52 @@
+#ifndef GEOMETRY_HPP
+#define GEOMETRY_HPP
+
+#include <iostream>
+#include <limits>
+
+using namespace std;
+
+using Func = double (*)(double);
+
+extern double inf; 
+
+//! The Geometry class contains all geometric parameters of the domain.
+class Geometry{
+public:
+  //! Geometry constructor
+  Geometry(double lX,size_t nX,size_t nZ,Func hsoil,Func dhsoil,Func hbot,Func dhbot);
+	   
+  //! Horizontal length of the domain
+  double lX;
+
+  //! Number of horizontal steps
+  size_t nX;
+
+  //! Horizontal step
+  double dX;
+
+  //! Level of the soil depending on X, e.g, hsoil[k]=level of the soil at X=k*dX.
+  //! Vector of size nX.
+  double* hsoil;
+
+  //! Derivative of the soil depending on X, vector of size nX.
+  double* dhsoil;
+
+  //! Level of the bottom depending on X, e.g, hbot[k]=level of the bottom at X=k*dX.
+  //! Vector of size nX.
+  double* hbot;
+
+  //! Derivative of the bottom depending on X, vector of size nX.
+  double* dhbot;
+
+  //! Number of vertical step at a given X, vector of size nX.
+  size_t* nZ;
+  
+  //! Vertical step at a given X, vector of size nX.
+  double* dZ;
+
+  //! Vertical considered positions at a given X, vector of vectors of size nX. For each k, Z[k] is a vector of size nZ[k]
+  double** Z;
+  
+};
+#endif

+ 39 - 30
src/main.cpp

@@ -1,44 +1,50 @@
+#include <iostream>
 #include <QApplication>
 #include "qt/mainwindow.hpp"
-/*#include <QMainWindow>
-#include <QTabWidget>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <iostream>
-#include "physics.hpp"*/
+#include "physics.hpp"
+#include "geometry.hpp"
 
 using namespace std;
 
+double hsoil(double x){
+  return 3+cos(x);
+}
+
+double dhsoil(double x){
+  return -sin(x);
+}
+
+double hbot(double x){
+  return sin(x);
+}
+
+double dhbot(double x){
+  return cos(x);
+}
+
 int main(int argc,char** argv){
-  QApplication app (argc, argv);
-  MainWindow window;
-
-  //  QTabWidget* tab=new QTabWidget;
-  //QWidget* phy_widget=new QWidget;
-  //tab->addTab(phy_widget,"Physics");
-    /*  int tab_phy=tab.addTab("Physics");
-  int tab_geo=tab.addTab("Geometry");
-  int tab_ini=tab.addTab("Initialisation");
-  int tab_src=tab.addTab("Source");*/
-  //QPushButton *button1 = new QPushButton("One");
-  //QVBoxLayout *layout=new QVBoxLayout;
-  //layout->addWidget(button1);
-  //Console console;
-  window.resize(800,600);
-  //window.setCentralWidget(tab);
+  QApplication app(argc,argv);
+  QtMainWindow window;
+  window.resize(1280,1024);
   window.show();
   return app.exec();
-  /* Physics physics;
-  physics.s=&Physics::s_BC;
-  physics.ds=&Physics::ds_BC;
-  physics.s_ds=&Physics::s_ds_BC;
-  physics.kr=&Physics::kr_BC;
-  physics.dkr=&Physics::dkr_BC;
-  physics.kr_dkr=&Physics::kr_dkr_BC;
+  /*
+  Physics physics(BrooksCorey);
+  //Physical parameters 
+
+  physics.g=9.81;
+  physics.rho=1000;
+  physics.phi=0.3;
+  physics.k0=3e-5;
+  physics.nivrivsat=0.01;
+  
+  //BrooksCorey model data
   physics.model_datas[0]=-2000;
   physics.model_datas[1]=0;
   physics.model_datas[2]=3;
   physics.model_datas[3]=11;
+
+  //BrooksCorey test
   double v,dv;
   double P=-4000;
   cout<<physics.s(P)<<endl;
@@ -48,5 +54,8 @@ int main(int argc,char** argv){
   physics.s_ds(P,v,dv);
   cout<<v<<' '<<dv<<endl;
   physics.kr_dkr(P,v,dv);
-  cout<<v<<' '<<dv<<endl;*/
+  cout<<v<<' '<<dv<<endl;
+
+  //Geometry test
+  Geometry geometry(10,200,200,&hsoil,&dhsoil,&hbot,&dhbot);*/
 }

+ 19 - 0
src/physics.cpp

@@ -2,6 +2,25 @@
 
 double Physics::model_datas[6];
 
+//-------------
+// Constructor
+//-------------
+
+Physics::Physics(PhysicModel model){
+  switch(model){
+  case BrooksCorey:
+    s=&s_BC;
+    ds=&ds_BC;
+    s_ds=&s_ds_BC;
+    kr=&kr_BC;
+    dkr=&dkr_BC;
+    kr_dkr=&kr_dkr_BC;
+    break;
+  default:
+    assert(false);
+  };
+
+}
 //------------------------
 // Brooks and Corey model
 //------------------------

+ 8 - 3
src/physics.hpp

@@ -2,14 +2,19 @@
 #define PHYSICS_HPP
 
 #include <cmath>
+#include <cassert>
+
+enum PhysicModel{BrooksCorey};
 
 //! The Physics class contains all physical parameters characterising the soil.
 class Physics{
 public:
-
-  //! Gravity acceleration
+  //! Physics constructor
+  Physics(PhysicModel model);
+  
+  //! Gravity acceleration (m.s^-2)
   double g;
-  //! Fluid density
+  //! Fluid density (g.l^(-1))
   double rho;
   
   //! Porosity of the soil

+ 30 - 0
src/qt/input.cpp

@@ -0,0 +1,30 @@
+#include "input.hpp"
+
+QtInput::QtInput():QWidget(){
+  main_layout=new QVBoxLayout;
+  button_layout=new QHBoxLayout();
+  tab_widget=new QTabWidget;
+  button_widget=new QWidget();
+  button_ok=new QPushButton("Ok");
+  button_cancel=new QPushButton("Cancel");
+
+  input_physics=new QtInputPhysics;
+  input_time=new QtInputTime;
+  input_geometry=new QtInputGeometry;
+
+  //Tab
+  tab_widget->addTab(input_physics,"Physics");
+  tab_widget->addTab(input_time,"Time");
+  tab_widget->addTab(input_geometry,"Geometry");
+  
+  //Buttons
+  button_layout->addWidget(button_ok);
+  button_layout->addWidget(button_cancel);
+  button_widget->setLayout(button_layout);
+
+  //Main
+  main_layout->addWidget(tab_widget);
+  main_layout->addWidget(button_widget);
+  setLayout(main_layout);
+
+}

+ 29 - 0
src/qt/input.hpp

@@ -0,0 +1,29 @@
+#ifndef QT_INPUT_HPP
+#define QT_INPUT_HPP
+
+#include <QTabWidget>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include "input_physics.hpp"
+#include "input_time.hpp"
+#include "input_geometry.hpp"
+
+class QtInput:public QWidget{
+private:
+  QVBoxLayout* main_layout;
+  QHBoxLayout* button_layout;
+  QTabWidget* tab_widget;
+  QWidget* button_widget;
+  QPushButton* button_ok;
+  QPushButton* button_cancel;
+  QtInputPhysics* input_physics;
+  QtInputTime* input_time;
+  QtInputGeometry* input_geometry;
+
+public:
+  QtInput();
+  
+};
+
+#endif

+ 7 - 0
src/qt/input_geometry.cpp

@@ -0,0 +1,7 @@
+#include "input_geometry.hpp"
+
+QtInputGeometry::QtInputGeometry():QWidget(){
+}
+
+QtInputGeometry::~QtInputGeometry(){
+}

+ 17 - 0
src/qt/input_geometry.hpp

@@ -0,0 +1,17 @@
+#ifndef QT_INPUT_GEOMETRY_HPP
+#define QT_INPUT_GEOMETRY_HPP
+
+#include <iostream>
+
+#include <QWidget>
+
+using namespace std;
+
+class QtInputGeometry:public QWidget{
+private:
+public:
+  QtInputGeometry();
+  ~QtInputGeometry();
+};
+
+#endif

+ 127 - 0
src/qt/input_physics.cpp

@@ -0,0 +1,127 @@
+#include "input_physics.hpp"
+
+QtInputPhysics::QtInputPhysics():QWidget(){  
+  g_label=new QLabel("Gravity (g) : ");
+  rho_label=new QLabel("Fluid density (&rho;) : ");
+  rho_label->setTextFormat(Qt::RichText);
+  phi_label=new QLabel("Porosity of the soil (&phi;) : ");
+  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("&lambda; exponent");
+    model_input[2]->setValidator(double_validator);
+    model_input[2]->setText(QString::number(BC_lambda));
+    model_label[3]->setText("&alpha; 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();
+  }
+}

+ 64 - 0
src/qt/input_physics.hpp

@@ -0,0 +1,64 @@
+#ifndef QT_INPUT_PHYSICS_HPP
+#define QT_INPUT_PHYSICS_HPP
+
+#include <iostream>
+#include <QLabel>
+#include <QWidget>
+#include <QGroupBox>
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QLineEdit>
+#include <QDoubleValidator>
+
+#include "../physics.hpp"
+
+using namespace std;
+
+static const double def_g=9.81;
+static const double def_rho=1e3;
+static const double def_phi=3e-1;
+static const double def_k0=3e-5;
+static const double def_nivrivsat=1e-2;
+
+//Brooks & Corey
+static const double BC_psat=-2000;
+static const double BC_sres=0;
+static const double BC_lambda=3;
+static const double BC_alpha=11;
+
+static const size_t max_model_parameters=6;
+
+class QtInputPhysics:public QWidget{
+  Q_OBJECT
+private:
+  QGroupBox* phy_common_box;
+  QGroupBox* phy_model_box;
+  QComboBox* phy_model_selection_box;
+  QLabel* g_label;
+  QLabel* rho_label;
+  QLabel* phi_label;
+  QLabel* k0_label;
+  QLabel* nivrivsat_label;
+  QLabel* model_label[max_model_parameters];
+  QLineEdit* g_input;
+  QLineEdit* rho_input;
+  QLineEdit* phi_input;
+  QLineEdit* k0_input;
+  QLineEdit* nivrivsat_input;
+  QLineEdit* model_input[max_model_parameters];
+  QHBoxLayout* base_layout;
+  QVBoxLayout* phy_common_layout;
+  QVBoxLayout* phy_model_layout;
+  QSpacerItem* phy_model_layout_spacer;
+  QDoubleValidator* double_validator;
+  QDoubleValidator* positive_double_validator;
+  size_t nb_model_parameters;
+public:
+  QtInputPhysics();
+  ~QtInputPhysics();
+private slots:
+  void modelChoosed(int index);
+};
+
+#endif

+ 22 - 0
src/qt/input_time.cpp

@@ -0,0 +1,22 @@
+#include "input_time.hpp"
+
+QtInputTime::QtInputTime():QWidget(){
+  main_layout=new QVBoxLayout;
+  T_label=new QLabel("Total duration of the simulation (T)");
+  nT_label=new QLabel("Number of time steps (nT)");
+  T_input=new QLineEdit(QString::number(def_T));
+  nT_input=new QLineEdit(QString::number(def_nT));
+
+  int vspace=20;
+  main_layout->addWidget(T_label);
+  main_layout->addWidget(T_input);
+  main_layout->addSpacing(vspace);
+  main_layout->addWidget(nT_label);
+  main_layout->addWidget(nT_input);
+  main_layout->addSpacing(vspace);
+  main_layout->addStretch();
+  setLayout(main_layout);
+}
+
+QtInputTime::~QtInputTime(){
+}

+ 29 - 0
src/qt/input_time.hpp

@@ -0,0 +1,29 @@
+#ifndef QT_INPUT_TIME_HPP
+#define QT_INPUT_TIME_HPP
+
+#include <iostream>
+#include <QLabel>
+#include <QWidget>
+#include <QLineEdit>
+#include <QVBoxLayout>
+
+#include "../time.hpp"
+
+using namespace std;
+static const double def_T=10;
+static const size_t def_nT=1000;
+
+class QtInputTime:public QWidget{
+private:
+  QLabel* T_label;
+  QLabel* nT_label;
+  QLineEdit* T_input;
+  QLineEdit* nT_input;
+  QVBoxLayout* main_layout;
+public:
+  QtInputTime();
+  ~QtInputTime();
+  
+};
+
+#endif

+ 0 - 13
src/qt/inputwidget.hpp

@@ -1,13 +0,0 @@
-#ifndef INPUT_WIDGET
-#define INPUT_WIDGET
-
-#include <QTabWidget>
-
-class InputWidget:public QTabWidget{
-private:
-public:
-  InputWidget();
-  
-};
-
-#endif

+ 4 - 3
src/qt/mainwindow.cpp

@@ -1,9 +1,10 @@
 #include "mainwindow.hpp"
 
-MainWindow::MainWindow():QMainWindow(){
+QtMainWindow::QtMainWindow():QMainWindow(){
+  QtInput* input=new QtInput();
+  setCentralWidget(input);
   
 }
 
-
-MainWindow::~MainWindow(){
+QtMainWindow::~QtMainWindow(){
 }

+ 7 - 6
src/qt/mainwindow.hpp

@@ -1,14 +1,15 @@
-#ifndef MAINWINDOW
-#define MAINWINDOW
+#ifndef QT_MAINWINDOW_HPP
+#define QT_MAINWINDOW_HPP
 
 #include <QMainWindow>
-#include "inputwidget.hpp"
+#include "input.hpp"
+//#include "view"
 
-class MainWindow:public QMainWindow{
+class QtMainWindow:public QMainWindow{
 private:
 public:
-  MainWindow();
-  ~MainWindow();
+  QtMainWindow();
+  ~QtMainWindow();
 };
 
 

+ 6 - 0
src/qt/view.hpp

@@ -0,0 +1,6 @@
+#include <QOpenGLWidget>
+
+class View:public QOpenGLWidget{
+  
+
+};

+ 16 - 0
src/time.hpp

@@ -0,0 +1,16 @@
+#ifndef TIME_HPP
+#define TIME_HPP
+
+//! The Time class contains information on time discretisation
+class Time{
+public:
+  //! Total duration of the simulation
+  double T;
+
+  //! Number of time steps
+  size_t nT;
+
+  //! Time step
+  double dT;
+};
+#endif