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 }
NETGeographicLib::SphericalHarmonic
.NET wrapper for GeographicLib::SphericalHarmonic.
Definition: SphericalHarmonic.h:75
SphericalCoefficients.h
Header for NETGeographicLib::SphericalCoefficients class.
SphericalHarmonic.h
Header for NETGeographicLib::SphericalHarmonic class.
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
NETGeographicLib::SphericalHarmonic::m_pSphericalHarmonic
const GeographicLib::SphericalHarmonic * m_pSphericalHarmonic
Definition: SphericalHarmonic.h:79
CircularEngine.h
Header for NETGeographicLib::CircularEngine class.
NETGeographicLib::SphericalHarmonic::HarmonicSum
double HarmonicSum(double x, double y, double z)
Definition: SphericalHarmonic.cpp:100
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
NETGeographicLib::SphericalHarmonic::Normalization
Normalization
Definition: SphericalHarmonic.h:90
NETGeographicLib::SphericalCoefficients
.NET wrapper for GeographicLib::SphericalEngine::coeff.
Definition: SphericalCoefficients.h:34
GeographicLib::SphericalHarmonic
Spherical harmonic series.
Definition: SphericalHarmonic.hpp:69
NETGeographicLib::SphericalHarmonic::Circle
CircularEngine Circle(double p, double z, bool gradp)
Definition: SphericalHarmonic.cpp:118
NETGeographicLib::SphericalHarmonic::SphericalHarmonic
SphericalHarmonic(array< double >^ C, array< double >^ S, int N, double a, Normalization norm)
Definition: SphericalHarmonic.cpp:43
stdafx.h
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
NETGeographicLib::SphericalHarmonic::m_S
std::vector< double > * m_S
Definition: SphericalHarmonic.h:85
NETGeographicLib.h
Header for NETGeographicLib::NETGeographicLib objects.
out
std::ofstream out("Result.txt")
NETGeographicLib::CircularEngine
.NET wrapper for GeographicLib::CircularEngine.
Definition: CircularEngine.h:54
y
Scalar * y
Definition: level1_cplx_impl.h:124
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
array< double >
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
GeographicLib::SphericalHarmonic::Coefficients
const SphericalEngine::coeff & Coefficients() const
Definition: SphericalHarmonic.hpp:348
p
float * p
Definition: Tutorial_Map_using.cpp:9
NETGeographicLib::SphericalHarmonic::m_C
std::vector< double > * m_C
Definition: SphericalHarmonic.h:85
N
#define N
Definition: igam.h:9
NULL
#define NULL
Definition: ccolamd.c:609
NETGeographicLib
Definition: Accumulator.h:13
GeographicLib::SphericalHarmonic::Circle
CircularEngine Circle(real p, real z, bool gradp) const
Definition: SphericalHarmonic.hpp:324
BADALLOC
const char BADALLOC[]
Definition: SphericalHarmonic.cpp:20
NETGeographicLib::SphericalHarmonic::Coefficients
SphericalCoefficients Coefficients()
Definition: SphericalHarmonic.cpp:124
S
DiscreteKey S(1, 2)
SphericalHarmonic.hpp
Header for GeographicLib::SphericalHarmonic class.


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:14:02