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

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

#include <DataBlocks2D.h>

Public Types

typedef DataVector ValueType
 

Public Member Functions

 DataBlocks2D ()
 Default constructor for DataBlocks2D. More...
 
 DataBlocks2D (const DataBlocks2D &other)
 Copy constructor for DataBlocks2D. More...
 
 DataBlocks2D (int numRows, int numCols, int blockSize)
 Constructor for DataBlocks2D. More...
 
 ~DataBlocks2D ()
 Default destructor for DataBlocks2D. More...
 
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. More...
 
ValueType::size_type getNumRows () const
 Return the number of rows in this DataBlocks2D array. More...
 
ValueType::size_type getNumCols () const
 Return the number of columns in this DataBlocks2D array. More...
 
ValueType::size_type getBlockSize () const
 Return the data point size for this DataBlocks2D array. More...
 
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. More...
 
DataBlocks2Doperator= (const DataBlocks2D &other)
 DataBlocks2D assignment operator = Assign the given DataBlocks2D object to this one. More...
 
void Swap (DataBlocks2D &other)
 Swap all the values managed by the given DataBlocks2D objects. More...
 
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. More...
 
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. More...
 
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). More...
 
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. More...
 
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

escript::DataBlocks2D::DataBlocks2D ( )

Default constructor for DataBlocks2D.

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

escript::DataBlocks2D::DataBlocks2D ( const DataBlocks2D other)

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

escript::DataBlocks2D::~DataBlocks2D ( )

Default destructor for DataBlocks2D.

Description: Default destructor for DataBlocks2D.

References m_blockSize, m_numCols, and m_numRows.

Member Function Documentation

DataBlocks2D::ValueType::size_type escript::DataBlocks2D::getBlockSize ( ) const
inline

Return the data point size for this DataBlocks2D array.

References EsysAssert, m_blockSize, m_numCols, and m_numRows.

DataBlocks2D::ValueType & escript::DataBlocks2D::getData ( )
inline

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

const DataBlocks2D::ValueType & escript::DataBlocks2D::getData ( ) const
inline
DataBlocks2D::ValueType::size_type escript::DataBlocks2D::getNumCols ( ) const
inline
DataBlocks2D::ValueType::size_type escript::DataBlocks2D::getNumRows ( ) const
inline
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().

DataBlocks2D::ValueType::size_type escript::DataBlocks2D::size ( ) const
inline

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(), escript::DataExpanded::replaceNaN(), and resize().

void escript::DataBlocks2D::Swap ( DataBlocks2D other)

Swap all the values managed by the given DataBlocks2D objects.

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

Referenced by operator=().

Member Data Documentation

ValueType::size_type escript::DataBlocks2D::m_blockSize
private
ValueType escript::DataBlocks2D::m_data
private
ValueType::size_type escript::DataBlocks2D::m_numCols
private
ValueType::size_type escript::DataBlocks2D::m_numRows
private

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