#include <DataVector.h>
Public Types | |
typedef double | ElementType |
typedef ElementType * | ValueType |
typedef ElementType | value_type |
typedef long | size_type |
typedef ElementType & | reference |
typedef const ElementType & | const_reference |
Public Member Functions | |
DataVector () | |
Default constructor for DataVector. | |
DataVector (const DataVector &other) | |
Copy constructor for DataVector. | |
DataVector (const size_type size, const value_type val=0.0, const size_type blockSize=1) | |
Constructor for DataVector. | |
~DataVector () | |
Default destructor for DataVector. | |
void | resize (const size_type newSize, const value_type newVal=0.0, const size_type newBlockSize=1) |
Resize the DataVector to the given length "newSize". All current data is lost. All elements in the new DataVector 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 WrappedArray &value, size_type offset, size_type copies) |
size_type | size () const |
Return the number of elements in this DataVector. | |
DataVector & | operator= (const DataVector &other) |
DataVector assignment operator "=". Assign the given DataVector object to this. | |
bool | operator== (const DataVector &other) const |
DataVector equality comparison operator "==". Return true if the given DataVector is equal to this. | |
bool | operator!= (const DataVector &other) const |
DataVector inequality comparison operator "!=". Return true if the given DataVector is not equal to this. | |
reference | operator[] (const size_type i) |
Return a reference to the element at position i in this DataVector. 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 |
ValueType | m_array_data |
Description: DataVector 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.
typedef double escript::DataVector::ElementType |
typedef long escript::DataVector::size_type |
typedef const ElementType& escript::DataVector::const_reference |
escript::DataVector::DataVector | ( | ) |
Default constructor for DataVector.
Description: Constructs an empty DataVector object.
escript::DataVector::DataVector | ( | const DataVector & | other | ) |
Copy constructor for DataVector.
Description: Constructs a DataVector object which is a copy of the given DataVector object.
References escript::arrayManager, m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().
escript::DataVector::DataVector | ( | const size_type | size, | |
const value_type | val = 0.0 , |
|||
const size_type | blockSize = 1 | |||
) |
Constructor for DataVector.
Description: Constructs a DataVector 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. |
References resize().
escript::DataVector::~DataVector | ( | ) |
Default destructor for DataVector.
Description: Destroys the current DataVector object.
References escript::arrayManager, escript::Taipan::delete_array(), m_array_data, m_dim, m_N, and m_size.
void escript::DataVector::resize | ( | const size_type | newSize, | |
const value_type | newVal = 0.0 , |
|||
const size_type | newBlockSize = 1 | |||
) |
Resize the DataVector to the given length "newSize". All current data is lost. All elements in the new DataVector 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::arrayManager, escript::Taipan::delete_array(), m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().
Referenced by escript::DataTagged::addTag(), escript::DataTagged::addTaggedValue(), escript::DataConstant::DataConstant(), escript::DataTagged::DataTagged(), DataVector(), escript::DataLazy::LazyNodeSetup(), and escript::DataBlocks2D::resize().
void escript::DataVector::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::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().
Referenced by escript::DataExpanded::copy(), escript::DataConstant::DataConstant(), and escript::Data::setTaggedValue().
void escript::DataVector::copyFromArrayToOffset | ( | const WrappedArray & | value, | |
size_type | offset, | |||
size_type | copies | |||
) |
DataVector::size_type escript::DataVector::size | ( | ) | const [inline] |
Return the number of elements in this DataVector.
References m_size.
Referenced by escript::DataTagged::addTag(), escript::DataTagged::addTaggedValue(), escript::DataTagged::addTaggedValues(), escript::DataMaths::binaryOp(), escript::DataMaths::checkOffset(), copyFromArrayToOffset(), escript::DataTypes::copyPoint(), escript::DataTypes::copySlice(), escript::DataTypes::copySliceFrom(), escript::Data::copyWithMask(), escript::DataExpanded::DataExpanded(), escript::DataTagged::DataTagged(), escript::DataTagged::getLength(), escript::DataConstant::getLength(), escript::DataBlocks2D::index(), operator[](), escript::DataTypes::pointToString(), escript::DataMaths::reductionOp(), escript::DataLazy::resolveVectorWorker(), escript::DataExpanded::setTaggedValue(), escript::DataTagged::setToZero(), escript::DataConstant::setToZero(), escript::DataBlocks2D::size(), and escript::DataMaths::unaryOp().
DataVector & escript::DataVector::operator= | ( | const DataVector & | other | ) |
DataVector assignment operator "=". Assign the given DataVector object to this.
References escript::arrayManager, escript::Taipan::delete_array(), m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().
bool escript::DataVector::operator== | ( | const DataVector & | other | ) | const |
DataVector equality comparison operator "==". Return true if the given DataVector is equal to this.
References m_array_data, m_dim, m_N, and m_size.
bool escript::DataVector::operator!= | ( | const DataVector & | other | ) | const |
DataVector inequality comparison operator "!=". Return true if the given DataVector is not equal to this.
DataVector::reference escript::DataVector::operator[] | ( | const size_type | i | ) | [inline] |
Return a reference to the element at position i in this DataVector. 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 EsysAssert, m_array_data, and size().
DataVector::const_reference escript::DataVector::operator[] | ( | const size_type | i | ) | const [inline] |
References EsysAssert, m_array_data, and size().
size_type escript::DataVector::m_size [private] |
Referenced by copyFromArray(), DataVector(), operator=(), operator==(), resize(), size(), and ~DataVector().
size_type escript::DataVector::m_dim [private] |
Referenced by copyFromArray(), DataVector(), operator=(), operator==(), resize(), and ~DataVector().
size_type escript::DataVector::m_N [private] |
Referenced by copyFromArray(), DataVector(), operator=(), operator==(), resize(), and ~DataVector().
ValueType escript::DataVector::m_array_data [private] |
Referenced by copyFromArray(), copyFromArrayToOffset(), DataVector(), operator=(), operator==(), operator[](), resize(), and ~DataVector().