UltraScan III
us_grid_editor.h
Go to the documentation of this file.
1 #ifndef US_GRID_EDITOR_H
2 #define US_GRID_EDITOR_H
3 
4 #include <QtGui>
5 
6 #include "qwt_plot_zoomer.h"
7 #include "qwt_plot_panner.h"
8 #include "qwt_color_map.h"
9 
10 #include "us_constants.h"
11 #include "us_editor.h"
12 #include "us_extern.h"
13 #include "us_gui_settings.h"
14 #include "us_help.h"
15 #include "us_license.h"
16 #include "us_license_t.h"
17 #include "us_math2.h"
18 #include "us_matrix.h"
19 #include "us_model_loader.h"
20 #include "us_passwd.h"
21 #include "us_plot.h"
22 #include "us_select_edits.h"
23 #include "us_settings.h"
24 #include "us_util.h"
25 #include "us_widgets.h"
26 #include "us_investigator.h"
27 
28 #ifndef DbgLv
29 #define DbgLv(a) if(dbg_level>=a)qDebug()
30 #endif
31 
32 struct gridpoint
33 {
34  double s;
35  double D;
36  double vbar;
37  double mw;
38  double f;
39  double ff0;
40  double f0;
41  int index;
42 };
43 
44 class US_Grid_Editor : public US_Widgets
45 {
46  Q_OBJECT
47 
48  public:
50 
51  private:
52 
54 
55  int grid_index; // number of total partialGrids, used as the index to identify partialGrids,
56  // starts at 1 and aligns with partialGrid
57  int partialGrid; // currently active partialGrid
58  int subGrids; // number of subgrids
59  QLabel *lb_info1;
60  QLabel *lb_info2;
61  QLabel *lb_xaxis;
62  QLabel *lb_yaxis;
63  QLabel *lb_fixed;
64  QLabel *lb_xRes;
65  QLabel *lb_yRes;
66  QLabel *lb_xMin;
67  QLabel *lb_xMax;
68  QLabel *lb_yMin;
69  QLabel *lb_yMax;
70  QLabel *lb_zVal;
71  QLabel *lb_density;
72  QLabel *lb_viscosity;
73  QLabel *lb_partialGrid;
74  QLabel *lb_subGrid;
75 
76  QLineEdit *le_density;
77  QLineEdit *le_viscosity;
78  QLineEdit *le_investigator;
79 
80  QComboBox *cb_fixed;
81 
83  QList <gridpoint> current_grid;
84  QList <gridpoint> final_grid;
85 
88 
89  QwtCounter *ct_xRes;
90  QwtCounter *ct_yRes;
91  QwtCounter *ct_yMin;
92  QwtCounter *ct_yMax;
93  QwtCounter *ct_xMin;
94  QwtCounter *ct_xMax;
95  QwtCounter *ct_zVal;
96  QwtCounter *ct_partialGrid;
97  QwtCounter *ct_subGrids;
98 
99  QwtPlot *data_plot1;
100  QwtLinearColorMap *colormap;
104 
105 
106  QPushButton *pb_add_partialGrid;
107  QPushButton *pb_delete_partialGrid;
108  QPushButton *pb_help;
109  QPushButton *pb_close;
110  QPushButton *pb_save;
111  QPushButton *pb_reset;
112  QPushButton *pb_investigator;
113 
114  QCheckBox *ck_show_final_grid;
115  QCheckBox *ck_show_sub_grid;
116 
117  QRadioButton *rb_x_s;
118  QRadioButton *rb_x_mw;
119  QRadioButton *rb_x_ff0;
120  QRadioButton *rb_x_D;
121  QRadioButton *rb_x_f;
122  QRadioButton *rb_x_vbar;
123  QRadioButton *rb_y_s;
124  QRadioButton *rb_y_mw;
125  QRadioButton *rb_y_ff0;
126  QRadioButton *rb_y_D;
127  QRadioButton *rb_y_f;
128  QRadioButton *rb_y_vbar;
129  QRadioButton *rb_plot1;
130  QRadioButton *rb_plot2;
131 
132  QButtonGroup *bg_x_axis;
133  QButtonGroup *bg_y_axis;
134  QButtonGroup *toggle_plot;
135 
136  double xMin;
137  double xMax;
138  double yMin;
139  double yMax;
140  double xRes;
141  double yRes;
142  double zVal;
143  double viscosity;
144  double density;
145  double vbar;
146  double ff0;
147 
149  int plot_x; // 0-5 for s,f/f0,mw,vbar,D,f
150  int plot_y; // 0-5 for s,f/f0,mw,vbar,D,f
151  int plot_z; // 0-5 for s,f/f0,mw,vbar,D,f
153 
154  private slots:
155 
156  void update_xRes( double );
157  void update_yRes( double );
158  void update_xMin( double );
159  void update_xMax( double );
160  void update_yMin( double );
161  void update_yMax( double );
162  void update_zVal( double );
163  void update_partialGrid( double );
164  void update_subGrids ( double );
165  void update_density ( const QString & );
166  void update_viscosity( const QString & );
167  void update_plot ( void );
168  void select_x_axis( int );
169  void select_y_axis( int );
170  void select_fixed ( const QString & );
171  void select_plot ( int );
172  void delete_partialGrid( void );
173  void add_partialGrid ( void );
174  void save ( void );
175  void reset( void );
176  void help ( void ) { showHelp.show_help( "grid_editor.html" ); };
177  void calc_gridpoints ( void );
178  void calc_gridpoints_2( void );
179  void set_minmax( const struct gridpoint &);
180  void show_final_grid( bool );
181  void show_sub_grid( bool );
182  void update_disk_db( bool );
183  void sel_investigator( void );
184  void print_minmax( void );
185  double grid_value( struct gridpoint&, int );
186  bool set_comp_skw( struct gridpoint& );
187  bool set_comp_skv( struct gridpoint& );
188  bool set_comp_skd( struct gridpoint& );
189  bool set_comp_skf( struct gridpoint& );
190  bool set_comp_swv( struct gridpoint& );
191  bool set_comp_swd( struct gridpoint& );
192  bool set_comp_swf( struct gridpoint& );
193  bool set_comp_svd( struct gridpoint& );
194  bool set_comp_svf( struct gridpoint& );
195  bool set_comp_sdf( struct gridpoint& );
196  bool set_comp_kwv( struct gridpoint& );
197  bool set_comp_kwd( struct gridpoint& );
198  bool set_comp_kwf( struct gridpoint& );
199  bool set_comp_kvd( struct gridpoint& );
200  bool set_comp_kvf( struct gridpoint& );
201  bool set_comp_kdf( struct gridpoint& );
202  bool set_comp_wvd( struct gridpoint& );
203  bool set_comp_wvf( struct gridpoint& );
204  bool set_comp_wdf( struct gridpoint& );
205  bool set_comp_vdf( struct gridpoint& );
206  bool check_grid_point( double, struct gridpoint& );
207  bool validate_ff0 ( void );
208  void clear_grid ( struct gridpoint& );
209  void set_grid_value ( struct gridpoint&, const int, const double );
210  bool complete_comp ( struct gridpoint& );
211 };
212 
213 #endif