DP3
PredictBuffer.h
Go to the documentation of this file.
1 // Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 #ifndef DP3_BASE_PREDICTBUFFER_H_
5 #define DP3_BASE_PREDICTBUFFER_H_
6 
7 #include <cassert>
8 #include <complex>
9 #include <vector>
10 
11 #include <aocommon/matrix2x2.h>
12 
13 #include <EveryBeam/station.h>
14 #include <EveryBeam/telescope/telescope.h>
15 
16 namespace dp3 {
17 namespace base {
18 
20  public:
21  void Resize(size_t n_directions, size_t n_channels, size_t n_stations,
22  bool full_beam) {
23  // The full buffer is not used when Stokes I is used -- conditionally
24  // allocating full/scalar will save some memory.
25  if (full_beam) {
26  full_beam_values_.resize(n_directions);
27  for (std::vector<aocommon::MC2x2>& values : full_beam_values_)
28  values.resize(n_stations * n_channels);
29  } else {
30  scalar_beam_values_.resize(n_directions);
31  for (std::vector<std::complex<double>>& values : scalar_beam_values_)
32  values.resize(n_stations * n_channels);
33  }
34 
35  full_beam_ = full_beam;
36  n_stations_ = n_stations;
37  }
38 
39  aocommon::MC2x2* GetFullBeamValues(size_t direction_index) {
40  assert(full_beam_);
41  return full_beam_values_[direction_index].data();
42  }
43 
44  std::complex<double>* GetScalarBeamValues(size_t direction_index) {
45  assert(!full_beam_);
46  return scalar_beam_values_[direction_index].data();
47  }
48 
49  size_t NStations() const { return n_stations_; }
50 
51  private:
52  std::vector<std::vector<aocommon::MC2x2>> full_beam_values_;
53  std::vector<std::vector<std::complex<double>>> scalar_beam_values_;
54  size_t n_stations_ = 0;
55  bool full_beam_ = false;
56 };
57 
58 } // namespace base
59 } // namespace dp3
60 
61 #endif
Definition: PredictBuffer.h:19
std::complex< double > * GetScalarBeamValues(size_t direction_index)
Definition: PredictBuffer.h:44
void Resize(size_t n_directions, size_t n_channels, size_t n_stations, bool full_beam)
Definition: PredictBuffer.h:21
aocommon::MC2x2 * GetFullBeamValues(size_t direction_index)
Definition: PredictBuffer.h:39
size_t NStations() const
Definition: PredictBuffer.h:49
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53