NETGeographicLib  1.43
Public Types | Public Member Functions | List of all members
NETGeographicLib::SphericalHarmonic1 Class Reference

.NET wrapper for GeographicLib::SphericalHarmonic1. More...

#include <NETGeographicLib/SphericalHarmonic1.h>

Public Types

enum  Normalization { Normalization::FULL, Normalization::SCHMIDT }
 

Public Member Functions

 SphericalHarmonic1 (array< double >^ C, array< double >^ S, int N, array< double >^ C1, array< double >^ S1, int N1, double a, Normalization norm)
 
 SphericalHarmonic1 (array< double >^ C, array< double >^ S, int N, int nmx, int mmx, array< double >^ C1, array< double >^ S1, int N1, int nmx1, int mmx1, double a, Normalization norm)
 
 ~SphericalHarmonic1 ()
 
double HarmonicSum (double tau, double x, double y, double z)
 
double HarmonicSum (double tau, double x, double y, double z, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz)
 
CircularEngineCircle (double tau, double p, double z, bool gradp)
 
SphericalCoefficientsCoefficients ()
 
SphericalCoefficientsCoefficients1 ()
 

Detailed Description

.NET wrapper for GeographicLib::SphericalHarmonic1.

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

This class is similar to SphericalHarmonic, except that the coefficients Cnm are replaced by Cnm + tau C'nm (and similarly for Snm).

C# Example:

using System;
namespace example_SphericalHarmonic1
{
class Program
{
static void Main(string[] args)
{
try {
int N = 3, N1 = 2; // The maximum degrees
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[] cb = {1, 2, 3, 4, 5, 6};
double[] sb = {3, 2, 1};
double a = 1;
SphericalHarmonic1 h = new SphericalHarmonic1(ca, sa, N, cb, sb, N1, a, SphericalHarmonic1.Normalization.SCHMIDT);
double tau = 0.1, x = 2, y = 3, z = 1;
double v, vx, vy, vz;
v = h.HarmonicSum(tau, x, y, z, 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*/)
{
try {
int N = 3, N1 = 2; // The maximum degrees
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
array<double>^ cb = {1, 2, 3, 4, 5, 6};
array<double>^ sb = {3, 2, 1};
double a = 1;
double tau = 0.1, x = 2, y = 3, z = 1;
double v, vx, vy, vz;
v = h->HarmonicSum(tau, x, y, z, 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_SphericalHarmonic1
Sub Main()
Try
Dim N As Integer = 3, N1 = 2 ' The maximum degrees
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 cb As Double() = {1, 2, 3, 4, 5, 6}
Dim sb As Double() = {3, 2, 1}
Dim a As Double = 1
Dim h As SphericalHarmonic1 = New SphericalHarmonic1(ca, sa, N, cb, sb, N1, a, SphericalHarmonic1.Normalization.SCHMIDT)
Dim tau As Double = 0.1, x = 2, y = 3, z = 1
Dim vx, vy, vz As Double
Dim v As Double = h.HarmonicSum(tau, x, y, z, 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:
This class replaces the () operator with HarmonicSum().

Coefficients returns a SphericalCoefficients object.

Definition at line 38 of file SphericalHarmonic1.h.

Member Enumeration Documentation

◆ Normalization

Supported normalizations for associate Legendre polynomials.

Enumerator
FULL 

Fully normalized associated Legendre polynomials. See SphericalHarmonic::FULL for documentation.

SCHMIDT 

Schmidt semi-normalized associated Legendre polynomials. See SphericalHarmonic::SCHMIDT for documentation.

Definition at line 56 of file SphericalHarmonic1.h.

Constructor & Destructor Documentation

◆ SphericalHarmonic1() [1/2]

NETGeographicLib::SphericalHarmonic1::SphericalHarmonic1 ( array< double >^  C,
array< double >^  S,
int  N,
array< double >^  C1,
array< double >^  S1,
int  N1,
double  a,
Normalization  norm 
)

Constructor with a full set of coefficients specified.

Parameters
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe maximum degree and order of the sum
[in]C1the coefficients C'nm.
[in]S1the coefficients S'nm.
[in]N1the maximum degree and order of the correction coefficients C'nm and S'nm.
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic1::FULL (the default) or SphericalHarmonic1::SCHMIDT.
Exceptions
GeographicErrif N and N1 do not satisfy NN1 ≥ −1.
GeographicErrif any of the vectors of coefficients is not large enough.

See SphericalHarmonic for the way the coefficients should be stored.

The class stores pointers to the first elements of C, S, C', and S'. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Referenced by ~SphericalHarmonic1().

◆ SphericalHarmonic1() [2/2]

NETGeographicLib::SphericalHarmonic1::SphericalHarmonic1 ( array< double >^  C,
array< double >^  S,
int  N,
int  nmx,
int  mmx,
array< double >^  C1,
array< double >^  S1,
int  N1,
int  nmx1,
int  mmx1,
double  a,
Normalization  norm 
)

Constructor with a subset of coefficients specified.

Parameters
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe degree used to determine the layout of C and S.
[in]nmxthe maximum degree used in the sum. The sum over n is from 0 thru nmx.
[in]mmxthe maximum order used in the sum. The sum over m is from 0 thru min(n, mmx).
[in]C1the coefficients C'nm.
[in]S1the coefficients S'nm.
[in]N1the degree used to determine the layout of C' and S'.
[in]nmx1the maximum degree used for C' and S'.
[in]mmx1the maximum order used for C' and S'.
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic1::FULL (the default) or SphericalHarmonic1::SCHMIDT.
Exceptions
GeographicErrif the parameters do not satisfy Nnmxmmx ≥ −1; N1nmx1mmx1 ≥ −1; NN1; nmxnmx1; mmxmmx1.
GeographicErrif any of the vectors of coefficients is not large enough.

The class stores pointers to the first elements of C, S, C', and S'. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

◆ ~SphericalHarmonic1()

NETGeographicLib::SphericalHarmonic1::~SphericalHarmonic1 ( )
inline

The destructor calls the finalizer.

Definition at line 151 of file SphericalHarmonic1.h.

References Circle(), Coefficients(), Coefficients1(), HarmonicSum(), and SphericalHarmonic1().

Member Function Documentation

◆ HarmonicSum() [1/2]

double NETGeographicLib::SphericalHarmonic1::HarmonicSum ( double  tau,
double  x,
double  y,
double  z 
)

Compute a spherical harmonic sum with a correction term.

Parameters
[in]taumultiplier for correction coefficients C' and S'.
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
Returns
V the spherical harmonic sum.

This routine requires constant memory and thus never throws an exception.

Referenced by ~SphericalHarmonic1().

◆ HarmonicSum() [2/2]

double NETGeographicLib::SphericalHarmonic1::HarmonicSum ( double  tau,
double  x,
double  y,
double  z,
[System::Runtime::InteropServices::Out] double%  gradx,
[System::Runtime::InteropServices::Out] double%  grady,
[System::Runtime::InteropServices::Out] double%  gradz 
)

Compute a spherical harmonic sum with a correction term and its gradient.

Parameters
[in]taumultiplier for correction coefficients C' and S'.
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
[out]gradxx component of the gradient
[out]gradyy component of the gradient
[out]gradzz component of the gradient
Returns
V the spherical harmonic sum.

This is the same as the previous function, except that the components of the gradients of the sum in the x, y, and z directions are computed. This routine requires constant memory and thus never throws an exception.

◆ Circle()

CircularEngine ^ NETGeographicLib::SphericalHarmonic1::Circle ( double  tau,
double  p,
double  z,
bool  gradp 
)

Create a CircularEngine to allow the efficient evaluation of several points on a circle of latitude at a fixed value of tau.

Parameters
[in]tauthe multiplier for the correction coefficients.
[in]pthe radius of the circle.
[in]zthe height of the circle above the equatorial plane.
[in]gradpif true the returned object will be able to compute the gradient of the sum.
Exceptions
std::bad_allocif the memory for the CircularEngine can't be allocated.
Returns
the CircularEngine object.

SphericalHarmonic1::operator()() exchanges the order of the sums in the definition, i.e., ∑n = 0..Nm = 0..n becomes ∑m = 0..Nn = m..N. SphericalHarmonic1::Circle performs the inner sum over degree n (which entails about N2 operations). Calling CircularEngine::operator()() on the returned object performs the outer sum over the order m (about N operations).

See SphericalHarmonic::Circle for an example of its use.

Referenced by ~SphericalHarmonic1().

◆ Coefficients()

SphericalCoefficients ^ NETGeographicLib::SphericalHarmonic1::Coefficients ( )
Returns
the zeroth SphericalCoefficients object.

Referenced by ~SphericalHarmonic1().

◆ Coefficients1()

SphericalCoefficients ^ NETGeographicLib::SphericalHarmonic1::Coefficients1 ( )
Returns
the first SphericalCoefficients object.

Referenced by ~SphericalHarmonic1().


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