General Purpose Geodetic Library
SgMeteoData.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_METEO_DATA_H
24 #define SG_METEO_DATA_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 
32 #include <math.h>
33 
34 #include <SgAttribute.h>
35 
36 
37 
38 
39 
40 /***===================================================================================================*/
46 class SgMeteoData : public SgAttribute
47 {
48 public:
50  {
51  Attr_BAD_DATA = 1<<0,
53  };
54 
55 
56  // Statics:
57  static double dewPt2Rho(double temperature, double dewPtTemperature);
58  //
59  // constructors/destructors:
60  //
64  inline SgMeteoData();
65 
69  inline SgMeteoData(double t, double p, double rho);
70 
74  inline SgMeteoData(const SgMeteoData&);
75 
79  inline ~SgMeteoData();
80 
81 
82 
83  //
84  // Interfaces:
85  //
88  inline SgMeteoData& operator=(const SgMeteoData&);
89 
90  // gets:
93  inline double getTemperature() const;
94 
97  inline double getPressure() const;
98 
101  inline double getRelativeHumidity() const;
102 
103 
104 
105 
106  // sets:
110  inline void setTemperature(double t);
111 
115  inline void setPressure(double p);
116 
120  inline void setRelativeHumidity(double rho);
121 
122 
123  //
124  // Functions:
125  //
128  inline const QString className() const;
129 
130  inline bool operator==(const SgMeteoData& meteo) const;
131 
132  inline bool operator!=(const SgMeteoData& meteo) const;
133 
136  double temperature(double height=0.0) const;
137 
140  double pressure(double height=0.0) const;
141 
144  double relativeHumidity(double height=0.0) const;
145 
146  //
147  // Friends:
148  //
149 
150  //
151  // I/O:
152  //
153  // ...
154 
155 private:
156  double temperature_;
157  double pressure_;
159 };
160 /*=====================================================================================================*/
161 
162 
163 
164 
165 
166 /*=====================================================================================================*/
167 /* */
168 /* SgMeteoData inline members: */
169 /* */
170 /*=====================================================================================================*/
171 //
172 //
173 // CONSTRUCTORS:
174 //
175 // An empty constructor:
177  SgAttribute()
178 {
179  temperature_ = 0.0;
180  pressure_ = 0.0;
181  relativeHumidity_ = 0.0;
182  // these data are unreal, when user setups correct values, he/she will turn off this flag:
184 };
185 
186 
187 
188 //
190  SgAttribute()
191 {
193  pressure_ = m.getPressure();
195 };
196 
197 
198 
199 //
200 inline SgMeteoData::SgMeteoData(double t, double p, double rho) :
201  SgAttribute()
202 {
203  temperature_ = t;
204  pressure_ = p;
205  relativeHumidity_ = rho;
206 };
207 
208 
209 
210 // A destructor:
212 {
213  // nothing to do
214 };
215 
216 
217 
218 //
220 {
223  pressure_ = m.pressure_;
225  return *this;
226 };
227 
228 
229 
230 //
231 // INTERFACES:
232 //
233 // returns temperature
234 inline double SgMeteoData::getTemperature() const
235 {
236  return temperature_;
237 };
238 
239 
240 
241 //
242 inline double SgMeteoData::getPressure() const
243 {
244  return pressure_;
245 };
246 
247 
248 
249 //
250 inline double SgMeteoData::getRelativeHumidity() const
251 {
252  return relativeHumidity_;
253 };
254 
255 
256 
257 //
258 inline void SgMeteoData::setTemperature(double t)
259 {
260  temperature_ = t;
261 };
262 
263 
264 
265 //
266 inline void SgMeteoData::setPressure(double p)
267 {
268  pressure_ = p;
269 };
270 
271 
272 
273 //
274 inline void SgMeteoData::setRelativeHumidity(double rho)
275 {
276  relativeHumidity_ = rho;
277 };
278 
279 
280 
281 //
282 // FUNCTIONS:
283 //
284 //
285 //
286 inline const QString SgMeteoData::className() const
287 {
288  return "SgMeteoData";
289 };
290 
291 
292 
293 //
294 inline bool SgMeteoData::operator==(const SgMeteoData& meteo) const
295 {
296  return temperature_ == meteo.getTemperature() &&
297  pressure_ == meteo.getPressure() &&
299 };
300 
301 
302 
303 //
304 inline bool SgMeteoData::operator!=(const SgMeteoData& meteo) const
305 {
306  return !(*this==meteo);
307 };
308 
309 
310 
311 
312 
313 
314 
315 
316 
317 
318 //
319 // FRIENDS:
320 //
321 //
322 //
323 
324 
325 /*=====================================================================================================*/
326 
327 
328 
329 
330 
331 /*=====================================================================================================*/
332 //
333 // aux functions:
334 //
335 
336 
337 /*=====================================================================================================*/
338 #endif // SG_METEO_DATA_H
void setAttributes(unsigned int a)
Definition: SgAttribute.h:191
unsigned int getAttributes() const
Definition: SgAttribute.h:183
void addAttr(uint a)
Definition: SgAttribute.h:202
double getPressure() const
Definition: SgMeteoData.h:242
double relativeHumidity_
Definition: SgMeteoData.h:158
SgMeteoData & operator=(const SgMeteoData &)
Definition: SgMeteoData.h:219
void setRelativeHumidity(double rho)
Definition: SgMeteoData.h:274
double pressure(double height=0.0) const
Definition: SgMeteoData.cpp:70
bool operator==(const SgMeteoData &meteo) const
Definition: SgMeteoData.h:294
double temperature_
Definition: SgMeteoData.h:156
double relativeHumidity(double height=0.0) const
Definition: SgMeteoData.cpp:90
double pressure_
Definition: SgMeteoData.h:157
const QString className() const
Definition: SgMeteoData.h:286
double getTemperature() const
Definition: SgMeteoData.h:234
void setTemperature(double t)
Definition: SgMeteoData.h:258
double temperature(double height=0.0) const
Definition: SgMeteoData.cpp:52
void setPressure(double p)
Definition: SgMeteoData.h:266
static double dewPt2Rho(double temperature, double dewPtTemperature)
Definition: SgMeteoData.cpp:39
@ Attr_ARTIFICIAL_DATA
data are artificial (mean values or some model);
Definition: SgMeteoData.h:52
@ Attr_BAD_DATA
data readings are wrong;
Definition: SgMeteoData.h:51
double getRelativeHumidity() const
Definition: SgMeteoData.h:250
bool operator!=(const SgMeteoData &meteo) const
Definition: SgMeteoData.h:304