forked from NHERI-SimCenter/EVW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.h
372 lines (288 loc) · 9.99 KB
/
MainWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
/* *****************************************************************************
Copyright (c) 2016-2017, The Regents of the University of California (Regents).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS
PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*************************************************************************** */
// Written: fmckenna
#include <QMainWindow>
#include <math.h>
#include <map>
#include <QString>
class QLineEdit;
class QComboBox;
class QHBoxLayout;
class QVBoxLayout;
class QLabel;
class QPushButton;
class QStackedWidget;
class QCustomPlot;
class MyGlWidget;
class QSlider;
class QCheckBox;
class MyGlWidget;
class Vector;
class EarthquakeRecord;
class QCPGraph;
class QCPItemText;
class QCPItemTracer;
class EarthquakeRecord;
class QNetworkAccessManager;
class QNetworkReply;
class QFrame;
class SimpleSpreadsheetWidget;
class ResponseWidget;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void draw(MyGlWidget *, int loading);
void doAnalysis();
float getBuildingHeight() {return buildingH;};
float getMaxDisp(){return maxDisp;};
int getNumFloors(){return numFloors;};
void setResponse(int floor, int responseItem);
float setSelectionBoundary(float y1, float y2);
friend class PropertiesWidget;
private slots:
// main edits
void on_EarthquakeButtonPressed(void);
void on_WindButtonPressed(void);
void on_PeriodSelectionChanged(const QString &arg1);
void on_includePDeltaChanged(int);
void on_inFloors_editingFinished();
void on_inWeight_editingFinished();
void on_inHeight_editingFinished();
void on_inK_editingFinished();
void on_inDamping_editingFinished();
void on_inGravity_editingFinished();
void on_shapeChange(int);
void on_buildingWidthChanged(double newWidth);
// for selected floor edits
void on_inFloorWeight_editingFinished();
// for selected story edits
void on_inStoryHeight_editingFinished();
void on_inStoryK_editingFinished();
void on_inStoryFy_editingFinished();
void on_inStoryB_editingFinished();
void on_dragCoefficient_editingFinished();
void on_windGustSpeed_editingFinished();
void on_Seed_editingFinished();
void on_expCatagory_indexChanged();
// for earthquake motion combo box
void on_inEarthquakeMotionSelectionChanged(const QString &arg1);
void on_addMotion_clicked();
void on_scaleFactor_editingFinished();
// for stop and start buttons
void on_stopButton_clicked();
void on_runButton_clicked();
void on_exitButton_clicked();
// for time slider
void on_slider_valueChanged(int value);
void on_slider_sliderPressed();
void on_slider_sliderReleased();
// for table editing
void on_theSpreadsheet_cellChanged(int row, int column);
void on_theSpreadsheet_cellClicked(int row, int column);
void replyFinished(QNetworkReply*);
void on_pushButton_2_clicked();
void resetFile();
void open();
bool save();
bool saveAs();
void about();
void submitFeedback();
void version();
void copyright();
void viewNodeResponse();
void viewStoryResponse();
private:
void errorMessage(QString);
void doEarthquakeAnalysis(void);
void doWindAnalysis(void);
void updatePeriod();
void setBasicModel(int numFloors, double buildingW, double buildingH, double storyK, double zeta, double grav, double width, double depth);
void setData(int numSteps, double dT, Vector *data);
void reset(void);
// methods to create some of the main layouts
void createHeaderBox();
void createFooterBox();
void createInputPanel();
void createOutputPanel();
void createActions();
QFrame *eqMotionFrame;
QFrame *harmonicMotionFrame;
// the main layouts created
QHBoxLayout *mainLayout;
QVBoxLayout *largeLayout;
QHBoxLayout *headerLayout;
QHBoxLayout *footerLayout;
QVBoxLayout *outputLayout;
QVBoxLayout *inputLayout;
// methods for loading and saving files given filename
void setCurrentFile(const QString &fileName);
bool saveFile(const QString &fileName);
void loadFile(const QString &fileName);
QComboBox *periodComboBox;
// QComboBox *motionType;
// QComboBox *inputMotionType;
QComboBox *eqMotion;
QPushButton *addMotion;
QLineEdit *scaleFactorEQ;
// global properties inputs when nothing slected
QLineEdit *inFloors;
QLineEdit *inWeight;
QLineEdit *inHeight;
QLineEdit *inK;
QLineEdit *inDamping;
QCheckBox *pDeltaBox;
QLineEdit *dragCoefficient;
// specific inputs when many selected
QLineEdit *inFloorWeight;
QLineEdit *inStoryK;
QLineEdit *inStoryFy;
QLineEdit *inStoryB;
QLineEdit *inStoryHeight;
QLineEdit *windGustSpeed;
QLineEdit *seed;
QLineEdit *squareHeight;
QLineEdit *squareWidth;
QLineEdit *rectangularHeight;
QLineEdit *rectangularWidth;
QLineEdit *rectangularDepth;
QLineEdit *circularHeight;
QLineEdit *circularDiameter;
QStackedWidget *shapesWidget;
QComboBox *shapeSelectionBox;
QComboBox *expCatagory;
QLineEdit *inScaleFactor;
// buttons for running, stoppping & exiting
QPushButton *runButton;
QPushButton *stopButton;
QPushButton *exitButton;
// input frames displayed depending on selection
QFrame *floorMassFrame;
QFrame *storyPropertiesFrame;
QFrame *spreadSheetFrame;
SimpleSpreadsheetWidget *theSpreadsheet;
// output panel widgets
QCustomPlot *earthquakePlot;
QCPItemText *earthquakeText;
QSlider *slider;
MyGlWidget *myEarthquakeResult;
MyGlWidget *myWindResponseResult;
QComboBox *periods;
QLabel *currentTime;
QLabel *currentDispEarthquake;
QLabel *currentDispWind;
QLabel *currentPeriod;
QLabel *maxEarthquakeDispLabel;
QLabel *maxWindDispLabel;
QStringList headings;
QList<int> dataTypes;
Ui::MainWindow *ui;
//
// following are the model properties
//
int numFloors;
double buildingW;
double buildingH;
double storyK;
double dampingRatio;
double buildingWidth;
double buildingDepth;
double *weights;
double *k;
double *fy;
double *b;
double *floorHeights;
double *storyHeights;
double *dampRatios;
double g;
// properties related to currently selected ground motion
// int motionTypeValue;
double dt;
int numSteps;
double *gMotion;
Vector *motionData;
double scaleFactor;
int numStepEarthquake;
double dtEarthquakeMotion;
Vector *eqData;
Vector *eigValues;
bool includePDelta;
bool needAnalysis;
bool analysisFailed;
// data stored from earthquake response
double **dispResponsesEarthquake;
double **storyForceResponsesEarthquake;
double **storyDriftResponsesEarthquake;
double **floorForcesEarthquake;
// data stored from wind response
double **dispResponsesWind;
double **storyForceResponsesWind;
double **storyDriftResponsesWind;
double **floorForcesWind;
// data for response widgets
QVector<double> time;
QVector<double> excitationValues;
QVector<double> nodeResponseValuesEarthquake;
QVector<double> storyForceValuesEarthquake;
QVector<double> storyDriftValuesEarthquake;
QVector<double> nodeResponseValuesWind;
QVector<double> storyForceValuesWind;
QVector<double> storyDriftValuesWind;
QVector<double> floorForceValuesWind;
QVector<double> floorForceValueEarthquake;
// the response widgets to display the results
ResponseWidget *theNodeResponse;
ResponseWidget *theForceTimeResponse;
ResponseWidget *theForceDispResponse;
ResponseWidget *theAppliedForcesResponse;
double maxDisp;
int currentStep;
bool stopRun;
bool movingSlider;
int fMinSelected, fMaxSelected;
int sMinSelected, sMaxSelected;
int floorSelected, storySelected;
bool updatingPropertiesTable;
QCPGraph *graph;
QCPItemTracer *groupTracer;
// map to hold earthquake records
std::map <QString, EarthquakeRecord *> records;
EarthquakeRecord *theCurrentRecord;
QNetworkAccessManager *manager;
QString currentFile;
};
#endif // MAINWINDOW_H