/usr/include/GeographicLib/MagneticCircle.hpp is in libgeographiclib-dev 1.21-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | /**
* \file MagneticCircle.hpp
* \brief Header for GeographicLib::MagneticCircle class
*
* Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
* the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#if !defined(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP)
#define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP \
"$Id: 5b3adc58d894f36ca4206864eb565541f24ff492 $"
#include <string>
#include <vector>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/CircularEngine.hpp>
namespace GeographicLib {
/**
* \brief Geomagnetic field on a circle of latitude
*
* Evaluate the earth's magnetic field on a circle of constant height and
* latitude. This uses a CircleEngine 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:
* \include example-MagneticCircle.cpp
*
* <a href="MagneticField.1.html">MagneticField</a> is a command-line utility
* providing access to the functionality of MagneticModel and MagneticCircle.
**********************************************************************/
class GEOGRAPHIC_EXPORT MagneticCircle {
private:
typedef Math::real real;
real _a, _f, _lat, _h, _t, _cphi, _sphi, _t1, _dt0;
bool _interpolate;
CircularEngine _circ0, _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)
: _a(a)
, _f(f)
, _lat(lat)
, _h(h)
, _t(t)
, _cphi(cphi)
, _sphi(sphi)
, _t1(t1)
, _dt0(dt0)
, _interpolate(interpolate)
, _circ0(circ0)
, _circ1(circ1)
{}
void Field(real lon, bool diffp,
real& Bx, real& By, real& Bz,
real& Bxt, real& Byt, real& Bzt) const throw();
friend class MagneticModel; // MagneticModel calls the private constructor
public:
/**
* A default constructor for the normal gravity. This sets up an
* uninitialized object which can be later replaced by the
* MagneticModel::Circle.
**********************************************************************/
MagneticCircle() : _a(-1) {}
/** \name Compute the magnetic field
**********************************************************************/
///@{
/**
* Evaluate the components of the geomagnetic field at a particular
* longitude.
*
* @param[in] lon longitude of the point (degrees).
* @param[out] Bx the easterly component of the magnetic field (nanotesla).
* @param[out] By the northerly component of the magnetic field (nanotesla).
* @param[out] Bz the vertical (up) component of the magnetic field
* (nanotesla).
**********************************************************************/
void operator()(real lon, real& Bx, real& By, real& Bz) const throw() {
real dummy;
Field(lon, false, Bx, By, Bz, dummy, dummy, dummy);
}
/**
* Evaluate the components of the geomagnetic field and their time
* derivatives at a particular longitude.
*
* @param[in] lon longitude of the point (degrees).
* @param[out] Bx the easterly component of the magnetic field (nanotesla).
* @param[out] By the northerly component of the magnetic field (nanotesla).
* @param[out] Bz the vertical (up) component of the magnetic field
* (nanotesla).
* @param[out] Bxt the rate of change of \e Bx (nT/yr).
* @param[out] Byt the rate of change of \e By (nT/yr).
* @param[out] Bzt the rate of change of \e Bz (nT/yr).
**********************************************************************/
void operator()(real lon, real& Bx, real& By, real& Bz,
real& Bxt, real& Byt, real& Bzt) const throw() {
Field(lon, true, Bx, By, Bz, Bxt, Byt, Bzt);
}
///@}
/** \name Inspector functions
**********************************************************************/
///@{
/**
* @return true if the object has been initialized.
**********************************************************************/
bool Init() const throw() { return _a > 0; }
/**
* @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value inherited from the MagneticModel object used in the
* constructor.
**********************************************************************/
Math::real MajorRadius() const throw()
{ return Init() ? _a : Math::NaN<real>(); }
/**
* @return \e f the flattening of the ellipsoid. This is the value
* inherited from the MagneticModel object used in the constructor.
**********************************************************************/
Math::real Flattening() const throw()
{ return Init() ? _f : Math::NaN<real>(); }
/**
* @return the latitude of the circle (degrees).
**********************************************************************/
Math::real Latitude() const throw()
{ return Init() ? _lat : Math::NaN<real>(); }
/**
* @return the height of the circle (meters).
**********************************************************************/
Math::real Height() const throw()
{ return Init() ? _h : Math::NaN<real>(); }
/**
* @return the time (fractional years).
**********************************************************************/
Math::real Time() const throw()
{ return Init() ? _t : Math::NaN<real>(); }
///@}
};
} // namespace GeographicLib
#endif // GEOGRAPHICLIB_MAGNETICCIRCLE_HPP
|