DP3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
dp3::parmdb::Axis Class Referenceabstract

Classes representing a regular or irregular axis. More...

#include <Axis.h>

Inheritance diagram for dp3::parmdb::Axis:
dp3::blob::BlobStreamable dp3::parmdb::OrderedAxis dp3::parmdb::RegularAxis

Public Types

typedef std::shared_ptr< AxisShPtr
 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 BlobStreamabledeserialize (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...
 

Detailed Description

Classes representing a regular or irregular axis.

Abstract base class for a cell centered axis.

Member Typedef Documentation

◆ ShPtr

typedef std::shared_ptr<Axis> dp3::parmdb::Axis::ShPtr

Define a shared_ptr for this class.

Constructor & Destructor Documentation

◆ Axis()

dp3::parmdb::Axis::Axis ( )

The constructor sets the unique id.

◆ ~Axis()

dp3::parmdb::Axis::~Axis ( )
inlineoverride

Member Function Documentation

◆ center()

double dp3::parmdb::Axis::center ( size_t  n) const
inline

Get the center, etc. of the i-th cell.

◆ centers()

const std::vector<double>& dp3::parmdb::Axis::centers ( ) const
inline

Get all centers, etc.

◆ checkIntervals()

bool dp3::parmdb::Axis::checkIntervals ( const Axis that) const

Check if the corresponding intervals in this and that axis are the same.

◆ classType()

const std::string& dp3::parmdb::Axis::classType ( ) const
overridepure virtual

Return the type of *this as a string.

Implements dp3::blob::BlobStreamable.

Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.

◆ clone()

virtual Axis::ShPtr dp3::parmdb::Axis::clone ( ) const
pure virtual

Clone the object.

Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.

◆ combine()

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.

◆ compress()

virtual Axis::ShPtr dp3::parmdb::Axis::compress ( size_t  factor) const
pure virtual

Compress the axis.

Implemented in dp3::parmdb::OrderedAxis, and dp3::parmdb::RegularAxis.

◆ end()

double dp3::parmdb::Axis::end ( ) const
inline

◆ find()

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.

◆ getId()

unsigned int dp3::parmdb::Axis::getId ( ) const
inline

Get the unique axis id.

◆ isRegular()

bool dp3::parmdb::Axis::isRegular ( ) const
inline

Is the axis regular?

◆ locate()

size_t dp3::parmdb::Axis::locate ( double  x,
bool  biasRight = true,
size_t  start = 0 
) const
inline

Get the cellnr as above, but throw an exception if not found.

◆ lower()

double dp3::parmdb::Axis::lower ( size_t  n) const
inline

◆ lowers()

const std::vector<double>& dp3::parmdb::Axis::lowers ( ) const
inline

◆ makeAxis()

static Axis::ShPtr dp3::parmdb::Axis::makeAxis ( const std::vector< double > &  low,
const std::vector< double > &  high 
)
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.

◆ operator!=()

bool dp3::parmdb::Axis::operator!= ( const Axis that) const
inline

◆ operator==()

bool dp3::parmdb::Axis::operator== ( const Axis that) const

Check if two axes are equal. They are if they the same type and values.

◆ range()

std::pair<double, double> dp3::parmdb::Axis::range ( ) const
inline

Get the total range of the axis.

◆ read()

void dp3::parmdb::Axis::read ( blob::BlobIStream bis)
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.

◆ setup() [1/2]

void dp3::parmdb::Axis::setup ( const std::vector< double > &  v1,
const std::vector< double > &  v2,
bool  asStartEnd 
)
protected

Set up the object for an irregular axis.

◆ setup() [2/2]

void dp3::parmdb::Axis::setup ( double  start,
double  width,
unsigned int  count 
)
protected

Set up the object for a regular axis.

◆ size()

size_t dp3::parmdb::Axis::size ( ) const
inline

Get nr of cells.

◆ start()

double dp3::parmdb::Axis::start ( ) const
inline

Get the start and end value.

◆ subset() [1/3]

Axis::ShPtr dp3::parmdb::Axis::subset ( double  start,
double  end 
) const

◆ subset() [2/3]

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.

◆ subset() [3/3]

Axis::ShPtr dp3::parmdb::Axis::subset ( size_t  start,
size_t  end 
) const
inline

Make a subset of the axis for the given start/end index.

◆ upper()

double dp3::parmdb::Axis::upper ( size_t  n) const
inline

◆ uppers()

const std::vector<double>& dp3::parmdb::Axis::uppers ( ) const
inline

◆ width()

double dp3::parmdb::Axis::width ( size_t  n) const
inline

◆ widths()

const std::vector<double>& dp3::parmdb::Axis::widths ( ) const
inline

◆ write()

void dp3::parmdb::Axis::write ( blob::BlobOStream bos) const
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.

Member Data Documentation

◆ itsCenter

std::vector<double> dp3::parmdb::Axis::itsCenter
protected

◆ itsId

unsigned int dp3::parmdb::Axis::itsId
protected

◆ itsIsRegular

bool dp3::parmdb::Axis::itsIsRegular
protected

◆ itsLower

std::vector<double> dp3::parmdb::Axis::itsLower
protected

◆ itsUpper

std::vector<double> dp3::parmdb::Axis::itsUpper
protected

◆ itsWidth

std::vector<double> dp3::parmdb::Axis::itsWidth
protected

◆ theirId

unsigned int dp3::parmdb::Axis::theirId
staticprotected

Unique seqnr of an Axis object. Used in class AxisMapping.


The documentation for this class was generated from the following file: