casa
$Rev:20696$
|
00001 //# SolarPos.h: Solar position class 00002 //# Copyright (C) 1995,1996,1997,1998 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: SolarPos.h 18093 2004-11-30 17:51:10Z ddebonis $ 00028 00029 #ifndef MEASURES_SOLARPOS_H 00030 #define MEASURES_SOLARPOS_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/Quanta/MVPosition.h> 00035 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 // <summary> Solar position class and calculations </summary> 00040 00041 // <use visibility=export> 00042 00043 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasMath" demos=""> 00044 // </reviewed> 00045 00046 // <prerequisite> 00047 // <li> <linkto class=Measure>Measure</linkto> class, 00048 // especially <linkto class=MEpoch>MEpoch</linkto> 00049 // <li> <linkto class=MeasData>MeasData</linkto> class for constants 00050 // </prerequisite> 00051 // 00052 // <etymology> 00053 // SolarPos from Solar Position 00054 // </etymology> 00055 // 00056 // <synopsis> 00057 // SolarPos forms the class for Solar Position calculations. It is a simple 00058 // container with the selected method, and the mean epoch.<br> 00059 // The method is selected from one of the following: 00060 // <ul> 00061 // <li> SolarPos::STANDARD (at 1995/09/04 the IAU1980 definition) 00062 // <li> SolarPos::NONE 00063 // </ul> 00064 // Epochs can be specified as the MJD (with defined constants MeasData::MJD2000 00065 // and MeasData::MJDB1950 or the actual MJD), 00066 // leading to the following constructors: 00067 // <ul> 00068 // <li> SolarPos() default; assuming JD2000, IAU1980 00069 // <li> SolarPos(method) assuming the correct default epoch of 00070 // JD2000 00071 // <li> SolarPos(method,epoch) with epoch Double(MJD) 00072 // </ul> 00073 // Actual SolarPos for a certain Epoch is calculated by the () operator 00074 // as SolarPos(epoch), with epoch Double MJD, as an MVPosition vector.<br> 00075 // It returns the geocentric position of the heliocentre in rectangular 00076 // coordinates in AU.<br> 00077 // The derivative (d<sup>-1</sup>) can be obtained as well by 00078 // derivative(epoch), baryEarthDerivative() and barySunDerivative().<br> 00079 // The Earth's and solar barycentric position can be obtained by the 00080 // members <src>baryEarth</src> and <src>barySun</src>. 00081 // The following details can be set with the 00082 // <linkto class=Aipsrc>Aipsrc</linkto> mechanism: 00083 // <ul> 00084 // <li> measures.solarpos.d_interval: approximation interval as time 00085 // (fraction of days is default unit) over which linear approximation 00086 // is used 00087 // <li> measures.solarpos.b_usejpl: use the JPL database for solar position. 00088 // Else analytical expression, relative error about 10<sup>-9</sup> 00089 // Note that the JPL database to be used can be set with 00090 // measures.jpl.ephemeris (at the moment of writing DE200 (default), 00091 // or DE405) 00092 // </ul> 00093 // Reference: M. Soma et al., Cel. Mech. 41 (1988), 389; 00094 // E.M. Standish, Astron. Astroph. 114 (1982), 297. 00095 // </synopsis> 00096 // 00097 // <example> 00098 // </example> 00099 // 00100 // <motivation> 00101 // To calculate the solar/Earth positions for gravitational deflection. 00102 // An alternate route could have been 00103 // a global function, but having a simple container allows 00104 // caching of some calculations for speed.<br> 00105 // Using MJD (JD-2400000.5) rather than JD is for precision reasons. 00106 // </motivation> 00107 // 00108 // <todo asof="1996/02/18"> 00109 // </todo> 00110 00111 class SolarPos { 00112 public: 00113 //# Constants 00114 // Interval to be used for linear approximation (in days) 00115 static const Double INTV; 00116 00117 //# Enumerations 00118 // Types of known SolarPos calculations (at 1995/09/04 STANDARD == IAU1980) 00119 enum SolarPosTypes {STANDARD,NONE}; 00120 00121 //# Constructors 00122 // Default constructor, generates default J2000 SolarPos identification 00123 SolarPos(); 00124 // Copy constructor 00125 SolarPos(const SolarPos &other); 00126 // Constructor with type 00127 SolarPos(SolarPosTypes type); 00128 // Copy assignment 00129 SolarPos &operator=(const SolarPos &other); 00130 00131 //# Destructor 00132 ~SolarPos(); 00133 00134 //# Operators 00135 // Operator () calculates the geocentric Solar Position in AU 00136 const MVPosition&operator()(Double epoch); 00137 00138 //# General Member Functions 00139 // <group> 00140 // Return derivatives of SolarPos (d<sup>-1</sup>) 00141 const MVPosition &derivative (Double epoch); 00142 const MVPosition &baryEarthDerivative (Double epoch); 00143 const MVPosition &barySunDerivative (Double epoch); 00144 // </group> 00145 // Barycentric position of Earth 00146 const MVPosition &baryEarth(Double epoch); 00147 // Barycentric position of Sun 00148 const MVPosition &barySun(Double epoch); 00149 00150 // Re-initialise SolarPos object 00151 // <group> 00152 void init(); 00153 void init(SolarPosTypes type); 00154 // </group> 00155 00156 // Refresh calculations 00157 void refresh(); 00158 00159 private: 00160 //# Data menbers 00161 // Method to be used 00162 SolarPosTypes method; 00163 // Check epoch for linear approximation 00164 Double checkEpoch; 00165 Double checkSunEpoch; 00166 // Cached calculated Earth positions 00167 Double eval[3]; 00168 // Cached derivatives 00169 Double deval[3]; 00170 // Cached calculated Sun positions 00171 Double sval[3]; 00172 // Cached derivatives 00173 Double dsval[3]; 00174 // To be able to use references in simple calculations, results are calculated 00175 // in a circular buffer. 00176 // Current buffer pointer 00177 Int lres; 00178 // Last calculation 00179 MVPosition result[6]; 00180 // Interpolation interval 00181 static uInt interval_reg; 00182 // JPL use 00183 static uInt usejpl_reg; 00184 00185 //# Member functions 00186 // Copy 00187 void copy(const SolarPos &other); 00188 // Fill an empty copy 00189 void fill(); 00190 // Calculate heliocentric Earth position for time t 00191 void calcEarth(Double t); 00192 // Calculate heliocentric barycentre position 00193 void calcSun(Double t); 00194 }; 00195 00196 00197 } //# NAMESPACE CASA - END 00198 00199 #endif