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 11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
39 *****************************************************************************/
41 /****************************************************************************/
43 /****************************************************************************/
44 #ifndef FGPhysicalProperty_H
45 #define FGPhysicalProperty_H
47 /****************************************************************************/
49 /****************************************************************************/
50 #include <Include/compiler.h>
53 FG_USING_NAMESPACE(std);
55 #include <Math/point3d.hxx>
56 #include <Voronoi/point2d.h>
57 #include "FGWeatherDefs.h"
58 #include "FGPhysicalProperties.h"
60 /****************************************************************************/
61 /* used for output: */
62 /****************************************************************************/
63 class FGPhysicalProperty
68 Point3D Wind; //Wind vector
69 Point3D Turbulence; //Turbulence vector
70 WeatherPrecition Temperature; //in deg. Kelvin (I *only* accept SI!)
71 WeatherPrecition AirPressure; //in Pascal (I *only* accept SI!)
72 WeatherPrecition VaporPressure; //in Pascal (I *only* accept SI!)
74 FGPhysicalProperty(); //consructor to fill it with FG standart weather
75 FGPhysicalProperty(const FGPhysicalProperties& p, const WeatherPrecition& altitude);
77 //allow calculations for easier handling such as interpolating
78 FGPhysicalProperty& operator = ( const FGPhysicalProperty& p ); // assignment of a Point3D
79 FGPhysicalProperty& operator += ( const FGPhysicalProperty& p ); // incrementation by a Point3D
80 FGPhysicalProperty& operator -= ( const FGPhysicalProperty& p ); // decrementation by a Point3D
81 FGPhysicalProperty& operator *= ( const double& d ); // multiplication by a constant
82 FGPhysicalProperty& operator /= ( const double& d ); // division by a constant
84 friend FGPhysicalProperty operator - (const FGPhysicalProperty& p); // -p1
85 friend bool operator == (const FGPhysicalProperty& a, const FGPhysicalProperty& b); // p1 == p2?
88 typedef vector<FGPhysicalProperty> FGPhysicalPropertyVector;
89 typedef FGPhysicalPropertyVector::iterator FGPhysicalPropertyVectorIt;
90 typedef FGPhysicalPropertyVector::const_iterator FGPhysicalPropertyVectorConstIt;
92 class FGPhysicalProperty3D : public FGPhysicalProperty
97 Point3D p; //position of the property (lat/lon/alt)
100 typedef vector<FGPhysicalProperty3D> FGPhysicalProperty3DVector;
101 typedef FGPhysicalProperty3DVector::iterator FGPhysicalProperty3DVectorIt;
102 typedef FGPhysicalProperty3DVector::const_iterator FGPhysicalProperty3DVectorConstIt;
104 inline FGPhysicalProperty& FGPhysicalProperty::operator = ( const FGPhysicalProperty& p )
107 Turbulence = p.Turbulence;
108 Temperature = p.Temperature;
109 AirPressure = p.AirPressure;
110 VaporPressure = p.VaporPressure;
114 inline FGPhysicalProperty& FGPhysicalProperty::operator += ( const FGPhysicalProperty& p )
117 Turbulence += p.Turbulence;
118 Temperature += p.Temperature;
119 AirPressure += p.AirPressure;
120 VaporPressure += p.VaporPressure;
124 inline FGPhysicalProperty& FGPhysicalProperty::operator -= ( const FGPhysicalProperty& p )
127 Turbulence -= p.Turbulence;
128 Temperature -= p.Temperature;
129 AirPressure -= p.AirPressure;
130 VaporPressure -= p.VaporPressure;
134 inline FGPhysicalProperty& FGPhysicalProperty::operator *= ( const double& d )
144 inline FGPhysicalProperty& FGPhysicalProperty::operator /= ( const double& d )
154 inline FGPhysicalProperty operator - (const FGPhysicalProperty& p)
156 FGPhysicalProperty x;
158 x.Turbulence = -p.Turbulence;
159 x.Temperature = -p.Temperature;
160 x.AirPressure = -p.AirPressure;
161 x.VaporPressure = -p.VaporPressure;
165 inline bool operator == (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
168 (a.Wind == b.Wind) &&
169 (a.Turbulence == b.Turbulence) &&
170 (a.Temperature == b.Temperature) &&
171 (a.AirPressure == b.AirPressure) &&
172 (a.VaporPressure == b.VaporPressure));
175 inline bool operator != (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
180 inline FGPhysicalProperty operator + (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
182 return FGPhysicalProperty(a) += b;
185 inline FGPhysicalProperty operator - (const FGPhysicalProperty& a, const FGPhysicalProperty& b)
187 return FGPhysicalProperty(a) -= b;
190 inline FGPhysicalProperty operator * (const FGPhysicalProperty& a, const WeatherPrecition& b)
192 return FGPhysicalProperty(a) *= b;
195 inline FGPhysicalProperty operator * (const WeatherPrecition& b, const FGPhysicalProperty& a)
197 return FGPhysicalProperty(a) *= b;
200 inline FGPhysicalProperty operator / (const FGPhysicalProperty& a, const WeatherPrecition& b)
202 return FGPhysicalProperty(a) *= (1.0/b);
206 /****************************************************************************/
207 #endif /*FGPhysicalProperty_H*/