SphericalHarmonic.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "SphericalHarmonic.h"
14 #include "CircularEngine.h"
15 #include "SphericalCoefficients.h"
16 #include "NETGeographicLib.h"
17 
18 using namespace NETGeographicLib;
19 
20 const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::SphericalHarmonic";
21 
22 //*****************************************************************************
24 {
25  if ( m_pSphericalHarmonic != NULL )
26  {
27  delete m_pSphericalHarmonic;
28  m_pSphericalHarmonic = NULL;
29  }
30  if ( m_C != NULL )
31  {
32  delete m_C;
33  m_C = NULL;
34  }
35  if ( m_S != NULL )
36  {
37  delete m_S;
38  m_S = NULL;
39  }
40 }
41 
42 //*****************************************************************************
45  int N, double a, Normalization norm )
46 {
47  try
48  {
49  m_C = new std::vector<double>();
50  m_S = new std::vector<double>();
51  for each ( double x in C ) m_C->push_back(x);
52  for each ( double x in S ) m_S->push_back(x);
54  *m_C, *m_S, N, a, static_cast<unsigned>(norm) );
55  }
56  catch (std::bad_alloc)
57  {
58  throw gcnew GeographicErr( BADALLOC );
59  }
60  catch ( const std::exception& xcpt )
61  {
62  throw gcnew GeographicErr( xcpt.what() );
63  }
64  catch ( System::Exception^ sxpt )
65  {
66  throw gcnew GeographicErr( sxpt->Message );
67  }
68 }
69 
70 //*****************************************************************************
73  int N, int nmx, int mmx,
74  double a, Normalization norm)
75 {
76  try
77  {
78  m_C = new std::vector<double>();
79  m_S = new std::vector<double>();
80  for each ( double x in C ) m_C->push_back(x);
81  for each ( double x in S ) m_S->push_back(x);
83  *m_C, *m_S, N, nmx, mmx, a, static_cast<unsigned>(norm) );
84  }
85  catch (std::bad_alloc)
86  {
87  throw gcnew GeographicErr( BADALLOC );
88  }
89  catch ( const std::exception& xcpt )
90  {
91  throw gcnew GeographicErr( xcpt.what() );
92  }
93  catch ( System::Exception^ sxpt )
94  {
95  throw gcnew GeographicErr( sxpt->Message );
96  }
97 }
98 
99 //*****************************************************************************
100 double SphericalHarmonic::HarmonicSum(double x, double y, double z)
101 {
102  return m_pSphericalHarmonic->operator()( x, y, z );
103 }
104 
105 //*****************************************************************************
106 double SphericalHarmonic::HarmonicSum(double x, double y, double z,
107  double% gradx, double% grady, double% gradz)
108 {
109  double lx, ly, lz;
110  double out = m_pSphericalHarmonic->operator()( x, y, z, lx, ly, lz );
111  gradx = lx;
112  grady = ly;
113  gradz = lz;
114  return out;
115 }
116 
117 //*****************************************************************************
118 CircularEngine^ SphericalHarmonic::Circle(double p, double z, bool gradp)
119 {
120  return gcnew CircularEngine( m_pSphericalHarmonic->Circle( p, z, gradp ) );
121 }
122 
123 //*****************************************************************************
125 {
127 }
Header for NETGeographicLib::NETGeographicLib objects.
Header for NETGeographicLib::SphericalHarmonic class.
Scalar * y
Exception class for NETGeographicLib.
CircularEngine Circle(real p, real z, bool gradp) const
const GeographicLib::SphericalHarmonic * m_pSphericalHarmonic
#define N
Definition: gksort.c:12
.NET wrapper for GeographicLib::SphericalEngine::coeff.
Header for NETGeographicLib::CircularEngine class.
Array33i a
CircularEngine Circle(double p, double z, bool gradp)
Header for NETGeographicLib::SphericalCoefficients class.
Key S(std::uint64_t j)
const SphericalEngine::coeff & Coefficients() const
#define NULL
Definition: ccolamd.c:609
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:37
Header for GeographicLib::SphericalHarmonic class.
double HarmonicSum(double x, double y, double z)
float * p
const char BADALLOC[]
SphericalHarmonic(array< double >^C, array< double >^S, int N, double a, Normalization norm)
.NET wrapper for GeographicLib::CircularEngine.
Spherical harmonic series.
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
.NET wrapper for GeographicLib::SphericalHarmonic.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:44:49