Continue...
This commit is contained in:
parent
42c3424e48
commit
cdc144e7d6
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@ doc/usg.pdf
|
||||
*.pyc
|
||||
brent_test
|
||||
tasmet
|
||||
tasmet_automoc.dir
|
||||
|
@ -38,6 +38,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
#==================================================
|
||||
# Optimized code flags *******************************************
|
||||
#==================================================
|
||||
@ -129,7 +130,6 @@ include_directories(
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(testing)
|
||||
|
||||
# add_executable(tasmet src/main.cpp src/main.moc)
|
||||
add_executable(tasmet src/main.cpp)
|
||||
add_executable(tasmet src/main.cpp src/gui/tasmet_resources.qrc)
|
||||
target_link_libraries(tasmet tasmet_gui tasmet_src messages PythonQt Qt5::Widgets openblas)
|
||||
|
||||
|
@ -8,6 +8,7 @@ include_directories(
|
||||
.
|
||||
protobuf
|
||||
duct
|
||||
ductbc
|
||||
# duct/cell
|
||||
# duct/connectors
|
||||
# duct/eq
|
||||
@ -35,6 +36,9 @@ add_library(tasmet_src
|
||||
duct/geom.cpp
|
||||
duct/duct.cpp
|
||||
|
||||
ductbc/ductbc.cpp
|
||||
ductbc/pressurebc.cpp
|
||||
|
||||
funcs/bessel.cpp
|
||||
funcs/cbessj.cpp
|
||||
funcs/rottfuncs.cpp
|
||||
@ -65,3 +69,4 @@ add_library(tasmet_src
|
||||
|
||||
add_subdirectory(gui)
|
||||
add_subdirectory(protobuf)
|
||||
target_link_libraries(tasmet_src Qt5::Widgets)
|
||||
|
33
src/ductbc/ductbc.cpp
Normal file
33
src/ductbc/ductbc.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// ductbc.cpp
|
||||
//
|
||||
// last-edit-by: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include "ductbc.h"
|
||||
#include "ductbc.pb.h"
|
||||
#include "tasmet_tracer.h"
|
||||
#include "tasmet_assert.h"
|
||||
#include "pressurebc.h"
|
||||
|
||||
Segment* DuctBc::newDuctBc(const us id,
|
||||
const TaSystem& sys,
|
||||
const pb::DuctBc& dbc) {
|
||||
|
||||
TRACE(15,"newDuctBc");
|
||||
|
||||
switch (dbc.type()) {
|
||||
case pb::PressureBc: {
|
||||
return new PressureBc(id,sys,dbc);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
tasmet_assert(false,"Not implemented DuctBc");
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
27
src/ductbc/ductbc.h
Normal file
27
src/ductbc/ductbc.h
Normal file
@ -0,0 +1,27 @@
|
||||
// ductbc.h
|
||||
//
|
||||
// Author: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
// Prototype for duct boundary conditions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#ifndef DUCTBC_H
|
||||
#define DUCTBC_H
|
||||
#include "segment.h"
|
||||
|
||||
namespace pb{
|
||||
class DuctBc;
|
||||
}
|
||||
|
||||
class DuctBc {
|
||||
|
||||
public:
|
||||
static Segment* newDuctBc(const us id,
|
||||
const TaSystem& sys,
|
||||
const pb::DuctBc&);
|
||||
};
|
||||
|
||||
|
||||
#endif // DUCTBC_H
|
||||
//////////////////////////////////////////////////////////////////////
|
63
src/ductbc/pressurebc.cpp
Normal file
63
src/ductbc/pressurebc.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
// pressurebc.cpp
|
||||
//
|
||||
// last-edit-by: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pressurebc.h"
|
||||
#include "ductbc.pb.h"
|
||||
#include "tasmet_tracer.h"
|
||||
|
||||
PressureBc::PressureBc(const us id,
|
||||
const TaSystem& sys,
|
||||
const pb::DuctBc& dbc):
|
||||
Segment(id,dbc.name())
|
||||
{
|
||||
TRACE(15,"PressureBc(id,sys,dbc)");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
PressureBc::PressureBc(const PressureBc& o):
|
||||
Segment(o) {
|
||||
|
||||
TRACE(15,"PressureBc(o)");
|
||||
|
||||
}
|
||||
PressureBc::~PressureBc() {
|
||||
|
||||
}
|
||||
PressureBc* PressureBc::copy() const {
|
||||
return new PressureBc(*this);
|
||||
}
|
||||
vd PressureBc::initialSolution(const TaSystem& sys) const {
|
||||
return vd();
|
||||
}
|
||||
|
||||
void PressureBc::residual(const TaSystem&,
|
||||
arma::subview_col<d>&& residual
|
||||
) const {
|
||||
|
||||
TRACE(15,"PressureBc::residual()");
|
||||
|
||||
|
||||
}
|
||||
|
||||
us PressureBc::getNEqs(const TaSystem&) const {
|
||||
TRACE(15,"PressureBc::getNEqs()");
|
||||
|
||||
|
||||
}
|
||||
void PressureBc::show(const TaSystem&,us verbosity_level) const {
|
||||
TRACE(15,"PressureBc::show()");
|
||||
}
|
||||
void PressureBc::jac(const TaSystem&,Jacobian&,
|
||||
us dof_start,us eq_start) const {
|
||||
|
||||
TRACE(15,"PressureBc::jac()");
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
56
src/ductbc/pressurebc.h
Normal file
56
src/ductbc/pressurebc.h
Normal file
@ -0,0 +1,56 @@
|
||||
// pressurebc.h
|
||||
//
|
||||
// Author: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
// Pressure boundary condition on a side of the duct
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#ifndef PRESSUREBC_H
|
||||
#define PRESSUREBC_H
|
||||
#include "segment.h"
|
||||
|
||||
class TaSystem;
|
||||
namespace pb{
|
||||
class DuctBc;
|
||||
}
|
||||
class Variable;
|
||||
|
||||
class PressureBc: public Segment {
|
||||
Variable *_p,*_T,*_Ts;
|
||||
protected:
|
||||
PressureBc(const PressureBc&);
|
||||
public:
|
||||
PressureBc(const us id,
|
||||
const TaSystem& sys,
|
||||
const pb::DuctBc&);
|
||||
~PressureBc();
|
||||
PressureBc* copy() const;
|
||||
|
||||
vd initialSolution(const TaSystem&) const;
|
||||
|
||||
virtual void residual(const TaSystem&,
|
||||
arma::subview_col<d>&& residual
|
||||
) const;
|
||||
|
||||
// Return the total number of equations in this segment
|
||||
virtual us getNEqs(const TaSystem&) const;
|
||||
|
||||
// Return the current mass in this segment
|
||||
virtual d getMass(const TaSystem&) const { return 0;};
|
||||
|
||||
virtual void show(const TaSystem&,us verbosity_level) const;
|
||||
|
||||
// Reset amplitude data in higher harmonics
|
||||
// virtual void resetHarmonics() = 0;
|
||||
|
||||
// Fill Jacobian with values from the equations in this
|
||||
// segment/connector.
|
||||
virtual void jac(const TaSystem&,Jacobian&,us dof_start,us eq_start) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // PRESSUREBC_H
|
||||
//////////////////////////////////////////////////////////////////////
|
@ -5,6 +5,8 @@
|
||||
add_library(tasmet_gui
|
||||
mainwindow.cpp
|
||||
add_duct_dialog.cpp
|
||||
add_ductbc_dialog.cpp
|
||||
about_dialog.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(tasmet_gui qcustomplot)
|
||||
|
18
src/gui/about_dialog.cpp
Normal file
18
src/gui/about_dialog.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// about_dialog.cpp
|
||||
//
|
||||
// last-edit-by: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include "about_dialog.h"
|
||||
#include "ui_about_dialog.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget* parent):
|
||||
QDialog(parent),
|
||||
_dialog(new Ui::about_dialog)
|
||||
{
|
||||
_dialog->setupUi(this);
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
22
src/gui/about_dialog.h
Normal file
22
src/gui/about_dialog.h
Normal file
@ -0,0 +1,22 @@
|
||||
// about_dialog.h
|
||||
//
|
||||
// Author: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#ifndef ABOUT_DIALOG_H
|
||||
#define ABOUT_DIALOG_H
|
||||
#include <QDialog>
|
||||
namespace Ui{
|
||||
class about_dialog;
|
||||
}
|
||||
class AboutDialog:public QDialog{
|
||||
Ui::about_dialog* _dialog;
|
||||
public:
|
||||
AboutDialog(QWidget* parent);
|
||||
};
|
||||
|
||||
#endif // ABOUT_DIALOG_H
|
||||
//////////////////////////////////////////////////////////////////////
|
142
src/gui/about_dialog.ui
Normal file
142
src/gui/about_dialog.ui
Normal file
@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>about_dialog</class>
|
||||
<widget class="QDialog" name="about_dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>318</width>
|
||||
<height>582</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About TaSMET</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TaSMET</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Thermoacoustic System</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Modeling Environment Twente</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>433</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>433</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255)</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="tasmet_resources.qrc">:/images/tasmet.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Copyright (c) 2017 Anne de Jong</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>All rights reserved</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="tasmet_resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>about_dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>158</x>
|
||||
<y>562</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>158</x>
|
||||
<y>290</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -129,11 +129,7 @@ void AddDuctDialog::accept(){
|
||||
}
|
||||
catch(TaSMETError& e) {
|
||||
|
||||
QMessageBox msg(QMessageBox::Warning,
|
||||
"Input parsing error",
|
||||
e.what());
|
||||
|
||||
msg.exec();
|
||||
e.show_user("Input parsing error");
|
||||
|
||||
// Do not finally accept until we do not have any errors
|
||||
return;
|
||||
@ -220,19 +216,19 @@ void AddDuctDialog::changed(){
|
||||
switch (pshow) {
|
||||
case CSArea:
|
||||
_plot->yAxis->setLabel("S [m^2]");
|
||||
y = geom->S;
|
||||
y = duct->S;
|
||||
break;
|
||||
case Porosity:
|
||||
_plot->yAxis->setLabel("phi [-]");
|
||||
y = geom->phi;
|
||||
y = duct->phi;
|
||||
break;
|
||||
case HydraulicRadius:
|
||||
_plot->yAxis->setLabel("rh [m]");
|
||||
y = geom->rh;
|
||||
y = duct->rh;
|
||||
break;
|
||||
case SolidTemperatureFunction:
|
||||
_plot->yAxis->setLabel("Ts [K]");
|
||||
y = geom->rh;
|
||||
y = duct->rh;
|
||||
break;
|
||||
default:
|
||||
tasmet_assert(false,"Unhandled PreviewShow case");
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>654</height>
|
||||
<width>848</width>
|
||||
<height>667</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -19,231 +19,13 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>391</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="geometry_groupbox">
|
||||
<property name="title">
|
||||
<string>Geometry</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="L">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Length (L): </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="S">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>[-]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="cshape"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="phi">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Cross-sectional area function:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>[m]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Cross sectional shape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Porosity function:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>[m^2]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Solid type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="solidtype"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Hydraulic radius: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="rh">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>[m]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Preview options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="previewshow"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
<string>Show: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Model</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>Drag model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Heat transfer model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="htmodel"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="stempfunc">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>Solid temperature function</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="dragmodel"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>[K]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>Solid temperature model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="stempmodel"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
@ -314,26 +96,245 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="geometry_groupbox">
|
||||
<property name="title">
|
||||
<string>Geometry</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Cross sectional shape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>[m^2]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>[m]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="S">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Solid type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="solidtype"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Porosity function:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="L">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Length (L): </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Hydraulic radius: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="rh">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>[m]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>[-]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Cross-sectional area function:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="cshape"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="phi">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Model</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>Drag model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Heat transfer model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="htmodel"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="stempfunc">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>Solid temperature function</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="dragmodel"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>[K]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>Solid temperature model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="stempmodel"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="preview_groupbox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCustomPlot" name="plot" native="true"/>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Preview options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
<string>Show: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="previewshow"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCustomPlot" name="plot" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>verticalLayoutWidget</zorder>
|
||||
<zorder>groupBox_4</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
104
src/gui/add_ductbc_dialog.cpp
Normal file
104
src/gui/add_ductbc_dialog.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
// add_ductbc_dialog.cpp
|
||||
//
|
||||
// last-edit-by: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "add_ductbc_dialog.h"
|
||||
#include "ui_add_ductbc_dialog.h"
|
||||
#include "tasmet_tracer.h"
|
||||
#include "tasmet_assert.h"
|
||||
|
||||
AddDuctBcDialog::AddDuctBcDialog(const std::string& name,QWidget* parent):
|
||||
QDialog(parent),
|
||||
_dialog(new Ui::add_ductbc_dialog),
|
||||
_ductbc(pb::DuctBc::default_instance())
|
||||
{
|
||||
TRACE(15,"AddDuctDialog");
|
||||
_dialog->setupUi(this);
|
||||
|
||||
_ductbc.set_name(name);
|
||||
|
||||
QString title = "Add/edit duct boundary condition segment '";
|
||||
title += QString::fromStdString(name);
|
||||
title +="'";
|
||||
this->setWindowTitle(title);
|
||||
|
||||
for(int ductbctype = pb::DuctBcType_MIN;
|
||||
ductbctype<=pb::DuctBcType_MAX;
|
||||
ductbctype++){
|
||||
_dialog->type->addItem(QString::fromStdString(DuctBcType_Name((pb::DuctBcType) ductbctype)));
|
||||
}
|
||||
_dialog->type->setCurrentIndex(0);
|
||||
|
||||
for(int ductside = pb::DuctSide_MIN;
|
||||
ductside<=pb::DuctSide_MAX;
|
||||
ductside++){
|
||||
_dialog->side->addItem(QString::fromStdString(DuctSide_Name((pb::DuctSide) ductside)));
|
||||
}
|
||||
_dialog->side->setCurrentIndex(0);
|
||||
|
||||
_dialog->pressure->setText("p0 + 1.0*sin(2*pi*freq*t)");
|
||||
_dialog->temperature->setText("T0");
|
||||
|
||||
_init = false;
|
||||
changed();
|
||||
|
||||
}
|
||||
void AddDuctBcDialog::changed() {
|
||||
if(_init) return;
|
||||
pb::DuctBcType type = (pb::DuctBcType) _dialog->type->currentIndex();
|
||||
bool isentropic = _dialog->isentropic->isChecked();
|
||||
VARTRACE(15,type);
|
||||
switch (type) {
|
||||
case pb::PressureBc:
|
||||
_dialog->isentropic->setEnabled(true);
|
||||
_dialog->temperature->setEnabled(!isentropic);
|
||||
_dialog->pressure->setEnabled(true);
|
||||
break;
|
||||
case pb::AdiabaticWall:
|
||||
_dialog->isentropic->setEnabled(false);
|
||||
_dialog->temperature->setEnabled(false);
|
||||
_dialog->pressure->setEnabled(false);
|
||||
break;
|
||||
case pb::IsoTWall:
|
||||
_dialog->isentropic->setEnabled(false);
|
||||
_dialog->temperature->setEnabled(true);
|
||||
_dialog->pressure->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
tasmet_assert(false,"Not implemented");
|
||||
break;
|
||||
}
|
||||
_ductbc.set_type(type);
|
||||
_ductbc.set_side((pb::DuctSide) _dialog->side->currentIndex());
|
||||
_ductbc.set_duct_id(_dialog->duct_id->value());
|
||||
_ductbc.set_pressure(_dialog->pressure->text().toStdString());
|
||||
_ductbc.set_temperature(_dialog->temperature->text().toStdString());
|
||||
_ductbc.set_isentropic(isentropic);
|
||||
|
||||
}
|
||||
void AddDuctBcDialog::set(const pb::DuctBc& ductbc) {
|
||||
|
||||
_dialog->type->setCurrentIndex((int) ductbc.type());
|
||||
_dialog->side->setCurrentIndex((int) ductbc.side());
|
||||
_dialog->duct_id->setValue(ductbc.duct_id());
|
||||
_dialog->pressure->setText(QString::fromStdString(ductbc.pressure()));
|
||||
_dialog->temperature->setText(QString::fromStdString(ductbc.temperature()));
|
||||
_dialog->isentropic->setChecked(ductbc.isentropic());
|
||||
_ductbc = ductbc;
|
||||
}
|
||||
|
||||
AddDuctBcDialog::~AddDuctBcDialog(){
|
||||
delete _dialog;
|
||||
|
||||
}
|
||||
void AddDuctBcDialog::reject() {
|
||||
QDialog::reject();
|
||||
}
|
||||
void AddDuctBcDialog::accept() {
|
||||
QDialog::accept();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
40
src/gui/add_ductbc_dialog.h
Normal file
40
src/gui/add_ductbc_dialog.h
Normal file
@ -0,0 +1,40 @@
|
||||
// add_ductbc_dialog.h
|
||||
//
|
||||
// Author: J.A. de Jong
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#ifndef ADD_DUCTBC_DIALOG_H
|
||||
#define ADD_DUCTBC_DIALOG_H
|
||||
#include "ductbc.pb.h"
|
||||
#include <QDialog>
|
||||
namespace Ui{
|
||||
class add_ductbc_dialog;
|
||||
}
|
||||
class AddDuctBcDialog: public QDialog {
|
||||
Q_OBJECT
|
||||
Ui::add_ductbc_dialog* _dialog;
|
||||
pb::DuctBc _ductbc;
|
||||
bool _init = true;
|
||||
public:
|
||||
AddDuctBcDialog(const std::string& name,QWidget* parent = nullptr);
|
||||
~AddDuctBcDialog();
|
||||
|
||||
void set(const pb::DuctBc&);
|
||||
const pb::DuctBc& get() const {return _ductbc; }
|
||||
|
||||
private:
|
||||
void changed();
|
||||
|
||||
private slots:
|
||||
void on_type_currentIndexChanged(int) {changed();}
|
||||
void on_isentropic_stateChanged(int) {changed();}
|
||||
void accept();
|
||||
void reject();
|
||||
|
||||
};
|
||||
|
||||
#endif // ADD_DUCTBC_DIALOG_H
|
||||
//////////////////////////////////////////////////////////////////////
|
151
src/gui/add_ductbc_dialog.ui
Normal file
151
src/gui/add_ductbc_dialog.ui
Normal file
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>add_ductbc_dialog</class>
|
||||
<widget class="QDialog" name="add_ductbc_dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Prescribed pressure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="duct_id">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="type"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Side</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>[K]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="pressure">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="temperature">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Duct ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="isentropic">
|
||||
<property name="text">
|
||||
<string>Isentropic pressure-temperature coupling</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="side"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>[Pa]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Prescribed temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>add_ductbc_dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>add_ductbc_dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
BIN
src/gui/images/document-new.png
Normal file
BIN
src/gui/images/document-new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
src/gui/images/document-open.png
Normal file
BIN
src/gui/images/document-open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
src/gui/images/document-save-as.png
Normal file
BIN
src/gui/images/document-save-as.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
src/gui/images/document-save.png
Normal file
BIN
src/gui/images/document-save.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
src/gui/images/tasmet.png
Executable file
BIN
src/gui/images/tasmet.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
@ -16,99 +16,456 @@
|
||||
#include <QIntValidator>
|
||||
#include "gas.h"
|
||||
#include "tasmet_tracer.h"
|
||||
#include "tasmet_assert.h"
|
||||
#include "add_duct_dialog.h"
|
||||
#include "add_ductbc_dialog.h"
|
||||
#include "tasystem.h"
|
||||
#include "tasmet_exception.h"
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <sstream>
|
||||
#include "about_dialog.h"
|
||||
#include <google/protobuf/text_format.h>
|
||||
|
||||
const QString default_name = "Unnamed segment";
|
||||
using google::protobuf::TextFormat;
|
||||
|
||||
const QString default_system_name = QString("Unsaved TaSMET Model") +
|
||||
constants::system_fileext;
|
||||
const QString default_segment_name = "Unnamed segment";
|
||||
const QString start_file_location = QStandardPaths::
|
||||
writableLocation(QStandardPaths::DocumentsLocation);
|
||||
const QString filetype = QString("TaSMET Model files (*") + constants::system_fileext + ")";
|
||||
const QString window_title_part = "TaSMET Model Builder - ";
|
||||
namespace {
|
||||
pb::System loadSystem(const string& filepath) {
|
||||
|
||||
TRACE(15,"loadSystem()");
|
||||
VARTRACE(15,filepath);
|
||||
std::ifstream myfile(filepath);
|
||||
|
||||
if(!myfile.good()) {
|
||||
string error = "Read error on ";
|
||||
error += filepath;
|
||||
throw TaSMETError(error);
|
||||
|
||||
}
|
||||
|
||||
pb::System sys;
|
||||
|
||||
std::stringstream strStream;
|
||||
strStream << myfile.rdbuf(); //read the file
|
||||
string data = strStream.str();//str holds the content of the file
|
||||
VARTRACE(15,data);
|
||||
|
||||
if(!TextFormat::ParseFromString(data,&sys)) {
|
||||
string error = "Invalid TaSMET Model file: ";
|
||||
error += filepath;
|
||||
throw TaSMETError(error);
|
||||
}
|
||||
|
||||
return sys;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// // Returns true when the two systems are equal
|
||||
bool compareSys(const pb::System& s1,const pb::System& s2) {
|
||||
return (s1.SerializeAsString()==s2.SerializeAsString());
|
||||
}
|
||||
|
||||
int saveFileFirstQuestion(QWidget* parent) {
|
||||
|
||||
return QMessageBox::question(parent,
|
||||
"Model has unsaved changes",
|
||||
"Would you like to save the changes?",
|
||||
QMessageBox::Yes |
|
||||
QMessageBox::No |
|
||||
QMessageBox::Cancel);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
TaSMETMainWindow::TaSMETMainWindow():
|
||||
window(new Ui::MainWindow())
|
||||
_window(new Ui::MainWindow()),
|
||||
_system(pb::System::default_instance())
|
||||
{
|
||||
|
||||
window->setupUi(this);
|
||||
if(!_window) throw TaSMETBadAlloc();
|
||||
_window->setupUi(this);
|
||||
|
||||
// Restore settings
|
||||
QSettings settings(company,appname);
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
restoreState(settings.value("windowState").toByteArray());
|
||||
|
||||
|
||||
for(const SystemType& t: SystemType_vec){
|
||||
window->systemtype->addItem(SystemTypeToString(t));
|
||||
_window->systemtype->addItem(SystemTypeToString(t));
|
||||
}
|
||||
for(int gastype = pb::GasType_MIN;gastype<=pb::GasType_MAX;gastype++){
|
||||
window->gastype->addItem(QString::fromStdString(GasType_Name((pb::GasType) gastype)));
|
||||
_window->gastype->addItem(QString::fromStdString(GasType_Name((pb::GasType) gastype)));
|
||||
}
|
||||
for(const SegmentType& t: SegmentType_vec){
|
||||
window->segmenttype->addItem(SegmentTypeToString(t));
|
||||
_window->segmenttype->addItem(SegmentTypeToString(t));
|
||||
}
|
||||
|
||||
window->T0->setText(QString::number(constants::default_T0));
|
||||
window->T0->setValidator(new QDoubleValidator(constants::min_T0,
|
||||
// TODO: change from omg to freq
|
||||
_window->freq->setValidator(new QDoubleValidator(constants::min_omg,
|
||||
constants::max_omg,
|
||||
constants::field_decimals));
|
||||
|
||||
|
||||
_window->T0->setText(QString::number(constants::default_T0));
|
||||
_window->T0->setValidator(new QDoubleValidator(constants::min_T0,
|
||||
constants::max_T0,
|
||||
constants::field_decimals));
|
||||
|
||||
window->p0->setText(QString::number(constants::default_p0));
|
||||
window->p0->setValidator(new QDoubleValidator(constants::min_p0,
|
||||
_window->p0->setText(QString::number(constants::default_p0));
|
||||
_window->p0->setValidator(new QDoubleValidator(constants::min_p0,
|
||||
constants::max_p0,
|
||||
constants::field_decimals));
|
||||
window->name->setText(default_name);
|
||||
_window->segmentname->setText(default_system_name);
|
||||
|
||||
_window->segmentid->setMaximum(constants::max_segs);
|
||||
|
||||
_window->nf->setMaximum(constants::max_Nf);
|
||||
|
||||
_init = false;
|
||||
|
||||
changed();
|
||||
|
||||
}
|
||||
|
||||
TaSMETMainWindow::~TaSMETMainWindow(){
|
||||
delete _window;
|
||||
}
|
||||
|
||||
void TaSMETMainWindow::newModel() {
|
||||
TRACE(15,"newModel");
|
||||
_system = pb::System::default_instance();
|
||||
_filepath = "";
|
||||
set(_system);
|
||||
}
|
||||
void TaSMETMainWindow::loadModel() {
|
||||
TRACE(15,"loadModel");
|
||||
if(isDirty()) {
|
||||
int answer = saveFileFirstQuestion(this);
|
||||
if(answer == QMessageBox::Yes) saveModel();
|
||||
else if(answer == QMessageBox::Cancel) return;
|
||||
}
|
||||
|
||||
QString title = tr("Open existing TaSMET model file");
|
||||
|
||||
QString filepath = QFileDialog::getOpenFileName(this,
|
||||
title,
|
||||
start_file_location,
|
||||
filetype);
|
||||
string filepath_s = filepath.toStdString();
|
||||
if(filepath.size()!=0) {
|
||||
try {
|
||||
TRACE(15,"Setting loaded system");
|
||||
_filepath = filepath_s;
|
||||
set(loadSystem(filepath_s));
|
||||
}
|
||||
catch(TaSMETError &e) {
|
||||
_filepath = "";
|
||||
e.show_user("Error opening model file");
|
||||
}
|
||||
}
|
||||
}
|
||||
void TaSMETMainWindow::saveModel(string* filepath) {
|
||||
|
||||
TRACE(15,"saveModel");
|
||||
|
||||
if(isDirty() || filepath!=nullptr) {
|
||||
|
||||
// The user pressed save, but the model has never
|
||||
// been saved. Hence we 'save as'
|
||||
if(_filepath.size()==0 && filepath == nullptr) {
|
||||
return saveAsModel();
|
||||
}
|
||||
else if(filepath == nullptr) {
|
||||
filepath = &_filepath;
|
||||
}
|
||||
|
||||
std::ofstream sfile(*filepath);
|
||||
if(!sfile.good()){
|
||||
|
||||
QMessageBox::warning(this,
|
||||
"File error",
|
||||
"Could not open file for saving");
|
||||
return;
|
||||
}
|
||||
string data;
|
||||
if(TextFormat::PrintToString(_system,&data)) {
|
||||
// Can maybe assign to itself. Which is no problem
|
||||
// according to C++ docs
|
||||
TRACE(15,"Saving file succeeded");
|
||||
VARTRACE(15,data);
|
||||
sfile << data;
|
||||
// Close file here, such that in can be opened to compare
|
||||
// whether the file is still dirty
|
||||
sfile.close();
|
||||
_filepath = *filepath;
|
||||
changed();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this,
|
||||
"File error",
|
||||
"Could not save model to file");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
TaSMETMainWindow::~TaSMETMainWindow(){
|
||||
delete window;
|
||||
void TaSMETMainWindow::saveAsModel() {
|
||||
TRACE(15,"saveModel");
|
||||
|
||||
QString suggested_file;
|
||||
|
||||
if(_filepath.size()==0) {
|
||||
suggested_file = QDir(start_file_location).filePath(default_system_name);
|
||||
}
|
||||
else {
|
||||
suggested_file.fromStdString(_filepath);
|
||||
}
|
||||
|
||||
|
||||
VARTRACE(15,filetype.toStdString());
|
||||
QString title = tr("Save model file");
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
title,
|
||||
suggested_file,
|
||||
filetype);
|
||||
|
||||
if(fileName.size()!=0) {
|
||||
string fn = fileName.toStdString();
|
||||
|
||||
saveModel(&fn);
|
||||
}
|
||||
|
||||
}
|
||||
void TaSMETMainWindow::changed() {
|
||||
TRACE(15,"changed()");
|
||||
if(_init) return;
|
||||
TRACE(15,"changed() continued");
|
||||
|
||||
_system.set_nf(_window->nf->value());
|
||||
_system.set_freq(_window->freq->text().toDouble());
|
||||
|
||||
_system.set_gastype((pb::GasType) _window->gastype->currentIndex());
|
||||
_system.set_t0(_window->T0->text().toDouble());
|
||||
_system.set_p0(_window->p0->text().toDouble());
|
||||
|
||||
_system.set_systemtype((pb::SystemType) _window->systemtype->currentIndex());
|
||||
|
||||
QString windowtitle = window_title_part;
|
||||
if(isDirty()) windowtitle+= '*';
|
||||
if(_filepath.size()!=0) {
|
||||
windowtitle += QString::fromStdString(_filepath);
|
||||
}
|
||||
else {
|
||||
windowtitle += default_system_name;
|
||||
}
|
||||
|
||||
setWindowTitle(windowtitle);
|
||||
_window->segoverview->setPlainText(QString::fromStdString(_system.DebugString()));
|
||||
|
||||
// Update stuff based on the segments
|
||||
int value = _window->segmentid->value();
|
||||
on_segmentid_valueChanged(value);
|
||||
|
||||
}
|
||||
void TaSMETMainWindow::set(const pb::System& sys) {
|
||||
TRACE(15,"set()");
|
||||
_init = true;
|
||||
|
||||
_window->nf->setValue(sys.nf());
|
||||
_window->freq->setText(QString::number(sys.freq()));
|
||||
_window->p0->setText(QString::number(sys.p0()));
|
||||
_window->T0->setText(QString::number(sys.t0()));
|
||||
_window->systemtype->setCurrentIndex((int) sys.systemtype());
|
||||
_window->gastype->setCurrentIndex((int) sys.gastype());
|
||||
|
||||
_system = sys;
|
||||
_init = false;
|
||||
|
||||
changed();
|
||||
|
||||
}
|
||||
void TaSMETMainWindow::closeEvent(QCloseEvent *event) {
|
||||
|
||||
if(isDirty()) {
|
||||
|
||||
int answer = saveFileFirstQuestion(this);
|
||||
if(answer == QMessageBox::Yes){
|
||||
saveModel();
|
||||
// If we are still dirty after a save (user probably
|
||||
// cancelled the save action, return to the GUI
|
||||
if(isDirty()) {
|
||||
TRACE(15,"still dirty");
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(answer == QMessageBox::Cancel) {
|
||||
TRACE(15,"CloseEvent cancelled");
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Save window configuration to settings
|
||||
QSettings settings(company,appname);
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("windowState", saveState());
|
||||
|
||||
// Forward close event to parent
|
||||
QMainWindow::closeEvent(event);
|
||||
event->accept();
|
||||
|
||||
}
|
||||
void TaSMETMainWindow::on_addsegment_clicked() {
|
||||
|
||||
us id = window->segmentid_add->value();
|
||||
string name = window->name->text().toStdString();
|
||||
VARTRACE(15,name);
|
||||
bool edit = false;
|
||||
|
||||
AddDuctDialog dialog(name,this);
|
||||
|
||||
auto& ductmap = *_system.mutable_ducts();
|
||||
if(ductmap.find(id) != ductmap.end()) {
|
||||
dialog.set(ductmap[id]);
|
||||
// Different segments all have different type. Therefore this part of
|
||||
// the code is templatized. In this function, the dialog is
|
||||
// created. If the segment already existed, the `set' function is
|
||||
// called, with the found segment in the list. Finally the exitcode of
|
||||
// the dialog is returned
|
||||
template<typename segmenttype,typename dialogtype>
|
||||
int add_edit_segment(QWidget* parent,
|
||||
const string& name,
|
||||
google::protobuf::Map<google::protobuf::uint32,segmenttype> & segmap,
|
||||
const us id) {
|
||||
|
||||
dialogtype dialog(name,parent);
|
||||
|
||||
if(segmap.find(id) != segmap.end()) {
|
||||
dialog.set(segmap[id]);
|
||||
}
|
||||
|
||||
int exitcode = dialog.exec();
|
||||
|
||||
if(exitcode == QDialog::Accepted) {
|
||||
|
||||
VARTRACE(15,dialog.get().name());
|
||||
ductmap[id] = dialog.get();
|
||||
window->segmentid_add->setValue(id+1);
|
||||
segmap[id] = dialog.get();
|
||||
|
||||
}
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
|
||||
void TaSMETMainWindow::on_addsegment_clicked() {
|
||||
TRACE(15,"on_addsegment_clicked");
|
||||
us id = _window->segmentid->value();
|
||||
string name = _window->segmentname->text().toStdString();
|
||||
VARTRACE(15,name);
|
||||
|
||||
SegmentType segtype = (SegmentType) _window->segmenttype->currentIndex();
|
||||
|
||||
int exitcode=QDialog::Rejected;
|
||||
|
||||
switch (segtype) {
|
||||
case Duct: {
|
||||
exitcode = add_edit_segment<pb::Duct,AddDuctDialog>
|
||||
(this,
|
||||
name,
|
||||
*_system.mutable_ducts(),
|
||||
id);
|
||||
break;
|
||||
}
|
||||
case DuctBc: {
|
||||
exitcode = add_edit_segment<pb::DuctBc,AddDuctBcDialog>
|
||||
(this,
|
||||
name,
|
||||
*_system.mutable_ductbcs(),
|
||||
id);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
tasmet_assert(false,"Not implemented");
|
||||
}
|
||||
|
||||
|
||||
if(exitcode == QDialog::Accepted) {
|
||||
_window->segmentid->setValue(id+1);
|
||||
changed();
|
||||
}
|
||||
|
||||
}
|
||||
void TaSMETMainWindow::on_segmentid_add_valueChanged(int id) {
|
||||
void TaSMETMainWindow::on_removesegment_clicked() {
|
||||
TRACE(15,"on_remove");
|
||||
QString question = "Are you you wish to delete segment ";
|
||||
int segid = _window->segmentid->value();
|
||||
|
||||
question+= QString::number(segid);
|
||||
question+= "?";
|
||||
int answ = QMessageBox::question(this,
|
||||
"Deleting segment",
|
||||
question,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(answ == QMessageBox::Yes) {
|
||||
_system.mutable_ducts()->erase(segid);
|
||||
_system.mutable_ductbcs()->erase(segid);
|
||||
changed();
|
||||
}
|
||||
}
|
||||
|
||||
void TaSMETMainWindow::on_segmentid_valueChanged(int id) {
|
||||
|
||||
auto& ductmap = *_system.mutable_ducts();
|
||||
auto& ductbcmap = *_system.mutable_ductbcs();
|
||||
|
||||
bool is_segment = false;
|
||||
|
||||
if(ductmap.find(id) != ductmap.end()) {
|
||||
window->name->setText(QString::fromStdString(ductmap[id].name()));
|
||||
}
|
||||
_window->segmentname->setText(QString::fromStdString(ductmap[id].name()));
|
||||
is_segment = true;
|
||||
}
|
||||
if(ductbcmap.find(id) != ductbcmap.end()) {
|
||||
_window->segmentname->setText(QString::fromStdString(ductbcmap[id].name()));
|
||||
is_segment = true;
|
||||
}
|
||||
|
||||
_window->removesegment->setEnabled(is_segment);
|
||||
|
||||
}
|
||||
void TaSMETMainWindow::on_name_textEdited() {
|
||||
|
||||
auto& ductmap = *_system.mutable_ducts();
|
||||
int id = window->segmentid_add->value();
|
||||
|
||||
auto& ductbcmap = *_system.mutable_ductbcs();
|
||||
|
||||
int id = _window->segmentid->value();
|
||||
|
||||
if(ductmap.find(id) != ductmap.end()) {
|
||||
ductmap[id].set_name(window->name->text().toStdString());
|
||||
|
||||
ductmap[id].set_name(_window->segmentname->text().toStdString());
|
||||
}
|
||||
if(ductbcmap.find(id) != ductbcmap.end()) {
|
||||
ductbcmap[id].set_name(_window->segmentname->text().toStdString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TaSMETMainWindow::on_actionSolve_triggered() {
|
||||
TRACE(15,"actionSolve()");
|
||||
TaSystem sys(_system);
|
||||
|
||||
}
|
||||
bool TaSMETMainWindow::isDirty() const {
|
||||
TRACE(15,"isDirty()");
|
||||
if(_filepath.size()==0) return true;
|
||||
|
||||
try {
|
||||
pb::System filesys = loadSystem(_filepath);
|
||||
bool dirty = !compareSys(filesys,_system);
|
||||
VARTRACE(15,dirty);
|
||||
return dirty;
|
||||
}
|
||||
catch(TaSMETError& e) {
|
||||
TRACE(15,"Files could not be compared");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void TaSMETMainWindow::on_actionAbout_triggered(){
|
||||
|
||||
AboutDialog(this).exec();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -11,23 +11,66 @@
|
||||
#include "tasmet_config.h"
|
||||
#include <QMainWindow>
|
||||
#include "protobuf/system.pb.h"
|
||||
#include "tasmet_types.h"
|
||||
|
||||
namespace Ui{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class TaSMETMainWindow: public QMainWindow {
|
||||
// For Qt
|
||||
Q_OBJECT
|
||||
Ui::MainWindow *window;
|
||||
|
||||
Ui::MainWindow *_window;
|
||||
|
||||
// In-memory system
|
||||
pb::System _system;
|
||||
|
||||
// Where the file is stored
|
||||
string _filepath = "";
|
||||
|
||||
bool _init = true;
|
||||
|
||||
public:
|
||||
TaSMETMainWindow();
|
||||
~TaSMETMainWindow();
|
||||
private:
|
||||
void newModel();
|
||||
void loadModel();
|
||||
void saveModel(string* filepath=nullptr);
|
||||
void saveAsModel();
|
||||
|
||||
// When the user interacts, we call this function to update the
|
||||
// internal state and set the widget status accordingly
|
||||
void changed();
|
||||
void set(const pb::System&);
|
||||
|
||||
// Check whether the filepath contents agree with the system in
|
||||
// memory
|
||||
bool isDirty() const;
|
||||
|
||||
private slots:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void on_addsegment_clicked();
|
||||
void on_segmentid_add_valueChanged(int i);
|
||||
void on_removesegment_clicked();
|
||||
void on_segmentid_valueChanged(int i);
|
||||
void on_name_textEdited();
|
||||
|
||||
// Couple slots to functions
|
||||
void on_actionNew_triggered() { newModel();}
|
||||
void on_actionOpen_triggered() { loadModel();}
|
||||
void on_actionSave_triggered() { saveModel();}
|
||||
void on_actionSaveAs_triggered() { saveAsModel();}
|
||||
void on_actionExit_triggered() { closeEvent(NULL);}
|
||||
void on_actionAbout_triggered(); // Show about dialog
|
||||
void on_actionSolve_triggered(); // Solve the system
|
||||
|
||||
void on_nf_valueChanged(int) {changed();}
|
||||
void on_freq_textEdited() {changed();}
|
||||
void on_gastype_currentIndexChanged(int) {changed();}
|
||||
void on_T0_textEdited() {changed();}
|
||||
void on_p0_textEdited() {changed();}
|
||||
void on_systemtype_currentIndexChanged(int) {changed();}
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,13 +6,17 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1124</width>
|
||||
<height>835</height>
|
||||
<width>683</width>
|
||||
<height>488</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="tasmet_resources.qrc">
|
||||
<normaloff>:/images/tasmet.png</normaloff>:/images/tasmet.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
@ -56,51 +60,10 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="T0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>[Hz]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Number of harmonics: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="f">
|
||||
<property name="text">
|
||||
<string>100</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Reference temperature</string>
|
||||
<string>System type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -111,57 +74,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="Nf">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
<string>Reference temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="T0">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="gastype"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>[-]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Fundamental frequency: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="systemtype"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>System type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>[K]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Reference pressure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="p0">
|
||||
<property name="text">
|
||||
@ -172,6 +101,47 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="freq">
|
||||
<property name="text">
|
||||
<string>100</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Reference pressure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Number of harmonics: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>[Hz]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Fundamental frequency: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="systemtype"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
@ -179,6 +149,33 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>[K]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="gastype"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>[-]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="nf"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -210,19 +207,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="segmentid_add">
|
||||
<widget class="QSpinBox" name="segmentid">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="addsegment">
|
||||
<property name="text">
|
||||
<string>Add/edit segment...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
@ -231,42 +221,26 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="name">
|
||||
<widget class="QLineEdit" name="segmentname">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="remseg">
|
||||
<property name="title">
|
||||
<string>Remove segment</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Segment ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="segmentid_remove"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="removesegment">
|
||||
<property name="text">
|
||||
<string>Remove segment...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="addsegment">
|
||||
<property name="text">
|
||||
<string>Add/edit segment...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -299,6 +273,12 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string>Type your info here...</string>
|
||||
</property>
|
||||
@ -310,29 +290,16 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Segment overview</string>
|
||||
<string>System overview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_2">
|
||||
<widget class="QPlainTextEdit" name="segoverview">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="output">
|
||||
<property name="title">
|
||||
<string>Output</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -345,49 +312,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Solve</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="solve">
|
||||
<property name="text">
|
||||
<string>Solve...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="text">
|
||||
<string>Reinitialize solution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Postprocess...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
@ -395,45 +319,109 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1124</width>
|
||||
<height>21</height>
|
||||
<width>683</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>Fi&le</string>
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSolver">
|
||||
<property name="title">
|
||||
<string>Solver</string>
|
||||
</property>
|
||||
<addaction name="actionSolve"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuSolver"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset theme="new" resource="tasmet_resources.qrc">
|
||||
<normaloff>:/images/document-new.png</normaloff>:/images/document-new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&New</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>New TaSMET Model</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="tasmet_resources.qrc">
|
||||
<normaloff>:/images/document-open.png</normaloff>:/images/document-open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Open</string>
|
||||
<string>&Open...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="tasmet_resources.qrc">
|
||||
<normaloff>:/images/document-save.png</normaloff>:/images/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAs">
|
||||
<property name="icon">
|
||||
<iconset resource="tasmet_resources.qrc">
|
||||
<normaloff>:/images/document-save-as.png</normaloff>:/images/document-save-as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save &as...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>&Exit</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSolve">
|
||||
<property name="text">
|
||||
<string>Solve...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="tasmet_resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -6,140 +6,183 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>711</width>
|
||||
<height>494</height>
|
||||
<width>730</width>
|
||||
<height>362</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>TaSMET Solver</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>651</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="solversettings">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Solver Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Maximum iterations:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Solver type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="solvertype"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="reltol">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Solution tolerance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Residual tolerance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="funtol">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="maxiter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="solve_gb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Solve!</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Solve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Single iteration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="progress_gb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Progress</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="solversettings">
|
||||
<property name="title">
|
||||
<string>Solver Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Maximum iterations:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Solver type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="solvertype"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="reltol">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Solution tolerance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Residual tolerance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="funtol">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="maxiter">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QCustomPlot" name="rel_error" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Solve!</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Solve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Single iteration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QCustomPlot" name="fun_error" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Progress</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="rel_error" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="fun_error" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<zorder>solversettings</zorder>
|
||||
<zorder>groupBox</zorder>
|
||||
<zorder>groupBox_2</zorder>
|
||||
<zorder>solversettings</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QCustomPlot</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qcustomplot.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
9
src/gui/tasmet_resources.qrc
Normal file
9
src/gui/tasmet_resources.qrc
Normal file
@ -0,0 +1,9 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>images/tasmet.png</file>
|
||||
<file>images/document-new.png</file>
|
||||
<file>images/document-open.png</file>
|
||||
<file>images/document-save.png</file>
|
||||
<file>images/document-save-as.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -83,7 +83,6 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
TaSMETMainWindow win;
|
||||
|
||||
win.setWindowTitle("TaSMET UI");
|
||||
win.show();
|
||||
|
||||
return app.exec();
|
||||
|
22
src/protobuf/ductbc.proto
Normal file
22
src/protobuf/ductbc.proto
Normal file
@ -0,0 +1,22 @@
|
||||
syntax = "proto2";
|
||||
package pb;
|
||||
|
||||
enum DuctBcType {
|
||||
PressureBc = 0;
|
||||
AdiabaticWall = 1;
|
||||
IsoTWall = 2;
|
||||
}
|
||||
enum DuctSide {
|
||||
left = 0;
|
||||
right = 1;
|
||||
}
|
||||
message DuctBc {
|
||||
required DuctBcType type = 1;
|
||||
required DuctSide side = 2;
|
||||
required uint32 duct_id = 3;
|
||||
optional string pressure = 4;
|
||||
optional string temperature = 5;
|
||||
optional bool isentropic = 6;
|
||||
required string name = 7;
|
||||
|
||||
}
|
@ -2,19 +2,20 @@ syntax = "proto2";
|
||||
package pb;
|
||||
|
||||
import "duct.proto";
|
||||
import "ductbc.proto";
|
||||
import "gas.proto";
|
||||
|
||||
enum SystemType {
|
||||
TaSystem = 0;
|
||||
}
|
||||
message System {
|
||||
required SystemType systemtype = 1;
|
||||
required uint32 Nf = 2;
|
||||
required double freq = 3;
|
||||
required GasType gastype = 4;
|
||||
required double p0 = 5;
|
||||
required double T0 = 6;
|
||||
required SystemType systemtype = 1 [default=TaSystem];
|
||||
required uint32 Nf = 2 [default=0];
|
||||
required double freq = 3 [default = 100];
|
||||
required GasType gastype = 4 [default = air];
|
||||
required double p0 = 5 [default = 101325];
|
||||
required double T0 = 6 [default = 293.15];
|
||||
map<uint32,Duct> ducts = 7;
|
||||
repeated double solution = 8;
|
||||
|
||||
map<uint32,DuctBc> ductbcs = 8;
|
||||
repeated double solution = 9;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ GlobalConf::GlobalConf(us Nf,d freq):
|
||||
|
||||
TRACE(10,"GlobalConf constructor done");
|
||||
|
||||
if(Nf>=constants::maxNf)
|
||||
if(Nf>=constants::max_Nf)
|
||||
throw TaSMETError("Too large number of frequencies given");
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ void GlobalConf::setomg(d omg){
|
||||
_DDTfd=zeros<dmat>(Ns(),Ns());
|
||||
|
||||
// Sanity checks
|
||||
if(omg<constants::minomg && omg>constants::maxomg)
|
||||
if(omg<constants::min_omg && omg>constants::max_omg)
|
||||
throw TaSMETError("Illegal frequency given");
|
||||
|
||||
this->_omg=omg;
|
||||
|
@ -9,10 +9,12 @@
|
||||
#include "tasystem.h"
|
||||
#include "triplets.h"
|
||||
#include "jacobian.h"
|
||||
#include "tasmet_utils.h"
|
||||
#include "tasmet_assert.h"
|
||||
#include "tasmet_exception.h"
|
||||
#include "tasmet_constants.h"
|
||||
#include "duct.h"
|
||||
#include "ductbc.h"
|
||||
|
||||
TaSystem::TaSystem(const pb::System& sys):
|
||||
GlobalConf(sys.nf(),sys.freq())
|
||||
@ -29,13 +31,33 @@ TaSystem::TaSystem(const pb::System& sys):
|
||||
|
||||
// Create all ducts
|
||||
for(const auto& d : sys.ducts()) {
|
||||
// d.first: id
|
||||
// d.second: duct description
|
||||
try {
|
||||
_segs[d.first] = new Duct(d.first,d.second);
|
||||
if(!_segs[d.first]) throw TaSMETBadAlloc();
|
||||
}
|
||||
catch(TaSMETError e) {
|
||||
// Cleanup the already successfully created Ducts
|
||||
// Cleanup the already successfully created Ducts and rethrow
|
||||
cleanup();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
// Create all ducts
|
||||
for(const auto& d : sys.ductbcs()) {
|
||||
// d.first: id
|
||||
// d.second: duct description
|
||||
try {
|
||||
_segs[d.first] = DuctBc::newDuctBc(d.first,
|
||||
*this,
|
||||
d.second);
|
||||
|
||||
if(!_segs[d.first]) throw TaSMETBadAlloc();
|
||||
}
|
||||
catch(TaSMETError e) {
|
||||
// Cleanup the already successfully created Ducts and rethrow
|
||||
cleanup();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,11 +333,7 @@ TaSystem::~TaSystem() {
|
||||
cleanup();
|
||||
}
|
||||
void TaSystem::cleanup() {
|
||||
|
||||
for(auto& seg: _segs){
|
||||
delete seg.second;
|
||||
}
|
||||
|
||||
purge(_segs);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -18,7 +18,7 @@ const QString company = "None";
|
||||
// DECLARE_ENUM(SYSTEM_TYPE,DrivenSystem,EngineSystem)
|
||||
DECLARE_ENUM(SystemType,Driven)
|
||||
|
||||
DECLARE_ENUM(SegmentType,Duct)
|
||||
DECLARE_ENUM(SegmentType,Duct,DuctBc)
|
||||
|
||||
DECLARE_ENUM(SolverType,NewtonRaphson)
|
||||
|
||||
|
@ -61,11 +61,11 @@ namespace constants {
|
||||
const us max_ngp=3000; // Maximum number of gridpoints
|
||||
const us default_ngp = 100;
|
||||
|
||||
const us maxNf=100; // Maximum number of frequencies
|
||||
const d minomg=1e-3; // Minimal oscillation frequency
|
||||
const d maxomg=1e5;
|
||||
const us max_Nf=20; // Maximum number of frequencies
|
||||
const d min_omg=1e-3; // Minimal oscillation frequency
|
||||
const d max_omg=1e5;
|
||||
|
||||
const int maxsegs=30; // Maximum number of segments in a TaSystem
|
||||
const int max_segs=30; // Maximum number of segments in a TaSystem
|
||||
const int maxndofs=600000; // Maximum number of DOFS
|
||||
|
||||
|
||||
@ -105,6 +105,8 @@ namespace constants {
|
||||
const int nvars_reserve=7;
|
||||
const int neqs_reserve=7;
|
||||
|
||||
const char* const system_fileext = ".tasmet";
|
||||
|
||||
} // namespace constants
|
||||
|
||||
#endif // TASMET_CONSTANTS_H
|
||||
|
@ -7,6 +7,7 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "tasmet_exception.h"
|
||||
#include <QString>
|
||||
|
||||
const char* TaSMETError::what() const throw() {
|
||||
return _msg.c_str();
|
||||
@ -19,7 +20,17 @@ const char* TaSMETBadAlloc::what() const throw() {
|
||||
return "Error: memory allocation failed. "
|
||||
"Please make sure enough memory is available and restart the application";
|
||||
}
|
||||
void TaSMETError::show_user(const std::string& window_title,
|
||||
QMessageBox::Icon icon) {
|
||||
|
||||
QString msg = what();
|
||||
QMessageBox msgbx(icon,
|
||||
QString::fromStdString(window_title),
|
||||
msg);
|
||||
|
||||
msgbx.exec();
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <sstream> // stringstream
|
||||
#include <QMessageBox>
|
||||
|
||||
class TaSMETError : public std::runtime_error {
|
||||
std::string _msg;
|
||||
@ -28,6 +29,8 @@ public:
|
||||
}
|
||||
void setContext(const std::string& ctx);
|
||||
virtual const char* what() const throw ();
|
||||
virtual void show_user(const std::string& window_title,
|
||||
QMessageBox::Icon = QMessageBox::Warning);
|
||||
};
|
||||
|
||||
class TaSMETBadAlloc: public std::bad_alloc {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// utils.h
|
||||
// tasmet_utils.h
|
||||
//
|
||||
// Author: J.A. de Jong
|
||||
//
|
||||
@ -6,21 +6,12 @@
|
||||
// Some generic utils.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "tracer.h"
|
||||
#include "vtypes.h"
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <cmath>
|
||||
|
||||
#ifndef TASMET_UTILS_H
|
||||
#define TASMET_UTILS_H
|
||||
|
||||
// Purge a vector of components
|
||||
template<typename T>
|
||||
void purge(std::vector<T>& vec){
|
||||
TRACE(10,"purge(vector)");
|
||||
for (T& it: vec){
|
||||
delete it;
|
||||
it=nullptr;
|
||||
@ -31,32 +22,12 @@ void purge(std::vector<T>& vec){
|
||||
// Purge a vector of components
|
||||
template<typename Key,typename T>
|
||||
void purge(std::map<Key,T>& map){
|
||||
TRACE(10,"purge(map)");
|
||||
for (auto& it: map){
|
||||
delete it.second;
|
||||
it.second=nullptr;
|
||||
}
|
||||
map.clear();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& min(const T& x,const T& y) {
|
||||
return x<=y? x : y;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& max(const T& x,const T& y) {
|
||||
return x<=y? y : x;
|
||||
}
|
||||
|
||||
template<typename SegType,typename Sys>
|
||||
SegType* copySeg(const SegType& t,const Sys& sys) {
|
||||
SegType* newt=new SegType(t);
|
||||
if(!newt){
|
||||
WARN("Copying " << typeid(t).name() << "failed!");
|
||||
}
|
||||
return newt;
|
||||
} // copySeg
|
||||
template<typename T>
|
||||
void makeNormal(T& c) {
|
||||
for(auto& val: c)
|
||||
@ -64,8 +35,5 @@ void makeNormal(T& c) {
|
||||
val=0;
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
||||
|
||||
#endif // TASMET_UTILS_H
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user