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
|
#ifndef MSPROVIDERS_TIMESTEP_BUFFER_H
#define MSPROVIDERS_TIMESTEP_BUFFER_H
#include "msprovider.h"
#include <aocommon/uvector.h>
namespace wsclean {
class TimestepBufferReader;
/**
* This class wraps any MSProvider to make it read whole blocks of rows
* at once that correspond to the same timestep.
*
* This is used in IDGMSGridder to be able to get the UVWs for calculating the
* a-terms.
*/
class TimestepBuffer final : public MSProvider {
friend class TimestepBufferReader;
public:
TimestepBuffer(MSProvider* ms_provider, bool read_model)
: ms_provider_(ms_provider), read_model_(read_model) {
ms_provider_->ResetWritePosition();
}
virtual ~TimestepBuffer(){};
std::unique_ptr<MSReader> MakeReader() final;
void NextOutputRow() final { ms_provider_->NextOutputRow(); }
void ResetWritePosition() final { ms_provider_->ResetWritePosition(); }
virtual void WriteModel(const std::complex<float>* buffer,
bool addToMS) final {
ms_provider_->WriteModel(buffer, addToMS);
}
void ReopenRW() final { ms_provider_->ReopenRW(); }
double StartTime() final { return ms_provider_->StartTime(); }
aocommon::PolarizationEnum Polarization() final {
return ms_provider_->Polarization();
}
bool IsRegular() const final { return ms_provider_->IsRegular(); }
bool HasFrequencyBda() const override {
return ms_provider_->HasFrequencyBda();
}
size_t NMaxChannels() final { return ms_provider_->NMaxChannels(); }
size_t NAntennas() final { return ms_provider_->NAntennas(); }
size_t NPolarizations() final { return ms_provider_->NPolarizations(); }
size_t NRows() final { return ms_provider_->NRows(); }
double Interval() final { return ms_provider_->Interval(); }
ObservationInfo GetObservationInfo() final {
return ms_provider_->GetObservationInfo();
}
std::vector<std::string> GetAntennaNames() final {
return ms_provider_->GetAntennaNames();
}
const aocommon::MultiBandData& SelectedBands() final {
return ms_provider_->SelectedBands();
}
std::optional<SynchronizedMS> MsIfAvailable() final {
return ms_provider_->MsIfAvailable();
}
std::string PartDescription() const final {
return ms_provider_->PartDescription();
}
private:
struct RowData {
std::vector<std::complex<float>> data;
std::vector<std::complex<float>> model;
std::vector<float> weights;
MSProvider::MetaData metadata;
size_t row_id;
};
MSProvider* ms_provider_;
bool read_model_;
};
} // namespace wsclean
#endif
|