#include <regularData1D.h>
Public Types | |
typedef ValueType | value_type |
typedef std::vector< ValueType >::iterator | iterator |
typedef std::vector< ValueType >::const_iterator | const_iterator |
typedef std::vector< ValueType >::reference | reference |
typedef std::vector< ValueType >::const_reference | const_reference |
typedef std::vector< ValueType >::pointer | pointer |
typedef std::vector< ValueType >::difference_type | difference_type |
typedef std::vector< ValueType >::size_type | size_type |
Type definitions | |
typedef Position | IndexType |
The IndexType. | |
typedef std::vector< ValueType > | VectorType |
The type containing an STL vector of the corresponding ValueType. | |
typedef double | CoordinateType |
The coordinate type. | |
typedef std::vector< ValueType >::iterator | Iterator |
A mutable iterator. | |
typedef std::vector< ValueType >::const_iterator | ConstIterator |
A constant iterator. | |
Public Member Functions | |
Constructors and Destructors. | |
TRegularData1D () throw () | |
Default constructor. | |
TRegularData1D (const TRegularData1D &data) throw (Exception::OutOfMemory) | |
Copy constructor. | |
TRegularData1D (const CoordinateType &origin, const CoordinateType &dimension, const CoordinateType &spacing) throw (Exception::OutOfMemory) | |
TRegularData1D (const IndexType &size) throw (Exception::OutOfMemory) | |
This constructor sets origin to 0.0 and dimension to 1.0. | |
TRegularData1D (const VectorType &data, const CoordinateType &origin=0.0, const CoordinateType &dimension=1.0) throw (Exception::OutOfMemory) | |
virtual | ~TRegularData1D () throw () |
Destructor. | |
virtual void | clear () throw () |
Clear the contents. | |
Assignment | |
TRegularData1D & | operator= (const TRegularData1D< ValueType > &data) throw (Exception::OutOfMemory) |
Assignment operator. | |
TRegularData1D & | operator= (const VectorType &data) throw (Exception::OutOfMemory) |
Assignment from a vector of ValueType . | |
Predicates | |
bool | operator== (const TRegularData1D &data) const throw () |
Equality operator. | |
bool | operator!= (const TRegularData1D &data) const throw () |
Inequality operator. | |
bool | empty () const throw () |
Empty predicate. | |
bool | isInside (const CoordinateType &x) const throw () |
Test whether a point is inside the grid. | |
Iterators | |
ConstIterator | begin () const throw () |
ConstIterator | end () const throw () |
Iterator | begin () throw () |
Iterator | end () throw () |
Accessors | |
size_type | size () const throw () |
size_type | max_size () const throw () |
void | swap (TRegularData1D< ValueType > &data) throw () |
const ValueType & | getData (const IndexType &index) const throw (Exception::OutOfGrid) |
Return a nonmutable reference to a specific data element. | |
ValueType & | getData (const IndexType &index) throw (Exception::OutOfGrid) |
Return a mutable reference to a specific data element. | |
const ValueType & | operator[] (const IndexType &index) const throw () |
Constant random access operator. | |
ValueType & | operator[] (const IndexType &index) throw () |
Mutable random access operator. | |
ValueType | operator() (const CoordinateType &x) const throw () |
Function operator. | |
ValueType | getInterpolatedValue (const CoordinateType &x) const throw (Exception::OutOfGrid) |
Return the linearly interpolated value of the surrounding two grid points. | |
void | getEnclosingIndices (const CoordinateType &x, Position &lower, Position &upper) const throw (Exception::OutOfGrid) |
Return the indices of the grid points to the left and to the right of a point. | |
void | getEnclosingValues (const CoordinateType &x, ValueType &lower, ValueType &upper) const throw (Exception::OutOfGrid) |
Return the data at the grid points to the left and to the right of a point. | |
CoordinateType | getCoordinates (const IndexType &index) const throw (Exception::OutOfGrid) |
Return the exact coordinates of a grid point. | |
IndexType | getClosestIndex (const CoordinateType &x) const throw (Exception::OutOfGrid) |
Return the index of the closest grid point. | |
IndexType | getLowerIndex (const CoordinateType &x) const throw (Exception::OutOfGrid) |
Return the index of the grid point with the next lowest coordinate. | |
const ValueType & | getClosestValue (const CoordinateType &x) const throw (Exception::OutOfGrid) |
Return a nonmutable reference to the closest non-interpolated value. | |
ValueType & | getClosestValue (const CoordinateType &x) throw (Exception::OutOfGrid) |
Return a mutable reference to the closest non-interpolated value. | |
IndexType | getSize () const throw () |
Return the number of points in the data set. | |
const CoordinateType & | getOrigin () const throw () |
Return the origin of the data. | |
const CoordinateType & | getSpacing () const throw () |
Return the spacing of the data. | |
void | setOrigin (const CoordinateType &origin) throw () |
Set the origin of the data. | |
const CoordinateType & | getDimension () const throw () |
Return the dimension of the data. | |
void | setDimension (const CoordinateType &dimension) throw () |
Set the dimension of the data. | |
void | resize (const IndexType &size) throw (Exception::OutOfMemory) |
Resize the data. | |
void | rescale (const IndexType &new_size) throw (Exception::OutOfMemory) |
Rescale the data. | |
void | binaryWrite (const String &filename) const throw (Exception::FileNotFound) |
Write the grid contents in a (non-portable) binary format. | |
void | binaryRead (const String &filename) throw (Exception::FileNotFound) |
Read the grid contents from a file written with binaryWrite. | |
Protected Attributes | |
CoordinateType | origin_ |
The origin of the data set. | |
CoordinateType | dimension_ |
The dimension (length). | |
CoordinateType | spacing_ |
The spacing. | |
VectorType | data_ |
The data. |
This class can is intended to hold regularly spaced, one-dimensional data sets. It might be useful to hold data sets like spectra, or precomputed function values.
Container
and Unary Function
requirements.
|
Read the grid contents from a file written with binaryWrite.
|
|
Write the grid contents in a (non-portable) binary format.
|
|
Return the index of the closest grid point.
This method first performs a range check for the argument |
|
Return a mutable reference to the closest non-interpolated value.
This method first performs a range check for the argument |
|
Return a nonmutable reference to the closest non-interpolated value.
This method first performs a range check for the argument |
|
Return the exact coordinates of a grid point.
|
|
Return a mutable reference to a specific data element.
This is the range chacking version of |
|
Return a nonmutable reference to a specific data element.
This is the range chacking version of |
|
Return the dimension of the data.
The dimension represents the length of the data vector. Hence, the coordinate of the rightmost element, |
|
Return the indices of the grid points to the left and to the right of a point.
|
|
Return the data at the grid points to the left and to the right of a point. getEnclosingIndices |
|
Return the linearly interpolated value of the surrounding two grid points.
This method first performs a range check for the argument |
|
Return the index of the grid point with the next lowest coordinate.
This method first performs a range check for the argument |
|
Return the origin of the data.
The origin represents the coordinate of the very first (leftmost) element, i.e. |
|
Return the spacing of the data. The spacing corresponds to the distance between two adjacent data elements. |
|
Function operator.
This operator allows the use of a TRegularData1D instance as a unary function. As required by the STL |
|
Assignment from a Copy the contents of the data without changing the boundaries. |
|
Assignment operator. Copy the data and the boundaries. |
|
Mutable random access operator.
|
|
Constant random access operator.
|
|
Rescale the data.
Keep the current boundaries of the data and reinterpolate the data to reflect the new size. To create a data set of
|
|
Resize the data.
If
|
|
Set the dimension of the data. This will affect neither the origin of the data, nor the number of elements stored (in contrast to resize() ). It will just store the appropriate scaling factor and affect the spacing. |
|
Set the origin of the data.
|