Public Member Functions | Private Member Functions | Private Attributes | List of all members
NETGeographicLib::MagneticCircle Class Reference

.NET wrapper for GeographicLib::MagneticCircle. More...

#include <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)
 

Public Attributes

Inspector functions
property bool Init { bool get()
 
property double MajorRadius { double get()
 
property double Flattening { double get()
 
property double Latitude { double get()
 
property double Height { double get()
 
property double Time { double get()
 

Private Member Functions

 !MagneticCircle (void)
 

Private Attributes

const GeographicLib::MagneticCirclem_pMagneticCircle
 

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;
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:

// Example of using the GeographicLib::MagneticCircle class
#include <iostream>
#include <exception>
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;
}
}

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

MagneticCircle::!MagneticCircle ( void  )
private

Definition at line 19 of file dotnet/NETGeographicLib/MagneticCircle.cpp.

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.

Definition at line 29 of file dotnet/NETGeographicLib/MagneticCircle.cpp.

NETGeographicLib::MagneticCircle::~MagneticCircle ( )
inline

brief The destructor calls the finalizer.

Definition at line 63 of file MagneticCircle.h.

Member Function Documentation

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

Definition at line 42 of file dotnet/NETGeographicLib/MagneticCircle.cpp.

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

Definition at line 55 of file dotnet/NETGeographicLib/MagneticCircle.cpp.

Member Data Documentation

property double NETGeographicLib::MagneticCircle::Flattening { double 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.

property double NETGeographicLib::MagneticCircle::Height { double 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.

property bool NETGeographicLib::MagneticCircle::Init { bool get()
Returns
true if the object has been initialized.

Definition at line 112 of file MagneticCircle.h.

property double NETGeographicLib::MagneticCircle::Latitude { double 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.

const GeographicLib::MagneticCircle* NETGeographicLib::MagneticCircle::m_pMagneticCircle
private

Definition at line 45 of file MagneticCircle.h.

property double NETGeographicLib::MagneticCircle::MajorRadius { double 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.

property double NETGeographicLib::MagneticCircle::Time { double 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 files:


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:59:11