.NET wrapper for GeographicLib::MagneticCircle. More...
#include <NETGeographicLib/MagneticCircle.h>
Public Member Functions | |
MagneticCircle (const GeographicLib::MagneticCircle &c) | |
~MagneticCircle () | |
Compute the magnetic field | |
void | Field (double lon,[System::Runtime::InteropServices::Out] double% Bx,[System::Runtime::InteropServices::Out] double% By,[System::Runtime::InteropServices::Out] double% Bz) |
void | Field (double lon,[System::Runtime::InteropServices::Out] double% Bx,[System::Runtime::InteropServices::Out] double% By,[System::Runtime::InteropServices::Out] double% Bz,[System::Runtime::InteropServices::Out] double% Bxt,[System::Runtime::InteropServices::Out] double% Byt,[System::Runtime::InteropServices::Out] double% Bzt) |
Properties | |
Inspector functions | |
bool | Init [get] |
double | MajorRadius [get] |
double | Flattening [get] |
double | Latitude [get] |
double | Height [get] |
double | Time [get] |
.NET wrapper for GeographicLib::MagneticCircle.
This class allows .NET applications to access GeographicLib::MagneticCircle.
Evaluate the earth's magnetic field on a circle of constant height and latitude. This uses a CircularEngine 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 for internal use only.)
C# Example:
using System; using NETGeographicLib; namespace example_MagneticCircle { class Program { static void Main(string[] args) { try { MagneticModel mag = new MagneticModel("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.Field(t, lat, lon, h, out Bx, out By, out Bz); Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } { // 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.Field(lon, out Bx, out By, out Bz); Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } }
Managed C++ Example:
using namespace System; using namespace NETGeographicLib; int main(array<System::String ^> ^/*args*/) { try { MagneticModel^ mag = gcnew MagneticModel("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->Field(t, lat, lon, h, Bx, By, Bz); Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } { // 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->Field(lon, Bx, By, Bz); Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; }
Visual Basic Example:
Imports NETGeographicLib Module example_MagneticCircle Sub Main() Try Dim mag As MagneticModel = New MagneticModel("wmm2010", "") Dim lat As Double = 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 i As Integer = -5 To 5 Dim lon As Double = lon0 + i * 0.2 Dim Bx, By, Bz As Double mag.Field(t, lat, lon, h, Bx, By, Bz) Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)) Next ' Fast method of evaluating the values at several points on a circle of ' latitude using MagneticCircle. Dim circ As MagneticCircle = mag.Circle(t, lat, h) For i As Integer = -5 To 5 Dim lon As Double = lon0 + i * 0.2 Dim Bx, By, Bz As Double circ.Field(lon, Bx, By, Bz) Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module
INTERFACE DIFFERENCES:
The () operator has been replaced with Field.
The following functions are implemented as properties: Init, MajorRadius, Flattening, Latitude, Height, and Time.
Definition at line 41 of file MagneticCircle.h.
NETGeographicLib::MagneticCircle::MagneticCircle | ( | const GeographicLib::MagneticCircle & | c | ) |
brief A constructor that is initialized from an unmanaged GeographicLib::MagneticCircle. This is for internal use only.
Developers should use MagneticModel::Circle to create a MagneticCircle.
Referenced by ~MagneticCircle().
NETGeographicLib::MagneticCircle::~MagneticCircle | ( | ) | [inline] |
brief The destructor calls the finalizer.
Definition at line 63 of file MagneticCircle.h.
References MagneticCircle().
void NETGeographicLib::MagneticCircle::Field | ( | double | lon, | |
[System::Runtime::InteropServices::Out] double% | Bx, | |||
[System::Runtime::InteropServices::Out] double% | By, | |||
[System::Runtime::InteropServices::Out] double% | Bz | |||
) |
brief 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). |
void NETGeographicLib::MagneticCircle::Field | ( | double | lon, | |
[System::Runtime::InteropServices::Out] double% | Bx, | |||
[System::Runtime::InteropServices::Out] double% | By, | |||
[System::Runtime::InteropServices::Out] double% | Bz, | |||
[System::Runtime::InteropServices::Out] double% | Bxt, | |||
[System::Runtime::InteropServices::Out] double% | Byt, | |||
[System::Runtime::InteropServices::Out] double% | Bzt | |||
) |
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). |
bool NETGeographicLib::MagneticCircle::Init [get] |
Definition at line 112 of file MagneticCircle.h.
double NETGeographicLib::MagneticCircle::MajorRadius [get] |
Definition at line 119 of file MagneticCircle.h.
double NETGeographicLib::MagneticCircle::Flattening [get] |
Definition at line 126 of file MagneticCircle.h.
double NETGeographicLib::MagneticCircle::Latitude [get] |
Definition at line 132 of file MagneticCircle.h.
double NETGeographicLib::MagneticCircle::Height [get] |
Definition at line 138 of file MagneticCircle.h.
double NETGeographicLib::MagneticCircle::Time [get] |
Definition at line 144 of file MagneticCircle.h.