Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
NETGeographicLib::SphericalHarmonic2 Class Reference

.NET wrapper for GeographicLib::SphericalHarmonic2. More...

#include <SphericalHarmonic2.h>

Public Types

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

Public Member Functions

CircularEngine Circle (double tau1, double tau2, double p, double z, bool gradp)
 
SphericalCoefficients Coefficients ()
 
SphericalCoefficients Coefficients1 ()
 
SphericalCoefficients Coefficients2 ()
 
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)
 
 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 ()
 

Private Member Functions

 !SphericalHarmonic2 (void)
 

Private Attributes

std::vector< double > ** m_C
 
const GeographicLib::SphericalHarmonic2m_pSphericalHarmonic2
 
std::vector< double > ** m_S
 

Static Private Attributes

static const int m_numCoeffVectors = 3
 

Detailed Description

.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;
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;
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:

// Example of using the GeographicLib::SphericalHarmonic2 class
#include <iostream>
#include <exception>
#include <vector>
using namespace std;
using namespace GeographicLib;
int main() {
try {
int N = 3, N1 = 2, N2 = 1; // The maxium degrees
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 cb[] = {1, 2, 3, 4, 5, 6};
vector<double> C1(cb, cb + (N1 + 1) * (N1 + 2) / 2);
double sb[] = {3, 2, 1};
vector<double> S1(sb, sb + N1 * (N1 + 1) / 2);
double cc[] = {2, 1};
vector<double> C2(cc, cc + (N2 + 1));
vector<double> S2;
double a = 1;
SphericalHarmonic2 h(C, S, N, N, N, C1, S1, N1, N1, N1,
C2, S2, N2, N2, 0, a);
double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1;
double v, vx, vy, vz;
v = h(tau1, tau2, x, y, z, 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_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.

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 57 of file SphericalHarmonic2.h.

Constructor & Destructor Documentation

◆ !SphericalHarmonic2()

SphericalHarmonic2::!SphericalHarmonic2 ( void  )
private

Definition at line 23 of file SphericalHarmonic2.cpp.

◆ SphericalHarmonic2() [1/2]

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.

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 first correction coefficients C'nm and S'nm.
[in]C2the coefficients C''nm.
[in]S2the coefficients S''nm.
[in]N2the maximum degree and order of the second 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 SphericalHarmonic2::FULL (the default) or SphericalHarmonic2::SCHMIDT.
Exceptions
GeographicErrif N and N1 do not satisfy NN1 ≥ −1, and similarly for N2.
GeographicErrif 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 N1N and N2N.

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.

Definition at line 51 of file SphericalHarmonic2.cpp.

◆ SphericalHarmonic2() [2/2]

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.

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]C2the coefficients C''nm.
[in]S2the coefficients S''nm.
[in]N2the degree used to determine the layout of C'' and S''.
[in]nmx2the maximum degree used for C'' and S''.
[in]mmx2the 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 SphericalHarmonic2::FULL (the default) or SphericalHarmonic2::SCHMIDT.
Exceptions
GeographicErrif the parameters do not satisfy Nnmxmmx ≥ −1; N1nmx1mmx1 ≥ −1; NN1; nmxnmx1; mmxmmx1; and similarly for N2, nmx2, and mmx2.
GeographicErrif 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.

Definition at line 93 of file SphericalHarmonic2.cpp.

◆ ~SphericalHarmonic2()

NETGeographicLib::SphericalHarmonic2::~SphericalHarmonic2 ( )
inline

The destructor calls the finalizer.

Definition at line 170 of file SphericalHarmonic2.h.

Member Function Documentation

◆ Circle()

CircularEngine 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.

Parameters
[in]tau1multiplier for correction coefficients C' and S'.
[in]tau2multiplier for correction coefficients C'' and S''.
[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.

SphericalHarmonic2::operator()() exchanges the order of the sums in the definition, i.e., ∑n = 0..Nm = 0..n becomes ∑m = 0..Nn = 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.

Definition at line 157 of file SphericalHarmonic2.cpp.

◆ Coefficients()

SphericalCoefficients SphericalHarmonic2::Coefficients ( )
Returns
the zeroth SphericalCoefficients object.

Definition at line 171 of file SphericalHarmonic2.cpp.

◆ Coefficients1()

SphericalCoefficients SphericalHarmonic2::Coefficients1 ( )
Returns
the first SphericalCoefficients object.

Definition at line 177 of file SphericalHarmonic2.cpp.

◆ Coefficients2()

SphericalCoefficients SphericalHarmonic2::Coefficients2 ( )
Returns
the second SphericalCoefficients object.

Definition at line 183 of file SphericalHarmonic2.cpp.

◆ HarmonicSum() [1/2]

double SphericalHarmonic2::HarmonicSum ( double  tau1,
double  tau2,
double  x,
double  y,
double  z 
)

Compute a spherical harmonic sum with two correction terms.

Parameters
[in]tau1multiplier for correction coefficients C' and S'.
[in]tau2multiplier 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.

Definition at line 136 of file SphericalHarmonic2.cpp.

◆ HarmonicSum() [2/2]

double 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.

Parameters
[in]tau1multiplier for correction coefficients C' and S'.
[in]tau2multiplier 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.

Definition at line 142 of file SphericalHarmonic2.cpp.

Member Data Documentation

◆ m_C

std::vector<double>** NETGeographicLib::SphericalHarmonic2::m_C
private

Definition at line 52 of file SphericalHarmonic2.h.

◆ m_numCoeffVectors

const int NETGeographicLib::SphericalHarmonic2::m_numCoeffVectors = 3
staticprivate

Definition at line 48 of file SphericalHarmonic2.h.

◆ m_pSphericalHarmonic2

const GeographicLib::SphericalHarmonic2* NETGeographicLib::SphericalHarmonic2::m_pSphericalHarmonic2
private

Definition at line 44 of file SphericalHarmonic2.h.

◆ m_S

std::vector<double> ** NETGeographicLib::SphericalHarmonic2::m_S
private

Definition at line 52 of file SphericalHarmonic2.h.


The documentation for this class was generated from the following files:
S1
static double S1[]
Definition: shichi.c:61
SphericalHarmonic2.hpp
Header for GeographicLib::SphericalHarmonic2 class.
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
C1
static double C1
Definition: ellpk.c:93
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
C2
Definition: test_operator_overloading.cpp:98
C2
static double C2[]
Definition: shichi.c:141
h
const double h
Definition: testSimpleHelicopter.cpp:19
main
int main(int argc, char **argv)
Definition: cmake/example_cmake_find_gtsam/main.cpp:63
vy
StridedVectorType vy(make_vector(y, *n, std::abs(*incy)))
S2
Symmetric< 2 > S2
Definition: testGroup.cpp:80
gtsam::Symmetric
Symmetric group.
Definition: testGroup.cpp:27
C1
Definition: test_operator_overloading.cpp:97
NETGeographicLib::SphericalHarmonic2::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)
Definition: SphericalHarmonic2.cpp:51
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
out
std::ofstream out("Result.txt")
y
Scalar * y
Definition: level1_cplx_impl.h:124
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
GeographicLib::SphericalHarmonic2
Spherical harmonic series with two corrections to the coefficients.
Definition: SphericalHarmonic2.hpp:35
std
Definition: BFloat16.h:88
args
Definition: pytypes.h:2210
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
N
#define N
Definition: igam.h:9
NETGeographicLib
Definition: Accumulator.h:13
S
DiscreteKey S(1, 2)
vx
StridedVectorType vx(make_vector(x, *n, std::abs(*incx)))


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:25:01