SphericalHarmonic2.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP)
11 #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP 1
12 
13 #include <vector>
17 
18 namespace GeographicLib {
19 
33  // Don't include the GEOGRPAHIC_EXPORT because this header-only class isn't
34  // used by any other classes in the library.
35  class /*GEOGRAPHICLIB_EXPORT*/ SphericalHarmonic2 {
36  public:
55  };
56 
57  private:
58  typedef Math::real real;
60  real _a;
61  unsigned _norm;
62 
63  public:
97  SphericalHarmonic2(const std::vector<real>& C,
98  const std::vector<real>& S,
99  int N,
100  const std::vector<real>& C1,
101  const std::vector<real>& S1,
102  int N1,
103  const std::vector<real>& C2,
104  const std::vector<real>& S2,
105  int N2,
106  real a, unsigned norm = FULL)
107  : _a(a)
108  , _norm(norm) {
109  if (!(N1 <= N && N2 <= N))
110  throw GeographicErr("N1 and N2 cannot be larger that N");
111  _c[0] = SphericalEngine::coeff(C, S, N);
112  _c[1] = SphericalEngine::coeff(C1, S1, N1);
113  _c[2] = SphericalEngine::coeff(C2, S2, N2);
114  }
115 
154  SphericalHarmonic2(const std::vector<real>& C,
155  const std::vector<real>& S,
156  int N, int nmx, int mmx,
157  const std::vector<real>& C1,
158  const std::vector<real>& S1,
159  int N1, int nmx1, int mmx1,
160  const std::vector<real>& C2,
161  const std::vector<real>& S2,
162  int N2, int nmx2, int mmx2,
163  real a, unsigned norm = FULL)
164  : _a(a)
165  , _norm(norm) {
166  if (!(nmx1 <= nmx && nmx2 <= nmx))
167  throw GeographicErr("nmx1 and nmx2 cannot be larger that nmx");
168  if (!(mmx1 <= mmx && mmx2 <= mmx))
169  throw GeographicErr("mmx1 and mmx2 cannot be larger that mmx");
170  _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx);
171  _c[1] = SphericalEngine::coeff(C1, S1, N1, nmx1, mmx1);
172  _c[2] = SphericalEngine::coeff(C2, S2, N2, nmx2, mmx2);
173  }
174 
181 
196  Math::real operator()(real tau1, real tau2, real x, real y, real z)
197  const {
198  real f[] = {1, tau1, tau2};
199  real v = 0;
200  real dummy;
201  switch (_norm) {
202  case FULL:
203  v = SphericalEngine::Value<false, SphericalEngine::FULL, 3>
204  (_c, f, x, y, z, _a, dummy, dummy, dummy);
205  break;
206  case SCHMIDT:
207  v = SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 3>
208  (_c, f, x, y, z, _a, dummy, dummy, dummy);
209  break;
210  }
211  return v;
212  }
213 
234  Math::real operator()(real tau1, real tau2, real x, real y, real z,
235  real& gradx, real& grady, real& gradz) const {
236  real f[] = {1, tau1, tau2};
237  real v = 0;
238  switch (_norm) {
239  case FULL:
240  v = SphericalEngine::Value<true, SphericalEngine::FULL, 3>
241  (_c, f, x, y, z, _a, gradx, grady, gradz);
242  break;
243  case SCHMIDT:
244  v = SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 3>
245  (_c, f, x, y, z, _a, gradx, grady, gradz);
246  break;
247  }
248  return v;
249  }
250 
277  CircularEngine Circle(real tau1, real tau2, real p, real z, bool gradp)
278  const {
279  real f[] = {1, tau1, tau2};
280  switch (_norm) {
281  case FULL:
282  return gradp ?
283  SphericalEngine::Circle<true, SphericalEngine::FULL, 3>
284  (_c, f, p, z, _a) :
285  SphericalEngine::Circle<false, SphericalEngine::FULL, 3>
286  (_c, f, p, z, _a);
287  break;
288  case SCHMIDT:
289  default: // To avoid compiler warnings
290  return gradp ?
291  SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 3>
292  (_c, f, p, z, _a) :
293  SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 3>
294  (_c, f, p, z, _a);
295  break;
296  }
297  }
298 
303  { return _c[0]; }
308  { return _c[1]; }
313  { return _c[2]; }
314  };
315 
316 } // namespace GeographicLib
317 
318 #endif // GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP
Scalar * y
Symmetric< 2 > S2
Definition: testGroup.cpp:80
#define N
Definition: gksort.c:12
const SphericalEngine::coeff & Coefficients() const
DiscreteKey S(1, 2)
const SphericalEngine::coeff & Coefficients1() const
Package up coefficients for SphericalEngine.
Array< int, Dynamic, 1 > v
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Namespace for GeographicLib.
const SphericalEngine::coeff & Coefficients2() const
Spherical harmonic series with two corrections to the coefficients.
SphericalHarmonic2(const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, int nmx2, int mmx2, real a, unsigned norm=FULL)
Header for GeographicLib::CircularEngine class.
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
Spherical harmonic sums for a circle.
Exception handling for GeographicLib.
Definition: Constants.hpp:389
Header for GeographicLib::Constants class.
Math::real operator()(real tau1, real tau2, real x, real y, real z) const
float * p
CircularEngine Circle(real tau1, real tau2, real p, real z, bool gradp) const
SphericalHarmonic2(const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, real a, unsigned norm=FULL)
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
Header for GeographicLib::SphericalEngine class.
Math::real operator()(real tau1, real tau2, real x, real y, real z, real &gradx, real &grady, real &gradz) const


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:36:19