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 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)
 
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::!CircularEngine ( )
private

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

◆ CircularEngine()

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.

◆ ~CircularEngine()

NETGeographicLib::CircularEngine::~CircularEngine ( )
inline

The destructor calls the finalizer

Definition at line 77 of file CircularEngine.h.

Member Function Documentation

◆ LongitudeSum() [1/4]

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.

◆ LongitudeSum() [2/4]

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.

◆ LongitudeSum() [3/4]

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.

◆ LongitudeSum() [4/4]

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

◆ m_pCircularEngine

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:
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
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
CircularEngine.hpp
Header for GeographicLib::CircularEngine class.
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)))
GeographicLib::CircularEngine
Spherical harmonic sums for a circle.
Definition: CircularEngine.hpp:52
GeographicLib::SphericalHarmonic
Spherical harmonic series.
Definition: SphericalHarmonic.hpp:69
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
NETGeographicLib::CircularEngine::CircularEngine
CircularEngine(const GeographicLib::CircularEngine &c)
Definition: dotnet/NETGeographicLib/CircularEngine.cpp:19
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
std
Definition: BFloat16.h:88
args
Definition: pytypes.h:2163
p
float * p
Definition: Tutorial_Map_using.cpp:9
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)
SphericalHarmonic.hpp
Header for GeographicLib::SphericalHarmonic class.
vx
StridedVectorType vx(make_vector(x, *n, std::abs(*incx)))


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:15:17