ESYS13  Revision_
Public Types | Public Member Functions | Private Attributes
escript::DataBlocks2D Class Reference

DataBlocks2D manages a 2D array of multi-dimensional data points. More...

#include <DataBlocks2D.h>

List of all members.

Public Types

typedef DataVector ValueType

Public Member Functions

 DataBlocks2D ()
 Default constructor for DataBlocks2D.
 DataBlocks2D (const DataBlocks2D &other)
 Copy constructor for DataBlocks2D.
 DataBlocks2D (int numRows, int numCols, int blockSize)
 Constructor for DataBlocks2D.
 ~DataBlocks2D ()
 Default destructor for DataBlocks2D.
ValueType::size_type size () const
 Return the size of the underlying data array. ie: Number of rows * Number of columns * Number of elements per data point.
ValueType::size_type getNumRows () const
 Return the number of rows in this DataBlocks2D array.
ValueType::size_type getNumCols () const
 Return the number of columns in this DataBlocks2D array.
ValueType::size_type getBlockSize () const
 Return the data point size for this DataBlocks2D array.
void resize (int numRows, int numCols, int blockSize)
 Resize the underlying data array. All current data is lost. The new data elements are initialised to 0.
DataBlocks2Doperator= (const DataBlocks2D &other)
 DataBlocks2D assignment operator = Assign the given DataBlocks2D object to this one.
void Swap (DataBlocks2D &other)
 Swap all the values managed by the given DataBlocks2D objects.
ValueType::size_type index (int row, int col) const
 Return the 1 dimensional index of the first element for data-point (i,j) within the underlying data array. Provides an index for accessing this data value via the [] operator. Subsequent elements of this data point can be accessed by manually incrementing the returned index value.
ValueType::reference operator[] (ValueType::size_type i)
 Return a reference to the first element for the data-point with index i within the underlying data array as determined by the index(i,j) method.
ValueType::const_reference operator[] (ValueType::size_type i) const
ValueType::reference operator() (int row, int col)
 Return a reference to the first element for the data-point (i,j).
ValueType::const_reference operator() (int row, int col) const
ValueTypegetData ()
 Return a reference to the underlying data array. Data returned is an array type object that can be indexed via indexes generated by DataBlocks2D::index.
const ValueTypegetData () const

Private Attributes

ValueType m_data
ValueType::size_type m_numRows
ValueType::size_type m_numCols
ValueType::size_type m_blockSize

Detailed Description

DataBlocks2D manages a 2D array of multi-dimensional data points.

Description: This class is used to manage the data held by instances of the DataExpanded class.


Member Typedef Documentation


Constructor & Destructor Documentation

Default constructor for DataBlocks2D.

Description: Default constructor for DataBlocks2D. Creates an empty DataBlocks2D object.

Copy constructor for DataBlocks2D.

Description: Copy constructor for DataBlocks2D.

References m_data.

escript::DataBlocks2D::DataBlocks2D ( int  numRows,
int  numCols,
int  blockSize 
)

Constructor for DataBlocks2D.

Description: Constructor for DataBlocks2D.

Parameters:
numRows- Input - Number of rows(samples).
numCols- Input - Number of columns(data-points per sample).
blockSize- Input - Number of elements per block(per data-point).

All parameters must be >0, else an exception will be thrown.

References m_numRows, and resize().

Default destructor for DataBlocks2D.

Description: Default destructor for DataBlocks2D.

References m_blockSize, m_numCols, and m_numRows.


Member Function Documentation

Return the data point size for this DataBlocks2D array.

References EsysAssert, m_blockSize, m_numCols, and m_numRows.

Return a reference to the underlying data array. Data returned is an array type object that can be indexed via indexes generated by DataBlocks2D::index.

References EsysAssert, m_blockSize, m_data, m_numCols, and m_numRows.

Referenced by escript::DataExpanded::DataExpanded(), escript::DataExpanded::getVectorRO(), escript::DataExpanded::getVectorRW(), escript::DataExpanded::hasNaN(), and escript::DataExpanded::matrixInverse().

DataBlocks2D::ValueType::size_type escript::DataBlocks2D::index ( int  row,
int  col 
) const [inline]

Return the 1 dimensional index of the first element for data-point (i,j) within the underlying data array. Provides an index for accessing this data value via the [] operator. Subsequent elements of this data point can be accessed by manually incrementing the returned index value.

References EsysAssert, m_blockSize, m_data, m_numCols, m_numRows, and escript::DataVector::size().

Referenced by escript::DataExpanded::getPointOffset(), and operator()().

DataBlocks2D::ValueType::reference escript::DataBlocks2D::operator() ( int  row,
int  col 
) [inline]

Return a reference to the first element for the data-point (i,j).

References EsysAssert, index(), m_blockSize, m_data, m_numCols, and m_numRows.

DataBlocks2D::ValueType::const_reference escript::DataBlocks2D::operator() ( int  row,
int  col 
) const [inline]
DataBlocks2D & escript::DataBlocks2D::operator= ( const DataBlocks2D other)

DataBlocks2D assignment operator = Assign the given DataBlocks2D object to this one.

References EsysAssert, m_blockSize, m_numCols, m_numRows, and Swap().

DataBlocks2D::ValueType::reference escript::DataBlocks2D::operator[] ( ValueType::size_type  i) [inline]

Return a reference to the first element for the data-point with index i within the underlying data array as determined by the index(i,j) method.

References EsysAssert, m_blockSize, m_data, m_numCols, and m_numRows.

DataBlocks2D::ValueType::const_reference escript::DataBlocks2D::operator[] ( ValueType::size_type  i) const [inline]
void escript::DataBlocks2D::resize ( int  numRows,
int  numCols,
int  blockSize 
)

Resize the underlying data array. All current data is lost. The new data elements are initialised to 0.

Parameters:
numRows- Input - Number of rows.
numCols- Input - Number of columns.
blockSize- Input - Number of elements per block.

All parameters must be >0, else an exception will be thrown.

References m_blockSize, m_data, m_numCols, m_numRows, escript::DataVector::resize(), and size().

Referenced by DataBlocks2D(), and escript::DataExpanded::initialise().

Return the size of the underlying data array. ie: Number of rows * Number of columns * Number of elements per data point.

References EsysAssert, m_blockSize, m_data, m_numCols, m_numRows, and escript::DataVector::size().

Referenced by escript::DataExpanded::getLength(), and resize().

Swap all the values managed by the given DataBlocks2D objects.

References EsysAssert, m_blockSize, m_data, m_numCols, m_numRows, and swap().

Referenced by operator=().


Member Data Documentation


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