npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0

#include <GridAxis.hh>

Public Member Functions

 GridAxis (const std::vector< double > &coords, bool useLogSpace=false)
 
 GridAxis (const std::vector< double > &coords, const char *label, bool useLogSpace=false)
 
 GridAxis (double x0, double x1)
 
 GridAxis (double x0, double x1, double x2)
 
 GridAxis (double x0, double x1, double x2, double x3)
 
 GridAxis (double x0, double x1, double x2, double x3, double x4)
 
const std::vector< double > & coords () const
 
const std::string & label () const
 
bool usesLogSpace () const
 
std::pair< unsigned, double > getInterval (double coordinate) const
 
std::pair< unsigned, double > linearInterval (double coordinate) const
 
unsigned nCoords () const
 
double coordinate (const unsigned i) const
 
double min () const
 
double max () const
 
double length () const
 
bool isUniform () const
 
unsigned nIntervals () const
 
double intervalWidth (const unsigned i=0) const
 
bool operator== (const GridAxis &r) const
 
bool operator!= (const GridAxis &r) const
 
bool isClose (const GridAxis &r, double tol) const
 
void setLabel (const char *newlabel)
 
gs::ClassId classId () const
 
bool write (std::ostream &of) const
 

Static Public Member Functions

static const char * classname ()
 
static unsigned version ()
 
static GridAxisread (const gs::ClassId &id, std::istream &in)
 

Detailed Description

Information needed to define an axis of a rectangular grid. The distance between grid points can change from point to point.

The UniformAxis class will be more efficient in representing equidistant grids.

Constructor & Destructor Documentation

◆ GridAxis() [1/2]

npstat::GridAxis::GridAxis ( const std::vector< double > &  coords,
bool  useLogSpace = false 
)
explicit

The number of grid coordinates provided must be at least 2. Coordinates will be sorted internally in the increasing order.

◆ GridAxis() [2/2]

npstat::GridAxis::GridAxis ( double  x0,
double  x1 
)

Construct a simple unlabeled grid using explicit point coordinates. This grid will use linear interpolation (not log space).

Member Function Documentation

◆ classId()

gs::ClassId npstat::GridAxis::classId ( ) const
inline

Method related to "geners" I/O

◆ coords()

const std::vector<double>& npstat::GridAxis::coords ( ) const
inline

Basic accessor returning a parameter provided in the constructor

◆ getInterval()

std::pair<unsigned,double> npstat::GridAxis::getInterval ( double  coordinate) const

This method returns the grid interval number and the weight of the point at the left side of the interval. The weight will be set to 1 if the given coordinate coincides with the grid point and will decay to 0 linearly as the coordinate moves towards the next point on the right.

The coordinates below the leftmost grid point are mapped into the 0th interval with weight 1. The coordinates above the rightmost grid point are mapped into the last interval with weight 0 for the left point (it is expected that weight 1 will then be assigned to the right point).

◆ isClose()

bool npstat::GridAxis::isClose ( const GridAxis r,
double  tol 
) const

Check for closeness of coordinates with another axis within the given relative tolerance

◆ linearInterval()

std::pair<unsigned,double> npstat::GridAxis::linearInterval ( double  coordinate) const

This method returns the grid interval number and the weight of the point at the left side of the interval. The weight will be set to 1 if the given coordinate coincides with the grid point and will decay to 0 linearly as the coordinate moves towards the next point on the right. The weight for the point on the right should be set to one minus the weight on the left.

The coordinates outside of grid boundaries will result in weights which are less than zero or more than one. They will be calculated by linear extrapolation from the closest interval in the grid (i.e., leftmost or rightmost).

◆ nCoords()

unsigned npstat::GridAxis::nCoords ( ) const
inline

Convenience accessor

◆ operator!=()

bool npstat::GridAxis::operator!= ( const GridAxis r) const
inline

Logical negation of operator==

◆ operator==()

bool npstat::GridAxis::operator== ( const GridAxis r) const

Compare two grids for equality

◆ setLabel()

void npstat::GridAxis::setLabel ( const char *  newlabel)
inline

Modify the axis label


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