UltraScan III
us_worker_2d.h
Go to the documentation of this file.
1 #ifndef US_THREAD_WORKER_H
3 #define US_THREAD_WORKER_H
4 
5 #include <QtCore>
6 
7 #include "us_extern.h"
8 #include "us_dataIO.h"
9 #include "us_simparms.h"
10 #include "us_model.h"
11 #include "us_noise.h"
12 #include "us_solute.h"
13 #include "us_solve_sim.h"
14 
15 #ifndef DbgLv
16 #define DbgLv(a) if(dbg_level>=a)qDebug()
17 #endif
18 
20 typedef struct work_packet_2d_s
21 {
22  int thrn;
23  int taskx;
24  int depth;
25  int iter;
26  int menmcx;
27  int typeref;
28  int state;
29  int noisf;
30 
31  double ll_s;
32  double ll_k;
33 
34  QVector< US_Solute > isolutes;
35  QVector< US_Solute > csolutes;
36  QVector< double > ti_noise;
37  QVector< double > ri_noise;
38 
39  QList< US_SolveSim::DataSet* > dsets;
41 
42 
43 } WorkPacket2D;
44 
46 
50 class WorkerThread2D : public QThread
51 {
52  Q_OBJECT
53 
54  public:
55  WorkerThread2D( QObject* parent = 0 );
57 
58  public slots:
61  void define_work ( WorkPacket2D& );
64  void get_result ( WorkPacket2D& );
66  void run ();
68  void flag_abort ();
70  void forward_progress( int );
71 
72  signals:
73  void work_progress ( int );
74  void work_complete ( WorkerThread2D* );
75 
76  private:
77 
78  void calc_residuals ( void );
79  void calc_resids_ratio( void );
80  long int max_rss ( void );
81 
82  long int maxrss;
83 
84  double llim_s; // lower limit in s (UGRID)
85  double llim_k; // lower limit in k (UGRID)
86 
87  int thrn; // thread number (1,...)
88  int taskx; // grid refinement task index
89  int depth; // depth index
90  int iter; // iteration index
91  int menmcx; // meniscus / monte carlo index
92  int typeref; // type of refinement (0=UGRID, ...)
93  int nscans; // number of scans in experiment
94  int npoints; // number of radius points in experiment
95  int nsolutes; // number of input solutes for this task
96  int noisflag; // noise flag (0-3 for NONE|TI|RI|BOTH)
97  int dbg_level; // debug flag
98 
99  bool abort; // should this thread be aborted?
100 
101  US_DataIO::EditedData* edata; // experiment data (pointer)
102  US_DataIO::RawData sdata; // simulation data
103  US_DataIO::RawData rdata; // residuals
104  US_Model model; // output model
105  US_Noise ri_noise; // computed radially-invariant noise
106  US_Noise ti_noise; // computed time-invariant noise
107  US_Noise ra_noise; // computed random noise
108  US_SimulationParameters simparms; // simulation parameters
109 
110  QList< US_SolveSim::DataSet* > dsets; // list of data set obj. ptrs.
111  US_SolveSim::Simulation sim_vals; // simulation values
112  US_SolveSim* solvesim; // object for calc_residuals()
113  US_SolveSim::DataSet dset_wk; // local copy of data set
114 
115  QVector< US_Solute > solutes_i; // solutes input
116  QVector< US_Solute > solutes_c; // solutes computed
117 };
118 
119 #endif
120