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

.NET wrapper for GeographicLib::CircularEngine. More...

#include <CircularEngine.h>

Public Member Functions

 CircularEngine (const GeographicLib::CircularEngine &c)
 
double LongitudeSum (double coslon, double sinlon)
 
double LongitudeSum (double lon)
 
double LongitudeSum (double coslon, double sinlon, [System::Runtime::InteropServices::Out] double%gradx, [System::Runtime::InteropServices::Out] double%grady, [System::Runtime::InteropServices::Out] double%gradz)
 
double LongitudeSum (double lon, [System::Runtime::InteropServices::Out] double%gradx, [System::Runtime::InteropServices::Out] double%grady, [System::Runtime::InteropServices::Out] double%gradz)
 
 ~CircularEngine ()
 

Private Member Functions

 !CircularEngine ()
 

Private Attributes

const GeographicLib::CircularEnginem_pCircularEngine
 

Detailed Description

.NET wrapper for GeographicLib::CircularEngine.

This class allows .NET applications to access GeographicLib::CircularEngine.

The class is a companion to SphericalEngine. If the results of a spherical harmonic sum are needed for several points on a circle of constant latitude lat and height h, then SphericalEngine::Circle can compute the inner sum, which is independent of longitude lon, and produce a CircularEngine object. CircularEngine::LongitudeSum() can then be used to perform the outer sum for particular values of lon. This can lead to substantial improvements in computational speed for high degree sum (approximately by a factor of N / 2 where N is the maximum degree).

CircularEngine is tightly linked to the internals of SphericalEngine. For that reason, the constructor for this class is for internal use only. Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and SphericalHarmonic2::Circle to create instances of this class.

CircularEngine stores the coefficients needed to allow the summation over order to be performed in 2 or 6 vectors of length M + 1 (depending on whether gradients are to be calculated). For this reason the constructor may throw a GeographicErr exception.

C# Example:

using System;
namespace example_CircularEngine
{
class Program
{
static void Main(string[] args)
{
// This computes the same value as example-SphericalHarmonic.cpp using a
// CircularEngine (which will be faster if many values on a circle of
// latitude are to be found).
try {
int N = 3; // The maxium degree
double[] ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
double[] sa = {6, 5, 4, 3, 2, 1}; // sine coefficients
double a = 1;
SphericalHarmonic h = new SphericalHarmonic(ca, sa, N, a, SphericalHarmonic.Normalization.SCHMIDT);
double x = 2, y = 3, z = 1, p = Math.Sqrt(x*x+y*y);
CircularEngine circ = h.Circle(p, z, true);
double v, vx, vy, vz;
v = circ.LongitudeSum(x/p, y/p, out vx, out vy, out vz);
Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz));
}
catch (GeographicErr e) {
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}

Managed C++ Example:

// Example of using the GeographicLib::CircularEngine class
#include <iostream>
#include <exception>
#include <vector>
using namespace std;
using namespace GeographicLib;
int main() {
// This computes the same value as example-SphericalHarmonic.cpp using a
// CircularEngine (which will be faster if many values on a circle of
// latitude are to be found).
try {
int N = 3; // The maxium degree
double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
vector<double> S(sa, sa + N * (N + 1) / 2);
double a = 1;
double x = 2, y = 3, z = 1, p = Math::hypot(x, y);
CircularEngine circ = h.Circle(p, z, true);
double v, vx, vy, vz;
v = circ(x/p, y/p, vx, vy, vz);
cout << v << " " << vx << " " << vy << " " << vz << "\n";
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

Visual Basic Example:

Imports NETGeographicLib
Module example_CircularEngine
Sub Main()
' This computes the same value as example-SphericalHarmonic.cpp using a
' CircularEngine (which will be faster if many values on a circle of
' latitude are to be found).
Try
Dim N As Integer = 3 ' The maxium degree
Dim ca As Double() = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1} ' cosine coefficients
Dim sa As Double() = {6, 5, 4, 3, 2, 1} ' sine coefficients
Dim a As Double = 1
Dim h As SphericalHarmonic = New SphericalHarmonic(ca, sa, N, a, SphericalHarmonic.Normalization.SCHMIDT)
Dim x As Double = 2, y = 3, z = 1, p = Math.Sqrt(x * x + y * y)
Dim circ As CircularEngine = h.Circle(p, z, True)
Dim v, vx, vy, vz As Double
v = circ.LongitudeSum(x / p, y / p, vx, vy, vz)
Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz))
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 with LongitudeSum.

This class does not have a constructor that can be used in a .NET application. Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle or SphericalHarmonic2::Circle to create instances of this class.

Definition at line 54 of file CircularEngine.h.

Constructor & Destructor Documentation

CircularEngine::!CircularEngine ( )
private

Definition at line 36 of file dotnet/NETGeographicLib/CircularEngine.cpp.

CircularEngine::CircularEngine ( const GeographicLib::CircularEngine c)

The constructor.

This constructor should not be used in .NET applications. Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle or SphericalHarmonic2::Circle to create instances of this class.

Parameters
[in]cThe unmanaged CircularEngine to be copied.

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

NETGeographicLib::CircularEngine::~CircularEngine ( )
inline

The destructor calls the finalizer

Definition at line 77 of file CircularEngine.h.

Member Function Documentation

double CircularEngine::LongitudeSum ( double  coslon,
double  sinlon 
)

Evaluate the sum for a particular longitude given in terms of its cosine and sine.

Parameters
[in]coslonthe cosine of the longitude.
[in]sinlonthe sine of the longitude.
Returns
V the value of the sum.

The arguments must satisfy coslon2 + sinlon2 = 1.

Definition at line 46 of file dotnet/NETGeographicLib/CircularEngine.cpp.

double CircularEngine::LongitudeSum ( double  lon)

Evaluate the sum for a particular longitude.

Parameters
[in]lonthe longitude (degrees).
Returns
V the value of the sum.

Definition at line 52 of file dotnet/NETGeographicLib/CircularEngine.cpp.

double CircularEngine::LongitudeSum ( double  coslon,
double  sinlon,
[System::Runtime::InteropServices::Out] double%  gradx,
[System::Runtime::InteropServices::Out] double%  grady,
[System::Runtime::InteropServices::Out] double%  gradz 
)

Evaluate the sum and its gradient for a particular longitude given in terms of its cosine and sine.

Parameters
[in]coslonthe cosine of the longitude.
[in]sinlonthe sine of the longitude.
[out]gradxx component of the gradient.
[out]gradyy component of the gradient.
[out]gradzz component of the gradient.
Returns
V the value of the sum.

The gradients will only be computed if the CircularEngine object was created with this capability (e.g., via gradp = true in SphericalHarmonic::Circle). If not, gradx, etc., will not be touched. The arguments must satisfy coslon2 + sinlon2 = 1.

Definition at line 58 of file dotnet/NETGeographicLib/CircularEngine.cpp.

double CircularEngine::LongitudeSum ( double  lon,
[System::Runtime::InteropServices::Out] double%  gradx,
[System::Runtime::InteropServices::Out] double%  grady,
[System::Runtime::InteropServices::Out] double%  gradz 
)

Evaluate the sum and its gradient for a particular longitude.

Parameters
[in]lonthe longitude (degrees).
[out]gradxx component of the gradient.
[out]gradyy component of the gradient.
[out]gradzz component of the gradient.
Returns
V the value of the sum.

The gradients will only be computed if the CircularEngine object was created with this capability (e.g., via gradp = true in SphericalHarmonic::Circle). If not, gradx, etc., will not be touched.

Definition at line 72 of file dotnet/NETGeographicLib/CircularEngine.cpp.

Member Data Documentation

const GeographicLib::CircularEngine* NETGeographicLib::CircularEngine::m_pCircularEngine
private

Definition at line 58 of file CircularEngine.h.


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


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