MeasTableMul.h

Go to the documentation of this file.
00001 //# MeasTableMul.h: Nutation multiplication coefficient for MeasTable
00002 //# Copyright (C) 1995-1999,2000-2004
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: MeasTable.h 21420 2014-03-19 09:18:51Z gervandiepen $
00028 
00029 #ifndef MEASURES_MEASTABLEMUL_H
00030 #define MEASURES_MEASTABLEMUL_H
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/scimath/Functionals/Polynomial.h>
00035 #include <casacore/casa/Arrays/Matrix.h>
00036 #include <casacore/casa/OS/Mutex.h>
00037 #include <vector>
00038 
00039 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00040 
00041   //# Forward Declarations
00042   class RotMatrix;
00043   class Euler;
00044 
00045   // <summary>
00046   // MeasTableMul provides thread-safe access to time-dependent multiplier matrices
00047   // </summary>
00048 
00049   // <use visibility=local>
00050 
00051   // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasMath" demos="">
00052   // </reviewed>
00053 
00054   // <synopsis>
00055   // MeasTableMul is a helper class for MeasTable to provide thread-safe
00056   // access to the various multiplier matrices for nutation, aberration, and
00057   // solar position. These matrices are dependent on the epoch.
00058   //
00059   // It is an abstract base class for specific derived classes dealing with
00060   // the various effects. This base class provides a cache to keep the matrices
00061   // for various epochs alive. The idea is that a program will process epochs
00062   // in order, where multiple threads can handle different epochs.
00063   // <br>When the cache is full, the least recently used entry is replaced by
00064   // the new matrix.
00065   //
00066   // The cache does not hold <src>Matrix</src> objects themselves, but a
00067   // <src>CountedPtr<Matrix></src> to avoid that in one thread a Matrix is
00068   // removed from the cache, while another thread is still using that Matrix.
00069   // This assumes that CountedPtr is compiled thread-safe.
00070   //
00071   // The class provides two virtual functions.
00072   // <ul>
00073   //  <li> <src>init</src> is called on the first access and makes it possible
00074   //       for the derived class to precompute some variables. In particular,
00075   //       <src>itsDefMatrix</src> should be filled with default values.
00076   //  <li> <src>calc</src> is called on each access and should return the
00077   //       matrix valid for the given epoch. Prior to calling this function,
00078   //       the class will copy <src>itsDefMatrix</src> to the result which
00079   //       also defines the shape of the result.
00080   //       Note that this function is only called if the matrix for the given
00081   //       epoch is not in the cache.
00082   // </ul>
00083   // </synopsis>
00084   //
00085   // <example>
00086   // Class MeasTable shows how it is used.
00087   // </example>
00088 
00089   class MeasTableMul
00090   {
00091   public:
00092     MeasTableMul();
00093     virtual ~MeasTableMul() {}
00094     void clear();
00095     CountedPtr<Matrix<Double> > getArray (Double time, Double epsilon);
00096     virtual void init() = 0;
00097     virtual void calc(Matrix<Double>&, Double time) = 0;
00098   protected:
00099     Mutex itsMutex;
00100     Int64 itsLastUsed;
00101     vector<Int64> itsUsed;
00102     vector<Double> itsTimes;
00103     vector<CountedPtr<Matrix<Double> > > itsArrays;
00104     Matrix<Double> itsDefArray;
00105   };
00106 
00107 
00108   // <summary>
00109   // Base class for standard and B1950 nutation multipliers.
00110   // </summary>
00111   class MeasTableMulSCBase: public MeasTableMul
00112   {
00113   public:
00114     MeasTableMulSCBase();
00115   protected:
00116     void doInit(Matrix<Double>& result,
00117                 Polynomial<Double> poly[],
00118                 Int nrowTD, const Long coeffTD[][5],
00119                 Int nrowSC, const Short coeffSC[][2]);
00120     void doCalc(Matrix<Double>& result, Double time,
00121                 const Polynomial<Double> poly[],
00122                 Int nrowTD, const Long coeffTD[][5]);
00123   };
00124 
00125   // <summary>
00126   // Class calculating the standard nutation multipliers.
00127   // </summary>
00128   class MeasTableMulSC: public MeasTableMulSCBase
00129   {
00130   public:
00131     MeasTableMulSC();
00132     virtual void init();
00133     virtual void calc(Matrix<Double>&, Double time);
00134   private:
00135     Polynomial<Double> itsPoly[2*15];
00136     static const Long theirMULTD[15][5];
00137     static const Short theirMULSC[106][2];
00138   };
00139 
00140   // <summary>
00141   // Class calculating the B1950 nutation multipliers.
00142   // </summary>
00143   class MeasTableMulSC1950: public MeasTableMulSCBase
00144   {
00145   public:
00146     MeasTableMulSC1950();
00147     virtual void init();
00148     virtual void calc(Matrix<Double>&, Double time);
00149   private:
00150     Polynomial<Double> itsPoly[2*13];
00151     static const Long theirMULTD[13][5];
00152     static const Short theirMULSC[69][2];
00153   };
00154 
00155 
00156   // <summary>
00157   // Base class for J2000 nutation multipliers.
00158   // </summary>
00159   class MeasTableMulSC2000Base: public MeasTableMul
00160   {
00161   public:
00162     MeasTableMulSC2000Base();
00163   protected:
00164     void doInit(Matrix<Double>& result,
00165                 Polynomial<Double> poly[],
00166                 Int nrowSC, const Long coeffSC[][6]);
00167     void doCalc(Matrix<Double>& result, Double time,
00168                 const Polynomial<Double> poly[],
00169                 Int nrowSC);
00170   };
00171 
00172   // <summary>
00173   // Class calculating the J2000A nutation multipliers.
00174   // </summary>
00175   class MeasTableMulSC2000A: public MeasTableMulSC2000Base
00176   {
00177   public:
00178     MeasTableMulSC2000A();
00179     virtual void init();
00180     virtual void calc(Matrix<Double>&, Double time);
00181   private:
00182     Polynomial<Double> itsPoly[2*678];
00183     static const Long theirMULSC[678][6];
00184   };
00185 
00186   // <summary>
00187   // Class calculating the J2000B nutation multipliers.
00188   // </summary>
00189   class MeasTableMulSC2000B: public MeasTableMulSC2000Base
00190   {
00191   public:
00192     MeasTableMulSC2000B();
00193     virtual void init();
00194     virtual void calc(Matrix<Double>&, Double time);
00195   private:
00196     Polynomial<Double> itsPoly[2*77];
00197     static const Long theirMULSC[77][6];
00198   };
00199 
00200 
00201   // <summary>
00202   // Class calculating the standard aberration multipliers.
00203   // </summary>
00204   class MeasTableMulAber: public MeasTableMul
00205   {
00206   public:
00207     MeasTableMulAber();
00208     virtual void init();
00209     virtual void calc(Matrix<Double>&, Double time);
00210   private:
00211     Polynomial<Double> itsPoly[18];
00212     static const Long theirMABERTD[3][18];
00213     static const Short theirMABER[80][6];
00214   };
00215 
00216 
00217   // <summary>
00218   // Class calculating the B1950 aberration multipliers.
00219   // </summary>
00220   class MeasTableMulAber1950: public MeasTableMul
00221   {
00222   public:
00223     MeasTableMulAber1950();
00224     virtual void init();
00225     virtual void calc(Matrix<Double>&, Double time);
00226   private:
00227     Polynomial<Double> itsPoly[18];
00228     double itsFactor;  //# AU/d
00229     static const Short theirMABER[130][6];
00230     static const Short theirABERT1T[10];
00231     static const Short theirABERT2T[2];
00232     static const Short theirABERT3T[1];
00233     static const Double theirABERSPEC[2][6];
00234   };
00235 
00236 
00237   // <summary>
00238   // Class calculating the XY solar position multipliers.
00239   // </summary>
00240   class MeasTableMulPosSunXY: public MeasTableMul
00241   {
00242   public:
00243     MeasTableMulPosSunXY();
00244     virtual void init();
00245     virtual void calc(Matrix<Double>&, Double time);
00246   private:
00247     static const Double theirMPOSXY[98][4];
00248   };
00249 
00250   // <summary>
00251   // Class calculating the Z solar position multipliers.
00252   // </summary>
00253   class MeasTableMulPosSunZ: public MeasTableMul
00254   {
00255   public:
00256     MeasTableMulPosSunZ();
00257     virtual void init();
00258     virtual void calc(Matrix<Double>&, Double time);
00259   private:
00260     static const Double theirMPOSZ[29][2];
00261   };
00262 
00263 
00264   // <summary>
00265   // Class calculating the XY earth position multipliers.
00266   // </summary>
00267   class MeasTableMulPosEarthXY: public MeasTableMul
00268   {
00269   public:
00270     MeasTableMulPosEarthXY();
00271     virtual void init();
00272     virtual void calc(Matrix<Double>&, Double time);
00273   private:
00274     static const Double theirMPOSXY[189][4];
00275   };
00276 
00277   // <summary>
00278   // Class calculating the Z earth position multipliers.
00279   // </summary>
00280   class MeasTableMulPosEarthZ: public MeasTableMul
00281   {
00282   public:
00283     MeasTableMulPosEarthZ();
00284     virtual void init();
00285     virtual void calc(Matrix<Double>&, Double time);
00286   private:
00287     static const Double theirMPOSZ[32][2];
00288   };
00289 
00290 
00291 } //# end namespace
00292 
00293 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1