|
DP3
|
Classes representing a regular or irregular axis. More...
#include <Axis.h>
Public Types | |
| typedef std::shared_ptr< Axis > | ShPtr |
| Define a shared_ptr for this class. More... | |
Public Member Functions | |
| Axis () | |
| The constructor sets the unique id. More... | |
| ~Axis () override | |
| bool | checkIntervals (const Axis &that) const |
| Check if the corresponding intervals in this and that axis are the same. More... | |
| const std::string & | classType () const override=0 |
Return the type of *this as a string. More... | |
| virtual Axis::ShPtr | clone () const =0 |
| Clone the object. More... | |
| Axis::ShPtr | combine (const Axis &that, int &s1, int &e1, int &s2, int &e2) const |
| virtual Axis::ShPtr | compress (size_t factor) const =0 |
| Compress the axis. More... | |
| std::pair< size_t, bool > | find (double x, bool biasRight=true, size_t start=0) const |
| unsigned int | getId () const |
| Get the unique axis id. More... | |
| bool | isRegular () const |
| Is the axis regular? More... | |
| 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. More... | |
| std::pair< double, double > | range () const |
| Get the total range of the axis. More... | |
| void | read (blob::BlobIStream &bis) override=0 |
Read the contents from the blob input stream bis into *this. More... | |
| size_t | size () const |
| Get nr of cells. More... | |
| Axis::ShPtr | subset (size_t start, size_t end) const |
| Make a subset of the axis for the given start/end index. More... | |
| void | write (blob::BlobOStream &bos) const override=0 |
Write the contents of *this into the blob output stream bos. More... | |
| bool | operator== (const Axis &that) const |
| bool | operator!= (const Axis &that) const |
| double | center (size_t n) const |
| double | width (size_t n) const |
| double | upper (size_t n) const |
| double | lower (size_t n) const |
| const std::vector< double > & | centers () const |
| const std::vector< double > & | widths () const |
| const std::vector< double > & | uppers () const |
| const std::vector< double > & | lowers () const |
| double | start () const |
| double | end () const |
| Axis::ShPtr | subset (double start, double end, size_t &index) const |
| Axis::ShPtr | subset (double start, double end) const |
Public Member Functions inherited from dp3::blob::BlobStreamable | |
| virtual | ~BlobStreamable () |
| Destructor. More... | |
| void | serialize (BlobOStream &bos) const |
Static Public Member Functions | |
| static Axis::ShPtr | makeAxis (const std::vector< double > &low, const std::vector< double > &high) |
Static Public Member Functions inherited from dp3::blob::BlobStreamable | |
| static BlobStreamable * | deserialize (BlobIStream &bis) |
Protected Member Functions | |
| void | setup (const std::vector< double > &v1, const std::vector< double > &v2, bool asStartEnd) |
| Set up the object for an irregular axis. More... | |
| void | setup (double start, double width, unsigned int count) |
| Set up the object for a regular axis. More... | |
Protected Attributes | |
| std::vector< double > | itsCenter |
| unsigned int | itsId |
| bool | itsIsRegular |
| std::vector< double > | itsLower |
| std::vector< double > | itsUpper |
| std::vector< double > | itsWidth |
Static Protected Attributes | |
| static unsigned int | theirId |
| Unique seqnr of an Axis object. Used in class AxisMapping. More... | |
Classes representing a regular or irregular axis.
Abstract base class for a cell centered axis.
| typedef std::shared_ptr<Axis> dp3::parmdb::Axis::ShPtr |
Define a shared_ptr for this class.
| dp3::parmdb::Axis::Axis | ( | ) |
The constructor sets the unique id.
|
inlineoverride |
|
inline |
Get the center, etc. of the i-th cell.
|
inline |
Get all centers, etc.
| bool dp3::parmdb::Axis::checkIntervals | ( | const Axis & | that | ) | const |
Check if the corresponding intervals in this and that axis are the same.
|
overridepure virtual |
Return the type of *this as a string.
Implements dp3::blob::BlobStreamable.
Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.
|
pure virtual |
Clone the object.
Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.
| Axis::ShPtr dp3::parmdb::Axis::combine | ( | const Axis & | that, |
| int & | s1, | ||
| int & | e1, | ||
| int & | s2, | ||
| int & | e2 | ||
| ) | const |
Return the union of this and that axis. If checks if matching intervals are the same. It fills s1,e1 with the first and last index of this axis in the new one. Similarly s2,e2 are filled for that axis. Note the e1 and e2 are one past the end. The returned object is a RegularAxis if all intervals in the result are consecutive and have the same width, otherwise the result is an OrderedAxis.
|
pure virtual |
Compress the axis.
Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.
|
inline |
| std::pair<size_t, bool> dp3::parmdb::Axis::find | ( | double | x, |
| bool | biasRight = true, |
||
| size_t | start = 0 |
||
| ) | const |
Get the cellnr of the cell containing value x. If x is right on the edge, biasRight tells if the left or right cell is taken. As a search hint one can tell where to start the search (usually the result of the previous locate). If the cell is not found, it returns the cellnr of the next higher cell and sets the bool to false.
|
inline |
Get the unique axis id.
|
inline |
Is the axis regular?
|
inline |
Get the cellnr as above, but throw an exception if not found.
|
inline |
|
inline |
|
static |
Make an Axis object from the intervals defined by the low/upp values. If all intervals have the same width, a RegularAxis object is made. Otherwise an OrderedAxis object. The intervals must be consecutive.
It checks if both vectors have equal length.
|
inline |
| bool dp3::parmdb::Axis::operator== | ( | const Axis & | that | ) | const |
Check if two axes are equal. They are if they the same type and values.
|
inline |
Get the total range of the axis.
|
overridepure virtual |
Read the contents from the blob input stream bis into *this.
Implements dp3::blob::BlobStreamable.
Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.
|
protected |
Set up the object for an irregular axis.
|
protected |
Set up the object for a regular axis.
|
inline |
Get nr of cells.
|
inline |
Get the start and end value.
| Axis::ShPtr dp3::parmdb::Axis::subset | ( | double | start, |
| double | end | ||
| ) | const |
| Axis::ShPtr dp3::parmdb::Axis::subset | ( | double | start, |
| double | end, | ||
| size_t & | index | ||
| ) | const |
Make a subset of the axis for the given start/end value. It fills the index of the starting point of the subset on the axis.
|
inline |
Make a subset of the axis for the given start/end index.
|
inline |
|
inline |
|
inline |
|
inline |
|
overridepure virtual |
Write the contents of *this into the blob output stream bos.
Implements dp3::blob::BlobStreamable.
Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
Unique seqnr of an Axis object. Used in class AxisMapping.