fesa-core
4.0.0
|
Represents a FESA function list. Allows conversion from a function list to arrays of points and vice versa. More...
#include <ImmutableFunctionList.h>
Public Member Functions | |
ImmutableFunctionList (const ImmutableArray< double > &data, bool checkValidity=true) | |
Constructor using a function list specified as an ImmutableArray. No copy of the data is performed. More... | |
ImmutableFunctionList (const double data[], const std::size_t size, bool copyData=false, bool checkValidity=true, bool forceValid=false) | |
Constructor using a function list specified as an array. More... | |
ImmutableFunctionList (const ImmutableArray2D< double > &x, const ImmutableArray2D< double > &y) | |
Construct a function list from two 2D arrays of points specified as Array2D. The points are copied. More... | |
ImmutableFunctionList (const double x[], const double y[], std::size_t nRows, std::size_t nCols) | |
Construct a function list from two flat arrays of points. The points are copied. More... | |
ImmutableFunctionList (const ImmutableFunctionList &other) | |
Copy constructor. If 'other' has its own data, the data is copied and this object will work on its own data as well. Otherwise, no copy is performed, and this object will use the same data as 'other'. More... | |
bool | isValid () const |
std::size_t | getNFunctions () const |
std::size_t | getTotalNPoints () const |
std::size_t | getNPoints (std::size_t function) const |
std::size_t | getMaxNPoints () const |
bool | hasOwnData () const |
const double * | get (std::size_t &size) const |
ImmutableArray< double > | get () const |
const double * | getX (std::size_t &nRows, std::size_t &nCols) const |
ImmutableArray2D< double > | getX () const |
const double * | getY (std::size_t &nRows, std::size_t &nCols) const |
ImmutableArray2D< double > | getY () const |
double | getXValue (std::size_t function, std::size_t point) const |
double | getYValue (std::size_t function, std::size_t point) const |
FunctionList | getMutable () const |
ConstFunctionsIterator | begin () const |
Get a constant iterator pointing to the first function in the list. | |
ConstFunctionsIterator | end () const |
Get a constant iterator pointing to the location of a function that would theoretically follow the last function in the list. | |
Static Public Member Functions | |
static std::size_t | getMaxNElements (std::size_t nFunctions, std::size_t maxNPoints) |
Protected Member Functions | |
std::size_t | findPoint (std::size_t function, std::size_t point, ImmutableFunctionList::CoordinateOffset coordinateOffset) const |
Protected Attributes | |
std::vector< double > | ownData_ |
const double * | data_ |
const std::size_t | size_ |
const std::vector< const double * > | functionPtrs_ |
Array | x_ |
Array | y_ |
boost::tribool | valid_ |
Represents a FESA function list. Allows conversion from a function list to arrays of points and vice versa.
A function list is a compact way to store x-coordinates and y-coordinates of several functions of different sizes Let #f be the number of functions #pi be the number of points in the ith function
The function list is [#f, #p1, (x, y) * #p1, #p2, (x, y) * #p2, ...]
If we represent as 2D arrays of coordinates, we have f1 [ x, x, ... x] [ y, y, ... y] f2 [ x, x, ... nan] [ y, y, ... nan] ... fn [ x, nan, ... nan] [ y, nan, ... nan]
fesa::ImmutableFunctionList::ImmutableFunctionList | ( | const ImmutableArray< double > & | data, |
bool | checkValidity = true |
||
) |
Constructor using a function list specified as an ImmutableArray. No copy of the data is performed.
data | An array describing a function list |
checkValidity | If true, the data of the function list is checked for validity |
FesaException | If checkValidity is true and data is not valid |
fesa::ImmutableFunctionList::ImmutableFunctionList | ( | const double | data[], |
const std::size_t | size, | ||
bool | copyData = false , |
||
bool | checkValidity = true , |
||
bool | forceValid = false |
||
) |
Constructor using a function list specified as an array.
data | An array describing a function list |
size | The size of the data of the function list |
copyData | If true, data is copied; otherwise, data must remain accessible until this object is destroyed |
checkValidity | If true, the data of the function list is checked for validity |
forceValid | If true, checkValidity is ignored and data is marked as valid without being checked. Use carefully |
FesaException | If checkValidity is true, forceValid is false, and data is not valid |
fesa::ImmutableFunctionList::ImmutableFunctionList | ( | const ImmutableArray2D< double > & | x, |
const ImmutableArray2D< double > & | y | ||
) |
Construct a function list from two 2D arrays of points specified as Array2D. The points are copied.
x | An array of x-coordinates of the functions' points |
y | An array of y-coordinates of the functions' points |
fesa::ImmutableFunctionList::ImmutableFunctionList | ( | const double | x[], |
const double | y[], | ||
std::size_t | nRows, | ||
std::size_t | nCols | ||
) |
Construct a function list from two flat arrays of points. The points are copied.
x | An array of x-coordinates of the functions' points |
y | An array of y-coordinates of the functions' points |
nRows | The number of rows of the arrays of points (the number of functions) |
nCols | The number of columns of the arrays of points (the number of points) |
fesa::ImmutableFunctionList::ImmutableFunctionList | ( | const ImmutableFunctionList & | other | ) |
Copy constructor. If 'other' has its own data, the data is copied and this object will work on its own data as well. Otherwise, no copy is performed, and this object will use the same data as 'other'.
other | The other function list |
|
protected |
Find the point index in the FunctionList data
const double * fesa::ImmutableFunctionList::get | ( | std::size_t & | size | ) | const |
[out] | size | size of the function list |
ImmutableArray< double > fesa::ImmutableFunctionList::get | ( | ) | const |
|
static |
Returns the maximum number of elements (double) needed to represent the function list, assuming every function has maxNPoints points.
std::size_t fesa::ImmutableFunctionList::getMaxNPoints | ( | ) | const |
FunctionList fesa::ImmutableFunctionList::getMutable | ( | ) | const |
Returns a FunctionList object that contains a copy of the elements of this FunctionList
std::size_t fesa::ImmutableFunctionList::getNFunctions | ( | ) | const |
std::size_t fesa::ImmutableFunctionList::getNPoints | ( | std::size_t | function | ) | const |
std::size_t fesa::ImmutableFunctionList::getTotalNPoints | ( | ) | const |
const double * fesa::ImmutableFunctionList::getX | ( | std::size_t & | nRows, |
std::size_t & | nCols | ||
) | const |
[out] | nRows | number of rows of the flat 2D array returned |
[out] | nCols | number of columns of the flat 2D array returned |
ImmutableArray2D< double > fesa::ImmutableFunctionList::getX | ( | ) | const |
double fesa::ImmutableFunctionList::getXValue | ( | std::size_t | function, |
std::size_t | point | ||
) | const |
function | |
point |
const double * fesa::ImmutableFunctionList::getY | ( | std::size_t & | nRows, |
std::size_t & | nCols | ||
) | const |
[out] | nRows | number of rows of the flat 2D array returned |
[out] | nCols | number of columns of the flat 2D array returned |
ImmutableArray2D< double > fesa::ImmutableFunctionList::getY | ( | ) | const |
double fesa::ImmutableFunctionList::getYValue | ( | std::size_t | function, |
std::size_t | point | ||
) | const |
function | |
point |
bool fesa::ImmutableFunctionList::hasOwnData | ( | ) | const |
Indicate whether this object owns its data
bool fesa::ImmutableFunctionList::isValid | ( | ) | const |
Checks that raw data of this function list (as an array of doubles) is valid.
|
protected |
Pointer to the elements of this FunctionList.
|
protected |
A vector of pointers to the beginnings of functions in a function list, plus a pointer to the theoretical beginning of a function that would follow the last function. A beginning of a function stores the number of points in the function
|
protected |
Used only when the object contains its own data If used, data_ must point on &ownData_[0].
|
protected |
Size of the function list
|
mutableprotected |
Tells if the data is valid
|
mutableprotected |
Contains flat 2D arrays of x-coordinates of the functions' points This member is lazily initialized
|
mutableprotected |
Contains flat 2D arrays of y-coordinates of the functions' points This member is lazily initialized