GeographicLib
1.21
|
Geomagnetic field on a circle of latitude. More...
#include <GeographicLib/MagneticCircle.hpp>
Public Member Functions | |
MagneticCircle () | |
Compute the magnetic field | |
void | operator() (real lon, real &Bx, real &By, real &Bz) const throw () |
void | operator() (real lon, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const throw () |
Inspector functions | |
bool | Init () const throw () |
Math::real | MajorRadius () const throw () |
Math::real | Flattening () const throw () |
Math::real | Latitude () const throw () |
Math::real | Height () const throw () |
Math::real | Time () const throw () |
Friends | |
class | MagneticModel |
Geomagnetic field on a circle of latitude.
Evaluate the earth's magnetic field on a circle of constant height and latitude. This uses a CircleEngine to pre-evaluate the inner sum of the spherical harmonic sum, allowing the values of the field at several different longitudes to be evaluated rapidly.
Use MagneticModel::Circle to create a MagneticCircle object. (The constructor for this class is private.)
Example of use:
// Example of using the GeographicLib::MagneticCircle class // $Id: d499f22160be523e01c0a6e3c740dbe828aa918d $ #include <iostream> #include <exception> #include <GeographicLib/MagneticModel.hpp> #include <GeographicLib/MagneticCircle.hpp> using namespace std; using namespace GeographicLib; int main() { try { MagneticModel mag("wmm2010"); double lat = 27.99, lon0 = 86.93, h = 8820, t = 2012; // Mt Everest { // Slow method of evaluating the values at several points on a circle of // latitude. for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double Bx, By, Bz; mag(t, lat, lon, h, Bx, By, Bz); cout << lon << " " << Bx << " " << By << " " << Bz << "\n"; } } { // Fast method of evaluating the values at several points on a circle of // latitude using MagneticCircle. MagneticCircle circ = mag.Circle(t, lat, h); for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double Bx, By, Bz; circ(lon, Bx, By, Bz); cout << lon << " " << Bx << " " << By << " " << Bz << "\n"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; }
MagneticField is a command-line utility providing access to the functionality of MagneticModel and MagneticCircle.
GeographicLib::MagneticCircle::MagneticCircle | ( | ) | [inline] |
A default constructor for the normal gravity. This sets up an uninitialized object which can be later replaced by the MagneticModel::Circle.
Definition at line 78 of file MagneticCircle.hpp.
void GeographicLib::MagneticCircle::operator() | ( | real | lon, |
real & | Bx, | ||
real & | By, | ||
real & | Bz | ||
) | const throw () [inline] |
Evaluate the components of the geomagnetic field at a particular longitude.
[in] | lon | longitude of the point (degrees). |
[out] | Bx | the easterly component of the magnetic field (nanotesla). |
[out] | By | the northerly component of the magnetic field (nanotesla). |
[out] | Bz | the vertical (up) component of the magnetic field (nanotesla). |
Definition at line 93 of file MagneticCircle.hpp.
void GeographicLib::MagneticCircle::operator() | ( | real | lon, |
real & | Bx, | ||
real & | By, | ||
real & | Bz, | ||
real & | Bxt, | ||
real & | Byt, | ||
real & | Bzt | ||
) | const throw () [inline] |
Evaluate the components of the geomagnetic field and their time derivatives at a particular longitude.
[in] | lon | longitude of the point (degrees). |
[out] | Bx | the easterly component of the magnetic field (nanotesla). |
[out] | By | the northerly component of the magnetic field (nanotesla). |
[out] | Bz | the vertical (up) component of the magnetic field (nanotesla). |
[out] | Bxt | the rate of change of Bx (nT/yr). |
[out] | Byt | the rate of change of By (nT/yr). |
[out] | Bzt | the rate of change of Bz (nT/yr). |
Definition at line 111 of file MagneticCircle.hpp.
bool GeographicLib::MagneticCircle::Init | ( | ) | const throw () [inline] |
Definition at line 123 of file MagneticCircle.hpp.
Math::real GeographicLib::MagneticCircle::MajorRadius | ( | ) | const throw () [inline] |
Definition at line 129 of file MagneticCircle.hpp.
Math::real GeographicLib::MagneticCircle::Flattening | ( | ) | const throw () [inline] |
Definition at line 135 of file MagneticCircle.hpp.
Math::real GeographicLib::MagneticCircle::Latitude | ( | ) | const throw () [inline] |
Definition at line 140 of file MagneticCircle.hpp.
Math::real GeographicLib::MagneticCircle::Height | ( | ) | const throw () [inline] |
Definition at line 145 of file MagneticCircle.hpp.
Math::real GeographicLib::MagneticCircle::Time | ( | ) | const throw () [inline] |
Definition at line 150 of file MagneticCircle.hpp.
friend class MagneticModel [friend] |
Definition at line 69 of file MagneticCircle.hpp.