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