1
0
Fork 0

Upgraded to latest weather data base code from Christian Mayer's and make

it the default.
This commit is contained in:
curt 1999-10-14 20:30:54 +00:00
parent b822efcf78
commit eddea671a2
35 changed files with 324 additions and 204 deletions

View file

@ -61,8 +61,8 @@
/* Define to include Oliver's networking support */
#undef FG_NETWORK_OLK
/* Define to include Oliver's networking support */
#undef FG_NEW_WEATHER
/* Define to avoid Christian's new weather code */
#undef FG_OLD_WEATHER
/* Define if we are building FGFS (should always be defined) */
#undef FGFS

View file

@ -4,11 +4,11 @@ else
SERIAL_LIBS =
endif
if ENABLE_NEW_WEATHER
if ENABLE_OLD_WEATHER
WEATHER_LIBS = $(top_builddir)/Simulator/Weather/libWeather.a
else
WEATHER_LIBS = $(top_builddir)/Simulator/WeatherCM/libWeatherCM.a \
$(top_builddir)/Lib/Voronoi/libVoronoi.a
else
WEATHER_LIBS = $(top_builddir)/Simulator/Weather/libWeather.a
endif

View file

@ -75,7 +75,7 @@
#include <Time/sunpos.hxx>
#include <Time/moonpos.hxx>
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Weather/weather.hxx>
@ -429,7 +429,7 @@ bool fgInitSubsystems( void ) {
fgEVENT::FG_EVENT_READY, 30000 );
// Initialize the weather modeling subsystem
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
// Initialize the WeatherDatabase
FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =

View file

@ -55,7 +55,7 @@
#include <Time/fg_time.hxx>
#include <Time/light.hxx>
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Weather/weather.hxx>
@ -190,7 +190,7 @@ void GLUTkey(unsigned char k, int x, int y) {
v->force_update_fov_math();
return;
case 90: // Z key
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
tmp = WeatherDatabase->getWeatherVisibility();
tmp /= 1.10;
WeatherDatabase->setWeatherVisibility( tmp );
@ -326,7 +326,7 @@ void GLUTkey(unsigned char k, int x, int y) {
v->force_update_fov_math();
return;
case 122: // z key
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
tmp = WeatherDatabase->getWeatherVisibility();
tmp *= 1.10;
WeatherDatabase->setWeatherVisibility( tmp );

View file

@ -92,7 +92,7 @@
#include <Time/fg_timer.hxx>
#include <Time/sunpos.hxx>
#ifndef FG_NEW_WEATHER
#ifdef FG_OLD_WEATHER
# include <Weather/weather.hxx>
#endif
@ -593,7 +593,7 @@ static void fgMainLoop( void ) {
// init routine and we don't have to worry about it again.
#endif
#ifndef FG_NEW_WEATHER
#ifdef FG_OLD_WEATHER
current_weather.Update();
#endif

View file

@ -47,7 +47,7 @@
#include <Objects/materialmgr.hxx>
#include <Objects/obj.hxx>
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Weather/weather.hxx>
@ -695,7 +695,7 @@ void FGTileMgr::prep_ssg_nodes( void ) {
if ( t->is_loaded() ) {
// set range selector (LOD trick) to be distance to center
// of tile + bounding radius
#ifdef FG_NEW_WEATHER
#ifndef FG_OLD_WEATHER
ranges[1] = WeatherDatabase->getWeatherVisibility()
+ t->bounding_radius;
#else

View file

@ -33,6 +33,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -33,6 +33,8 @@ HISTORY
08.06.1999 Christian Mayer Added international air preasure formula
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -33,6 +33,9 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
09.10.1999 Christian Mayer changed CloudItem on Durks request
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -43,8 +46,4 @@ HISTORY
/****************************************************************************/
/********************************** CODE ************************************/
/****************************************************************************/
bool operator<(const FGCloudItem& arg1, const FGCloudItem& arg2)
{
return arg1.alt < arg2.alt;
}

View file

@ -32,6 +32,9 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
09.10.1999 Christian Mayer changed CloudItem on Durks request
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -55,16 +58,17 @@ HISTORY
class FGCloudItem
{
private:
WeatherPrecition thickness;
WeatherPrecition density;
protected:
public:
WeatherPrecition value;
WeatherPrecition alt;
FGCloudItem(const WeatherPrecition& a, const WeatherPrecition& v) {alt = a; value = v;}
FGCloudItem(const WeatherPrecition& v) {alt = 0.0; value = v;}
FGCloudItem() {alt = 0.0; value = FG_WEATHER_DEFAULT_AIRPRESSURE;}
FGCloudItem(const WeatherPrecition& t, const WeatherPrecition& d) {thickness = t; density = d;}
FGCloudItem() {thickness = 0.0; density = 0.0;}
friend bool operator<(const FGCloudItem& arg1, const FGCloudItem& arg2);
WeatherPrecition getThickness(void) const { return thickness; }
WeatherPrecition getDensity (void) const { return density; }
};
/****************************************************************************/

View file

@ -35,6 +35,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -232,7 +234,7 @@ FGPhysicalProperties2DVector FGGlobalWeatherDatabase::getAll(const Point2D& p, c
if (ret_list.size()<min)
{
for(i = 0; (i < (min - ret_list.size())) && (ret_list.size() < database.size()); i++)
for(i = 0; (i < (int)(min - ret_list.size())) && (ret_list.size() < database.size()); i++)
ret_list.push_back(*it[i]);
}

View file

@ -35,6 +35,8 @@ HISTORY
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -48,6 +50,7 @@ HISTORY
/****************************************************************************/
#include "FGPhysicalProperties.h"
#include "FGPhysicalProperty.h"
#include "sg.h"
#include <Include/compiler.h>
#include <vector>
#include STL_IOSTREAM
@ -90,7 +93,9 @@ public:
/* Get the physical properties on the specified point p */
/************************************************************************/
FGPhysicalProperties get(const Point2D& p) const;
FGPhysicalProperties get(const sgVec2& p) const {return get(Point2D(p[0], p[1]));}
inline FGPhysicalProperty get(const Point3D& p) const {return FGPhysicalProperty(get(Point2D(p)), p.elev());}
inline FGPhysicalProperty get(const sgVec3& p) const {return FGPhysicalProperty(get(Point2D(p[0], p[1])), p[3]);}
/************************************************************************/
/* update the database. Since the last call we had dt seconds */

View file

@ -34,6 +34,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -212,6 +214,17 @@ FGPhysicalProperty FGLocalWeatherDatabase::get(const sgVec3& p) const
return global->get(temp);
}
FGPhysicalProperties FGLocalWeatherDatabase::get(const sgVec2& p) const
{
Point3D temp(p[0], p[1], 0.0);
unsigned int a = AreaWith(temp);
if (a != 0)
return WeatherAreas[a-1].get();
else //point is outside => ask GlobalWeatherDatabase
return global->get(p);
}
WeatherPrecition FGLocalWeatherDatabase::getAirDensity(const Point3D& p) const
{
FGPhysicalProperty dummy;
@ -245,46 +258,46 @@ WeatherPrecition FGLocalWeatherDatabase::getAirDensity(const sgVec3& p) const
/****************************************************************************/
/* Add a weather feature at the point p and surrounding area */
/****************************************************************************/
void FGLocalWeatherDatabase::addWind(const FGWindItem& x, const Point2D& p)
void FGLocalWeatherDatabase::addWind(const WeatherPrecition alt, const Point3D& x, const Point2D& p)
{
unsigned int a = AreaWith(p);
if (a != 0)
WeatherAreas[a-1].addWind(x);
WeatherAreas[a-1].addWind(alt, x);
}
void FGLocalWeatherDatabase::addTurbulence(const FGTurbulenceItem& x, const Point2D& p)
void FGLocalWeatherDatabase::addTurbulence(const WeatherPrecition alt, const Point3D& x, const Point2D& p)
{
unsigned int a = AreaWith(p);
if (a != 0)
WeatherAreas[a-1].addTurbulence(x);
WeatherAreas[a-1].addTurbulence(alt, x);
}
void FGLocalWeatherDatabase::addTemperature(const FGTemperatureItem& x, const Point2D& p)
void FGLocalWeatherDatabase::addTemperature(const WeatherPrecition alt, const WeatherPrecition x, const Point2D& p)
{
unsigned int a = AreaWith(p);
if (a != 0)
WeatherAreas[a-1].addTemperature(x);
WeatherAreas[a-1].addTemperature(alt, x);
}
void FGLocalWeatherDatabase::addAirPressure(const FGAirPressureItem& x, const Point2D& p)
void FGLocalWeatherDatabase::addAirPressure(const WeatherPrecition alt, const WeatherPrecition x, const Point2D& p)
{
unsigned int a = AreaWith(p);
if (a != 0)
WeatherAreas[a-1].addAirPressure(x);
WeatherAreas[a-1].addAirPressure(alt, x);
}
void FGLocalWeatherDatabase::addVaporPressure(const FGVaporPressureItem& x, const Point2D& p)
void FGLocalWeatherDatabase::addVaporPressure(const WeatherPrecition alt, const WeatherPrecition x, const Point2D& p)
{
unsigned int a = AreaWith(p);
if (a != 0)
WeatherAreas[a-1].addVaporPressure(x);
WeatherAreas[a-1].addVaporPressure(alt, x);
}
void FGLocalWeatherDatabase::addCloud(const FGCloudItem& x, const Point2D& p)
void FGLocalWeatherDatabase::addCloud(const WeatherPrecition alt, const FGCloudItem& x, const Point2D& p)
{
unsigned int a = AreaWith(p);
if (a != 0)
WeatherAreas[a-1].addCloud(x);
WeatherAreas[a-1].addCloud(alt, x);
}
void FGLocalWeatherDatabase::setSnowRainIntensity(const WeatherPrecition& x, const Point2D& p)

View file

@ -34,6 +34,8 @@ HISTORY
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -141,6 +143,7 @@ public:
/************************************************************************/
FGPhysicalProperty get(const Point3D& p) const;
FGPhysicalProperty get(const sgVec3& p) const;
FGPhysicalProperties get(const sgVec2& p) const;
WeatherPrecition getAirDensity(const Point3D& p) const;
WeatherPrecition getAirDensity(const sgVec3& p) const;
@ -149,12 +152,12 @@ public:
/* Add a weather feature at the point p and surrounding area */
/************************************************************************/
void addWind(const FGWindItem& x, const Point2D& p);
void addTurbulence(const FGTurbulenceItem& x, const Point2D& p);
void addTemperature(const FGTemperatureItem& x, const Point2D& p);
void addAirPressure(const FGAirPressureItem& x, const Point2D& p);
void addVaporPressure(const FGVaporPressureItem& x, const Point2D& p);
void addCloud(const FGCloudItem& x, const Point2D& p);
void addWind(const WeatherPrecition alt, const Point3D& x, const Point2D& p);
void addTurbulence(const WeatherPrecition alt, const Point3D& x, const Point2D& p);
void addTemperature(const WeatherPrecition alt, const WeatherPrecition x, const Point2D& p);
void addAirPressure(const WeatherPrecition alt, const WeatherPrecition x, const Point2D& p);
void addVaporPressure(const WeatherPrecition alt, const WeatherPrecition x, const Point2D& p);
void addCloud(const WeatherPrecition alt, const FGCloudItem& x, const Point2D& p);
void setSnowRainIntensity(const WeatherPrecition& x, const Point2D& p);
void setSnowRainType(const SnowRainType& x, const Point2D& p);

View file

@ -33,6 +33,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -58,35 +60,35 @@ FGMicroWeather::~FGMicroWeather()
/* Add the features to the micro weather */
/* return succss */
/****************************************************************************/
void FGMicroWeather::addWind(const FGWindItem& x)
void FGMicroWeather::addWind(const WeatherPrecition alt, const Point3D& x)
{
StoredWeather.Wind.insert(x);
StoredWeather.Wind[alt] = x;
}
void FGMicroWeather::addTurbulence(const FGTurbulenceItem& x)
void FGMicroWeather::addTurbulence(const WeatherPrecition alt, const Point3D& x)
{
StoredWeather.Turbulence.insert(x);
StoredWeather.Turbulence[alt] = x;
}
void FGMicroWeather::addTemperature(const FGTemperatureItem& x)
void FGMicroWeather::addTemperature(const WeatherPrecition alt, const WeatherPrecition x)
{
StoredWeather.Temperature.insert(x);
StoredWeather.Temperature[alt] = x;
}
void FGMicroWeather::addAirPressure(const FGAirPressureItem& x)
void FGMicroWeather::addAirPressure(const WeatherPrecition alt, const WeatherPrecition x)
{
cerr << "Error: caught attempt to add AirPressure which is logical wrong\n";
//StoredWeather.AirPressure.insert(x);
//StoredWeather.AirPressure[alt] = x;
}
void FGMicroWeather::addVaporPressure(const FGVaporPressureItem& x)
void FGMicroWeather::addVaporPressure(const WeatherPrecition alt, const WeatherPrecition x)
{
StoredWeather.VaporPressure.insert(x);
StoredWeather.VaporPressure[alt] = x;
}
void FGMicroWeather::addCloud(const FGCloudItem& x)
void FGMicroWeather::addCloud(const WeatherPrecition alt, const FGCloudItem& x)
{
StoredWeather.Clouds.insert(x);
StoredWeather.Clouds[alt] = x;
}
void FGMicroWeather::setSnowRainIntensity(const WeatherPrecition& x)

View file

@ -33,6 +33,8 @@ HISTORY
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -93,12 +95,12 @@ public:
/************************************************************************/
/* Add a feature to the micro weather */
/************************************************************************/
void addWind(const FGWindItem& x);
void addTurbulence(const FGTurbulenceItem& x);
void addTemperature(const FGTemperatureItem& x);
void addAirPressure(const FGAirPressureItem& x);
void addVaporPressure(const FGVaporPressureItem& x);
void addCloud(const FGCloudItem& x);
void addWind(const WeatherPrecition alt, const Point3D& x);
void addTurbulence(const WeatherPrecition alt, const Point3D& x);
void addTemperature(const WeatherPrecition alt, const WeatherPrecition x);
void addAirPressure(const WeatherPrecition alt, const WeatherPrecition x);
void addVaporPressure(const WeatherPrecition alt, const WeatherPrecition x);
void addCloud(const WeatherPrecition alt, const FGCloudItem& x);
void setSnowRainIntensity(const WeatherPrecition& x);
void setSnowRainType(const SnowRainType& x);
@ -116,6 +118,11 @@ public:
return FGPhysicalProperty(StoredWeather, altitude);
}
inline FGPhysicalProperties get(void) const
{
return FGPhysicalProperties();
}
/************************************************************************/
/* return true if p is inside this micro weather */
/************************************************************************/

View file

@ -33,6 +33,8 @@ HISTORY
29.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -50,21 +52,21 @@ FGPhysicalProperties::FGPhysicalProperties()
/* This standart constructor fills the class with a standard weather */
/************************************************************************/
Wind.insert(FGWindItem(-1000.0, Point3D(0.0))); //no Wind by default
Wind.insert(FGWindItem(10000.0, Point3D(0.0))); //no Wind by default
Wind[-1000.0] = Point3D(0.0); //no Wind by default
Wind[10000.0] = Point3D(0.0); //no Wind by default
Turbulence.insert(FGTurbulenceItem(-1000.0, Point3D(0.0))); //no Turbulence by default
Turbulence.insert(FGTurbulenceItem(10000.0, Point3D(0.0))); //no Turbulence by default
Turbulence[-1000.0] = Point3D(0.0); //no Turbulence by default
Turbulence[10000.0] = Point3D(0.0); //no Turbulence by default
//Initialice with the CINA atmosphere
Temperature.insert(FGTemperatureItem( 0.0, (+15.0+273.16)));
Temperature.insert(FGTemperatureItem(11000.0, (-56.5+273.16)));
Temperature.insert(FGTemperatureItem(20000.0, (-56.5+273.16)));
Temperature[ 0.0] = +15.0 + 273.16;
Temperature[11000.0] = -56.5 + 273.16;
Temperature[20000.0] = -56.5 + 273.16;
AirPressure = FGAirPressureItem(101325.0);
VaporPressure.insert(FGVaporPressureItem( 0.0, FG_WEATHER_DEFAULT_VAPORPRESSURE)); //in Pa (I *only* accept SI!)
VaporPressure.insert(FGVaporPressureItem(10000.0, FG_WEATHER_DEFAULT_VAPORPRESSURE)); //in Pa (I *only* accept SI!)
VaporPressure[ 0.0] = FG_WEATHER_DEFAULT_VAPORPRESSURE; //in Pa (I *only* accept SI!)
VaporPressure[10000.0] = FG_WEATHER_DEFAULT_VAPORPRESSURE; //in Pa (I *only* accept SI!)
//Clouds.insert(FGCloudItem()) => none
SnowRainIntensity = 0.0;
@ -72,6 +74,23 @@ FGPhysicalProperties::FGPhysicalProperties()
LightningProbability = 0.0;
}
unsigned int FGPhysicalProperties::getNumberOfCloudLayers(void) const
{
return Clouds.size();
}
FGCloudItem FGPhysicalProperties::getCloudLayer(unsigned int nr) const
{
map<WeatherPrecition,FGCloudItem>::const_iterator CloudsIt = Clouds.begin();
//set the iterator to the 'nr'th entry
for (; nr > 0; nr--)
CloudsIt++;
return CloudsIt->second;
}

View file

@ -34,6 +34,8 @@ HISTORY
20.06.1999 Christian Mayer Changed struct to class
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -47,21 +49,17 @@ HISTORY
/****************************************************************************/
#include <Include/compiler.h>
#include <vector>
#include <set>
#include <map>
FG_USING_STD(vector);
FG_USING_STD(set);
FG_USING_STD(map);
FG_USING_NAMESPACE(std);
#include <Math/point3d.hxx>
#include <Voronoi/point2d.h>
#include "FGWeatherDefs.h"
#include "FGWindItem.h"
#include "FGTurbulenceItem.h"
#include "FGTemperatureItem.h"
#include "FGAirPressureItem.h"
#include "FGVaporPressureItem.h"
#include "FGCloudItem.h"
#include "FGSnowRain.h"
@ -69,13 +67,16 @@ FG_USING_NAMESPACE(std);
class FGPhysicalProperties
{
public:
set<FGWindItem> Wind; //all Wind vectors
set<FGTurbulenceItem> Turbulence; //all Turbulence vectors
set<FGTemperatureItem> Temperature; //in deg. Kelvin (I *only* accept SI!)
FGAirPressureItem AirPressure; //in Pascal (I *only* accept SI!)
set<FGVaporPressureItem> VaporPressure; //in Pascal (I *only* accept SI!)
typedef WeatherPrecition Altitude;
map<Altitude,Point3D> Wind; //all Wind vectors
map<Altitude,Point3D> Turbulence; //all Turbulence vectors
map<Altitude,WeatherPrecition> Temperature; //in deg. Kelvin (I *only* accept SI!)
FGAirPressureItem AirPressure; //in Pascal (I *only* accept SI!)
map<Altitude,WeatherPrecition> VaporPressure; //in Pascal (I *only* accept SI!)
map<Altitude,FGCloudItem> Clouds; //amount of covering and type
set<FGCloudItem> Clouds; //amount of covering and type
WeatherPrecition SnowRainIntensity; //this also stands for hail, snow,...
SnowRainType snowRainType;
WeatherPrecition LightningProbability;
@ -88,6 +89,10 @@ public:
WeatherPrecition TemperatureAt(const WeatherPrecition& a) const;
WeatherPrecition AirPressureAt(const WeatherPrecition& a) const;
WeatherPrecition VaporPressureAt(const WeatherPrecition& a) const;
//for easier access to the cloud stuff:
unsigned int getNumberOfCloudLayers(void) const;
FGCloudItem getCloudLayer(unsigned int nr) const;
FGPhysicalProperties& operator = ( const FGPhysicalProperties& p );
FGPhysicalProperties& operator *= ( const WeatherPrecition& d );
@ -123,32 +128,44 @@ typedef FGPhysicalProperties2DVector::const_iterator FGPhysicalProperties2DVecto
inline ostream& operator<< ( ostream& out, const FGPhysicalProperties2D& p )
{
out << "Position: " << p.p << "\nStored Wind: ";
for (set<FGWindItem>::const_iterator WindIt = p.Wind.begin(); WindIt != p.Wind.end(); WindIt++)
out << "(" << WindIt->getValue() << ") at " << WindIt->getAlt() << "m; ";
typedef map<FGPhysicalProperties::Altitude, Point3D >::const_iterator vector_iterator;
typedef map<FGPhysicalProperties::Altitude, WeatherPrecition>::const_iterator scalar_iterator;
out << "\nStored Turbulence: ";
for (set<FGTurbulenceItem>::const_iterator TurbulenceIt = p.Turbulence.begin();
TurbulenceIt != p.Turbulence.end();
TurbulenceIt++)
out << "(" << TurbulenceIt->getValue() << ") at " << TurbulenceIt->getAlt() << "m; ";
out << "Position: " << p.p << endl;
out << "Stored Wind: ";
for (vector_iterator WindIt = p.Wind.begin();
WindIt != p.Wind.end();
WindIt++)
out << "(" << WindIt->first << ") at " << WindIt->second << "m; ";
out << endl;
out << "\nStored Temperature: ";
for (set<FGTemperatureItem>::const_iterator TemperatureIt = p.Temperature.begin();
TemperatureIt != p.Temperature.end();
TemperatureIt++)
out << TemperatureIt->getValue() << " at " << TemperatureIt->getAlt() << "m; ";
out << "Stored Turbulence: ";
for (vector_iterator TurbulenceIt = p.Turbulence.begin();
TurbulenceIt != p.Turbulence.end();
TurbulenceIt++)
out << "(" << TurbulenceIt->first << ") at " << TurbulenceIt->second << "m; ";
out << endl;
out << "\nStored AirPressure: ";
out << p.AirPressure.getValue(0) << " at " << 0 << "m; ";
out << "Stored Temperature: ";
for (scalar_iterator TemperatureIt = p.Temperature.begin();
TemperatureIt != p.Temperature.end();
TemperatureIt++)
out << TemperatureIt->first << " at " << TemperatureIt->second << "m; ";
out << endl;
out << "\nStored VaporPressure: ";
for (set<FGVaporPressureItem>::const_iterator VaporPressureIt = p.VaporPressure.begin();
VaporPressureIt != p.VaporPressure.end();
VaporPressureIt++)
out << VaporPressureIt->getValue() << " at " << VaporPressureIt->getAlt() << "m; ";
out << "Stored AirPressure: ";
out << p.AirPressure.getValue(0) << " at " << 0.0 << "m; ";
out << endl;
return out << "\n";
out << "Stored VaporPressure: ";
for (scalar_iterator VaporPressureIt = p.VaporPressure.begin();
VaporPressureIt != p.VaporPressure.end();
VaporPressureIt++)
out << VaporPressureIt->first << " at " << VaporPressureIt->second << "m; ";
out << endl;
return out << endl;
}
@ -164,107 +181,99 @@ inline FGPhysicalProperties& FGPhysicalProperties::operator = ( const FGPhysical
inline FGPhysicalProperties& FGPhysicalProperties::operator *= ( const WeatherPrecition& d )
{
typedef map<FGPhysicalProperties::Altitude, Point3D >::iterator vector_iterator;
typedef map<FGPhysicalProperties::Altitude, WeatherPrecition>::iterator scalar_iterator;
for (set<FGWindItem>::iterator WindIt = Wind.begin();
WindIt != Wind.end();
WindIt++)
*WindIt *= d;
for (vector_iterator WindIt = Wind.begin();
WindIt != Wind.end();
WindIt++)
WindIt->second *= d;
for (set<FGTurbulenceItem>::iterator TurbulenceIt = Turbulence.begin();
TurbulenceIt != Turbulence.end();
TurbulenceIt++)
*TurbulenceIt *= d;
for (vector_iterator TurbulenceIt = Turbulence.begin();
TurbulenceIt != Turbulence.end();
TurbulenceIt++)
TurbulenceIt->second *= d;
for (set<FGTemperatureItem>::iterator TemperatureIt = Temperature.begin();
TemperatureIt != Temperature.end();
TemperatureIt++)
*TemperatureIt *= d;
for (scalar_iterator TemperatureIt = Temperature.begin();
TemperatureIt != Temperature.end();
TemperatureIt++)
TemperatureIt->second *= d;
AirPressure *= d;
for (set<FGVaporPressureItem>::iterator VaporPressureIt = VaporPressure.begin();
VaporPressureIt != VaporPressure.end();
VaporPressureIt++)
*VaporPressureIt *= d;
for (scalar_iterator VaporPressureIt = VaporPressure.begin();
VaporPressureIt != VaporPressure.end();
VaporPressureIt++)
VaporPressureIt->second *= d;
return *this;
}
inline FGPhysicalProperties& FGPhysicalProperties::operator += (const FGPhysicalProperties& p)
{
for (set<FGWindItem>::const_iterator WindIt = p.Wind.begin();
WindIt != p.Wind.end();
WindIt++ )
if (WindIt != Wind.upper_bound( FGWindItem(WindIt->getAlt(), Point3D(0)) ))
Wind.insert(*WindIt);
else
*(Wind.upper_bound( FGWindItem(WindIt->getAlt(), Point3D(0))) ) += WindIt->getValue();
typedef map<FGPhysicalProperties::Altitude, Point3D >::const_iterator vector_iterator;
typedef map<FGPhysicalProperties::Altitude, WeatherPrecition>::const_iterator scalar_iterator;
for (vector_iterator WindIt = p.Wind.begin();
WindIt != p.Wind.end();
WindIt++ )
if (!Wind.insert(*WindIt).second) //when it's not inserted => it's already existing
Wind[WindIt->first] += WindIt->second; //=> add the value
for (set<FGTurbulenceItem>::const_iterator TurbulenceIt = p.Turbulence.begin();
TurbulenceIt != p.Turbulence.end();
TurbulenceIt++)
if (TurbulenceIt != Turbulence.upper_bound( FGTurbulenceItem(TurbulenceIt->getAlt(), Point3D(0)) ))
Turbulence.insert(*TurbulenceIt);
else
*(Turbulence.upper_bound( FGTurbulenceItem(TurbulenceIt->getAlt(), Point3D(0)) )) += TurbulenceIt->getValue();
for (vector_iterator TurbulenceIt = p.Turbulence.begin();
TurbulenceIt != p.Turbulence.end();
TurbulenceIt++)
if (!Turbulence.insert(*TurbulenceIt).second)
Turbulence[TurbulenceIt->first] += TurbulenceIt->second;
for (set<FGTemperatureItem>::const_iterator TemperatureIt = p.Temperature.begin();
TemperatureIt != p.Temperature.end();
TemperatureIt++)
if (TemperatureIt != Temperature.upper_bound( FGTemperatureItem(TemperatureIt->getAlt(), 0.0) ))
Temperature.insert(*TemperatureIt);
else
*(Temperature.upper_bound( FGTemperatureItem(TemperatureIt->getAlt(), 0.0) )) += TemperatureIt->getValue();
for (scalar_iterator TemperatureIt = p.Temperature.begin();
TemperatureIt != p.Temperature.end();
TemperatureIt++)
if (!Temperature.insert(*TemperatureIt).second)
Temperature[TemperatureIt->first] += TemperatureIt->second;
AirPressure += p.AirPressure.getValue(0.0);
for (set<FGVaporPressureItem>::const_iterator VaporPressureIt = p.VaporPressure.begin();
VaporPressureIt != p.VaporPressure.end();
VaporPressureIt++)
if (VaporPressureIt != VaporPressure.upper_bound( FGVaporPressureItem(VaporPressureIt->getAlt(), 0.0) ))
VaporPressure.insert(*VaporPressureIt);
else
*(VaporPressure.upper_bound( FGVaporPressureItem(VaporPressureIt->getAlt(), 0.0) )) += VaporPressureIt->getValue();
for (scalar_iterator VaporPressureIt = p.VaporPressure.begin();
VaporPressureIt != p.VaporPressure.end();
VaporPressureIt++)
if (!VaporPressure.insert(*VaporPressureIt).second)
VaporPressure[VaporPressureIt->first] += VaporPressureIt->second;
return *this;
}
inline FGPhysicalProperties& FGPhysicalProperties::operator -= (const FGPhysicalProperties& p)
{
typedef map<FGPhysicalProperties::Altitude, Point3D >::const_iterator vector_iterator;
typedef map<FGPhysicalProperties::Altitude, WeatherPrecition>::const_iterator scalar_iterator;
for (set<FGWindItem>::const_iterator WindIt = p.Wind.begin();
WindIt != p.Wind.end();
WindIt++)
if (WindIt != Wind.upper_bound( FGWindItem(WindIt->getAlt(), Point3D(0)) ))
Wind.insert(-(*WindIt));
else
*(Wind.upper_bound( FGWindItem(WindIt->getAlt(), Point3D(0)) )) -= WindIt->getValue();
for (vector_iterator WindIt = p.Wind.begin();
WindIt != p.Wind.end();
WindIt++ )
if (!Wind.insert( make_pair(WindIt->first, -WindIt->second) ).second) //when it's not inserted => it's already existing
Wind[WindIt->first] -= WindIt->second; //=> substract the value
for (set<FGTurbulenceItem>::const_iterator TurbulenceIt = p.Turbulence.begin();
TurbulenceIt != p.Turbulence.end();
TurbulenceIt++)
if (TurbulenceIt != Turbulence.upper_bound( FGTurbulenceItem(TurbulenceIt->getAlt(), Point3D(0)) ))
Turbulence.insert(-(*TurbulenceIt));
else
*(Turbulence.upper_bound( FGTurbulenceItem(TurbulenceIt->getAlt(), Point3D(0)) )) -= TurbulenceIt->getValue();
for (vector_iterator TurbulenceIt = p.Turbulence.begin();
TurbulenceIt != p.Turbulence.end();
TurbulenceIt++)
if (!Turbulence.insert( make_pair(TurbulenceIt->first, -TurbulenceIt->second) ).second)
Turbulence[TurbulenceIt->first] -= TurbulenceIt->second;
for (set<FGTemperatureItem>::const_iterator TemperatureIt = p.Temperature.begin();
TemperatureIt != p.Temperature.end();
TemperatureIt++)
if (TemperatureIt != Temperature.upper_bound( FGTemperatureItem(TemperatureIt->getAlt(), 0.0) ))
Temperature.insert(-(*TemperatureIt));
else
*(Temperature.upper_bound( FGTemperatureItem(TemperatureIt->getAlt(), 0.0) )) -= TemperatureIt->getValue();
for (scalar_iterator TemperatureIt = p.Temperature.begin();
TemperatureIt != p.Temperature.end();
TemperatureIt++)
if (!Temperature.insert( make_pair(TemperatureIt->first, -TemperatureIt->second) ).second)
Temperature[TemperatureIt->first] -= TemperatureIt->second;
AirPressure -= p.AirPressure.getValue(0.0);
for (set<FGVaporPressureItem>::const_iterator VaporPressureIt = p.VaporPressure.begin();
VaporPressureIt != p.VaporPressure.end();
VaporPressureIt++)
if (VaporPressureIt != VaporPressure.upper_bound( FGVaporPressureItem(VaporPressureIt->getAlt(), 0.0) ))
VaporPressure.insert(-(*VaporPressureIt));
else
*(VaporPressure.upper_bound( FGVaporPressureItem(VaporPressureIt->getAlt(), 0.0) )) -= VaporPressureIt->getValue();
for (scalar_iterator VaporPressureIt = p.VaporPressure.begin();
VaporPressureIt != p.VaporPressure.end();
VaporPressureIt++)
if (!VaporPressure.insert( make_pair(VaporPressureIt->first, -VaporPressureIt->second) ).second)
VaporPressure[VaporPressureIt->first] -= VaporPressureIt->second;
return *this;
}
@ -272,36 +281,38 @@ inline FGPhysicalProperties& FGPhysicalProperties::operator -= (const FGPhysical
inline Point3D FGPhysicalProperties::WindAt(const WeatherPrecition& a) const
{
set<FGWindItem>::const_iterator it = Wind.lower_bound(FGWindItem(a, Point3D(0)));
set<FGWindItem>::const_iterator it2 = it;
typedef map<FGPhysicalProperties::Altitude, Point3D>::const_iterator vector_iterator;
vector_iterator it = Wind.lower_bound(a);
vector_iterator it2 = it;
it--;
//now I've got it->alt < a < it2->alt so I can interpolate
return ( (it2->getValue() - it->getValue())/(it2->getAlt() - it->getAlt()) )*
(a - it2->getAlt()) +
it2->getValue();
return ( (it2->second - it->second)/(it2->first - it->first) ) * (a - it2->first) + it2->second;
}
inline Point3D FGPhysicalProperties::TurbulenceAt(const WeatherPrecition& a) const
{
set<FGTurbulenceItem>::const_iterator it = Turbulence.lower_bound(FGTurbulenceItem(a, Point3D(0)));
set<FGTurbulenceItem>::const_iterator it2 = it;
typedef map<FGPhysicalProperties::Altitude, Point3D>::const_iterator vector_iterator;
vector_iterator it = Turbulence.lower_bound(a);
vector_iterator it2 = it;
it--;
//now I've got it->alt < a < it2->alt so I can interpolate
return ( (it2->getValue() - it->getValue() )/(it2->getAlt() - it->getAlt()) )*
(a - it2->getAlt())+ it2->getValue();
return ( (it2->second - it->second)/(it2->first - it->first) ) * (a - it2->first) + it2->second;
}
inline WeatherPrecition FGPhysicalProperties::TemperatureAt(const WeatherPrecition& a) const
{
set<FGTemperatureItem>::const_iterator it = Temperature.lower_bound(FGTemperatureItem(a, 0));
set<FGTemperatureItem>::const_iterator it2 = it;
typedef map<FGPhysicalProperties::Altitude, WeatherPrecition>::const_iterator scalar_iterator;
scalar_iterator it = Temperature.lower_bound(a);
scalar_iterator it2 = it;
it--;
//now I've got it->alt < a < it2->alt so I can interpolate
return ( (it2->getValue() - it->getValue()) / (it2->getAlt() - it->getAlt()) )*
(a - it2->getAlt() )+ it2->getValue();
return ( (it2->second - it->second)/(it2->first - it->first) ) * (a - it2->first) + it2->second;
}
inline WeatherPrecition FGPhysicalProperties::AirPressureAt(const WeatherPrecition& a) const
@ -311,34 +322,35 @@ inline WeatherPrecition FGPhysicalProperties::AirPressureAt(const WeatherPreciti
inline WeatherPrecition FGPhysicalProperties::VaporPressureAt(const WeatherPrecition& a) const
{
set<FGVaporPressureItem>::const_iterator it = VaporPressure.lower_bound(FGVaporPressureItem(a, 0));
set<FGVaporPressureItem>::const_iterator it2 = it;
typedef map<FGPhysicalProperties::Altitude, WeatherPrecition>::const_iterator scalar_iterator;
scalar_iterator it = VaporPressure.lower_bound(a);
scalar_iterator it2 = it;
it--;
//now I've got it->alt < a < it2->alt so I can interpolate
return ( (it2->getValue() - it->getValue() ) / (it2->getAlt() - it->getAlt() ) ) *
(a - it2->getAlt() )+ it2->getValue();
return ( (it2->second - it->second)/(it2->first - it->first) ) * (a - it2->first) + it2->second;
}
inline FGPhysicalProperties operator * (const FGPhysicalProperties& a, const WeatherPrecition& b)
inline FGPhysicalProperties operator * (FGPhysicalProperties a, const WeatherPrecition& b)
{
return FGPhysicalProperties(a) *= b;
return a *= b;
}
inline FGPhysicalProperties operator * (const WeatherPrecition& b, const FGPhysicalProperties& a)
inline FGPhysicalProperties operator * (const WeatherPrecition& b, FGPhysicalProperties a)
{
return FGPhysicalProperties(a) *= b;
return a *= b;
}
inline FGPhysicalProperties operator + (const FGPhysicalProperties& a, const FGPhysicalProperties& b)
inline FGPhysicalProperties operator + (FGPhysicalProperties a, const FGPhysicalProperties& b)
{
return FGPhysicalProperties(a) += (FGPhysicalProperties)b;
return a += b;
}
inline FGPhysicalProperties operator - (const FGPhysicalProperties& a, const FGPhysicalProperties& b)
inline FGPhysicalProperties operator - (FGPhysicalProperties a, const FGPhysicalProperties& b)
{
return FGPhysicalProperties(a) -= (FGPhysicalProperties)b;
return a -= b;
}
/****************************************************************************/

View file

@ -33,6 +33,8 @@ HISTORY
29.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -34,6 +34,8 @@ HISTORY
20.06.1999 Christian Mayer Changed struct to class
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -33,6 +33,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,9 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
10.10.1999 Christian Mayer added mutable for gcc 2.95 portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -44,6 +47,9 @@ HISTORY
/* INCLUDES */
/****************************************************************************/
#include "FGWeatherDefs.h"
//for the case that mutable isn't supported:
#include "Include/compiler.h"
/****************************************************************************/
/* DEFINES */
@ -57,7 +63,7 @@ FGTemperatureItem operator-(const FGTemperatureItem& arg);
class FGTemperatureItem
{
private:
WeatherPrecition value;
mutable WeatherPrecition value;
WeatherPrecition alt;
protected:

View file

@ -33,6 +33,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,9 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
10.10.1999 Christian Mayer added mutable for gcc 2.95 portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -45,6 +48,9 @@ HISTORY
/****************************************************************************/
#include <Math/point3d.hxx>
#include "FGWeatherDefs.h"
//for the case that mutable isn't supported:
#include "Include/compiler.h"
/****************************************************************************/
/* DEFINES */
@ -58,7 +64,7 @@ FGTurbulenceItem operator-(const FGTurbulenceItem& arg);
class FGTurbulenceItem
{
private:
Point3D value;
mutable Point3D value;
WeatherPrecition alt;
protected:

View file

@ -33,6 +33,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,9 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
10.10.1999 Christian Mayer added mutable for gcc 2.95 portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -44,6 +47,9 @@ HISTORY
/* INCLUDES */
/****************************************************************************/
#include "FGWeatherDefs.h"
//for the case that mutable isn't supported:
#include "Include/compiler.h"
/****************************************************************************/
/* DEFINES */
@ -57,7 +63,7 @@ FGVaporPressureItem operator-(const FGVaporPressureItem& arg);
class FGVaporPressureItem
{
private:
WeatherPrecition value;
mutable WeatherPrecition value;
WeatherPrecition alt;
protected:

View file

@ -36,6 +36,8 @@ HISTORY
------------------------------------------------------------------------------
30.05.99 Christian Mayer Created
16.06.99 Durk Talsma Portability for Linux
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -37,6 +37,8 @@ HISTORY
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -34,6 +34,8 @@ HISTORY
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
30.06.1999 Christian Mayer STL portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -33,6 +33,8 @@ HISTORY
08.06.1999 Christian Mayer Changed sat_vp
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -33,6 +33,8 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/

View file

@ -32,6 +32,9 @@ HISTORY
28.05.1999 Christian Mayer Created
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
10.10.1999 Christian Mayer added mutable for gcc 2.95 portability
11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
suggestion
*****************************************************************************/
/****************************************************************************/
@ -45,6 +48,9 @@ HISTORY
/****************************************************************************/
#include <Math/point3d.hxx>
#include "FGWeatherDefs.h"
//for the case that mutable isn't supported:
#include "Include/compiler.h"
/****************************************************************************/
/* DEFINES */
@ -58,7 +64,7 @@ FGWindItem operator-(const FGWindItem& arg);
class FGWindItem
{
private:
Point3D value;
mutable Point3D value;
WeatherPrecition alt;
protected: