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