NETGeographicLib::CircularEngine Class Reference

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

#include <NETGeographicLib/CircularEngine.h>

List of all members.

Public Member Functions

 CircularEngine (const GeographicLib::CircularEngine &c)
 ~CircularEngine ()
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)

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;
using NETGeographicLib;

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:

using namespace System;
using namespace NETGeographicLib;

int main(array<System::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
        array<double>^ ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
        array<double>^ sa = {6, 5, 4, 3, 2, 1}; // sine coefficients
        double a = 1;
        SphericalHarmonic^ h = gcnew 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, vx, vy, 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));
        return -1;
    }
    return 0;
}

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

NETGeographicLib::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] c The unmanaged CircularEngine to be copied.

Referenced by ~CircularEngine().

NETGeographicLib::CircularEngine::~CircularEngine (  )  [inline]

The destructor calls the finalizer

Definition at line 77 of file CircularEngine.h.

References CircularEngine().


Member Function Documentation

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

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

Parameters:
[in] coslon the cosine of the longitude.
[in] sinlon the sine of the longitude.
Returns:
V the value of the sum.

The arguments must satisfy coslon2 + sinlon2 = 1.

double NETGeographicLib::CircularEngine::LongitudeSum ( double  lon  ) 

Evaluate the sum for a particular longitude.

Parameters:
[in] lon the longitude (degrees).
Returns:
V the value of the sum.
double NETGeographicLib::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] coslon the cosine of the longitude.
[in] sinlon the sine of the longitude.
[out] gradx x component of the gradient.
[out] grady y component of the gradient.
[out] gradz z 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.

double NETGeographicLib::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] lon the longitude (degrees).
[out] gradx x component of the gradient.
[out] grady y component of the gradient.
[out] gradz z 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 documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends

Generated on 6 Oct 2014 for NETGeographicLib by  doxygen 1.6.1