General Purpose Geodetic Library
SgArcStorage.cpp
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) 2012-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 #include <SgArcStorage.h>
24 #include <SgLogger.h>
25 #include <SgSymMatrix.h>
26 
27 
28 
29 
30 /*=======================================================================================================
31 *
32 * METHODS:
33 *
34 *======================================================================================================*/
35 //
36 // static first:
37 const QString SgArcStorage::className()
38 {
39  return "SgArcStorage";
40 };
41 
42 
43 
44 //
46 {
47  pOrig_ = new SgParameter(*s.pOrig_);
48  num_ = s.num_;
49  tStart_ = s.tStart_;
50  tFinis_ = s.tFinis_;
51  step_ = s.step_;
52  pPi_ = new SgParameter[num_];
53  for (int i=0; i<num_; i++)
54  pPi_[i] = s.pPi_[i];
55  return *this;
56 };
57 
58 
59 
60 //
62  const SgMJD& t0, const SgMJD& tN, const SgMJD& /*tFinis*/)
63 {
64  pOrig_ = p;
65  tStart_ = t0;
66  tFinis_ = tN;
67  step_ = pOrig_->getStep();
68 
69  num_ = ceil((tFinis_ - tStart_)/step_);
70  // arcs:
71  pPi_ = new SgParameter[num_];
72  for (int i=0; i<num_; i++)
73  {
74  pPi_[i].setName(pOrig_->getName() + ": P_" + QString("").sprintf("%03d", i));
75  pPi_[i].tune(*p);
77  pPi_[i].setTLeft(tStart_ + i*step_);
78  pPi_[i].setTRight(tStart_ + (i + 1)*step_);
79  };
80 };
81 
82 
83 
84 //
86 {
88  return;
89  if (t<tStart_ || tFinis_<t)
90  return;
91 //int j=floor((t - tStart_)/step_);
92  int j=calcCurrentIdx(t);
93  pPi_[j].setD(pOrig_->getD());
94  pOrig_->zerofy();
95 };
96 
97 
98 
99 //
100 double SgArcStorage::calcAX(const SgMJD& t, bool)
101 {
102 //int j=floor((t - tStart_)/step_);
103  int j=calcCurrentIdx(t);
104  pOrig_->setSolution(pPi_[j].getSolution());
105  pOrig_->setSigma(pPi_[j].getSigma());
106  pOrig_->setNumObs(pPi_[j].getNumObs());
107  return pOrig_->getD()*pPi_[j].getSolution();
108 };
109 
110 
111 
112 //
113 double SgArcStorage::calc_P_a(const SgSymMatrix& P, int idx, const SgMJD& t)
114 {
115 //int j=floor((t - tStart_)/step_);
116  int j=calcCurrentIdx(t);
117  return P.getElement(idx, pPi_[j].getIdx())*pOrig_->getD();
118 };
119 
120 
121 
122 //
123 double SgArcStorage::calc_aT_P_a(const SgVector& vP_a, const SgMJD& t)
124 {
125 //int j=floor((t - tStart_)/step_);
126  int j=calcCurrentIdx(t);
127  return pOrig_->getD()*vP_a.getElement(pPi_[j].getIdx());
128 };
129 
130 
131 
132 //
134 {
135  int j=calcCurrentIdx(t);
136  return pPi_[j].getSolution();
137 };
138 
139 
140 
141 //
143 {
144  int j=calcCurrentIdx(t);
145  return pPi_[j].getSigma();
146 };
147 /*=====================================================================================================*/
148 
149 
150 
151 
152 /*=======================================================================================================
153 *
154 * FRIENDS:
155 *
156 *======================================================================================================*/
157 //
158 
159 
160 
161 /*=====================================================================================================*/
162 //
163 // aux functions:
164 //
165 
166 
167 // i/o:
168 
169 
170 /*=====================================================================================================*/
171 //
172 // constants:
173 //
174 
175 
176 /*=====================================================================================================*/
SgArcStorage & operator=(const SgArcStorage &)
SgParameter * pOrig_
Definition: SgArcStorage.h:125
void deployParameters(SgParameter *, const SgMJD &tStart, const SgMJD &tFinis, const SgMJD &tRefer)
double calcSolution(const SgMJD &)
double calc_aT_P_a(const SgVector &, const SgMJD &)
double calcAX(const SgMJD &, bool)
double calcSigma(const SgMJD &)
static const QString className()
double calc_P_a(const SgSymMatrix &, int, const SgMJD &)
SgParameter * pPi_
Definition: SgArcStorage.h:128
void propagatePartials(const SgMJD &t)
int calcCurrentIdx(const SgMJD &t)
Definition: SgArcStorage.h:208
bool isAttr(uint a) const
Definition: SgAttribute.h:226
Definition: SgMJD.h:59
double getStep() const
Definition: SgParameter.h:523
double getSolution() const
Definition: SgParameter.h:435
void setTLeft(const SgMJD &t)
Definition: SgParameter.h:691
void setTRight(const SgMJD &t)
Definition: SgParameter.h:699
void tune(const SgParameterCfg &)
Definition: SgParameter.cpp:72
void setSigma(double v)
Definition: SgParameter.h:587
double getSigma() const
Definition: SgParameter.h:443
void setSolution(double v)
Definition: SgParameter.h:579
void setPMode(SgParameterCfg::PMode mode)
Definition: SgParameter.h:603
void setD(double d)
Definition: SgPartial.h:347
void setName(const QString &name)
Definition: SgPartial.h:339
const QString & getName() const
Definition: SgPartial.h:283
double getD() const
Definition: SgPartial.h:291
void setNumObs(int n)
Definition: SgPartial.h:356
void zerofy()
Definition: SgPartial.h:408
@ Attr_IS_PARTIAL_SET
rise this bit on when the partial is assigned
Definition: SgPartial.h:53
double getElement(unsigned int i, unsigned int j) const
Definition: SgSymMatrix.h:274
double getElement(unsigned int i) const
Definition: SgVector.h:362