10 #ifndef LOFAR_PARMDB_AXIS_H
11 #define LOFAR_PARMDB_AXIS_H
30 typedef std::shared_ptr<Axis>
ShPtr;
77 std::pair<double, double>
range()
const {
78 return std::make_pair(
start(),
end());
88 std::pair<size_t, bool>
find(
double x,
bool biasRight =
true,
89 size_t start = 0)
const;
92 size_t locate(
double x,
bool biasRight =
true,
size_t start = 0)
const {
93 std::pair<size_t, bool> res =
find(x, biasRight,
start);
94 if (!res.second) throwNotFound(x);
133 const std::vector<double>& high);
142 void throwNotFound(
double x)
const;
148 void setup(
const std::vector<double>& v1,
const std::vector<double>& v2,
170 bool asStartEnd =
false);
198 OrderedAxis(
const std::vector<double>& v1,
const std::vector<double>& v2,
199 bool asStartEnd =
false);
Classes representing a regular or irregular axis.
Definition: Axis.h:27
std::vector< double > itsCenter
Definition: Axis.h:156
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:30
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:109
double upper(size_t n) const
Definition: Axis.h:52
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:50
static unsigned int theirId
Unique seqnr of an Axis object. Used in class AxisMapping.
Definition: Axis.h:152
const std::vector< double > & centers() const
Definition: Axis.h:58
virtual ~Axis()
Definition: Axis.h:34
const std::vector< double > & uppers() const
Definition: Axis.h:60
bool operator==(const Axis &that) const
unsigned int itsId
Definition: Axis.h:154
double start() const
Definition: Axis.h:72
size_t size() const
Get nr of cells.
Definition: Axis.h:68
std::pair< double, double > range() const
Get the total range of the axis.
Definition: Axis.h:77
Axis::ShPtr subset(double start, double end) const
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:46
std::vector< double > itsUpper
Definition: Axis.h:159
std::vector< double > itsWidth
Definition: Axis.h:157
static Axis::ShPtr makeAxis(const std::vector< double > &low, const std::vector< double > &high)
bool isRegular() const
Is the axis regular?
Definition: Axis.h:65
double lower(size_t n) const
Definition: Axis.h:53
bool operator!=(const Axis &that) const
Definition: Axis.h:42
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:73
const std::vector< double > & widths() const
Definition: Axis.h:59
double width(size_t n) const
Definition: Axis.h:51
std::vector< double > itsLower
Definition: Axis.h:158
bool itsIsRegular
Definition: Axis.h:155
const std::vector< double > & lowers() const
Definition: Axis.h:61
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:92
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:189
OrderedAxis()
Default constructor creates one cell from -1e30 till 1e30.
OrderedAxis(const std::vector< double > &v1, const std::vector< double > &v2, bool asStartEnd=false)
Axis::ShPtr doSubset(size_t start, size_t end) const override
Axis::ShPtr clone() const override
Clone the object.
Axis::ShPtr compress(size_t factor) const override
Compress the axis.
Regularly strided cell centered axis.
Definition: Axis.h:163
Axis::ShPtr compress(size_t factor) const override
Compress the axis.
Axis::ShPtr clone() const override
Clone the object.
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
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53