General Purpose Geodetic Library
SgVlbiSourceInfo.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef SG_VLBI_SOURCE_INFO_H
24 #define SG_VLBI_SOURCE_INFO_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 
32 #include <math.h>
33 
34 #include <QtCore/QString>
35 #include <QtCore/QList>
36 #include <QtCore/QMap>
37 
38 #include <SgObjectInfo.h>
39 #include <SgParameter.h>
40 
41 
42 class QDataStream;
43 
45 
46 
47 /***===================================================================================================*/
53 // typedefs:
54 class SgVlbiSourceInfo;
55 typedef QMap<QString, SgVlbiSourceInfo*> SourcesByName;
56 typedef QMap<QString, SgVlbiSourceInfo*>::iterator SourcesByName_it;
57 //
58 //
60 {
61 public:
63  {
64  Attr_NOT_VALID = 1<<0,
69  Attr_APPLY_SSM = 1<<5,
70  // ...
72  Attr_TEST = 1<<31,
73  };
74  //
75  //
77  {
78  public:
79  inline StructModel(double k, double b, double x, double y) {k_=k; b_=b; x_=x; y_=y;
80  kSig_=xSig_=ySig_=bSig_=0.0;};
81  inline ~StructModel() {};
82  inline double getK() const {return k_;};
83  inline double getKsig() const {return kSig_;};
84  inline double getB() const {return b_;};
85  inline double getBsig() const {return bSig_;};
86  inline double getX() const {return x_;};
87  inline double getXsig() const {return xSig_;};
88  inline double getY() const {return y_;};
89  inline double getYsig() const {return ySig_;};
90  inline void setK(double d) {k_ = d;};
91  inline void setKsig(double d) {kSig_ = d;};
92  inline void setB(double d) {b_ = d;};
93  inline void setBsig(double d) {bSig_ = d;};
94  inline void setX(double d) {x_ = d;};
95  inline void setXsig(double d) {xSig_ = d;};
96  inline void setY(double d) {y_ = d;};
97  inline void setYsig(double d) {ySig_ = d;};
98  double tauS(double f, double u, double v) const;
99  private:
100  double k_;
101  double kSig_;
102  double b_;
103  double bSig_;
104  double x_;
105  double xSig_;
106  double y_;
107  double ySig_;
108  };
109  class StructModelMp : public StructModel
110  {
111  public:
112  inline StructModelMp(double k, double b, double x, double y,
113  bool estK=true, bool estB=true, bool estCoo=true) : StructModel(k, b, x, y)
114  {pK_=pB_=pX_=pY_=NULL; estimateRatio_=estK; estimateSpIdx_=estB; estimatePosition_=estCoo;};
115  inline ~StructModelMp() {if (pK_) {delete pK_; pK_=NULL;}; if (pB_) {delete pB_; pB_=NULL;};
116  if (pX_) {delete pX_; pX_=NULL;}; if (pY_) {delete pY_; pY_=NULL;};};
117  inline SgParameter* &pK() {return pK_;};
118  inline SgParameter* &pB() {return pB_;};
119  inline SgParameter* &pX() {return pX_;};
120  inline SgParameter* &pY() {return pY_;};
121  inline double getR() const {return dR_;};
122  inline double getS() const {return dS_;};
123  inline double getC() const {return dC_;};
124  inline bool getEstimateRatio() const {return estimateRatio_;};
125  inline bool getEstimateSpIdx() const {return estimateSpIdx_;};
126  inline bool getEstimatePosition() const {return estimatePosition_;};
127  inline void setEstimateRatio(bool b) {estimateRatio_ = b;};
128  inline void setEstimateSpIdx(bool b) {estimateSpIdx_ = b;};
129  inline void setEstimatePosition(bool b) {estimatePosition_ = b;};
130  void prepareModel(double u, double v);
131  private:
136  double dR_; // R_l
137  double dS_; // S_l
138  double dC_; // C_l
142  };
143 
144  //
145  //
146  // Statics:
149  static const QString className();
150 
151  static double arcLength(double ra_1, double dn_1, double ra_2, double dn_2);
152 
153  static QString ra2String(double ra);
154 
155  static QString dn2String(double dn, bool mandatorySign=false);
156 
157  //
158  // constructors/destructors:
159  //
163  SgVlbiSourceInfo(int idx=-1, const QString& key="Unknown", const QString& aka="Unknown too");
164 
169 
173  inline ~SgVlbiSourceInfo();
174 
175 
176 
177  //
178  // Interfaces:
179  //
180  inline const QString& getAprioriReference() const {return aprioriReference_;};
181  inline const QString& getAprioriComments() const {return aprioriComments_;};
182  inline int getTotalScanNum() const {return totalScanNum_;};
183  inline int getProcdScanNum() const {return procdScanNum_;};
184 
187  inline SgParameter* pRA();
188 
191  inline SgParameter* pDN();
192 
193 
194 
195 
198  inline double getRA() const;
199 
202  inline double getDN() const;
203 
206  inline double getRA_ea() const;
207 
210  inline double getDN_ea() const;
211 
212  inline double getAl2ExtA() const {return al2ExtA_;};
213  inline double getAl2Estd() const {return al2Estd_;};
214 
215 
216 
217 
218 
219 
220  // sets:
221  inline void setAprioriReference(const QString& ref) {aprioriReference_ = ref;};
222  inline void setAprioriComments(const QString& str) {aprioriComments_ = str;};
223 
227  inline void setRA(double ra);
228 
232  inline void setDN(double dn);
233 
237  inline void setRA_ea(double ra);
238 
242  inline void setDN_ea(double dn);
243 
244  inline void setAl2ExtA(double l) {al2ExtA_ = l;};
245  inline void setAl2Estd(double l) {al2Estd_ = l;};
246 
247  //
248  inline void setTotalScanNum(int n) {totalScanNum_ = n;};
249  inline void setProcdScanNum(int n) {procdScanNum_ = n;};
250 
251  //
252 
253  //
254  // Functions:
255  //
258  void createParameters();
259 
262  void releaseParameters();
263 
264 // double calcR(double u, double v);
265  double tauS(double f, double u, double v);
266 
267 // double dTauS_dK(double f, double u, double v);
268 // double dTauS_dB(double f, double u, double v);
269 // double dTauS_dR(double f, double u, double v);
270 // double dTauS_dX(double f, double u, double v);
271 // double dTauS_dY(double f, double u, double v);
272 
273 // double dTauS_dA0(double f, double u, double v);
274 // double dTauS_dB0(double f, double u, double v);
275 // double dTauS_dTheta0(double f, double u, double v);
276 // double dTauS_dA1(double f, double u, double v);
277 // double dTauS_dB1(double f, double u, double v);
278 // double dTauS_dTheta1(double f, double u, double v);
279 
280  //double dTauS_dKj(int j, double f, double u, double v);
281  void processPartials4SrcStructModel(QList<SgParameter*>& parameters, double f, double u, double v);
282 
283  //
284  inline void incTotalScanNum(int n=1) {totalScanNum_ += n;};
285  inline void incProcdScanNum(int n=1) {procdScanNum_ += n;};
286 
287  inline void resetAllEditings();
288 
289  inline bool getIsSsModelEstimating() const {return isSsModelEstimating_;};
290  inline void setIsSsModelEstimating(bool is) {isSsModelEstimating_ = is;};
291 
292  //
293  // Friends:
294  //
295 
296  //
297  // I/O:
298  //
300 
302 
303  //
304  short calculateStatusBits();
305  void applyStatusBits(short bitArray);
306 
307 private:
308  //
309  // :
314 
315  // temporary place for the coordinates:
316  double RA_;
317  double DN_;
318  // temporary place for the coordinates (from external a priori file):
319  double RA_ea_;
320  double DN_ea_;
321  // arc length:
322  double al2ExtA_; // length of arc from database a priori to external a priori
323  double al2Estd_; // length of arc from a priori to estimated position
324 
325  // temporary place for the parameters:
328 
329  // multiple point:
332 public:
333  inline QList<StructModelMp>& sModel() {return sModel_;};
334  inline const QList<StructModelMp>& sModel() const {return sModel_;};
335  inline void addSrcStructPoint(double k, double b, double x, double y,
336  bool estK=false, bool estB=false, bool estR=false)
337  {sModel_.append(SgVlbiSourceInfo::StructModelMp(k, b, x, y, estK, estB, estR));};
338  inline void clearSrcStructPoints() {sModel_.clear();};
340 
341 };
342 /*=====================================================================================================*/
343 
344 
345 
346 
347 
348 /*=====================================================================================================*/
349 /* */
350 /* SgObjectInfo inline members: */
351 /* */
352 /*=====================================================================================================*/
353 //
354 //
355 // CONSTRUCTORS:
356 //
357 // A destructor:
359 {
361  sModel_.clear();
362 };
363 
364 
365 
366 //
367 // INTERFACES:
368 //
369 //
371 {
372  return pRA_;
373 };
374 
375 
376 
377 //
379 {
380  return pDN_;
381 };
382 
383 
384 
385 //
386 inline double SgVlbiSourceInfo::getRA() const
387 {
388  return RA_;
389 };
390 
391 
392 
393 //
394 inline double SgVlbiSourceInfo::getDN() const
395 {
396  return DN_;
397 };
398 
399 
400 
401 //
402 inline double SgVlbiSourceInfo::getRA_ea() const
403 {
404  return RA_ea_;
405 };
406 
407 
408 
409 //
410 inline double SgVlbiSourceInfo::getDN_ea() const
411 {
412  return DN_ea_;
413 };
414 
415 
416 
417 //
418 inline void SgVlbiSourceInfo::setRA(double ra)
419 {
420  RA_ = ra;
421 };
422 
423 
424 
425 //
426 inline void SgVlbiSourceInfo::setDN(double dn)
427 {
428  DN_ = dn;
429 };
430 
431 
432 //
433 inline void SgVlbiSourceInfo::setRA_ea(double ra)
434 {
435  RA_ea_ = ra;
436 };
437 
438 
439 
440 //
441 inline void SgVlbiSourceInfo::setDN_ea(double dn)
442 {
443  DN_ea_ = dn;
444 };
445 
446 
447 //
448 // FUNCTIONS:
449 //
450 //
451 //
452 //
454 {
456  procdScanNum_ = 0;
463  //addAttr(Attr_ESTIMATE_COO);
464 };
465 
466 
467 //
468 // FRIENDS:
469 //
470 //
471 //
472 
473 
474 /*=====================================================================================================*/
475 
476 
477 
478 
479 
480 /*=====================================================================================================*/
481 //
482 // aux functions:
483 //
484 
485 
486 /*=====================================================================================================*/
487 #endif //SG_VLBI_SOURCE_INFO_H
QMap< QString, SgVlbiSourceInfo * >::iterator SourcesByName_it
QMap< QString, SgVlbiSourceInfo * > SourcesByName
void delAttr(uint a)
Definition: SgAttribute.h:210
void resetAllEditings()
Definition: SgObjectInfo.h:595
void prepareModel(double u, double v)
StructModelMp(double k, double b, double x, double y, bool estK=true, bool estB=true, bool estCoo=true)
double tauS(double f, double u, double v) const
StructModel(double k, double b, double x, double y)
const QString & getAprioriComments() const
double getDN_ea() const
void addSrcStructPoint(double k, double b, double x, double y, bool estK=false, bool estB=false, bool estR=false)
void setTotalScanNum(int n)
SgVlbiSourceInfo(int idx=-1, const QString &key="Unknown", const QString &aka="Unknown too")
double getRA_ea() const
double tauS(double f, double u, double v)
void setAprioriComments(const QString &str)
double getAl2Estd() const
static QString dn2String(double dn, bool mandatorySign=false)
void applyStatusBits(short bitArray)
void setAl2Estd(double l)
bool getIsSsModelEstimating() const
void setDN_ea(double dn)
void incTotalScanNum(int n=1)
static const QString className()
SgParameter * pRA_
double getAl2ExtA() const
int procdScanNum_
total number of scans for the source;
void setProcdScanNum(int n)
SgParameter * pDN_
int getTotalScanNum() const
double getRA() const
double RA_
number of processed scans for the source;
void setRA_ea(double ra)
QList< StructModelMp > & sModel()
int calcNumOfEstimatedSsmParameters() const
void setDN(double dn)
const QList< StructModelMp > & sModel() const
bool loadIntermediateResults(QDataStream &)
void incProcdScanNum(int n=1)
void setRA(double ra)
void processPartials4SrcStructModel(QList< SgParameter * > &parameters, double f, double u, double v)
void setAprioriReference(const QString &ref)
QList< StructModelMp > sModel_
static QString ra2String(double ra)
bool saveIntermediateResults(QDataStream &) const
void setAl2ExtA(double l)
int getProcdScanNum() const
SgParameter * pRA()
double getDN() const
SgParameter * pDN()
void setIsSsModelEstimating(bool is)
static double arcLength(double ra_1, double dn_1, double ra_2, double dn_2)
@ Attr_TEST
for testing purposes.
@ Attr_APPLY_SSM
apply the source structure model;
@ Attr_HAS_A_PRIORI_POS
indicates that the source has a priori position;
@ Attr_ESTIMATE_VEL
estimate source velocity;
@ Attr_CONSTRAIN_COO
constrain source position in estimation;
@ Attr_NOT_VALID
omit the source;
@ Attr_ESTIMATE_COO
estimate source position;
@ Attr_CONSTRAIN_VEL
constrain source velocity in estimation;
const QString & getAprioriReference() const