Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
GeographicLib::MagneticCircle Class Reference

Geomagnetic field on a circle of latitude. More...

#include <MagneticCircle.hpp>

Public Member Functions

 MagneticCircle ()
 
Compute the magnetic field
void operator() (real lon, real &Bx, real &By, real &Bz) const
 
void operator() (real lon, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const
 
Inspector functions
bool Init () const
 
Math::real MajorRadius () const
 
Math::real Flattening () const
 
Math::real Latitude () const
 
Math::real Height () const
 
Math::real Time () const
 

Private Types

typedef Math::real real
 

Private Member Functions

void Field (real lon, bool diffp, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const
 
 MagneticCircle (real a, real f, real lat, real h, real t, real cphi, real sphi, real t1, real dt0, bool interpolate, const CircularEngine &circ0, const CircularEngine &circ1)
 
 MagneticCircle (real a, real f, real lat, real h, real t, real cphi, real sphi, real t1, real dt0, bool interpolate, const CircularEngine &circ0, const CircularEngine &circ1, const CircularEngine &circ2)
 

Private Attributes

real _a
 
CircularEngine _circ0
 
CircularEngine _circ1
 
CircularEngine _circ2
 
bool _constterm
 
real _cphi
 
real _dt0
 
real _f
 
real _h
 
bool _interpolate
 
real _lat
 
real _sphi
 
real _t
 
real _t1
 

Friends

class MagneticModel
 

Detailed Description

Geomagnetic field on a circle of latitude.

Evaluate the earth's magnetic field on a circle of constant height and latitude. This uses a CircularEngine to pre-evaluate the inner sum of the spherical harmonic sum, allowing the values of the field at several different longitudes to be evaluated rapidly.

Use MagneticModel::Circle to create a MagneticCircle object. (The constructor for this class is private.)

Example of use:

// Example of using the GeographicLib::MagneticCircle class
#include <iostream>
#include <exception>
using namespace std;
using namespace GeographicLib;
int main() {
try {
MagneticModel mag("wmm2010");
double lat = 27.99, lon0 = 86.93, h = 8820, t = 2012; // Mt Everest
{
// Slow method of evaluating the values at several points on a circle of
// latitude.
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double Bx, By, Bz;
mag(t, lat, lon, h, Bx, By, Bz);
cout << lon << " " << Bx << " " << By << " " << Bz << "\n";
}
}
{
// Fast method of evaluating the values at several points on a circle of
// latitude using MagneticCircle.
MagneticCircle circ = mag.Circle(t, lat, h);
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double Bx, By, Bz;
circ(lon, Bx, By, Bz);
cout << lon << " " << Bx << " " << By << " " << Bz << "\n";
}
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

MagneticField is a command-line utility providing access to the functionality of MagneticModel and MagneticCircle.

Definition at line 37 of file MagneticCircle.hpp.

Member Typedef Documentation

◆ real

Definition at line 39 of file MagneticCircle.hpp.

Constructor & Destructor Documentation

◆ MagneticCircle() [1/3]

GeographicLib::MagneticCircle::MagneticCircle ( real  a,
real  f,
real  lat,
real  h,
real  t,
real  cphi,
real  sphi,
real  t1,
real  dt0,
bool  interpolate,
const CircularEngine circ0,
const CircularEngine circ1 
)
inlineprivate

Definition at line 45 of file MagneticCircle.hpp.

◆ MagneticCircle() [2/3]

GeographicLib::MagneticCircle::MagneticCircle ( real  a,
real  f,
real  lat,
real  h,
real  t,
real  cphi,
real  sphi,
real  t1,
real  dt0,
bool  interpolate,
const CircularEngine circ0,
const CircularEngine circ1,
const CircularEngine circ2 
)
inlineprivate

Definition at line 64 of file MagneticCircle.hpp.

◆ MagneticCircle() [3/3]

GeographicLib::MagneticCircle::MagneticCircle ( )
inline

A default constructor for the normal gravity. This sets up an uninitialized object which can be later replaced by the MagneticModel::Circle.

Definition at line 98 of file MagneticCircle.hpp.

Member Function Documentation

◆ Field()

void GeographicLib::MagneticCircle::Field ( real  lon,
bool  diffp,
real Bx,
real By,
real Bz,
real Bxt,
real Byt,
real Bzt 
) const
private

Definition at line 19 of file src/MagneticCircle.cpp.

◆ Flattening()

Math::real GeographicLib::MagneticCircle::Flattening ( ) const
inline
Returns
f the flattening of the ellipsoid. This is the value inherited from the MagneticModel object used in the constructor.

Definition at line 157 of file MagneticCircle.hpp.

◆ Height()

Math::real GeographicLib::MagneticCircle::Height ( ) const
inline
Returns
the height of the circle (meters).

Definition at line 167 of file MagneticCircle.hpp.

◆ Init()

bool GeographicLib::MagneticCircle::Init ( ) const
inline
Returns
true if the object has been initialized.

Definition at line 145 of file MagneticCircle.hpp.

◆ Latitude()

Math::real GeographicLib::MagneticCircle::Latitude ( ) const
inline
Returns
the latitude of the circle (degrees).

Definition at line 162 of file MagneticCircle.hpp.

◆ MajorRadius()

Math::real GeographicLib::MagneticCircle::MajorRadius ( ) const
inline
Returns
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the MagneticModel object used in the constructor.

Definition at line 151 of file MagneticCircle.hpp.

◆ operator()() [1/2]

void GeographicLib::MagneticCircle::operator() ( real  lon,
real Bx,
real By,
real Bz 
) const
inline

Evaluate the components of the geomagnetic field at a particular longitude.

Parameters
[in]lonlongitude of the point (degrees).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).

Definition at line 114 of file MagneticCircle.hpp.

◆ operator()() [2/2]

void GeographicLib::MagneticCircle::operator() ( real  lon,
real Bx,
real By,
real Bz,
real Bxt,
real Byt,
real Bzt 
) const
inline

Evaluate the components of the geomagnetic field and their time derivatives at a particular longitude.

Parameters
[in]lonlongitude of the point (degrees).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).
[out]Bxtthe rate of change of Bx (nT/yr).
[out]Bytthe rate of change of By (nT/yr).
[out]Bztthe rate of change of Bz (nT/yr).

Definition at line 133 of file MagneticCircle.hpp.

◆ Time()

Math::real GeographicLib::MagneticCircle::Time ( ) const
inline
Returns
the time (fractional years).

Definition at line 172 of file MagneticCircle.hpp.

Friends And Related Function Documentation

◆ MagneticModel

friend class MagneticModel
friend

Definition at line 89 of file MagneticCircle.hpp.

Member Data Documentation

◆ _a

real GeographicLib::MagneticCircle::_a
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _circ0

CircularEngine GeographicLib::MagneticCircle::_circ0
private

Definition at line 43 of file MagneticCircle.hpp.

◆ _circ1

CircularEngine GeographicLib::MagneticCircle::_circ1
private

Definition at line 43 of file MagneticCircle.hpp.

◆ _circ2

CircularEngine GeographicLib::MagneticCircle::_circ2
private

Definition at line 43 of file MagneticCircle.hpp.

◆ _constterm

bool GeographicLib::MagneticCircle::_constterm
private

Definition at line 42 of file MagneticCircle.hpp.

◆ _cphi

real GeographicLib::MagneticCircle::_cphi
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _dt0

real GeographicLib::MagneticCircle::_dt0
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _f

real GeographicLib::MagneticCircle::_f
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _h

real GeographicLib::MagneticCircle::_h
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _interpolate

bool GeographicLib::MagneticCircle::_interpolate
private

Definition at line 42 of file MagneticCircle.hpp.

◆ _lat

real GeographicLib::MagneticCircle::_lat
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _sphi

real GeographicLib::MagneticCircle::_sphi
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _t

real GeographicLib::MagneticCircle::_t
private

Definition at line 41 of file MagneticCircle.hpp.

◆ _t1

real GeographicLib::MagneticCircle::_t1
private

Definition at line 41 of file MagneticCircle.hpp.


The documentation for this class was generated from the following files:
MagneticModel.hpp
Header for GeographicLib::MagneticModel class.
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::MagneticModel
Model of the earth's magnetic field.
Definition: MagneticModel.hpp:69
h
const double h
Definition: testSimpleHelicopter.cpp:19
main
int main(int argc, char **argv)
Definition: cmake/example_cmake_find_gtsam/main.cpp:63
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
MagneticCircle.hpp
Header for GeographicLib::MagneticCircle class.
std
Definition: BFloat16.h:88
lon
static const double lon
Definition: testGeographicLib.cpp:34
align_3::t
Point2 t(10, 10)
GeographicLib::MagneticCircle
Geomagnetic field on a circle of latitude.
Definition: MagneticCircle.hpp:37
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:15:07