casacore
Loading...
Searching...
No Matches
SolarPos.h
Go to the documentation of this file.
1// # SolarPos.h: Solar position class
2// # Copyright (C) 1995,1996,1997,1998
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef MEASURES_SOLARPOS_H
27#define MEASURES_SOLARPOS_H
28
29// # Includes
30#include <mutex>
31
32#include <casacore/casa/aips.h>
33#include <casacore/casa/Quanta/MVPosition.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// <summary> Solar position class and calculations </summary>
38
39// <use visibility=export>
40
41// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasMath" demos="">
42// </reviewed>
43
44// <prerequisite>
45// <li> <linkto class=Measure>Measure</linkto> class,
46// especially <linkto class=MEpoch>MEpoch</linkto>
47// <li> <linkto class=MeasData>MeasData</linkto> class for constants
48// </prerequisite>
49//
50// <etymology>
51// SolarPos from Solar Position
52// </etymology>
53//
54// <synopsis>
55// SolarPos forms the class for Solar Position calculations. It is a simple
56// container with the selected method, and the mean epoch.<br>
57// The method is selected from one of the following:
58// <ul>
59// <li> SolarPos::STANDARD (at 1995/09/04 the IAU1980 definition)
60// <li> SolarPos::NONE
61// </ul>
62// Epochs can be specified as the MJD (with defined constants MeasData::MJD2000
63// and MeasData::MJDB1950 or the actual MJD),
64// leading to the following constructors:
65// <ul>
66// <li> SolarPos() default; assuming JD2000, IAU1980
67// <li> SolarPos(method) assuming the correct default epoch of
68// JD2000
69// <li> SolarPos(method,epoch) with epoch Double(MJD)
70// </ul>
71// Actual SolarPos for a certain Epoch is calculated by the () operator
72// as SolarPos(epoch), with epoch Double MJD, as an MVPosition vector.<br>
73// It returns the geocentric position of the heliocentre in rectangular
74// coordinates in AU.<br>
75// The derivative (d<sup>-1</sup>) can be obtained as well by
76// derivative(epoch), baryEarthDerivative() and barySunDerivative().<br>
77// The Earth's and solar barycentric position can be obtained by the
78// members <src>baryEarth</src> and <src>barySun</src>.
79// The following details can be set with the
80// <linkto class=Aipsrc>Aipsrc</linkto> mechanism:
81// <ul>
82// <li> measures.solarpos.d_interval: approximation interval as time
83// (fraction of days is default unit) over which linear approximation
84// is used
85// <li> measures.solarpos.b_usejpl: use the JPL database for solar position.
86// Else analytical expression, relative error about 10<sup>-9</sup>
87// Note that the JPL database to be used can be set with
88// measures.jpl.ephemeris (at the moment of writing DE200 (default),
89// or DE405)
90// </ul>
91// Reference: M. Soma et al., Cel. Mech. 41 (1988), 389;
92// E.M. Standish, Astron. Astroph. 114 (1982), 297.
93// </synopsis>
94//
95// <example>
96// </example>
97//
98// <motivation>
99// To calculate the solar/Earth positions for gravitational deflection.
100// An alternate route could have been
101// a global function, but having a simple container allows
102// caching of some calculations for speed.<br>
103// Using MJD (JD-2400000.5) rather than JD is for precision reasons.
104// </motivation>
105//
106// <todo asof="1996/02/18">
107// </todo>
108
109class SolarPos {
110 public:
111 // # Constants
112 // Interval to be used for linear approximation (in days)
113 static constexpr Double INTV = 0.04;
114
115 // # Enumerations
116 // Types of known SolarPos calculations (at 1995/09/04 STANDARD == IAU1980)
118
119 // # Constructors
120 // Default constructor, generates default J2000 SolarPos identification
122 // Copy constructor
123 SolarPos(const SolarPos &other);
124 // Constructor with type
126 // Copy assignment
128
129 // # Destructor
131
132 // # Operators
133 // Operator () calculates the geocentric Solar Position in AU
135
136 // # General Member Functions
137 // <group>
138 // Return derivatives of SolarPos (d<sup>-1</sup>)
142 // </group>
143 // Barycentric position of Earth
145 // Barycentric position of Sun
146 const MVPosition &barySun(Double epoch);
147
148 // Re-initialise SolarPos object
149 // <group>
150 void init();
152 // </group>
153
154 // Refresh calculations
155 void refresh();
156
157 private:
158 // # Data menbers
159 // Method to be used
161 // Check epoch for linear approximation
164 // Cached calculated Earth positions
166 // Cached derivatives
168 // Cached calculated Sun positions
170 // Cached derivatives
172 // To be able to use references in simple calculations, results are calculated
173 // in a circular buffer.
174 // Current buffer pointer
176 // Last calculation
178 // Interpolation interval
179 inline static uInt interval_reg;
180 // JPL use
181 inline static uInt usejpl_reg;
182 inline static std::once_flag initialize_once_flag;
183
184 // # Member functions
185 void copy(const SolarPos &other);
186 static void initialize_statics();
187 // Calculate heliocentric Earth position for time t
189 // Calculate heliocentric barycentre position
191};
192
193} // namespace casacore
194
195#endif
SolarPos(const SolarPos &other)
Copy constructor.
void init(SolarPosTypes type)
const MVPosition & barySunDerivative(Double epoch)
MVPosition result[6]
Last calculation.
Definition SolarPos.h:177
void refresh()
Refresh calculations.
const MVPosition & baryEarth(Double epoch)
Barycentric position of Earth.
void calcSun(Double t)
Calculate heliocentric barycentre position.
Double sval[3]
Cached calculated Sun positions.
Definition SolarPos.h:169
Int lres
To be able to use references in simple calculations, results are calculated in a circular buffer.
Definition SolarPos.h:175
static constexpr Double INTV
Interval to be used for linear approximation (in days).
Definition SolarPos.h:113
void copy(const SolarPos &other)
Double checkEpoch
Check epoch for linear approximation.
Definition SolarPos.h:162
const MVPosition & operator()(Double epoch)
Operator () calculates the geocentric Solar Position in AU.
void init()
Re-initialise SolarPos object.
SolarPosTypes
Types of known SolarPos calculations (at 1995/09/04 STANDARD == IAU1980).
Definition SolarPos.h:117
static uInt interval_reg
Interpolation interval.
Definition SolarPos.h:179
const MVPosition & derivative(Double epoch)
Return derivatives of SolarPos (d-1).
static std::once_flag initialize_once_flag
Definition SolarPos.h:182
static uInt usejpl_reg
JPL use.
Definition SolarPos.h:181
Double dsval[3]
Cached derivatives.
Definition SolarPos.h:171
SolarPos & operator=(const SolarPos &other)
Copy assignment.
static void initialize_statics()
const MVPosition & barySun(Double epoch)
Barycentric position of Sun.
SolarPosTypes method
Method to be used.
Definition SolarPos.h:160
const MVPosition & baryEarthDerivative(Double epoch)
void calcEarth(Double t)
Calculate heliocentric Earth position for time t.
SolarPos(SolarPosTypes type)
Constructor with type.
SolarPos()
Default constructor, generates default J2000 SolarPos identification.
Double deval[3]
Cached derivatives.
Definition SolarPos.h:167
Double eval[3]
Cached calculated Earth positions.
Definition SolarPos.h:165
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
double Double
Definition aipstype.h:53