NETGeographicLib  1.38
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Pages
Public Member Functions | List of all members
NETGeographicLib::MagneticCircle Class Reference

.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]
 

Detailed Description

.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.

Constructor & Destructor Documentation

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().

Member Function Documentation

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.

Parameters
[in]lonlongitude of the point (degrees).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe 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.

Parameters
[in]lonlongitude of the point (degrees).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).
[out]Bxtthe rate of change of Bx (nT/yr).
[out]Bytthe rate of change of By (nT/yr).
[out]Bztthe rate of change of Bz (nT/yr).

Property Documentation

bool NETGeographicLib::MagneticCircle::Init
get
Returns
true if the object has been initialized.

Definition at line 112 of file MagneticCircle.h.

double NETGeographicLib::MagneticCircle::MajorRadius
get
Returns
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the MagneticModel object used in the constructor. This property throws a GeographicErr exception if the object is not initialized.

Definition at line 119 of file MagneticCircle.h.

double NETGeographicLib::MagneticCircle::Flattening
get
Returns
f the flattening of the ellipsoid. This is the value inherited from the MagneticModel object used in the constructor. This property throws a GeographicErr exception if the object is not initialized.

Definition at line 126 of file MagneticCircle.h.

double NETGeographicLib::MagneticCircle::Latitude
get
Returns
the latitude of the circle (degrees). This property throws a GeographicErr exception if the object is not initialized.

Definition at line 132 of file MagneticCircle.h.

double NETGeographicLib::MagneticCircle::Height
get
Returns
the height of the circle (meters). This property throws a GeographicErr exception if the object is not initialized.

Definition at line 138 of file MagneticCircle.h.

double NETGeographicLib::MagneticCircle::Time
get
Returns
the time (fractional years). This property throws a GeographicErr exception if the object is not initialized.

Definition at line 144 of file MagneticCircle.h.


The documentation for this class was generated from the following file: