casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dyscodatacolumn.h
Go to the documentation of this file.
1 #ifndef DYSCO_DATA_COLUMN_H
2 #define DYSCO_DATA_COLUMN_H
3 
4 #include "threadeddyscocolumn.h"
5 
6 #include "stochasticencoder.h"
7 #include "timeblockencoder.h"
8 
9 namespace dyscostman {
10 
11 class DyscoStMan;
12 
18 class DyscoDataColumn final : public ThreadedDyscoColumn<std::complex<float>> {
19  public:
25  : ThreadedDyscoColumn(parent, dtype),
26  _rnd(std::random_device{}()),
27  _gausEncoder(),
30  _randomize(true) {}
31 
32  DyscoDataColumn(const DyscoDataColumn &source) = delete;
33 
34  void operator=(const DyscoDataColumn &source) = delete;
35 
37  virtual ~DyscoDataColumn() { shutdown(); }
38 
39  virtual void Prepare(DyscoDistribution distribution,
40  Normalization normalization, double studentsTNu,
41  double distributionTruncation) override;
42 
44  std::cout
45  << "Warning: Initializing random number generator with static seed!\n";
46  _rnd = std::mt19937();
47  _randomize = false;
48  }
49 
50  protected:
51  virtual void initializeDecode(TimeBlockBuffer<data_t> *buffer,
52  const float *metaBuffer, size_t nRow,
53  size_t nAntennae) override;
54 
55  virtual void decode(TimeBlockBuffer<data_t> *buffer, const symbol_t *data,
56  size_t blockRow, size_t a1, size_t a2) override;
57 
58  virtual std::unique_ptr<ThreadDataBase> initializeEncodeThread() override;
59 
60  virtual void encode(ThreadDataBase *threadData,
61  TimeBlockBuffer<data_t> *buffer, float *metaBuffer,
62  symbol_t *symbolBuffer, size_t nAntennae) override;
63 
64  virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations,
65  size_t nChannels,
66  size_t nAntennae) const override;
67 
68  virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations,
69  size_t nChannels) const override;
70 
71  virtual size_t defaultThreadCount() const override;
72 
73  private:
74  struct ThreadData final : public ThreadDataBase {
75  ThreadData(std::unique_ptr<TimeBlockEncoder> timeBlockEncoder)
76  : encoder(std::move(timeBlockEncoder)) {}
77  std::unique_ptr<TimeBlockEncoder> encoder;
78  std::mt19937 rnd;
79  };
80 
81  std::mt19937 _rnd;
82  std::unique_ptr<StochasticEncoder<float>> _gausEncoder;
83  std::unique_ptr<TimeBlockEncoder> _decoder;
86  double _studentsTNu;
87  bool _randomize;
88 };
89 
90 } // namespace dyscostman
91 
92 #endif
std::unique_ptr< StochasticEncoder< float > > _gausEncoder
virtual void shutdown() overridefinal
To be called before destructing the class.
virtual void initializeDecode(TimeBlockBuffer< data_t > *buffer, const float *metaBuffer, size_t nRow, size_t nAntennae) override
DyscoDistribution _distribution
void operator=(const DyscoDataColumn &source)=delete
A column for storing compressed values in a threaded way, tailored for the data and weight columns th...
virtual void Prepare(DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation) override
std::unique_ptr< TimeBlockEncoder > encoder
virtual void encode(ThreadDataBase *threadData, TimeBlockBuffer< data_t > *buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t nAntennae) override
virtual void decode(TimeBlockBuffer< data_t > *buffer, const symbol_t *data, size_t blockRow, size_t a1, size_t a2) override
virtual ~DyscoDataColumn()
Destructor.
A column for storing compressed complex values with an approximate Gaussian distribution.
std::unique_ptr< TimeBlockEncoder > _decoder
DataType dtype() const
virtual size_t defaultThreadCount() const override
virtual std::unique_ptr< ThreadDataBase > initializeEncodeThread() override
ThreadData(std::unique_ptr< TimeBlockEncoder > timeBlockEncoder)
DyscoDataColumn(DyscoStMan *parent, int dtype)
Create a new column.
virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations, size_t nChannels, size_t nAntennae) const override
virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations, size_t nChannels) const override
The main class for the Dysco storage manager.
Definition: dyscostman.h:46