escript Revision_
|
DataVectorTaipan implements an arbitrarily long vector of data values. DataVectorTaipan is the underlying data container for Data objects. More...
#include <DataVectorTaipan.h>
Public Types | |
typedef double | ElementType |
typedef ElementType * | VectorStorageType |
typedef const ElementType * | const_pointer |
typedef ElementType | value_type |
typedef long | size_type |
typedef ElementType & | reference |
typedef const ElementType & | const_reference |
Public Member Functions | |
DataVectorTaipan () | |
Default constructor for DataVectorTaipan. | |
DataVectorTaipan (const DataVectorTaipan &other) | |
Copy constructor for DataVectorTaipan. | |
DataVectorTaipan (const size_type size, const value_type val=0.0, const size_type blockSize=1) | |
Constructor for DataVectorTaipan. | |
~DataVectorTaipan () | |
Default destructor for DataVectorTaipan. | |
void | resize (const size_type newSize, const value_type newVal=0.0, const size_type newBlockSize=1) |
Resize the DataVectorTaipan to the given length "newSize". All current data is lost. All elements in the new DataVectorTaipan are initialised to "newVal". | |
void | copyFromArray (const escript::WrappedArray &value, size_type copies) |
Populates the vector with the data from value. This method currently throws an exception if the specified number of copies won't fit. | |
void | copyFromArrayToOffset (const escript::WrappedArray &value, size_type offset, size_type copies) |
size_type | size () const |
Return the number of elements in this DataVectorTaipan. | |
DataVectorTaipan & | operator= (const DataVectorTaipan &other) |
DataVectorTaipan assignment operator "=". Assign the given DataVectorTaipan object to this. | |
bool | operator== (const DataVectorTaipan &other) const |
DataVectorTaipan equality comparison operator "==". Return true if the given DataVectorTaipan is equal to this. | |
bool | operator!= (const DataVectorTaipan &other) const |
DataVectorTaipan inequality comparison operator "!=". Return true if the given DataVectorTaipan is not equal to this. | |
reference | operator[] (const size_type i) |
Return a reference to the element at position i in this DataVectorTaipan. Will throw an exception if an invalid index "i" is given. | |
const_reference | operator[] (const size_type i) const |
Private Attributes | |
size_type | m_size |
size_type | m_dim |
size_type | m_N |
VectorStorageType | m_array_data |
DataVectorTaipan implements an arbitrarily long vector of data values. DataVectorTaipan is the underlying data container for Data objects.
Description: DataVectorTaipan provides an implementation of a vector of data values for use by DataBlocks2D and DataArrayView. Hiding the vector in this container allows different implementations to be swapped in without disrupting the client classes.
escript::DataTypes::DataVectorTaipan::DataVectorTaipan | ( | ) |
Default constructor for DataVectorTaipan.
Description: Constructs an empty DataVectorTaipan object.
escript::DataTypes::DataVectorTaipan::DataVectorTaipan | ( | const DataVectorTaipan & | other | ) |
Copy constructor for DataVectorTaipan.
Description: Constructs a DataVectorTaipan object which is a copy of the given DataVectorTaipan object.
References escript::DataTypes::arrayManager, m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().
escript::DataTypes::DataVectorTaipan::DataVectorTaipan | ( | const size_type | size, |
const value_type | val = 0.0, | ||
const size_type | blockSize = 1 ) |
Constructor for DataVectorTaipan.
Description: Constructs a DataVectorTaipan object of length "size" with all elements initilised to "val".
size | - Input - Number of elements in the vector. |
val | - Input - Initial value for all elements in the vector. Default is 0.0. |
blockSize | - Input - size of blocks within the vector, overall vector size must be a precise multiple of the block size. Default is 1. |
In escript::Data, blocksize corresponds to the number of elements required to hold all the data-points for a sample, ie: the product of the dimensions of a data-point and the number of data-points per sample. Size is the total number of elements required to hold all elements for all data-points in the given object, ie: number of samples * blocksize.
escript::DataTypes::DataVectorTaipan::~DataVectorTaipan | ( | ) |
Default destructor for DataVectorTaipan.
Description: Destroys the current DataVectorTaipan object.
References escript::DataTypes::arrayManager, escript::Taipan::delete_array(), m_array_data, m_dim, m_N, and m_size.
void escript::DataTypes::DataVectorTaipan::copyFromArray | ( | const escript::WrappedArray & | value, |
size_type | copies ) |
Populates the vector with the data from value. This method currently throws an exception if the specified number of copies won't fit.
References escript::DataTypes::arrayManager, copyFromArrayToOffset(), escript::Taipan::delete_array(), escript::WrappedArray::getShape(), m_array_data, m_dim, m_N, m_size, escript::Taipan::new_array(), and escript::DataTypes::noValues().
void escript::DataTypes::DataVectorTaipan::copyFromArrayToOffset | ( | const escript::WrappedArray & | value, |
size_type | offset, | ||
size_type | copies ) |
bool escript::DataTypes::DataVectorTaipan::operator!= | ( | const DataVectorTaipan & | other | ) | const |
DataVectorTaipan inequality comparison operator "!=". Return true if the given DataVectorTaipan is not equal to this.
DataVectorTaipan & escript::DataTypes::DataVectorTaipan::operator= | ( | const DataVectorTaipan & | other | ) |
DataVectorTaipan assignment operator "=". Assign the given DataVectorTaipan object to this.
References escript::DataTypes::arrayManager, escript::Taipan::delete_array(), m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().
bool escript::DataTypes::DataVectorTaipan::operator== | ( | const DataVectorTaipan & | other | ) | const |
DataVectorTaipan equality comparison operator "==". Return true if the given DataVectorTaipan is equal to this.
References m_array_data, m_dim, m_N, and m_size.
|
inline |
Return a reference to the element at position i in this DataVectorTaipan. Will throw an exception if an invalid index "i" is given.
NB: access to the element one past the end of the vector is permitted in order to provide a facility equivalent to an end() pointer.
References ESYS_ASSERT, m_array_data, and size().
|
inline |
References ESYS_ASSERT, m_array_data, and size().
void escript::DataTypes::DataVectorTaipan::resize | ( | const size_type | newSize, |
const value_type | newVal = 0.0, | ||
const size_type | newBlockSize = 1 ) |
Resize the DataVectorTaipan to the given length "newSize". All current data is lost. All elements in the new DataVectorTaipan are initialised to "newVal".
newSize | - Input - New size for the vector. |
newVal | - Input - New initial value for all elements in the vector. |
newBlockSize | - Input - New block size for the vector. |
References escript::DataTypes::arrayManager, escript::Taipan::delete_array(), m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().
Referenced by DataVectorTaipan().
|
inline |
Return the number of elements in this DataVectorTaipan.
References m_size.
Referenced by copyFromArrayToOffset(), DataVectorTaipan(), operator[](), and operator[]().
|
private |
Referenced by copyFromArray(), copyFromArrayToOffset(), DataVectorTaipan(), operator=(), operator==(), operator[](), operator[](), resize(), and ~DataVectorTaipan().
|
private |
Referenced by copyFromArray(), DataVectorTaipan(), operator=(), operator==(), resize(), and ~DataVectorTaipan().
|
private |
Referenced by copyFromArray(), DataVectorTaipan(), operator=(), operator==(), resize(), and ~DataVectorTaipan().
|
private |
Referenced by copyFromArray(), DataVectorTaipan(), operator=(), operator==(), resize(), size(), and ~DataVectorTaipan().