Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/Application/src/convergenceview.h
3203 views
1
/*****************************************************************************
2
* *
3
* Elmer, A Finite Element Software for Multiphysical Problems *
4
* *
5
* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *
6
* *
7
* This program is free software; you can redistribute it and/or *
8
* modify it under the terms of the GNU General Public License *
9
* as published by the Free Software Foundation; either version 2 *
10
* of the License, or (at your option) any later version. *
11
* *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with this program (in file fem/GPL-2); if not, write to the *
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
20
* Boston, MA 02110-1301, USA. *
21
* *
22
*****************************************************************************/
23
24
/*****************************************************************************
25
* *
26
* ElmerGUI convergenceview *
27
* *
28
*****************************************************************************
29
* *
30
* Authors: Mikko Lyly, Juha Ruokolainen and Peter Råback *
31
* Email: [email protected] *
32
* Web: http://www.csc.fi/elmer *
33
* Address: CSC - IT Center for Science Ltd. *
34
* Keilaranta 14 *
35
* 02101 Espoo, Finland *
36
* *
37
* Original Date: 15 Mar 2008 *
38
* *
39
*****************************************************************************/
40
41
#ifndef CONVERGENCEVIEW_H
42
#define CONVERGENCEVIEW_H
43
44
#include <QMainWindow>
45
#include <QHash>
46
#include <QIcon>
47
#include "maxlimits.h"
48
49
#include <qwt_plot.h>
50
#include <qwt_plot_marker.h>
51
#include <qwt_plot_curve.h>
52
#include <qwt_plot_grid.h>
53
#include <qwt_legend.h>
54
/*#include <qwt_data.h> <-- deprecated in Qwt6, using qwt_compat.h instead
55
#include <qwt_compat.h> <-- Removed in Qwt 6.2 */
56
#include <qwt_text.h>
57
#include <qwt_scale_engine.h>
58
59
#define MAX_NOF_PENS 25
60
#if QWT_VERSION >= 0x060100
61
#define QwtLog10ScaleEngine QwtLogScaleEngine
62
#endif
63
64
65
class CurveData
66
{
67
public:
68
CurveData();
69
70
void append(double*, double*, int);
71
72
int count() const;
73
int size() const;
74
const double *x() const;
75
const double *y() const;
76
77
private:
78
int d_count;
79
QVector<double> d_x;
80
QVector<double> d_y;
81
};
82
83
class Curve
84
{
85
public:
86
CurveData *d_data;
87
QwtPlotCurve *d_curve;
88
};
89
90
class ConvergenceView : public QMainWindow
91
{
92
Q_OBJECT
93
94
public:
95
ConvergenceView(Limit *limit, QWidget *parent = 0);
96
~ConvergenceView();
97
98
QSize minimumSizeHint() const;
99
QSize sizeHint() const;
100
101
void appendData(double, QString);
102
void appendData(double*, int, QString);
103
void removeData();
104
105
QString title;
106
107
private slots:
108
void savePictureSlot();
109
void showGridSlot();
110
void showLegendSlot();
111
void showNSHistorySlot();
112
void showSSHistorySlot();
113
void clearHistorySlot();
114
115
private:
116
QwtPlot *plot;
117
QwtPlotGrid *grid;
118
QwtLegend *legend;
119
QwtLog10ScaleEngine *scaleEngine;
120
121
QHash<QString, Curve*> curveList;
122
QPen *pen;
123
124
QAction *savePictureAct;
125
QAction *exitAct;
126
QAction *showGridAct;
127
QAction *showLegendAct;
128
QAction *showNSHistoryAct;
129
QAction *showSSHistoryAct;
130
QAction *clearHistoryAct;
131
132
QMenu *fileMenu;
133
QMenu *viewMenu;
134
135
QToolBar *fileToolBar;
136
QToolBar *viewToolBar;
137
138
void createActions();
139
void createMenus();
140
void createToolBars();
141
void createStatusBar();
142
143
bool showGrid;
144
bool showLegend;
145
bool showNSHistory;
146
bool showSSHistory;
147
148
QIcon iconChecked;
149
};
150
151
#endif // CONVERGENCEVIEW_H
152
153