casacore
MeasTableMul.h
Go to the documentation of this file.
1 //# MeasTableMul.h: Nutation multiplication coefficient for MeasTable
2 //# Copyright (C) 1995-1999,2000-2004
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: MeasTable.h 21420 2014-03-19 09:18:51Z gervandiepen $
28 
29 #ifndef MEASURES_MEASTABLEMUL_H
30 #define MEASURES_MEASTABLEMUL_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/scimath/Functionals/Polynomial.h>
35 #include <casacore/casa/Arrays/Matrix.h>
36 #include <casacore/casa/OS/Mutex.h>
37 #include <casacore/casa/Utilities/CountedPtr.h>
38 #include <vector>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42  //# Forward Declarations
43  class RotMatrix;
44  class Euler;
45 
46  // <summary>
47  // MeasTableMul provides thread-safe access to time-dependent multiplier matrices
48  // </summary>
49 
50  // <use visibility=local>
51 
52  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasMath" demos="">
53  // </reviewed>
54 
55  // <synopsis>
56  // MeasTableMul is a helper class for MeasTable to provide thread-safe
57  // access to the various multiplier matrices for nutation, aberration, and
58  // solar position. These matrices are dependent on the epoch.
59  //
60  // It is an abstract base class for specific derived classes dealing with
61  // the various effects. This base class provides a cache to keep the matrices
62  // for various epochs alive. The idea is that a program will process epochs
63  // in order, where multiple threads can handle different epochs.
64  // <br>When the cache is full, the least recently used entry is replaced by
65  // the new matrix.
66  //
67  // The cache does not hold <src>Matrix</src> objects themselves, but a
68  // <src>CountedPtr<Matrix></src> to avoid that in one thread a Matrix is
69  // removed from the cache, while another thread is still using that Matrix.
70  // This assumes that CountedPtr is compiled thread-safe.
71  //
72  // The class provides two virtual functions.
73  // <ul>
74  // <li> <src>init</src> is called on the first access and makes it possible
75  // for the derived class to precompute some variables. In particular,
76  // <src>itsDefMatrix</src> should be filled with default values.
77  // <li> <src>calc</src> is called on each access and should return the
78  // matrix valid for the given epoch. Prior to calling this function,
79  // the class will copy <src>itsDefMatrix</src> to the result which
80  // also defines the shape of the result.
81  // Note that this function is only called if the matrix for the given
82  // epoch is not in the cache.
83  // </ul>
84  // </synopsis>
85  //
86  // <example>
87  // Class MeasTable shows how it is used.
88  // </example>
89 
91  {
92  public:
94  virtual ~MeasTableMul() {}
95  void clear();
97  virtual void init() = 0;
98  virtual void calc(Matrix<Double>&, Double time) = 0;
99  protected:
102  std::vector<Int64> itsUsed;
103  std::vector<Double> itsTimes;
104  std::vector<CountedPtr<Matrix<Double> > > itsArrays;
106  };
107 
108 
109  // <summary>
110  // Base class for standard and B1950 nutation multipliers.
111  // </summary>
113  {
114  public:
116  protected:
117  void doInit(Matrix<Double>& result,
118  Polynomial<Double> poly[],
119  Int nrowTD, const Long coeffTD[][5],
120  Int nrowSC, const Short coeffSC[][2]);
122  const Polynomial<Double> poly[],
123  Int nrowTD, const Long coeffTD[][5]);
124  };
125 
126  // <summary>
127  // Class calculating the standard nutation multipliers.
128  // </summary>
130  {
131  public:
133  virtual void init();
134  virtual void calc(Matrix<Double>&, Double time);
135  private:
137  static const Long theirMULTD[15][5];
138  static const Short theirMULSC[106][2];
139  };
140 
141  // <summary>
142  // Class calculating the B1950 nutation multipliers.
143  // </summary>
145  {
146  public:
148  virtual void init();
149  virtual void calc(Matrix<Double>&, Double time);
150  private:
152  static const Long theirMULTD[13][5];
153  static const Short theirMULSC[69][2];
154  };
155 
156 
157  // <summary>
158  // Base class for J2000 nutation multipliers.
159  // </summary>
161  {
162  public:
164  protected:
165  void doInit(Matrix<Double>& result,
166  Polynomial<Double> poly[],
167  Int nrowSC, const Long coeffSC[][6]);
169  const Polynomial<Double> poly[],
170  Int nrowSC);
171  };
172 
173  // <summary>
174  // Class calculating the J2000A nutation multipliers.
175  // </summary>
177  {
178  public:
180  virtual void init();
181  virtual void calc(Matrix<Double>&, Double time);
182  private:
184  static const Long theirMULSC[678][6];
185  };
186 
187  // <summary>
188  // Class calculating the J2000B nutation multipliers.
189  // </summary>
191  {
192  public:
194  virtual void init();
195  virtual void calc(Matrix<Double>&, Double time);
196  private:
198  static const Long theirMULSC[77][6];
199  };
200 
201 
202  // <summary>
203  // Class calculating the standard aberration multipliers.
204  // </summary>
206  {
207  public:
209  virtual void init();
210  virtual void calc(Matrix<Double>&, Double time);
211  private:
213  static const Long theirMABERTD[3][18];
214  static const Short theirMABER[80][6];
215  };
216 
217 
218  // <summary>
219  // Class calculating the B1950 aberration multipliers.
220  // </summary>
222  {
223  public:
225  virtual void init();
226  virtual void calc(Matrix<Double>&, Double time);
227  private:
229  double itsFactor; //# AU/d
230  static const Short theirMABER[130][6];
231  static const Short theirABERT1T[10];
232  static const Short theirABERT2T[2];
233  static const Short theirABERT3T[1];
234  static const Double theirABERSPEC[2][6];
235  };
236 
237 
238  // <summary>
239  // Class calculating the XY solar position multipliers.
240  // </summary>
242  {
243  public:
245  virtual void init();
246  virtual void calc(Matrix<Double>&, Double time);
247  private:
248  static const Double theirMPOSXY[98][4];
249  };
250 
251  // <summary>
252  // Class calculating the Z solar position multipliers.
253  // </summary>
255  {
256  public:
258  virtual void init();
259  virtual void calc(Matrix<Double>&, Double time);
260  private:
261  static const Double theirMPOSZ[29][2];
262  };
263 
264 
265  // <summary>
266  // Class calculating the XY earth position multipliers.
267  // </summary>
269  {
270  public:
272  virtual void init();
273  virtual void calc(Matrix<Double>&, Double time);
274  private:
275  static const Double theirMPOSXY[189][4];
276  };
277 
278  // <summary>
279  // Class calculating the Z earth position multipliers.
280  // </summary>
282  {
283  public:
285  virtual void init();
286  virtual void calc(Matrix<Double>&, Double time);
287  private:
288  static const Double theirMPOSZ[32][2];
289  };
290 
291 
292 } //# end namespace
293 
294 #endif
Referenced counted pointer for constant data.
Definition: CountedPtr.h:81
Class calculating the B1950 aberration multipliers.
Definition: MeasTableMul.h:222
Polynomial< Double > itsPoly[18]
Definition: MeasTableMul.h:228
static const Short theirABERT2T[2]
Definition: MeasTableMul.h:232
virtual void calc(Matrix< Double > &, Double time)
static const Short theirABERT3T[1]
Definition: MeasTableMul.h:233
static const Short theirABERT1T[10]
Definition: MeasTableMul.h:231
static const Double theirABERSPEC[2][6]
Definition: MeasTableMul.h:234
static const Short theirMABER[130][6]
Definition: MeasTableMul.h:230
Class calculating the standard aberration multipliers.
Definition: MeasTableMul.h:206
Polynomial< Double > itsPoly[18]
Definition: MeasTableMul.h:212
virtual void calc(Matrix< Double > &, Double time)
static const Short theirMABER[80][6]
Definition: MeasTableMul.h:214
static const Long theirMABERTD[3][18]
Definition: MeasTableMul.h:213
Class calculating the XY earth position multipliers.
Definition: MeasTableMul.h:269
virtual void calc(Matrix< Double > &, Double time)
static const Double theirMPOSXY[189][4]
Definition: MeasTableMul.h:275
Class calculating the Z earth position multipliers.
Definition: MeasTableMul.h:282
virtual void calc(Matrix< Double > &, Double time)
static const Double theirMPOSZ[32][2]
Definition: MeasTableMul.h:288
Class calculating the XY solar position multipliers.
Definition: MeasTableMul.h:242
virtual void calc(Matrix< Double > &, Double time)
static const Double theirMPOSXY[98][4]
Definition: MeasTableMul.h:248
Class calculating the Z solar position multipliers.
Definition: MeasTableMul.h:255
static const Double theirMPOSZ[29][2]
Definition: MeasTableMul.h:261
virtual void calc(Matrix< Double > &, Double time)
Class calculating the B1950 nutation multipliers.
Definition: MeasTableMul.h:145
Polynomial< Double > itsPoly[2 *13]
Definition: MeasTableMul.h:151
virtual void calc(Matrix< Double > &, Double time)
static const Short theirMULSC[69][2]
Definition: MeasTableMul.h:153
static const Long theirMULTD[13][5]
Definition: MeasTableMul.h:152
Class calculating the J2000A nutation multipliers.
Definition: MeasTableMul.h:177
Polynomial< Double > itsPoly[2 *678]
Definition: MeasTableMul.h:183
static const Long theirMULSC[678][6]
Definition: MeasTableMul.h:184
virtual void calc(Matrix< Double > &, Double time)
Class calculating the J2000B nutation multipliers.
Definition: MeasTableMul.h:191
Polynomial< Double > itsPoly[2 *77]
Definition: MeasTableMul.h:197
static const Long theirMULSC[77][6]
Definition: MeasTableMul.h:198
virtual void calc(Matrix< Double > &, Double time)
Base class for J2000 nutation multipliers.
Definition: MeasTableMul.h:161
void doInit(Matrix< Double > &result, Polynomial< Double > poly[], Int nrowSC, const Long coeffSC[][6])
void doCalc(Matrix< Double > &result, Double time, const Polynomial< Double > poly[], Int nrowSC)
Base class for standard and B1950 nutation multipliers.
Definition: MeasTableMul.h:113
void doCalc(Matrix< Double > &result, Double time, const Polynomial< Double > poly[], Int nrowTD, const Long coeffTD[][5])
void doInit(Matrix< Double > &result, Polynomial< Double > poly[], Int nrowTD, const Long coeffTD[][5], Int nrowSC, const Short coeffSC[][2])
Class calculating the standard nutation multipliers.
Definition: MeasTableMul.h:130
virtual void calc(Matrix< Double > &, Double time)
static const Short theirMULSC[106][2]
Definition: MeasTableMul.h:138
Polynomial< Double > itsPoly[2 *15]
Definition: MeasTableMul.h:136
static const Long theirMULTD[15][5]
Definition: MeasTableMul.h:137
CountedPtr< Matrix< Double > > getArray(Double time, Double epsilon)
virtual void init()=0
std::vector< Int64 > itsUsed
Definition: MeasTableMul.h:102
virtual void calc(Matrix< Double > &, Double time)=0
std::vector< Double > itsTimes
Definition: MeasTableMul.h:103
std::vector< CountedPtr< Matrix< Double > > > itsArrays
Definition: MeasTableMul.h:104
Matrix< Double > itsDefArray
Definition: MeasTableMul.h:105
this file contains all the compiler specific defines
Definition: mainpage.dox:28
long Long
Definition: aipstype.h:52
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1580
short Short
Definition: aipstype.h:48
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:50
double Double
Definition: aipstype.h:55