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
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary> Solar position class and calculations </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasMath" demos="">
43// </reviewed>
44
45// <prerequisite>
46// <li> <linkto class=Measure>Measure</linkto> class,
47// especially <linkto class=MEpoch>MEpoch</linkto>
48// <li> <linkto class=MeasData>MeasData</linkto> class for constants
49// </prerequisite>
50//
51// <etymology>
52// SolarPos from Solar Position
53// </etymology>
54//
55// <synopsis>
56// SolarPos forms the class for Solar Position calculations. It is a simple
57// container with the selected method, and the mean epoch.<br>
58// The method is selected from one of the following:
59// <ul>
60// <li> SolarPos::STANDARD (at 1995/09/04 the IAU1980 definition)
61// <li> SolarPos::NONE
62// </ul>
63// Epochs can be specified as the MJD (with defined constants MeasData::MJD2000
64// and MeasData::MJDB1950 or the actual MJD),
65// leading to the following constructors:
66// <ul>
67// <li> SolarPos() default; assuming JD2000, IAU1980
68// <li> SolarPos(method) assuming the correct default epoch of
69// JD2000
70// <li> SolarPos(method,epoch) with epoch Double(MJD)
71// </ul>
72// Actual SolarPos for a certain Epoch is calculated by the () operator
73// as SolarPos(epoch), with epoch Double MJD, as an MVPosition vector.<br>
74// It returns the geocentric position of the heliocentre in rectangular
75// coordinates in AU.<br>
76// The derivative (d<sup>-1</sup>) can be obtained as well by
77// derivative(epoch), baryEarthDerivative() and barySunDerivative().<br>
78// The Earth's and solar barycentric position can be obtained by the
79// members <src>baryEarth</src> and <src>barySun</src>.
80// The following details can be set with the
81// <linkto class=Aipsrc>Aipsrc</linkto> mechanism:
82// <ul>
83// <li> measures.solarpos.d_interval: approximation interval as time
84// (fraction of days is default unit) over which linear approximation
85// is used
86// <li> measures.solarpos.b_usejpl: use the JPL database for solar position.
87// Else analytical expression, relative error about 10<sup>-9</sup>
88// Note that the JPL database to be used can be set with
89// measures.jpl.ephemeris (at the moment of writing DE200 (default),
90// or DE405)
91// </ul>
92// Reference: M. Soma et al., Cel. Mech. 41 (1988), 389;
93// E.M. Standish, Astron. Astroph. 114 (1982), 297.
94// </synopsis>
95//
96// <example>
97// </example>
98//
99// <motivation>
100// To calculate the solar/Earth positions for gravitational deflection.
101// An alternate route could have been
102// a global function, but having a simple container allows
103// caching of some calculations for speed.<br>
104// Using MJD (JD-2400000.5) rather than JD is for precision reasons.
105// </motivation>
106//
107// <todo asof="1996/02/18">
108// </todo>
109
110class SolarPos {
111public:
112//# Constants
113// Interval to be used for linear approximation (in days)
114 static constexpr Double INTV = 0.04;
115
116//# Enumerations
117// Types of known SolarPos calculations (at 1995/09/04 STANDARD == IAU1980)
119
120//# Constructors
121// Default constructor, generates default J2000 SolarPos identification
123// Copy constructor
124 SolarPos(const SolarPos &other);
125// Constructor with type
127// Copy assignment
129
130//# Destructor
132
133//# Operators
134// Operator () calculates the geocentric Solar Position in AU
136
137//# General Member Functions
138// <group>
139// Return derivatives of SolarPos (d<sup>-1</sup>)
143// </group>
144// Barycentric position of Earth
146// Barycentric position of Sun
147 const MVPosition &barySun(Double epoch);
148
149// Re-initialise SolarPos object
150// <group>
151 void init();
153// </group>
154
155// Refresh calculations
156 void refresh();
157
158private:
159//# Data menbers
160// Method to be used
162// Check epoch for linear approximation
165// Cached calculated Earth positions
167// Cached derivatives
169// Cached calculated Sun positions
171// Cached derivatives
173// To be able to use references in simple calculations, results are calculated
174// in a circular buffer.
175// Current buffer pointer
177// Last calculation
179// Interpolation interval
180 inline static uInt interval_reg;
181// JPL use
182 inline static uInt usejpl_reg;
183 inline static std::once_flag initialize_once_flag;
184
185//# Member functions
186 void copy(const SolarPos &other);
187 static void initialize_statics();
188// Calculate heliocentric Earth position for time t
190// Calculate heliocentric barycentre position
192};
193
194
195} //# NAMESPACE CASACORE - END
196
197#endif
SolarPos(const SolarPos &other)
Copy constructor.
void init(SolarPosTypes type)
const MVPosition & barySunDerivative(Double epoch)
MVPosition result[6]
Last calculation.
Definition SolarPos.h:178
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:170
Int lres
To be able to use references in simple calculations, results are calculated in a circular buffer.
Definition SolarPos.h:176
static constexpr Double INTV
Interval to be used for linear approximation (in days).
Definition SolarPos.h:114
void copy(const SolarPos &other)
Double checkEpoch
Check epoch for linear approximation.
Definition SolarPos.h:163
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:118
static uInt interval_reg
Interpolation interval.
Definition SolarPos.h:180
const MVPosition & derivative(Double epoch)
Return derivatives of SolarPos (d-1).
static std::once_flag initialize_once_flag
Definition SolarPos.h:183
static uInt usejpl_reg
JPL use.
Definition SolarPos.h:182
Double dsval[3]
Cached derivatives.
Definition SolarPos.h:172
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:161
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:168
Double eval[3]
Cached calculated Earth positions.
Definition SolarPos.h:166
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
double Double
Definition aipstype.h:53