#include <ppfdatatype.hpp>
Public Member Functions | |
datatype () | |
Constructor. | |
datatype (const string filename) | |
Initialising constructor. | |
void | resizeT (const int nt) |
Resizes the T and data vectors to the specified number of elements along the T axis. | |
void | resizeX (const int nx) |
Resizes the X and data vectors to the specified number of elements along the X axis. | |
void | resizeTX (int nt, int nx) |
Resizes the T, X and data vectors to the specified number of elements along the T and X axes. | |
void | clear () |
Clears the datatype by setting it back to its default values. | |
bool | empty () const |
Returns true if the T and X dimensions of the datatype are zero, false otherwise. | |
void | readLocal (const string filename) |
Reads in data from a local file. | |
void | writeLocal (const string filename) |
Reads in data from a local file. | |
int | sizeT () const |
Returns the T dimension of the data and T vectors. | |
int | sizeX () const |
Returns the X dimension of the data and X vectors. | |
string | getTUnit () const |
Returns the units of the T vector. | |
string | getXUnit () const |
Returns the units of the X vector. | |
string | getDataUnit () const |
Returns the units of the data vector. | |
string | getComment () const |
Returns the datatype comment. | |
int | getUserStatus () const |
Returns the user status of the datatype. | |
int | getSysStatus () const |
Returns the system status of the datatype. | |
float | getT (const int It) const |
Returns the T vector value at index It. | |
float | getX (const int Ix) const |
Returns the X vector value at index Ix. | |
float | getDataIt (const int It) const |
Returns the data value at index It (Ix=0). | |
float | getDataIx (const int Ix) const |
Returns the data value at index Ix (It=0). | |
float | getDataItIx (const int It, const int Ix) const |
Returns the data value at index [It, Ix]. | |
int | getIt (const float t) const |
Returns the closest T vector index to the passed time t. | |
int | getIx (const float x) const |
Returns the closest X vector index to the passed x co-ordinate. | |
float | getDataT (const float t) const |
Returns linearly interpolated data value at time t (assumes Ix=0). | |
float | getDataT (const float t, const processflag flag) const |
Returns the data value at time t using the method specified by the passed process flag (assumes Ix=0). | |
coord | getDataCT (const float t, const processflag flag) const |
Returns a packed coordinate (t, x, data value) at time t using the method specified by the passed process flag (assumes Ix=0). | |
float | getDataX (const float x) const |
Returns linearly interpolated data value at x (assumes It=0). | |
float | getDataX (const float x, const processflag flag) const |
Returns the data value at x using the method specified by the passed process flag (assumes It=0). | |
coord | getDataCX (const float x, const processflag flag) const |
Returns a packed coordinate (t, x, data value) at x using the method specified by the passed process flag (assumes It=0). | |
float | getDataTIx (const float t, const long Ix) const |
Returns linearly interpolated data value at time t and X index Ix. | |
float | getDataTIx (const float t, const long Ix, const processflag t_flag) const |
Returns the data value at time t and X index Ix using the method specified by the passed process flag. | |
coord | getDataCTIx (const float t, const long Ix, const processflag t_flag) const |
Returns a packed coordinate (t, x, data value) at time t and X index Ix using the method specified by the passed process flag. | |
float | getDataItX (const long It, const float x) const |
Returns linearly interpolated data value at x and T index It. | |
float | getDataItX (const long It, const float x, const processflag x_flag) const |
Returns the data value at x and T index It using the method specified by the passed process flag. | |
coord | getDataCItX (const long It, const float x, const processflag x_flag) const |
Returns a packed coordinate (t, x, data value) at x and T index It using the method specified by the passed process flag (assumes It=0). | |
float | getDataTX (const float t, const float x) const |
Returns linearly interpolated data value at time t and co-ordinate x. | |
float | getDataTX (const float t, const float x, const processflag t_flag, const processflag x_flag) const |
Returns the data value at time t and co-ordinate x using the method specified by the passed process flag. | |
coord | getDataCTX (const float t, const float x, const processflag t_flag, const processflag x_flag) const |
Returns a packed coordinate (t, x, data value) at time t and co-ordinate x using the method specified by the passed process flag. | |
void | setTUnit (const string s) |
Sets the units of the T vector. | |
void | setXUnit (const string s) |
Sets the units of the X vector The maximum string length is 8 chars, characters beyond this limit will be removed. | |
void | setDataUnit (const string s) |
Sets the units of the data vector The maximum string length is 8 chars, characters beyond this limit will be removed. | |
void | setComment (const string s) |
Sets the datatype comment The maximum string length is 24 chars, characters beyond this limit will be removed. | |
void | setUserStatus (const int v) |
Sets the user status of the datatype. | |
void | setSysStatus (const int v) |
Sets the system status of the datatype. | |
void | setT (const int It, const float v) |
Sets the T vector value at index It. | |
void | setX (const int Ix, const float v) |
Sets the X vector value at index Ix. | |
void | setDataIt (const int It, const float v) |
Sets the data value at index It (Ix=0). | |
void | setDataIx (const int Ix, const float v) |
Sets the data value at index Ix (It=0). | |
void | setDataItIx (const int It, const int Ix, const float v) |
Sets the data value at index [It, Ix]. |
ppf::datatype::datatype | ( | const string | filename | ) | [inline] |
Initialising constructor.
Reads in data from a local file.
filename | String containing the filename (including path) |
void ppf::datatype::resizeT | ( | const int | nt | ) | [inline] |
Resizes the T and data vectors to the specified number of elements along the T axis.
Any contents in the data and T vectors at indicies outside the T range will be lost. If the datatype vectors are initially zero sized and the new T size is > 0 the data vector will be expanded along the X axis by a single element to provide space for 1D data. Setting the T size to zero will destroy the contents of the T, X and data vectors.
nt | Number of T elements. |
ppf_error | If an invalid number of elements is passed. |
void ppf::datatype::resizeX | ( | const int | nx | ) | [inline] |
Resizes the X and data vectors to the specified number of elements along the X axis.
Any contents in the data and X vectors at indicies outside the X range will be lost. If the datatype vectors are initially zero sized and the new X size is > 0 the data vector will be expanded along the T axis by a single element to provide space for 1D data. Setting the X size to zero will destroy the contents of the T, X and data vectors.
nx | Number of X elements. |
ppf_error | If an invalid number of elements is passed. |
void ppf::datatype::resizeTX | ( | int | nt, | |
int | nx | |||
) |
Resizes the T, X and data vectors to the specified number of elements along the T and X axes.
Any contents at indicies outside the new T and X ranges will be lost. Setting either the X or T sizes are set to zero the contents of T, X and data vectors will be destroyed.
nt | Number of T elements. | |
nx | Number of X elements. |
ppf_error | If an invalid number of elements is passed. |
void ppf::datatype::clear | ( | ) |
Clears the datatype by setting it back to its default values.
All contents of the datatype will be erased including comments, units and status flags.
bool ppf::datatype::empty | ( | ) | const [inline] |
Returns true if the T and X dimensions of the datatype are zero, false otherwise.
Meta-data such as the comments, units and status flags are not checked by a call to empty().
void ppf::datatype::readLocal | ( | const string | filename | ) |
Reads in data from a local file.
filename | String containing the filename (including path) |
void ppf::datatype::writeLocal | ( | const string | filename | ) |
Reads in data from a local file.
filename | String containing the filename (including path) |
int ppf::datatype::sizeT | ( | ) | const [inline] |
Returns the T dimension of the data and T vectors.
int ppf::datatype::sizeX | ( | ) | const [inline] |
Returns the X dimension of the data and X vectors.
string ppf::datatype::getTUnit | ( | ) | const [inline] |
Returns the units of the T vector.
string ppf::datatype::getXUnit | ( | ) | const [inline] |
Returns the units of the X vector.
string ppf::datatype::getDataUnit | ( | ) | const [inline] |
Returns the units of the data vector.
string ppf::datatype::getComment | ( | ) | const [inline] |
Returns the datatype comment.
int ppf::datatype::getUserStatus | ( | ) | const [inline] |
Returns the user status of the datatype.
int ppf::datatype::getSysStatus | ( | ) | const [inline] |
Returns the system status of the datatype.
float ppf::datatype::getT | ( | const int | It | ) | const [inline] |
Returns the T vector value at index It.
It | index in T-direction |
float ppf::datatype::getX | ( | const int | Ix | ) | const [inline] |
Returns the X vector value at index Ix.
Ix | index in X-direction |
float ppf::datatype::getDataIt | ( | const int | It | ) | const [inline] |
Returns the data value at index It (Ix=0).
If the ppf is 2D then the X index is always taken to be zero.
It | index in T-direction |
float ppf::datatype::getDataIx | ( | const int | Ix | ) | const [inline] |
Returns the data value at index Ix (It=0).
If the ppf is 2D then the T index is always taken to be zero.
Ix | index in X-direction |
float ppf::datatype::getDataItIx | ( | const int | It, | |
const int | Ix | |||
) | const [inline] |
Returns the data value at index [It, Ix].
It | index in T-direction | |
Ix | index in X-direction |
int ppf::datatype::getIt | ( | const float | t | ) | const |
Returns the closest T vector index to the passed time t.
This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time |
int ppf::datatype::getIx | ( | const float | x | ) | const |
Returns the closest X vector index to the passed x co-ordinate.
This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | co-ordinate |
float ppf::datatype::getDataT | ( | const float | t | ) | const [inline] |
Returns linearly interpolated data value at time t (assumes Ix=0).
This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time |
float ppf::datatype::getDataT | ( | const float | t, | |
const processflag | flag | |||
) | const |
Returns the data value at time t using the method specified by the passed process flag (assumes Ix=0).
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time | |
flag | a valid process flag |
coord ppf::datatype::getDataCT | ( | const float | t, | |
const processflag | flag | |||
) | const |
Returns a packed coordinate (t, x, data value) at time t using the method specified by the passed process flag (assumes Ix=0).
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time | |
flag | a valid process flag |
float ppf::datatype::getDataX | ( | const float | x | ) | const [inline] |
Returns linearly interpolated data value at x (assumes It=0).
This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | x co-ordinate |
float ppf::datatype::getDataX | ( | const float | x, | |
const processflag | flag | |||
) | const |
Returns the data value at x using the method specified by the passed process flag (assumes It=0).
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | x co-ordinate | |
flag | a valid process flag |
coord ppf::datatype::getDataCX | ( | const float | x, | |
const processflag | flag | |||
) | const |
Returns a packed coordinate (t, x, data value) at x using the method specified by the passed process flag (assumes It=0).
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | x co-ordinate | |
flag | a valid process flag |
float ppf::datatype::getDataTIx | ( | const float | t, | |
const long | Ix | |||
) | const [inline] |
Returns linearly interpolated data value at time t and X index Ix.
This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time | |
Ix | index in X-direction |
float ppf::datatype::getDataTIx | ( | const float | t, | |
const long | Ix, | |||
const processflag | t_flag | |||
) | const |
Returns the data value at time t and X index Ix using the method specified by the passed process flag.
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time | |
Ix | index in X-direction | |
t_flag | a valid process flag |
coord ppf::datatype::getDataCTIx | ( | const float | t, | |
const long | Ix, | |||
const processflag | t_flag | |||
) | const |
Returns a packed coordinate (t, x, data value) at time t and X index Ix using the method specified by the passed process flag.
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the T vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
t | time | |
Ix | index in X-direction | |
t_flag | a valid process flag |
float ppf::datatype::getDataItX | ( | const long | It, | |
const float | x | |||
) | const [inline] |
Returns linearly interpolated data value at x and T index It.
This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | x co-ordinate | |
It | index in T-direction |
float ppf::datatype::getDataItX | ( | const long | It, | |
const float | x, | |||
const processflag | x_flag | |||
) | const |
Returns the data value at x and T index It using the method specified by the passed process flag.
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | x co-ordinate | |
It | index in T-direction | |
x_flag | a valid process flag |
coord ppf::datatype::getDataCItX | ( | const long | It, | |
const float | x, | |||
const processflag | x_flag | |||
) | const |
Returns a packed coordinate (t, x, data value) at x and T index It using the method specified by the passed process flag (assumes It=0).
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the X vector is monotonically increasing or decreasing and no two values are equal, its result is undefined if applied to data not satisfying these conditions.
x | x co-ordinate | |
It | index in T-direction | |
x_flag | a valid process flag |
float ppf::datatype::getDataTX | ( | const float | t, | |
const float | x | |||
) | const [inline] |
Returns linearly interpolated data value at time t and co-ordinate x.
This routine will only be successful provided the T and X vectors are monotonically increasing or decreasing and no two values are equal in each vector, its result is undefined if applied to data not satisfying these conditions.
t | time | |
x | x co-ordinate |
float ppf::datatype::getDataTX | ( | const float | t, | |
const float | x, | |||
const processflag | t_flag, | |||
const processflag | x_flag | |||
) | const |
Returns the data value at time t and co-ordinate x using the method specified by the passed process flag.
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the T and X vectors are monotonically increasing or decreasing and no two values are equal in each vector, its result is undefined if applied to data not satisfying these conditions.
t | time | |
x | x co-ordinate | |
t_flag | a valid process flag for the T vector | |
x_flag | a valid process flag for the X vector |
coord ppf::datatype::getDataCTX | ( | const float | t, | |
const float | x, | |||
const processflag | t_flag, | |||
const processflag | x_flag | |||
) | const |
Returns a packed coordinate (t, x, data value) at time t and co-ordinate x using the method specified by the passed process flag.
Valid process flags are: nearest, linear, bicubic This routine will only be successful provided the T and X vectors are monotonically increasing or decreasing and no two values are equal in each vector, its result is undefined if applied to data not satisfying these conditions.
t | time | |
x | x co-ordinate | |
t_flag | a valid process flag for the T vector | |
x_flag | a valid process flag for the X vector |
void ppf::datatype::setTUnit | ( | const string | s | ) |
Sets the units of the T vector.
The maximum string length is 8 chars, characters beyond this limit will be removed. Strings shorter than 8 chars will be automatically padded with spaces.
s | T vector unit string. |
void ppf::datatype::setXUnit | ( | const string | s | ) |
Sets the units of the X vector The maximum string length is 8 chars, characters beyond this limit will be removed.
Strings shorter than 8 chars will be automatically padded with spaces.
s | X vector unit string. |
void ppf::datatype::setDataUnit | ( | const string | s | ) |
Sets the units of the data vector The maximum string length is 8 chars, characters beyond this limit will be removed.
Strings shorter than 8 chars will be automatically padded with spaces.
s | Data vector unit string. |
void ppf::datatype::setComment | ( | const string | s | ) |
Sets the datatype comment The maximum string length is 24 chars, characters beyond this limit will be removed.
Strings shorter than 24 chars will be automatically padded with spaces.
s | Comment string. |
void ppf::datatype::setUserStatus | ( | const int | v | ) | [inline] |
Sets the user status of the datatype.
v | Datatype user status flag. |
void ppf::datatype::setSysStatus | ( | const int | v | ) | [inline] |
Sets the system status of the datatype.
v | Datatype system status flag. |
void ppf::datatype::setT | ( | const int | It, | |
const float | v | |||
) | [inline] |
Sets the T vector value at index It.
It | index in T-direction | |
v | new T vector value |
void ppf::datatype::setX | ( | const int | Ix, | |
const float | v | |||
) | [inline] |
Sets the X vector value at index Ix.
Ix | index in X-direction | |
v | new X vector value |
void ppf::datatype::setDataIt | ( | const int | It, | |
const float | v | |||
) | [inline] |
Sets the data value at index It (Ix=0).
If the ppf is 2D then the X index is always taken to be zero.
It | index in T-direction | |
v | new data value |
void ppf::datatype::setDataIx | ( | const int | Ix, | |
const float | v | |||
) | [inline] |
Sets the data value at index Ix (It=0).
If the ppf is 2D then the T index is always taken to be zero.
Ix | index in X-direction | |
v | new data value |
void ppf::datatype::setDataItIx | ( | const int | It, | |
const int | Ix, | |||
const float | v | |||
) | [inline] |
Sets the data value at index [It, Ix].
It | index in T-direction | |
Ix | index in X-direction | |
v | new data value |