GeographicLib 2.1.2
|
Package up coefficients for SphericalEngine. More...
#include <GeographicLib/SphericalEngine.hpp>
Public Member Functions | |
coeff () | |
coeff (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx) | |
coeff (const std::vector< real > &C, const std::vector< real > &S, int N) | |
int | N () const |
int | nmx () const |
int | mmx () const |
int | index (int n, int m) const |
Math::real | Cv (int k) const |
Math::real | Sv (int k) const |
Math::real | Cv (int k, int n, int m, real f) const |
Math::real | Sv (int k, int n, int m, real f) const |
Static Public Member Functions | |
static int | Csize (int N, int M) |
static int | Ssize (int N, int M) |
static void | readcoeffs (std::istream &stream, int &N, int &M, std::vector< real > &C, std::vector< real > &S, bool truncate=false) |
Package up coefficients for SphericalEngine.
This packages up the C, S coefficients and information about how the coefficients are stored into a single structure. This allows a vector of type SphericalEngine::coeff to be passed to SphericalEngine::Value. This class also includes functions to aid indexing into C and S.
The storage layout of the coefficients is documented in SphericalHarmonic and SphericalHarmonic::SphericalHarmonic.
Definition at line 99 of file SphericalEngine.hpp.
|
inline |
A default constructor
Definition at line 108 of file SphericalEngine.hpp.
|
inline |
The general constructor.
[in] | C | a vector of coefficients for the cosine terms. |
[in] | S | a vector of coefficients for the sine terms. |
[in] | N | the degree giving storage layout for C and S. |
[in] | nmx | the maximum degree to be used. |
[in] | mmx | the maximum order to be used. |
GeographicErr | if N, nmx, and mmx do not satisfy N ≥ nmx ≥ mmx ≥ −1. |
GeographicErr | if C or S is not big enough to hold the coefficients. |
std::bad_alloc | if the memory for the square root table can't be allocated. |
Definition at line 124 of file SphericalEngine.hpp.
References GeographicLib::SphericalEngine::RootTable().
|
inline |
The constructor for full coefficient vectors.
[in] | C | a vector of coefficients for the cosine terms. |
[in] | S | a vector of coefficients for the sine terms. |
[in] | N | the maximum degree and order. |
GeographicErr | if N does not satisfy N ≥ −1. |
GeographicErr | if C or S is not big enough to hold the coefficients. |
std::bad_alloc | if the memory for the square root table can't be allocated. |
Definition at line 154 of file SphericalEngine.hpp.
References GeographicLib::SphericalEngine::RootTable().
|
inline |
Definition at line 173 of file SphericalEngine.hpp.
Referenced by GeographicLib::GravityModel::GravityModel(), and readcoeffs().
|
inline |
Definition at line 177 of file SphericalEngine.hpp.
Referenced by GeographicLib::SphericalEngine::Circle(), GeographicLib::GravityModel::GravityModel(), and GeographicLib::SphericalEngine::Value().
|
inline |
Definition at line 181 of file SphericalEngine.hpp.
Referenced by GeographicLib::SphericalEngine::Circle(), GeographicLib::GravityModel::GravityModel(), and GeographicLib::SphericalEngine::Value().
|
inline |
The one-dimensional index into C and S.
[in] | n | the degree. |
[in] | m | the order. |
Definition at line 189 of file SphericalEngine.hpp.
|
inline |
An element of C.
[in] | k | the one-dimensional index. |
Definition at line 197 of file SphericalEngine.hpp.
Referenced by GeographicLib::SphericalEngine::Circle(), and GeographicLib::SphericalEngine::Value().
|
inline |
An element of S.
[in] | k | the one-dimensional index. |
Definition at line 204 of file SphericalEngine.hpp.
Referenced by GeographicLib::SphericalEngine::Circle(), and GeographicLib::SphericalEngine::Value().
|
inline |
An element of C with checking.
[in] | k | the one-dimensional index. |
[in] | n | the requested degree. |
[in] | m | the requested order. |
[in] | f | a multiplier. |
Definition at line 215 of file SphericalEngine.hpp.
|
inline |
An element of S with checking.
[in] | k | the one-dimensional index. |
[in] | n | the requested degree. |
[in] | m | the requested order. |
[in] | f | a multiplier. |
Definition at line 227 of file SphericalEngine.hpp.
|
inlinestatic |
The size of the coefficient vector for the cosine terms.
[in] | N | the maximum degree. |
[in] | M | the maximum order. |
Definition at line 238 of file SphericalEngine.hpp.
Referenced by readcoeffs().
|
inlinestatic |
The size of the coefficient vector for the sine terms.
[in] | N | the maximum degree. |
[in] | M | the maximum order. |
Definition at line 249 of file SphericalEngine.hpp.
Referenced by readcoeffs().
|
static |
Load coefficients from a binary stream.
[in] | stream | the input stream. |
[in,out] | N | The maximum degree of the coefficients. |
[in,out] | M | The maximum order of the coefficients. |
[out] | C | The vector of cosine coefficients. |
[out] | S | The vector of sine coefficients. |
[in] | truncate | if false (the default) then N and M are determined by the values in the binary stream; otherwise, the input values of N and M are used to truncate the coefficients read from the stream at the given degree and order. |
GeographicErr | if N and M do not satisfy N ≥ M ≥ −1. |
GeographicErr | if there's an error reading the data. |
std::bad_alloc | if the memory for C or S can't be allocated. |
N and M are read as 4-byte ints. C and S are resized to accommodate all the coefficients (with the m = 0 coefficients for S excluded) and the data for these coefficients read as 8-byte doubles. The coefficients are stored in column major order. The bytes in the stream should use little-endian ordering. IEEE floating point is assumed for the coefficients.
Definition at line 385 of file SphericalEngine.cpp.
References Csize(), N(), Ssize(), and GeographicLib::Utility::str().
Referenced by GeographicLib::GravityModel::GravityModel(), and GeographicLib::MagneticModel::MagneticModel().