.NET wrapper for GeographicLib::SphericalHarmonic2. More...
#include <NETGeographicLib/SphericalHarmonic2.h>
Public Types | |
enum | Normalization { FULL, SCHMIDT } |
Public Member Functions | |
SphericalHarmonic2 (array< double >^C, array< double >^S, int N, array< double >^C1, array< double >^S1, int N1, array< double >^C2, array< double >^S2, int N2, double a, Normalization norm) | |
SphericalHarmonic2 (array< double >^C, array< double >^S, int N, int nmx, int mmx, array< double >^C1, array< double >^S1, int N1, int nmx1, int mmx1, array< double >^C2, array< double >^S2, int N2, int nmx2, int mmx2, double a, Normalization norm) | |
~SphericalHarmonic2 () | |
double | HarmonicSum (double tau1, double tau2, double x, double y, double z) |
double | HarmonicSum (double tau1, double tau2, double x, double y, double z,[System::Runtime::InteropServices::Out] double% gradx,[System::Runtime::InteropServices::Out] double% grady,[System::Runtime::InteropServices::Out] double% gradz) |
CircularEngine^ | Circle (double tau1, double tau2, double p, double z, bool gradp) |
SphericalCoefficients^ | Coefficients () |
SphericalCoefficients^ | Coefficients1 () |
SphericalCoefficients^ | Coefficients2 () |
.NET wrapper for GeographicLib::SphericalHarmonic2.
This class allows .NET applications to access GeographicLib::SphericalHarmonic2.
This class is similar to SphericalHarmonic, except that the coefficients Cnm are replaced by Cnm + tau' C'nm + tau'' C''nm (and similarly for Snm).
C# Example:
using System; using NETGeographicLib; namespace example_SphericalHarmonic2 { class Program { static void Main(string[] args) { try { int N = 3, N1 = 2, N2 = 1; // 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[] cc = { 2, 1 }; double[] S2 = { 0 }; double a = 1; SphericalHarmonic2 h = new SphericalHarmonic2( ca, sa, N, N, N, cb, sb, N1, N1, N1, cc, S2, N2, N2, 0, a, SphericalHarmonic2.Normalization.SCHMIDT); double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h.HarmonicSum(tau1, tau2, 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, N2 = 1; // 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 }; array<double>^ cc = { 2, 1 }; array<double>^ S2 = { 0 }; double a = 1; SphericalHarmonic2^ h = gcnew SphericalHarmonic2( ca, sa, N, N, N, cb, sb, N1, N1, N1, cc, S2, N2, N2, 0, a, SphericalHarmonic2::Normalization::SCHMIDT); double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h->HarmonicSum(tau1, tau2, 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_SphericalHarmonic2 Sub Main() Try Dim N As Integer = 3, N1 = 2, N2 = 1 ' 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 cc As Double() = {2, 1} Dim S2 As Double() = {0} Dim a As Double = 1 Dim h As SphericalHarmonic2 = New SphericalHarmonic2( ca, sa, N, N, N, cb, sb, N1, N1, N1, cc, S2, N2, N2, 0, a, SphericalHarmonic2.Normalization.SCHMIDT) Dim tau1 As Double = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1 Dim vx, vy, vz As Double Dim v As Double = h.HarmonicSum(tau1, tau2, 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, Coefficients1, and Coefficients2 return a SphericalCoefficients object.
Definition at line 40 of file SphericalHarmonic2.h.
Supported normalizations for associate Legendre polynomials.
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 57 of file SphericalHarmonic2.h.
NETGeographicLib::SphericalHarmonic2::SphericalHarmonic2 | ( | array< double >^ | C, | |
array< double >^ | S, | |||
int | N, | |||
array< double >^ | C1, | |||
array< double >^ | S1, | |||
int | N1, | |||
array< double >^ | C2, | |||
array< double >^ | S2, | |||
int | N2, | |||
double | a, | |||
Normalization | norm | |||
) |
Constructor with a full set of coefficients specified.
[in] | C | the coefficients Cnm. |
[in] | S | the coefficients Snm. |
[in] | N | the maximum degree and order of the sum |
[in] | C1 | the coefficients C'nm. |
[in] | S1 | the coefficients S'nm. |
[in] | N1 | the maximum degree and order of the first correction coefficients C'nm and S'nm. |
[in] | C2 | the coefficients C''nm. |
[in] | S2 | the coefficients S''nm. |
[in] | N2 | the maximum degree and order of the second correction coefficients C'nm and S'nm. |
[in] | a | the reference radius appearing in the definition of the sum. |
[in] | norm | the normalization for the associated Legendre polynomials, either SphericalHarmonic2::FULL (the default) or SphericalHarmonic2::SCHMIDT. |
GeographicErr | if N and N1 do not satisfy N N1 1, and similarly for N2. | |
GeographicErr | if any of the vectors of coefficients is not large enough. |
See SphericalHarmonic for the way the coefficients should be stored. N1 and N2 should satisfy N1 N and N2 N.
The class stores pointers to the first elements of C, S, C', S', C'', and S''. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.
Referenced by ~SphericalHarmonic2().
NETGeographicLib::SphericalHarmonic2::SphericalHarmonic2 | ( | array< double >^ | C, | |
array< double >^ | S, | |||
int | N, | |||
int | nmx, | |||
int | mmx, | |||
array< double >^ | C1, | |||
array< double >^ | S1, | |||
int | N1, | |||
int | nmx1, | |||
int | mmx1, | |||
array< double >^ | C2, | |||
array< double >^ | S2, | |||
int | N2, | |||
int | nmx2, | |||
int | mmx2, | |||
double | a, | |||
Normalization | norm | |||
) |
Constructor with a subset of coefficients specified.
[in] | C | the coefficients Cnm. |
[in] | S | the coefficients Snm. |
[in] | N | the degree used to determine the layout of C and S. |
[in] | nmx | the maximum degree used in the sum. The sum over n is from 0 thru nmx. |
[in] | mmx | the maximum order used in the sum. The sum over m is from 0 thru min(n, mmx). |
[in] | C1 | the coefficients C'nm. |
[in] | S1 | the coefficients S'nm. |
[in] | N1 | the degree used to determine the layout of C' and S'. |
[in] | nmx1 | the maximum degree used for C' and S'. |
[in] | mmx1 | the maximum order used for C' and S'. |
[in] | C2 | the coefficients C''nm. |
[in] | S2 | the coefficients S''nm. |
[in] | N2 | the degree used to determine the layout of C'' and S''. |
[in] | nmx2 | the maximum degree used for C'' and S''. |
[in] | mmx2 | the maximum order used for C'' and S''. |
[in] | a | the reference radius appearing in the definition of the sum. |
[in] | norm | the normalization for the associated Legendre polynomials, either SphericalHarmonic2::FULL (the default) or SphericalHarmonic2::SCHMIDT. |
GeographicErr | if the parameters do not satisfy N nmx mmx 1; N1 nmx1 mmx1 1; N N1; nmx nmx1; mmx mmx1; and similarly for N2, nmx2, and mmx2. | |
GeographicErr | if any of the vectors of coefficients is not large enough. |
The class stores pointers to the first elements of C, S, C', S', C'', and S''. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.
NETGeographicLib::SphericalHarmonic2::~SphericalHarmonic2 | ( | ) | [inline] |
The destructor calls the finalizer.
Definition at line 170 of file SphericalHarmonic2.h.
References SphericalHarmonic2().
double NETGeographicLib::SphericalHarmonic2::HarmonicSum | ( | double | tau1, | |
double | tau2, | |||
double | x, | |||
double | y, | |||
double | z | |||
) |
Compute a spherical harmonic sum with two correction terms.
[in] | tau1 | multiplier for correction coefficients C' and S'. |
[in] | tau2 | multiplier for correction coefficients C'' and S''. |
[in] | x | cartesian coordinate. |
[in] | y | cartesian coordinate. |
[in] | z | cartesian coordinate. |
This routine requires constant memory and thus never throws an exception.
double NETGeographicLib::SphericalHarmonic2::HarmonicSum | ( | double | tau1, | |
double | tau2, | |||
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 two correction terms and its gradient.
[in] | tau1 | multiplier for correction coefficients C' and S'. |
[in] | tau2 | multiplier for correction coefficients C'' and S''. |
[in] | x | cartesian coordinate. |
[in] | y | cartesian coordinate. |
[in] | z | cartesian coordinate. |
[out] | gradx | x component of the gradient |
[out] | grady | y component of the gradient |
[out] | gradz | z component of the gradient |
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.
CircularEngine ^ NETGeographicLib::SphericalHarmonic2::Circle | ( | double | tau1, | |
double | tau2, | |||
double | p, | |||
double | z, | |||
bool | gradp | |||
) |
Create a CircularEngine to allow the efficient evaluation of several points on a circle of latitude at fixed values of tau1 and tau2.
[in] | tau1 | multiplier for correction coefficients C' and S'. |
[in] | tau2 | multiplier for correction coefficients C'' and S''. |
[in] | p | the radius of the circle. |
[in] | z | the height of the circle above the equatorial plane. |
[in] | gradp | if true the returned object will be able to compute the gradient of the sum. |
std::bad_alloc | if the memory for the CircularEngine can't be allocated. |
SphericalHarmonic2::operator()() exchanges the order of the sums in the definition, i.e., n = 0..N m = 0..n becomes m = 0..N n = m..N.. SphericalHarmonic2::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.
SphericalCoefficients ^ NETGeographicLib::SphericalHarmonic2::Coefficients | ( | ) |
SphericalCoefficients ^ NETGeographicLib::SphericalHarmonic2::Coefficients1 | ( | ) |
SphericalCoefficients ^ NETGeographicLib::SphericalHarmonic2::Coefficients2 | ( | ) |