casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MEASURES_MEASTABLEMUL_H
27#define MEASURES_MEASTABLEMUL_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/scimath/Functionals/Polynomial.h>
32#include <casacore/casa/Arrays/Matrix.h>
33
34#include <mutex>
35#include <vector>
36#include <memory>
37
38namespace casacore { // # NAMESPACE CASACORE - BEGIN
39
40// # Forward Declarations
41class RotMatrix;
42class Euler;
43
44// <summary>
45// MeasTableMul provides thread-safe access to time-dependent multiplier matrices
46// </summary>
47
48// <use visibility=local>
49
50// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasMath" demos="">
51// </reviewed>
52
53// <synopsis>
54// MeasTableMul is a helper class for MeasTable to provide thread-safe
55// access to the various multiplier matrices for nutation, aberration, and
56// solar position. These matrices are dependent on the epoch.
57//
58// It is an abstract base class for specific derived classes dealing with
59// the various effects. This base class provides a cache to keep the matrices
60// for various epochs alive. The idea is that a program will process epochs
61// in order, where multiple threads can handle different epochs.
62// <br>When the cache is full, the least recently used entry is replaced by
63// the new matrix.
64//
65// The cache does not hold <src>Matrix</src> objects themselves, but a
66// <src>std::shared_ptr<Matrix></src> to avoid that in one thread a Matrix is
67// removed from the cache, while another thread is still using that Matrix.
68// This assumes that std::shared_ptr is compiled thread-safe.
69//
70// The class provides two virtual functions.
71// <ul>
72// <li> <src>init</src> is called on the first access and makes it possible
73// for the derived class to precompute some variables. In particular,
74// <src>itsDefMatrix</src> should be filled with default values.
75// <li> <src>calc</src> is called on each access and should return the
76// matrix valid for the given epoch. Prior to calling this function,
77// the class will copy <src>itsDefMatrix</src> to the result which
78// also defines the shape of the result.
79// Note that this function is only called if the matrix for the given
80// epoch is not in the cache.
81// </ul>
82// </synopsis>
83//
84// <example>
85// Class MeasTable shows how it is used.
86// </example>
87
89 public:
91 virtual ~MeasTableMul() {}
92 void clear();
93 std::shared_ptr<Matrix<Double>> getArray(Double time, Double epsilon);
94 virtual void init() = 0;
95 virtual void calc(Matrix<Double>&, Double time) = 0;
96
97 protected:
98 std::mutex itsMutex;
100 std::vector<Int64> itsUsed;
101 std::vector<Double> itsTimes;
102 std::vector<std::shared_ptr<Matrix<Double>>> itsArrays;
104};
105
106// <summary>
107// Base class for standard and B1950 nutation multipliers.
108// </summary>
110 public:
112
113 protected:
114 void doInit(Matrix<Double>& result, Polynomial<Double> poly[], Int nrowTD,
115 const Long coeffTD[][5], Int nrowSC, const Short coeffSC[][2]);
116 void doCalc(Matrix<Double>& result, Double time, const Polynomial<Double> poly[], Int nrowTD,
117 const Long coeffTD[][5]);
118};
119
120// <summary>
121// Class calculating the standard nutation multipliers.
122// </summary>
124 public:
126 virtual void init();
128
129 private:
131 static const Long theirMULTD[15][5];
132 static const Short theirMULSC[106][2];
133};
134
135// <summary>
136// Class calculating the B1950 nutation multipliers.
137// </summary>
139 public:
141 virtual void init();
143
144 private:
146 static const Long theirMULTD[13][5];
147 static const Short theirMULSC[69][2];
148};
149
150// <summary>
151// Base class for J2000 nutation multipliers.
152// </summary>
154 public:
156
157 protected:
158 void doInit(Matrix<Double>& result, Polynomial<Double> poly[], Int nrowSC,
159 const Long coeffSC[][6]);
160 void doCalc(Matrix<Double>& result, Double time, const Polynomial<Double> poly[], Int nrowSC);
161};
162
163// <summary>
164// Class calculating the J2000A nutation multipliers.
165// </summary>
167 public:
169 virtual void init();
171
172 private:
174 static const Long theirMULSC[678][6];
175};
176
177// <summary>
178// Class calculating the J2000B nutation multipliers.
179// </summary>
181 public:
183 virtual void init();
185
186 private:
188 static const Long theirMULSC[77][6];
189};
190
191// <summary>
192// Class calculating the standard aberration multipliers.
193// </summary>
195 public:
197 virtual void init();
199
200 private:
202 static const Long theirMABERTD[3][18];
203 static const Short theirMABER[80][6];
204};
205
206// <summary>
207// Class calculating the B1950 aberration multipliers.
208// </summary>
210 public:
212 virtual void init();
214
215 private:
217 double itsFactor; // # AU/d
218 static const Short theirMABER[130][6];
219 static const Short theirABERT1T[10];
220 static const Short theirABERT2T[2];
221 static const Short theirABERT3T[1];
222 static const Double theirABERSPEC[2][6];
223};
224
225// <summary>
226// Class calculating the XY solar position multipliers.
227// </summary>
229 public:
231 virtual void init();
233
234 private:
235 static const Double theirMPOSXY[98][4];
236};
237
238// <summary>
239// Class calculating the Z solar position multipliers.
240// </summary>
242 public:
244 virtual void init();
246
247 private:
248 static const Double theirMPOSZ[29][2];
249};
250
251// <summary>
252// Class calculating the XY earth position multipliers.
253// </summary>
255 public:
257 virtual void init();
259
260 private:
261 static const Double theirMPOSXY[189][4];
262};
263
264// <summary>
265// Class calculating the Z earth position multipliers.
266// </summary>
268 public:
270 virtual void init();
272
273 private:
274 static const Double theirMPOSZ[32][2];
275};
276
277} // namespace casacore
278
279#endif
Polynomial< Double > itsPoly[18]
static const Short theirABERT2T[2]
virtual void calc(Matrix< Double > &, Double time)
static const Short theirABERT3T[1]
static const Short theirABERT1T[10]
static const Double theirABERSPEC[2][6]
static const Short theirMABER[130][6]
Polynomial< Double > itsPoly[18]
virtual void calc(Matrix< Double > &, Double time)
static const Short theirMABER[80][6]
static const Long theirMABERTD[3][18]
virtual void calc(Matrix< Double > &, Double time)
static const Double theirMPOSXY[189][4]
virtual void calc(Matrix< Double > &, Double time)
static const Double theirMPOSZ[32][2]
virtual void calc(Matrix< Double > &, Double time)
static const Double theirMPOSXY[98][4]
static const Double theirMPOSZ[29][2]
virtual void calc(Matrix< Double > &, Double time)
Polynomial< Double > itsPoly[2 *13]
virtual void calc(Matrix< Double > &, Double time)
static const Short theirMULSC[69][2]
static const Long theirMULTD[13][5]
Polynomial< Double > itsPoly[2 *678]
static const Long theirMULSC[678][6]
virtual void calc(Matrix< Double > &, Double time)
Polynomial< Double > itsPoly[2 *77]
static const Long theirMULSC[77][6]
virtual void calc(Matrix< Double > &, Double time)
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)
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])
virtual void calc(Matrix< Double > &, Double time)
static const Short theirMULSC[106][2]
Polynomial< Double > itsPoly[2 *15]
static const Long theirMULTD[15][5]
virtual void init()=0
std::vector< Int64 > itsUsed
std::vector< std::shared_ptr< Matrix< Double > > > itsArrays
virtual void calc(Matrix< Double > &, Double time)=0
std::vector< Double > itsTimes
Matrix< Double > itsDefArray
std::shared_ptr< Matrix< Double > > getArray(Double time, Double epsilon)
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
long Long
Definition aipstype.h:50
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1368
short Short
Definition aipstype.h:46
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
int Int
Definition aipstype.h:48
double Double
Definition aipstype.h:53