10 #ifndef LOFAR_PARMDB_AXIS_H
11 #define LOFAR_PARMDB_AXIS_H
32 typedef std::shared_ptr<Axis>
ShPtr;
80 std::pair<double, double>
range()
const {
81 return std::make_pair(
start(),
end());
91 std::pair<size_t, bool>
find(
double x,
bool biasRight =
true,
92 size_t start = 0)
const;
95 size_t locate(
double x,
bool biasRight =
true,
size_t start = 0)
const {
96 std::pair<size_t, bool> res =
find(x, biasRight,
start);
97 if (!res.second) throwNotFound(x);
145 const std::vector<double>& high);
154 void throwNotFound(
double x)
const;
160 void setup(
const std::vector<double>& v1,
const std::vector<double>& v2,
182 bool asStartEnd =
false);
219 OrderedAxis(
const std::vector<double>& v1,
const std::vector<double>& v2,
220 bool asStartEnd =
false);
Input stream for a blob.
Definition: BlobIStream.h:43
Output stream for a blob.
Definition: BlobOStream.h:40
Interface for classes that can be streamed using blobs.
Definition: BlobStreamable.h:25
Classes representing a regular or irregular axis.
Definition: Axis.h:29
std::vector< double > itsCenter
Definition: Axis.h:168
void setup(const std::vector< double > &v1, const std::vector< double > &v2, bool asStartEnd)
Set up the object for an irregular axis.
std::shared_ptr< Axis > ShPtr
Define a shared_ptr for this class.
Definition: Axis.h:32
Axis::ShPtr combine(const Axis &that, int &s1, int &e1, int &s2, int &e2) const
Axis::ShPtr subset(size_t start, size_t end) const
Make a subset of the axis for the given start/end index.
Definition: Axis.h:112
double upper(size_t n) const
Definition: Axis.h:55
Axis::ShPtr subset(double start, double end, size_t &index) const
Axis()
The constructor sets the unique id.
double center(size_t n) const
Definition: Axis.h:53
static unsigned int theirId
Unique seqnr of an Axis object. Used in class AxisMapping.
Definition: Axis.h:164
void read(blob::BlobIStream &bis) override=0
Read the contents from the blob input stream bis into *this.
const std::vector< double > & centers() const
Definition: Axis.h:61
const std::vector< double > & uppers() const
Definition: Axis.h:63
bool operator==(const Axis &that) const
unsigned int itsId
Definition: Axis.h:166
~Axis() override
Definition: Axis.h:37
double start() const
Definition: Axis.h:75
size_t size() const
Get nr of cells.
Definition: Axis.h:71
std::pair< double, double > range() const
Get the total range of the axis.
Definition: Axis.h:80
void write(blob::BlobOStream &bos) const override=0
Write the contents of *this into the blob output stream bos.
Axis::ShPtr subset(double start, double end) const
const std::string & classType() const override=0
Return the type of *this as a string.
virtual Axis::ShPtr clone() const =0
Clone the object.
virtual Axis::ShPtr compress(size_t factor) const =0
Compress the axis.
unsigned int getId() const
Get the unique axis id.
Definition: Axis.h:49
std::vector< double > itsUpper
Definition: Axis.h:171
std::vector< double > itsWidth
Definition: Axis.h:169
static Axis::ShPtr makeAxis(const std::vector< double > &low, const std::vector< double > &high)
bool isRegular() const
Is the axis regular?
Definition: Axis.h:68
double lower(size_t n) const
Definition: Axis.h:56
bool operator!=(const Axis &that) const
Definition: Axis.h:45
bool checkIntervals(const Axis &that) const
Check if the corresponding intervals in this and that axis are the same.
double end() const
Definition: Axis.h:76
const std::vector< double > & widths() const
Definition: Axis.h:62
double width(size_t n) const
Definition: Axis.h:54
std::vector< double > itsLower
Definition: Axis.h:170
bool itsIsRegular
Definition: Axis.h:167
const std::vector< double > & lowers() const
Definition: Axis.h:64
void setup(double start, double width, unsigned int count)
Set up the object for a regular axis.
size_t locate(double x, bool biasRight=true, size_t start=0) const
Get the cellnr as above, but throw an exception if not found.
Definition: Axis.h:95
std::pair< size_t, bool > find(double x, bool biasRight=true, size_t start=0) const
Ordered irregularly strided cell centered axis. The cells are ordered and disjoint,...
Definition: Axis.h:210
OrderedAxis()
Default constructor creates one cell from -1e30 till 1e30.
OrderedAxis(const std::vector< double > &v1, const std::vector< double > &v2, bool asStartEnd=false)
void read(blob::BlobIStream &bis) override
Read the contents from the blob input stream bis into *this.
const std::string & classType() const override
Return the type of *this as a string.
Axis::ShPtr doSubset(size_t start, size_t end) const override
Axis::ShPtr clone() const override
Clone the object.
void write(blob::BlobOStream &bos) const override
Write the contents of *this into the blob output stream bos.
Axis::ShPtr compress(size_t factor) const override
Compress the axis.
Regularly strided cell centered axis.
Definition: Axis.h:175
Axis::ShPtr compress(size_t factor) const override
Compress the axis.
Axis::ShPtr clone() const override
Clone the object.
const std::string & classType() const override
Return the type of *this as a string.
RegularAxis(double begin, double cellWidth, unsigned int count, bool asStartEnd=false)
Construct giving the beginning of the axis and the width of each cell.
RegularAxis()
Default constructor creates one cell from -1e30 till 1e30.
Axis::ShPtr doSubset(size_t start, size_t end) const override
void write(blob::BlobOStream &bos) const override
Write the contents of *this into the blob output stream bos.
void read(blob::BlobIStream &bis) override
Read the contents from the blob input stream bis into *this.
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53