1 /*****************************************************************************
3 Header: FGPhysicalProperty.h
4 Author: Christian Mayer
7 ---------- Copyright (C) 1999 Christian Mayer (vader@t-online.de) ----------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
26 FUNCTIONAL DESCRIPTION
27 ------------------------------------------------------------------------------
28 Define the simulated physical property of the weather in one point
31 ------------------------------------------------------------------------------
32 28.05.1999 Christian Mayer Created
33 16.06.1999 Durk Talsma Portability for Linux
34 20.06.1999 Christian Mayer Changed struct to class
35 20.06.1999 Christian Mayer added lots of consts
36 30.06.1999 Christian Mayer STL portability
37 *****************************************************************************/
39 /****************************************************************************/
41 /****************************************************************************/
42 #ifndef FGPhysicalProperty_H
43 #define FGPhysicalProperty_H
45 /****************************************************************************/
47 /****************************************************************************/
48 #include <Include/compiler.h>
51 FG_USING_NAMESPACE(std);
53 #include <Math/point3d.hxx>
54 #include <Voronoi/point2d.h>
55 #include "FGWeatherDefs.h"
56 #include "FGPhysicalProperties.h"
58 /****************************************************************************/
59 /* used for output: */
60 /****************************************************************************/
61 class FGPhysicalProperty
66 Point3D Wind; //Wind vector
67 Point3D Turbulence; //Turbulence vector
68 WeatherPrecition Temperature; //in deg. Kelvin (I *only* accept SI!)
69 WeatherPrecition AirPressure; //in Pascal (I *only* accept SI!)
70 WeatherPrecition VaporPressure; //in Pascal (I *only* accept SI!)
72 FGPhysicalProperty(); //consructor to fill it with FG standart weather
73 FGPhysicalProperty(const FGPhysicalProperties& p, const WeatherPrecition& altitude);
75 //allow calculations for easier handling such as interpolating
76 FGPhysicalProperty& operator = ( const FGPhysicalProperty& p ); // assignment of a Point3D
77 FGPhysicalProperty& operator += ( const FGPhysicalProperty& p ); // incrementation by a Point3D
78 FGPhysicalProperty& operator -= ( const FGPhysicalProperty& p ); // decrementation by a Point3D
79 FGPhysicalProperty& operator *= ( const double& d ); // multiplication by a constant
80 FGPhysicalProperty& operator /= ( const double& d ); // division by a constant
82 friend FGPhysicalProperty operator - (const FGPhysicalProperty& p); // -p1
83 friend bool operator == (const FGPhysicalProperty& a, const FGPhysicalProperty& b); // p1 == p2?
86 typedef vector<FGPhysicalProperty> FGPhysicalPropertyVector;
87 typedef FGPhysicalPropertyVector::iterator FGPhysicalPropertyVectorIt;
88 typedef FGPhysicalPropertyVector::const_iterator FGPhysicalPropertyVectorConstIt;
90 class FGPhysicalProperty3D : public FGPhysicalProperty
95 Point3D p; //position of the property (lat/lon/alt)
98 typedef vector<FGPhysicalProperty3D> FGPhysicalProperty3DVector;
99 typedef FGPhysicalProperty3DVector::iterator FGPhysicalProperty3DVectorIt;
100 typedef FGPhysicalProperty3DVector::const_iterator FGPhysicalProperty3DVectorConstIt;
102 inline FGPhysicalProperty& FGPhysicalProperty::operator = ( const FGPhysicalProperty& p )
105 Turbulence = p.Turbulence;
106 Temperature = p.Temperature;
107 AirPressure = p.AirPressure;
108 VaporPressure = p.VaporPressure;
112 inline FGPhysicalProperty& FGPhysicalProperty::operator += ( const FGPhysicalProperty& p )
115 Turbulence += p.Turbulence;
116 Temperature += p.Temperature;
117 AirPressure += p.AirPressure;
118 VaporPressure += p.VaporPressure;
122 inline FGPhysicalProperty& FGPhysicalProperty::operator -= ( const FGPhysicalProperty& p )
125 Turbulence -= p.Turbulence;
126 Temperature -= p.Temperature;
127 AirPressure -= p.AirPressure;
128 VaporPressure -= p.VaporPressure;
132 inline FGPhysicalProperty& FGPhysicalProperty::operator *= ( const double& d )
142 inline FGPhysicalProperty& FGPhysicalProperty::operator /= ( const double& d )
152 inline FGPhysicalProperty operator - (const FGPhysicalProperty& p)
154 FGPhysicalProperty x;
156 x.Turbulence = -p.Turbulence;
157 x.Temperature = -p.Temperature;
158 x.AirPressure = -p.AirPressure;
159 x.VaporPressure = -p.VaporPressure;
163 inline bool operator == (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
166 (a.Wind == b.Wind) &&
167 (a.Turbulence == b.Turbulence) &&
168 (a.Temperature == b.Temperature) &&
169 (a.AirPressure == b.AirPressure) &&
170 (a.VaporPressure == b.VaporPressure));
173 inline bool operator != (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
178 inline FGPhysicalProperty operator + (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
180 return FGPhysicalProperty(a) += b;
183 inline FGPhysicalProperty operator - (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
185 return FGPhysicalProperty(a) -= b;
188 inline FGPhysicalProperty operator * (const FGPhysicalProperty& a, const WeatherPrecition& b)
190 return FGPhysicalProperty(a) *= b;
193 inline FGPhysicalProperty operator * (const WeatherPrecition& b, const FGPhysicalProperty& a)
195 return FGPhysicalProperty(a) *= b;
198 inline FGPhysicalProperty operator / (const FGPhysicalProperty& a, const WeatherPrecition& b)
200 return FGPhysicalProperty(a) *= (1.0/b);
204 /****************************************************************************/
205 #endif /*FGPhysicalProperty_H*/