General Purpose Geodetic Library
SgPartial.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_EST_PARTIAL_H
24 #define SG_EST_PARTIAL_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 #include <QtCore/QString>
32 
33 #include <SgAttribute.h>
34 #include <SgMJD.h>
35 
36 
37 
38 
39 /***===================================================================================================*/
45 class SgPartial : public SgAttribute
46 {
47 public:
49  {
50  Attr_IS_BREAK = 1<<0,
52  Attr_IS_IN_RUN = 1<<2,
54  Attr_IS_SPECIAL = 1<<4,
55  };
57  {
58  DD_OFFSET = 0,
59  DD_RATE = 1,
60  };
61  //
62  // constructors/destructors:
63  //
67  inline SgPartial();
68 
73  inline SgPartial(const SgPartial& p);
74 
79  inline SgPartial(const QString& name);
80 
84  inline ~SgPartial();
85 
86  //
87  // Interfaces:
88  //
91  SgPartial& operator=(const SgPartial& a);
92 
95  inline const QString& getName() const;
96 
97  inline DataDomain getDataDomain() const {return dataDomain_;};
98 
101  inline double getD() const;
102 
105  inline int getNumObs() const;
106 
109  inline int getNumSes() const;
110 
113  inline const SgMJD& getTStart() const;
114 
117  inline const SgMJD& getTFinis() const;
118 
121  inline const SgMJD& getTCurrent() const;
122 
126  inline void setName(const QString& name);
127 
131  inline void setD(double d);
132 
133  inline void setDataDomain(DataDomain domain) {dataDomain_=domain;};
134 
138  inline void setNumObs(int n);
139 
143  inline void setNumSes(int n);
144 
148  inline void setTStart(const SgMJD& t);
149 
153  inline void setTFinis(const SgMJD& t);
154 
155  //
156  // Functions:
157  //
160  static const QString className();
161 
164  inline void resetStatistics();
165 
170  void updateStatistics(const SgMJD& t, double weight);
171 
174  inline void zerofy();
175 
178  inline SgMJD getTMean(const SgMJD& =tZero) const;
179 
180  //
181  // Friends:
182  //
183 
184  //
185  // I/O:
186  //
187  // ...
188 
189 private:
190  QString name_;
192  double d_;
193  int numObs_;
194  int numSes_;
197  double twSum_;
198  double wSum_;
199 };
200 /*=====================================================================================================*/
201 
202 
203 
204 
205 
206 
207 
208 
209 /*=====================================================================================================*/
210 /* */
211 /* SgPartial inline members: */
212 /* */
213 /*=====================================================================================================*/
214 //
215 //
216 // CONSTRUCTORS:
217 //
218 // An empty constructor:
220  SgAttribute(),
221  name_("unnamed"),
222  tStart_(tZero),
223  tFinis_(tZero)
224 {
226  d_ = 0.0;
227  numObs_ = 0;
228  numSes_ = 0;
229  twSum_ = 0.0;
230  wSum_ = 0.0;
231 };
232 
233 
234 
235 // An empty constructor that set up a name:
236 inline SgPartial::SgPartial(const QString& name) :
237  SgAttribute(),
238  name_(name),
239  tStart_(tZero),
240  tFinis_(tZero)
241 {
243  d_ = 0.0;
244  numObs_ = 0;
245  numSes_ = 0;
246  twSum_ = 0.0;
247  wSum_ = 0.0;
248 };
249 
250 
251 
252 // A regular constructor:
253 inline SgPartial::SgPartial(const SgPartial& p) :
254  SgAttribute(p),
255  name_(p.getName()),
256  tStart_(p.getTStart()),
257  tFinis_(p.getTFinis())
258 {
260  d_ = p.getD();
261  numObs_ = p.getNumObs();
262  numSes_ = p.getNumSes();
263  twSum_ = p.twSum_;
264  wSum_ = p.wSum_;
265 };
266 
267 
268 
269 
270 // A destructor:
272 {
273  // nothing to do
274 };
275 
276 
277 
278 //
279 // INTERFACES:
280 //
281 //
282 //
283 inline const QString& SgPartial::getName() const
284 {
285  return name_;
286 };
287 
288 
289 
290 //
291 inline double SgPartial::getD() const
292 {
293  return d_;
294 };
295 
296 
297 
298 //
299 inline int SgPartial::getNumObs() const
300 {
301  return numObs_;
302 };
303 
304 
305 
306 //
307 inline int SgPartial::getNumSes() const
308 {
309  return numSes_;
310 };
311 
312 
313 
314 //
315 inline const SgMJD& SgPartial::getTStart() const
316 {
317  return tStart_;
318 };
319 
320 
321 
322 //
323 inline const SgMJD& SgPartial::getTFinis() const
324 {
325  return tFinis_;
326 };
327 
328 
329 
330 //
331 inline const SgMJD& SgPartial::getTCurrent() const
332 {
333  return tFinis_;
334 };
335 
336 
337 
338 //
339 inline void SgPartial::setName(const QString& name)
340 {
341  name_ = name;
342 };
343 
344 
345 
346 //
347 inline void SgPartial::setD(double d)
348 {
349  d_ = d;
351 };
352 
353 
354 
355 //
356 inline void SgPartial::setNumObs(int n)
357 {
358  numObs_ = n;
359 };
360 
361 
362 
363 //
364 inline void SgPartial::setNumSes(int n)
365 {
366  numSes_ = n;
367 };
368 
369 
370 
371 //
372 inline void SgPartial::setTStart(const SgMJD& t)
373 {
374  tStart_ = t;
375 };
376 
377 
378 
379 //
380 inline void SgPartial::setTFinis(const SgMJD& t)
381 {
382  tFinis_ = t;
383 };
384 
385 
386 
387 
388 
389 
390 //
391 // FRUNCTIONS:
392 //
393 //
394 //
396 {
397  numObs_ = 0;
398  numSes_ = 0;
399  tStart_ = tZero;
400  tFinis_ = tZero;
401  twSum_ = 0.0;
402  wSum_ = 0.0;
403 };
404 
405 
406 
407 //
408 inline void SgPartial::zerofy()
409 {
410  d_ = 0.0;
412 };
413 
414 
415 
416 inline SgMJD SgPartial::getTMean(const SgMJD&) const
417 {
418  return (numObs_ && wSum_>0.0) ? SgMJD(twSum_/wSum_) : tZero;
419 };
420 
421 
422 
423 //
424 // FRIENDS:
425 //
426 //
427 //
428 /*=====================================================================================================*/
429 
430 
431 
432 
433 
434 /*=====================================================================================================*/
435 //
436 // aux functions:
437 //
438 
439 
440 /*=====================================================================================================*/
441 #endif //SG_EST_PARTIAL_H
const SgMJD tZero(1957, 10, 4)
void delAttr(uint a)
Definition: SgAttribute.h:210
void addAttr(uint a)
Definition: SgAttribute.h:202
Definition: SgMJD.h:59
SgMJD tStart_
MJD of the first measurement;.
Definition: SgPartial.h:195
void updateStatistics(const SgMJD &t, double weight)
Definition: SgPartial.cpp:62
void setTFinis(const SgMJD &t)
Definition: SgPartial.h:380
QString name_
name of a derivation;
Definition: SgPartial.h:190
void setD(double d)
Definition: SgPartial.h:347
~SgPartial()
Definition: SgPartial.h:271
void setDataDomain(DataDomain domain)
Definition: SgPartial.h:133
SgMJD tFinis_
MJD of the last measurement;.
Definition: SgPartial.h:196
double twSum_
the weighted sum of epochs of observation;
Definition: SgPartial.h:197
void setName(const QString &name)
Definition: SgPartial.h:339
int getNumObs() const
Definition: SgPartial.h:299
const SgMJD & getTStart() const
Definition: SgPartial.h:315
int numObs_
number of points per derivation;
Definition: SgPartial.h:193
@ DD_OFFSET
Definition: SgPartial.h:58
double wSum_
the sum of weights of observations;
Definition: SgPartial.h:198
SgMJD getTMean(const SgMJD &=tZero) const
Definition: SgPartial.h:416
void setTStart(const SgMJD &t)
Definition: SgPartial.h:372
void setNumSes(int n)
Definition: SgPartial.h:364
SgPartial & operator=(const SgPartial &a)
Definition: SgPartial.cpp:44
const QString & getName() const
Definition: SgPartial.h:283
double getD() const
Definition: SgPartial.h:291
int numSes_
number of sessions per derivation;
Definition: SgPartial.h:194
const SgMJD & getTCurrent() const
Definition: SgPartial.h:331
void setNumObs(int n)
Definition: SgPartial.h:356
int getNumSes() const
Definition: SgPartial.h:307
static const QString className()
Definition: SgPartial.cpp:36
DataDomain dataDomain_
Definition: SgPartial.h:191
DataDomain getDataDomain() const
Definition: SgPartial.h:97
double d_
value of a derivation;
Definition: SgPartial.h:192
void resetStatistics()
Definition: SgPartial.h:395
void zerofy()
Definition: SgPartial.h:408
@ Attr_IS_IN_RUN
Definition: SgPartial.h:52
@ Attr_IS_SPECIAL
for estimator use
Definition: SgPartial.h:54
@ Attr_IS_PARTIAL_SET
rise this bit on when the partial is assigned
Definition: SgPartial.h:53
@ Attr_IS_PROPAGATED
the parameter's info have to be propagated in future
Definition: SgPartial.h:51
@ Attr_IS_BREAK
there is a break in the parameter's behavior
Definition: SgPartial.h:50
const SgMJD & getTFinis() const
Definition: SgPartial.h:323