escript  Revision_
Public Types | Public Member Functions | Private Attributes | List of all members
escript::DataTypes::DataVectorTaipan Class Reference

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 ElementTypeVectorStorageType
 
typedef const ElementTypeconst_pointer
 
typedef ElementType value_type
 
typedef long size_type
 
typedef ElementTypereference
 
typedef const ElementTypeconst_reference
 

Public Member Functions

 DataVectorTaipan ()
 Default constructor for DataVectorTaipan. More...
 
 DataVectorTaipan (const DataVectorTaipan &other)
 Copy constructor for DataVectorTaipan. More...
 
 DataVectorTaipan (const size_type size, const value_type val=0.0, const size_type blockSize=1)
 Constructor for DataVectorTaipan. More...
 
 ~DataVectorTaipan ()
 Default destructor for DataVectorTaipan. More...
 
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". More...
 
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. More...
 
void copyFromArrayToOffset (const escript::WrappedArray &value, size_type offset, size_type copies)
 
size_type size () const
 Return the number of elements in this DataVectorTaipan. More...
 
DataVectorTaipanoperator= (const DataVectorTaipan &other)
 DataVectorTaipan assignment operator "=". Assign the given DataVectorTaipan object to this. More...
 
bool operator== (const DataVectorTaipan &other) const
 DataVectorTaipan equality comparison operator "==". Return true if the given DataVectorTaipan is equal to this. More...
 
bool operator!= (const DataVectorTaipan &other) const
 DataVectorTaipan inequality comparison operator "!=". Return true if the given DataVectorTaipan is not equal to this. More...
 
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. More...
 
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
 

Detailed Description

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.

Member Typedef Documentation

◆ const_pointer

◆ const_reference

◆ ElementType

◆ reference

◆ size_type

◆ value_type

◆ VectorStorageType

Constructor & Destructor Documentation

◆ DataVectorTaipan() [1/3]

escript::DataTypes::DataVectorTaipan::DataVectorTaipan ( )

Default constructor for DataVectorTaipan.

Description: Constructs an empty DataVectorTaipan object.

◆ DataVectorTaipan() [2/3]

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 m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().

◆ DataVectorTaipan() [3/3]

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".

Parameters
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.

References resize().

◆ ~DataVectorTaipan()

escript::DataTypes::DataVectorTaipan::~DataVectorTaipan ( )

Default destructor for DataVectorTaipan.

Description: Destroys the current DataVectorTaipan object.

References escript::Taipan::delete_array(), m_array_data, m_dim, m_N, and m_size.

Member Function Documentation

◆ copyFromArray()

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.

Warning
This function does not attempt to perform shape checking.

References 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().

◆ copyFromArrayToOffset()

void escript::DataTypes::DataVectorTaipan::copyFromArrayToOffset ( const escript::WrappedArray value,
size_type  offset,
size_type  copies 
)

◆ operator!=()

bool escript::DataTypes::DataVectorTaipan::operator!= ( const DataVectorTaipan other) const

DataVectorTaipan inequality comparison operator "!=". Return true if the given DataVectorTaipan is not equal to this.

◆ operator=()

DataVectorTaipan & escript::DataTypes::DataVectorTaipan::operator= ( const DataVectorTaipan other)

DataVectorTaipan assignment operator "=". Assign the given DataVectorTaipan object to this.

References escript::Taipan::delete_array(), m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().

◆ operator==()

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.

◆ operator[]() [1/2]

DataVectorTaipan::reference escript::DataTypes::DataVectorTaipan::operator[] ( const size_type  i)
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.

◆ operator[]() [2/2]

DataVectorTaipan::const_reference escript::DataTypes::DataVectorTaipan::operator[] ( const size_type  i) const
inline

References ESYS_ASSERT.

◆ resize()

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".

Parameters
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::Taipan::delete_array(), m_array_data, m_dim, m_N, m_size, and escript::Taipan::new_array().

Referenced by DataVectorTaipan().

◆ size()

DataVectorTaipan::size_type escript::DataTypes::DataVectorTaipan::size ( ) const
inline

Return the number of elements in this DataVectorTaipan.

Referenced by copyFromArrayToOffset().

Member Data Documentation

◆ m_array_data

VectorStorageType escript::DataTypes::DataVectorTaipan::m_array_data
private

◆ m_dim

size_type escript::DataTypes::DataVectorTaipan::m_dim
private

◆ m_N

size_type escript::DataTypes::DataVectorTaipan::m_N
private

◆ m_size

size_type escript::DataTypes::DataVectorTaipan::m_size
private

The documentation for this class was generated from the following files: