File: spatialmatrixmetadata.h

package info (click to toggle)
aoflagger 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 4,232 kB
  • sloc: cpp: 61,805; python: 60; sh: 23; makefile: 8
file content (110 lines) | stat: -rw-r--r-- 2,659 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef SPATIALMATRIXMETADATA_H
#define SPATIALMATRIXMETADATA_H

#include "antennainfo.h"

class SpatialMatrixMetaData
{
	public:
		explicit SpatialMatrixMetaData(size_t antennaCount)
			: _antennaCount(antennaCount), _antennae(new AntennaInfo[antennaCount]),
				_uvw(new class UVW*[antennaCount]), _frequency(0.0), _channelIndex(0), _timeIndex(0)
		{
			for(size_t i=0;i<_antennaCount;++i)
				_uvw[i] = new class UVW[_antennaCount];
		}
		SpatialMatrixMetaData(const SpatialMatrixMetaData &source)
			: _antennaCount(source._antennaCount),
			_antennae(new AntennaInfo[_antennaCount]),
			_uvw(new class UVW*[_antennaCount]),
			_frequency(source._frequency),
			_channelIndex(source._channelIndex),
			_timeIndex(source._timeIndex)
		{
			for(size_t i=0;i<_antennaCount;++i)
			{
				_uvw[i] = new class UVW[_antennaCount];
				_antennae[i] = source._antennae[i];
				for(size_t j=0;j<_antennaCount;++j)
					_uvw[i][j] = source._uvw[i][j];
			}
		}
		~SpatialMatrixMetaData()
		{
			for(size_t i=0;i<_antennaCount;++i)
				delete[] _uvw[i];
			delete[] _uvw;
			delete[] _antennae;
		}
		SpatialMatrixMetaData& operator=(const SpatialMatrixMetaData &source)
		{
			_antennaCount = source._antennaCount;
			_antennae = new AntennaInfo[_antennaCount];
			_uvw = new class UVW*[_antennaCount];
			_frequency = source._frequency;
			_channelIndex = source._channelIndex;
			_timeIndex = source._timeIndex;

			for(size_t i=0;i<_antennaCount;++i)
			{
				_uvw[i] = new class UVW[_antennaCount];
				_antennae[i] = source._antennae[i];
				for(size_t j=0;j<_antennaCount;++j)
					_uvw[i][j] = source._uvw[i][j];
			}
			return *this;
		}
		void SetAntenna(unsigned index, const AntennaInfo &antenna)
		{
			_antennae[index] = antenna;
		}
		const AntennaInfo &Antenna(unsigned index) const
		{
			return _antennae[index];
		}
		void SetUVW(unsigned a1, unsigned a2, const class UVW &uvw)
		{
			_uvw[a2][a1] = uvw;
		}
		const class UVW &UVW(unsigned a1, unsigned a2) const
		{
			return _uvw[a2][a1];
		}
		size_t AntennaCount() const
		{
			return _antennaCount;
		}
		void SetFrequency(num_t frequency)
		{
			_frequency = frequency;
		}
		num_t Frequency() const
		{
			return _frequency;
		}
		void SetChannelIndex(size_t channelIndex)
		{
			_channelIndex = channelIndex;
		}
		size_t ChannelIndex() const
		{
			return _channelIndex;
		}
		void SetTimeIndex(size_t timeIndex)
		{
			_timeIndex = timeIndex;
		}
		size_t TimeIndex() const
		{
			return _timeIndex;
		}
	private:
		size_t _antennaCount;
		AntennaInfo *_antennae;
		class UVW **_uvw;
		num_t _frequency;
		size_t _channelIndex;
		size_t _timeIndex;
};

#endif // SPATIALMATRIXMETADATA_H