tychoGUI
1.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
logic_parameter.cpp
Go to the documentation of this file.
1
#include "
mainwindow.h
"
2
#include "
ui_mainwindow.h
"
3
#include <QFileDialog>
4
#include <QFile>
5
#include <QTextStream>
6
#include <QString>
7
#include <iostream>
8
12
void
MainWindow::ic_logic
(){
13
14
if
(
ic_selector
(
ui
->
initial_conditions
->currentText()) ==
"0"
){
15
ui
->
ic_density
->setDisabled(
true
);
16
ui
->
ic_temperatur
->setDisabled(
true
);
17
ui
->
ic_velocity
->setDisabled(
true
);
18
ui
->
ic_wind
->setDisabled(
true
);
19
ui
->
ic_obstacle
->setDisabled(
true
);
20
ui
->
ic_marker
->setDisabled(
true
);
21
22
obstacle_logic
();
23
windemitter_logic
();
24
marker_logic
();
25
}
26
27
28
if
(
ic_selector
(
ui
->
initial_conditions
->currentText()) ==
"1"
){
29
ui
->
ic_density
->setDisabled(
false
);
30
ui
->
ic_temperatur
->setDisabled(
false
);
31
ui
->
ic_velocity
->setDisabled(
false
);
32
ui
->
ic_wind
->setDisabled(
true
);
33
ui
->
ic_obstacle
->setDisabled(
true
);
34
ui
->
ic_marker
->setDisabled(
true
);
35
36
if
(
ui
->
obstacle_on
->isChecked())
ui
->
ic_obstacle
->setEnabled(
true
);
37
if
(
ui
->
wind_emitter_on
->isChecked())
ui
->
ic_wind
->setEnabled(
true
);
38
if
(
ui
->
marker_field_on
->isChecked())
ui
->
ic_marker
->setEnabled(
true
);
39
40
}
41
42
if
(
ic_selector
(
ui
->
initial_conditions
->currentText()) ==
"2"
){
43
ui
->
ic_density
->setDisabled(
true
);
44
ui
->
ic_temperatur
->setDisabled(
true
);
45
ui
->
ic_velocity
->setDisabled(
true
);
46
ui
->
ic_wind
->setDisabled(
true
);
47
ui
->
ic_obstacle
->setDisabled(
false
);
48
ui
->
ic_marker
->setDisabled(
true
);
49
50
ui
->
obstacle_on
->setChecked(
true
);
51
ui
->
obstacle_off
->setChecked(
false
);
52
53
ui
->
obstacle_density
->setDisabled(
false
);
54
ui
->
obstacle_temp
->setDisabled(
false
);
55
ui
->
obstacle_diff
->setDisabled(
false
);
56
57
ui
->
obstacle_density
->setText(
"7874"
);
58
ui
->
obstacle_temp
->setText(
"300"
);
59
ui
->
obstacle_diff
->setText(
"0.000023"
);
60
}
61
62
if
(
ic_selector
(
ui
->
initial_conditions
->currentText()) ==
"3"
){
63
ui
->
ic_density
->setDisabled(
true
);
64
ui
->
ic_temperatur
->setDisabled(
true
);
65
ui
->
ic_velocity
->setDisabled(
true
);
66
ui
->
ic_wind
->setDisabled(
true
);
67
ui
->
ic_obstacle
->setDisabled(
true
);
68
ui
->
ic_marker
->setDisabled(
true
);
69
70
ui
->
obstacle_on
->setChecked(
false
);
71
ui
->
obstacle_off
->setChecked(
true
);
72
ui
->
obstacle_density
->setDisabled(
true
);
73
ui
->
obstacle_temp
->setDisabled(
true
);
74
ui
->
obstacle_diff
->setDisabled(
true
);
75
ui
->
obstacle_density
->setText(
"0"
);
76
ui
->
obstacle_temp
->setText(
"0"
);
77
ui
->
obstacle_diff
->setText(
"0"
);
78
79
ui
->
wind_emitter_off
->setChecked(
true
);
80
ui
->
wind_emitter_on
->setChecked(
false
);
81
ui
->
wind_speed
->setDisabled(
true
);
82
ui
->
wind_speed
->setText(
"0"
);
83
84
ui
->
marker_field_off
->setChecked(
true
);
85
ui
->
marker_field_on
->setChecked(
false
);
86
ui
->
marker_density
->setDisabled(
true
);
87
ui
->
marker_density
->setText(
"0"
);
88
89
}
90
91
if
(
ic_selector
(
ui
->
initial_conditions
->currentText()) ==
"4"
){
92
ui
->
ic_density
->setDisabled(
true
);
93
ui
->
ic_temperatur
->setDisabled(
true
);
94
ui
->
ic_velocity
->setDisabled(
true
);
95
ui
->
ic_wind
->setDisabled(
true
);
96
ui
->
ic_obstacle
->setDisabled(
true
);
97
ui
->
ic_marker
->setDisabled(
true
);
98
99
ui
->
obstacle_on
->setChecked(
false
);
100
ui
->
obstacle_off
->setChecked(
true
);
101
102
//set the boundaries periodic
103
ui
->
bound_down
->setCurrentIndex(5);
104
ui
->
bound_up
->setCurrentIndex(5);
105
ui
->
bound_left
->setCurrentIndex(5);
106
ui
->
bound_right
->setCurrentIndex(5);
107
ui
->
bound_front
->setCurrentIndex(5);
108
ui
->
bound_back
->setCurrentIndex(5);
109
110
ui
->
dimension
->setCurrentIndex(1);
111
ui
->
res_x
->setValue(128);
112
ui
->
res_y
->setValue(128);
113
ui
->
res_z
->setValue(1);
114
115
ui
->
inflow_density
->setText(
"0"
);
116
ui
->
inflow_velocity
->setText(
"0"
);
117
ui
->
inflow_temperature
->setText(
"0"
);
118
119
ui
->
gravity_off
->setChecked(
true
);
120
ui
->
gravity_on
->setChecked(
false
);
121
122
ui
->
startified_atmos_off
->setChecked(
true
);
123
ui
->
startified_atmos_on
->setChecked(
false
);
124
125
ui
->
obstacle_on
->setChecked(
false
);
126
ui
->
obstacle_off
->setChecked(
true
);
127
ui
->
obstacle_density
->setDisabled(
true
);
128
ui
->
obstacle_temp
->setDisabled(
true
);
129
ui
->
obstacle_diff
->setDisabled(
true
);
130
ui
->
obstacle_density
->setText(
"0"
);
131
ui
->
obstacle_temp
->setText(
"0"
);
132
ui
->
obstacle_diff
->setText(
"0"
);
133
134
ui
->
wind_emitter_off
->setChecked(
true
);
135
ui
->
wind_emitter_on
->setChecked(
false
);
136
ui
->
wind_speed
->setDisabled(
true
);
137
ui
->
wind_speed
->setText(
"0"
);
138
139
ui
->
marker_field_off
->setChecked(
true
);
140
ui
->
marker_field_on
->setChecked(
false
);
141
ui
->
marker_density
->setDisabled(
true
);
142
ui
->
marker_density
->setText(
"0"
);
143
144
}
145
146
}
147
151
void
MainWindow::boundary_logic
(){
152
153
if
((
ui
->
bound_down
->currentIndex() == 4)||
154
(
ui
->
bound_up
->currentIndex() == 4)||
155
(
ui
->
bound_left
->currentIndex() == 4)||
156
(
ui
->
bound_right
->currentIndex() == 4)||
157
(
ui
->
bound_front
->currentIndex() == 4)||
158
(
ui
->
bound_back
->currentIndex() == 4))
159
{
160
ui
->
inflow_velocity
->setDisabled(
false
);
161
ui
->
inflow_density
->setDisabled(
false
);
162
ui
->
inflow_temperature
->setDisabled(
false
);
163
ui
->
wind_boundary_0
->setDisabled(
false
);
164
ui
->
wind_boundary_1
->setDisabled(
false
);
165
}
166
else
167
{
168
ui
->
inflow_velocity
->setDisabled(
true
);
169
ui
->
inflow_density
->setDisabled(
true
);
170
ui
->
inflow_temperature
->setDisabled(
true
);
171
ui
->
wind_boundary_0
->setDisabled(
true
);
172
ui
->
wind_boundary_1
->setDisabled(
true
);
173
ui
->
wind_boundary_0
->setChecked(
true
);
174
175
ui
->
inflow_density
->setText(
"1.229"
);
176
ui
->
inflow_temperature
->setText(
"300"
);
177
ui
->
inflow_velocity
->setText(
"100"
);
178
}
179
180
181
}
182
186
void
MainWindow::dimension_logic
(){
187
188
if
(
ui
->
dimension
->currentIndex()==0){
189
ui
->
res_x
->setDisabled(
false
);
190
ui
->
res_y
->setDisabled(
true
);
191
ui
->
res_z
->setDisabled(
true
);
192
193
ui
->
extend_x
->setDisabled(
false
);
194
ui
->
extend_y
->setDisabled(
true
);
195
ui
->
extend_z
->setDisabled(
true
);
196
197
}
198
if
(
ui
->
dimension
->currentIndex()==1){
199
ui
->
res_x
->setDisabled(
false
);
200
ui
->
res_y
->setDisabled(
false
);
201
ui
->
res_z
->setDisabled(
true
);
202
203
ui
->
extend_x
->setDisabled(
false
);
204
ui
->
extend_y
->setDisabled(
false
);
205
ui
->
extend_z
->setDisabled(
true
);
206
207
}
208
if
(
ui
->
dimension
->currentIndex()==2){
209
ui
->
res_x
->setDisabled(
false
);
210
ui
->
res_y
->setDisabled(
false
);
211
ui
->
res_z
->setDisabled(
false
);
212
213
ui
->
extend_x
->setDisabled(
false
);
214
ui
->
extend_y
->setDisabled(
false
);
215
ui
->
extend_z
->setDisabled(
false
);
216
}
217
218
}
219
224
void
MainWindow::gravity_logic
(){
225
226
if
(
ui
->
gravity_on
->isChecked()){
227
ui
->
startified_atmos_off
->setDisabled(
false
);
228
ui
->
startified_atmos_on
->setDisabled(
false
);
229
230
ui
->
bound_down
->setCurrentIndex(1);
231
ui
->
bound_up
->setCurrentIndex(0);
232
ui
->
bound_down
->setDisabled(
true
);
233
ui
->
bound_up
->setDisabled(
true
);
234
235
}
236
if
(!
ui
->
gravity_on
->isChecked()){
237
ui
->
startified_atmos_off
->setDisabled(
true
);
238
ui
->
startified_atmos_on
->setDisabled(
true
);
239
ui
->
startified_atmos_off
->setChecked(
true
);
240
241
ui
->
bound_down
->setCurrentIndex(0);
242
ui
->
bound_up
->setCurrentIndex(0);
243
ui
->
bound_down
->setDisabled(
false
);
244
ui
->
bound_up
->setDisabled(
false
);
245
246
}
247
248
}
249
253
void
MainWindow::windemitter_logic
(){
254
255
if
(
ui
->
wind_emitter_off
->isChecked()){
256
ui
->
wind_speed
->setDisabled(
true
);
257
ui
->
wind_speed
->setText(
"0"
);
258
}
259
if
(
ui
->
wind_emitter_on
->isChecked())
ui
->
wind_speed
->setDisabled(
false
);
260
261
if
(
ui
->
wind_emitter_on
->isChecked())
ui
->
ic_wind
->setDisabled(
false
);
262
if
(
ui
->
wind_emitter_off
->isChecked()){
263
ui
->
ic_wind
->setDisabled(
true
);
264
ic_windemitter_file
=
"dummy"
;
265
}
266
}
267
272
void
MainWindow::obstacle_logic
(){
273
274
if
(
ui
->
obstacle_on
->isChecked()){
275
ui
->
obstacle_density
->setDisabled(
false
);
276
ui
->
obstacle_temp
->setDisabled(
false
);
277
ui
->
obstacle_diff
->setDisabled(
false
);
278
279
ui
->
obstacle_density
->setText(
"7874"
);
280
ui
->
obstacle_temp
->setText(
"300"
);
281
ui
->
obstacle_diff
->setText(
"0.000023"
);
282
283
ui
->
ic_obstacle
->setDisabled(
false
);
284
285
}
286
287
if
(
ui
->
obstacle_off
->isChecked()){
288
ui
->
obstacle_density
->setDisabled(
true
);
289
ui
->
obstacle_temp
->setDisabled(
true
);
290
ui
->
obstacle_diff
->setDisabled(
true
);
291
292
ui
->
obstacle_density
->setText(
"0"
);
293
ui
->
obstacle_temp
->setText(
"0"
);
294
ui
->
obstacle_diff
->setText(
"0"
);
295
296
ui
->
ic_obstacle
->setDisabled(
true
);
297
298
if
(
ui
->
initial_conditions
->currentIndex()==2){
299
ui
->
initial_conditions
->setCurrentIndex(0);
300
ui
->
ic_obstacle
->setDisabled(
true
);
301
}
302
303
ic_obstacle_file
=
"dummy"
;
304
}
305
306
307
}
308
312
void
MainWindow::marker_logic
(){
313
314
if
(
ui
->
marker_field_on
->isChecked()){
315
ui
->
marker_density
->setDisabled(
false
);
316
ui
->
marker_density
->setText(
"0.1"
);
317
ui
->
ic_marker
->setDisabled(
false
);
318
}
319
320
if
(
ui
->
marker_field_off
->isChecked()){
321
ui
->
marker_density
->setDisabled(
true
);
322
ui
->
marker_density
->setText(
"0"
);
323
ui
->
ic_marker
->setDisabled(
true
);
324
ic_marker_file
=
"dummy"
;
325
}
326
}
327
331
void
MainWindow::soundemitter_logic
(){
332
333
if
(
ui
->
Soundemitter_on
->isChecked()){
334
ui
->
ic_soundemitter
->setEnabled(
true
);
335
ui
->
soundReflexionCoefficient
->setEnabled(
true
);
336
ui
->
soundPressureLevel
->setEnabled(
true
);
337
ui
->
obstacleSoundAbsoption
->setEnabled(
true
);
338
}
339
340
if
(
ui
->
Soundemitter_off
->isChecked()){
341
ui
->
ic_soundemitter
->setEnabled(
false
);
342
ic_soundemitter_file
=
"dummy"
;
343
ui
->
soundEmitterFrequency
->setEnabled(
false
);
344
ui
->
soundReflexionCoefficient
->setEnabled(
false
);
345
ui
->
soundPressureLevel
->setEnabled(
false
);
346
ui
->
obstacleSoundAbsoption
->setEnabled(
false
);
347
ui
->
soundEmitterFrequency
->setText(
"0"
);
348
ui
->
soundReflexionCoefficient
->setText(
"0"
);
349
ui
->
obstacleSoundAbsoption
->setText(
"0"
);
350
ui
->
soundPressureLevel
->setText(
"0"
);
351
}
352
353
soundemitter_logic_part2
();
354
}
355
359
void
MainWindow::soundemitter_logic_part2
(){
360
361
if
(
ui
->
one_pulse_off
->isChecked()){
362
if
(
ui
->
Soundemitter_on
->isChecked())
ui
->
soundEmitterFrequency
->setEnabled(
true
);
363
if
(
ui
->
Soundemitter_off
->isChecked())
ui
->
soundEmitterFrequency
->setEnabled(
false
);
364
}
365
if
(
ui
->
one_pulse_on
->isChecked()){
366
ui
->
soundEmitterFrequency
->setEnabled(
false
);
367
ui
->
soundEmitterFrequency
->setText(
"0"
);
368
}
369
}
370
371
Generated on Wed Oct 9 2013 19:57:23 for tychoGUI by
1.8.1.1