.NET wrapper for GeographicLib::GravityCircle.
This class allows .NET applications to access GeographicLib::GravityCircle.
Evaluate the earth's gravity 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 GravityModel::Circle to create a GravityCircle object. (The constructor for this class is private.)
See Geoid heights on a multi-processor system for an example of using GravityCircle (together with OpenMP) to speed up the computation of geoid heights.
C# Example:
using System;
namespace example_GravityCircle
{
class Program
{
static void Main(string[] args)
{
try {
double lat = 27.99, lon0 = 86.93, h = 8820;
{
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double gx, gy, gz;
grav.
Gravity(lat, lon, h, out gx, out gy, out gz);
Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz));
}
}
{
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double gx, gy, gz;
circ.
Gravity(lon, out gx, out gy, out gz);
Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz));
}
}
}
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}
Exception class for NETGeographicLib.
.NET wrapper for GeographicLib::GravityCircle.
double Gravity(double lon, [System::Runtime::InteropServices::Out] double% gx, [System::Runtime::InteropServices::Out] double% gy, [System::Runtime::InteropServices::Out] double% gz)
.NET wrapper for GeographicLib::GravityModel.
GravityCircle ^ Circle(double lat, double h, Mask caps)
double Gravity(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% gx, [System::Runtime::InteropServices::Out] double% gy, [System::Runtime::InteropServices::Out] double% gz)
Managed C++ Example:
using namespace System;
int main(array<System::String ^> ^)
{
try {
double lat = 27.99, lon0 = 86.93, h = 8820;
{
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double gx, gy, gz;
grav->
Gravity(lat, lon, h, gx, gy, gz);
Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, gx, gy, gz));
}
}
{
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double gx, gy, gz;
Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, gx, gy, gz));
}
}
}
Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
return -1;
}
return 0;
}
int main(int argc, const char *const argv[])
Visual Basic Example:
Imports NETGeographicLib
Module example_GravityCircle
Sub Main()
Try
Dim grav As GravityModel = New GravityModel("egm96", "")
Dim lat As Double = 27.99, lon0 = 86.93, h = 8820 ' 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 gx, gy, gz As Double
grav.Gravity(lat, lon, h, gx, gy, gz)
Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz))
Next
' Fast method of evaluating the values at several points on a circle of
' latitude using GravityCircle.
Dim circ As GravityCircle = grav.Circle(lat, h, GravityModel.Mask.ALL)
For i As Integer = -5 To 5
Dim lon As Double = lon0 + i * 0.2
Dim gx, gy, gz As Double
circ.Gravity(lon, gx, gy, gz)
Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz))
Next
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module
INTERFACE DIFFERENCES:
The following functions are implemented as properties: Init, EquatorialRadius, Flattening, Latitude, and Height.
The Capabilities functions accept and return the "capabilities mask" as a NETGeographicLib::GravityModel::Mask rather than an unsigned.
Definition at line 45 of file GravityCircle.h.