UltraScan III
us_solve_sim.h
Go to the documentation of this file.
1 #ifndef US_SOLVE_SIM_H
2 #define US_SOLVE_SIM_H
3 
4 #include <QtCore>
5 
6 #include "us_model.h"
7 #include "us_dataIO.h"
8 #include "us_noise.h"
9 #include "us_simparms.h"
10 #include "us_solution.h"
11 #include "us_solute.h"
12 #include "us_zsolute.h"
13 #include "us_astfem_math.h"
14 #include "us_astfem_rsa.h"
15 
16 #define SIMPARAMS US_SimulationParameters
17 
22 
23 class US_UTIL_EXTERN US_SolveSim : public QObject
24 {
25  Q_OBJECT
26 
27  public:
28 
31  {
32  public:
33  QString requestID;
34  QString auc_file;
35  QString edit_file;
36  QString model_file;
37  QList< QString > noise_files;
42  double viscosity;
43  double density;
44  double compress;
45  double temperature;
46 
47  double vbar20;
48  double vbartb;
49  double s20w_correction;
50  double D20w_correction;
51  double rotor_stretch[ 2 ];
53  double zcoeffs[ 4 ];
54 
56  bool manual;
57  };
58 
61  {
62  public:
63 
64  Simulation();
65 
66  double variance;
67  double xnormsq;
68  double alpha;
69  QVector< double > variances;
70  QVector< double > ti_noise;
71  QVector< double > ri_noise;
72  QVector< US_Solute > solutes;
73  QVector< US_ZSolute > zsolutes;
74  long int maxrss;
75  int noisflag;
76  int dbg_level;
77  bool dbg_timing;
80  };
81 
87  US_SolveSim ( QList< DataSet* >&, int, bool = false );
88 
89  public slots:
90 
96  static bool checkGridSize( QList< DataSet* >&, double, QString& );
97 
102  bool check_grid_size( double, QString& );
103 
112  void calc_residuals( int, int, Simulation&, bool = false,
113  QVector< double >* = 0, QVector< double >* = 0 );
114 
116  void abort_work ( void );
117 
118  signals:
120  void work_progress ( int );
121 
122  private:
123 
124  enum attr_type { ATTR_S, ATTR_K, ATTR_W, ATTR_V, ATTR_D, ATTR_F };
125 
126  QList< DataSet* >& data_sets; // Data sets for which to solve
127 
128  int thrnrank; // Thread number or processor rank (1,...)
129  bool signal_wanted; // Flag whether to emit progress signals
130 
131  int d_offs; // Current data offset
132  int noisflag; // Calc-noise flag (0-3 for no|ti|ri|both)
133  int dbg_level; // Debug level
134  bool dbg_timing; // Flag whether to print timings
135  bool abort; // Flag to abort at next opportunity
136  bool calc_ti; // Calculate-TI-noise flag
137  bool calc_ri; // Calculate-RI-noise flag
138  bool banddthr; // Band-forming data threshold peak enhance
139  QDateTime startCalc; // Start calc time for elapsed time prints
140 
141  private slots:
142  // Compute "a~", the average experiment signal at each time
143  void compute_a_tilde ( QVector< double >&, const QVector< double >& );
144 
145  // Compute "L~s", the average signal at each radius
146  void compute_L_tildes ( int, int,
147  QVector< double >&,
148  const QVector< double >& );
149 
150  // Compute "L~", the average model signal at each radius
151  void compute_L_tilde ( QVector< double >&,
152  const QVector< double >& );
153 
154  // Compute "L"
155  void compute_L ( int, int,
156  QVector< double >&,
157  const QVector< double >&,
158  const QVector< double >& );
159 
160  // Compute "small_a" and "small_b" matrices for RI noise
161  void ri_small_a_and_b ( int, int, int,
162  QVector< double >&,
163  QVector< double >&,
164  const QVector< double >&,
165  const QVector< double >&,
166  const QVector< double >&,
167  const QVector< double >& );
168 
169  // Compute "small_a" and "small_b" matrices for TI noise
170  void ti_small_a_and_b ( int, int, int,
171  QVector< double >&,
172  QVector< double >&,
173  const QVector< double >&,
174  const QVector< double >&,
175  const QVector< double >&,
176  const QVector< double >& );
177 
178  // Compute "L_bar"
179  void compute_L_bar ( QVector< double >&,
180  const QVector< double >&,
181  const QVector< double >& );
182 
183  // Compute "a_bar"
184  void compute_a_bar ( QVector< double >&,
185  const QVector< double >&,
186  const QVector< double >& );
187 
188  // Compute "L_bar-s"
189  void compute_L_bars ( int, int, int, int,
190  QVector< double >&,
191  const QVector< double >&,
192  const QVector< double >& );
193 
194  // Limit data to thresholds
195  bool data_threshold ( US_DataIO::RawData*,
196  double, double, double, double );
197 
198  // Limit data to thresholds (experiment data version)
199  bool data_threshold ( US_DataIO::EditedData*,
200  double, double, double, double );
201 
202  // Set a model component attribute value
203  void set_comp_attr ( US_Model::SimulationComponent&,
204  US_Solute&, int );
205 
206  // Output a debug print of time for a labelled event
207  void DebugTime ( QString );
208 };
209 #endif
210