OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Types | Public Member Functions | Protected Attributes | List of all members
Array2D< T > Class Template Reference

Two-dimensional array. More...

#include <Array2D.h>

Inheritance diagram for Array2D< T >:
Inheritance graph
[legend]

Public Types

typedef T value_type
 The value type of the array. More...
 
typedef T * iterator
 The iterator type for sequential access to all elements. More...
 
typedef const T * const_iterator
 The iterator type for sequential access to all elements. More...
 
typedef T * row_iterator
 The iterator type for access by rows. More...
 
typedef const T * const_row_iterator
 The iterator type for access by rows for a constant array. More...
 
typedef SliceIterator< T > col_iterator
 The iterator type for access by columns. More...
 
typedef ConstSliceIterator< T > const_col_iterator
 The iterator type for access by columns for a constant array. More...
 

Public Member Functions

 Array2D ()
 Default constructor. More...
 
 Array2D (int rows, int cols)
 Constructor. More...
 
 Array2D (int rows, int cols, const T &t)
 Constructor. More...
 
 Array2D (const Array2D &)
 
 ~Array2D ()
 
Array2D< T > & operator= (const Array2D< T > &)
 
T & operator() (int r, int c)
 Get element reference. More...
 
const T & operator() (int r, int c) const
 Get element value. More...
 
int nrows () const
 Get number of rows. More...
 
int ncols () const
 Get number of columns. More...
 
int size () const
 Get total size (rows times columns). More...
 
iterator begin ()
 Get pointer to beginning of data. More...
 
iterator end ()
 Get pointer past end of data. More...
 
const_iterator begin () const
 Get pointer to beginning of data. More...
 
const_iterator end () const
 Get pointer past end of data. More...
 
row_iterator row_begin (int r)
 Get row iterator. More...
 
row_iterator row_end (int r)
 Get row iterator. More...
 
const_row_iterator row_begin (int r) const
 Get row iterator. More...
 
const_row_iterator row_end (int r) const
 Get row iterator. More...
 
row_iterator operator[] (int r)
 Get row iterator. More...
 
const_row_iterator operator[] (int r) const
 Get row iterator. More...
 
col_iterator col_begin (int c)
 Get column iterator. More...
 
col_iterator col_end (int c)
 Get column iterator. More...
 
const_col_iterator col_begin (int c) const
 Get column iterator. More...
 
const_col_iterator col_end (int c) const
 Get column iterator. More...
 
void getColumn (Array1D< T > &toArray, int c) const
 Fetch column. More...
 
void getRow (Array1D< T > &toArray, int r) const
 Fetch row. More...
 
void putColumn (const Array1D< T > &fromArray, int c)
 Store column. More...
 
void putRow (const Array1D< T > &fromArray, int r)
 Store row. More...
 
void swapColumns (int c1, int c2)
 Exchange columns. More...
 
void swapRows (int row1, int row2)
 Exchange rows. More...
 

Protected Attributes

int rows
 
int cols
 
int len
 
T * data
 

Detailed Description

template<class T>
class Array2D< T >

Two-dimensional array.

Definition at line 40 of file Array2D.h.

Member Typedef Documentation

◆ col_iterator

template<class T >
typedef SliceIterator<T> Array2D< T >::col_iterator

The iterator type for access by columns.

Definition at line 61 of file Array2D.h.

◆ const_col_iterator

template<class T >
typedef ConstSliceIterator<T> Array2D< T >::const_col_iterator

The iterator type for access by columns for a constant array.

Definition at line 64 of file Array2D.h.

◆ const_iterator

template<class T >
typedef const T* Array2D< T >::const_iterator

The iterator type for sequential access to all elements.

Definition at line 52 of file Array2D.h.

◆ const_row_iterator

template<class T >
typedef const T* Array2D< T >::const_row_iterator

The iterator type for access by rows for a constant array.

Definition at line 58 of file Array2D.h.

◆ iterator

template<class T >
typedef T* Array2D< T >::iterator

The iterator type for sequential access to all elements.

Definition at line 48 of file Array2D.h.

◆ row_iterator

template<class T >
typedef T* Array2D< T >::row_iterator

The iterator type for access by rows.

Definition at line 55 of file Array2D.h.

◆ value_type

template<class T >
typedef T Array2D< T >::value_type

The value type of the array.

Definition at line 45 of file Array2D.h.

Constructor & Destructor Documentation

◆ Array2D() [1/4]

template<class T >
Array2D< T >::Array2D
inline

Default constructor.

Definition at line 233 of file Array2D.h.

◆ Array2D() [2/4]

template<class T >
Array2D< T >::Array2D ( int  rows,
int  cols 
)
inline

Constructor.

Definition at line 246 of file Array2D.h.

◆ Array2D() [3/4]

template<class T >
Array2D< T >::Array2D ( int  rows,
int  cols,
const T &  t 
)
inline

Constructor.

Definition at line 252 of file Array2D.h.

References Array2D< T >::begin(), and Array2D< T >::end().

Here is the call graph for this function:

◆ Array2D() [4/4]

template<class T >
Array2D< T >::Array2D ( const Array2D< T > &  array)
inline

Definition at line 239 of file Array2D.h.

References Array2D< T >::begin(), and Array2D< T >::end().

Here is the call graph for this function:

◆ ~Array2D()

template<class T >
Array2D< T >::~Array2D
inline

Definition at line 259 of file Array2D.h.

Member Function Documentation

◆ begin() [1/2]

template<class T >
Array2D< T >::iterator Array2D< T >::begin
inline

Get pointer to beginning of data.

Definition at line 319 of file Array2D.h.

Referenced by Array2D< T >::Array2D(), Matrix< T >::operator+=(), operator-(), Matrix< T >::operator-=(), and Array2D< T >::operator=().

◆ begin() [2/2]

template<class T >
Array2D< T >::const_iterator Array2D< T >::begin
inline

Get pointer to beginning of data.

Definition at line 331 of file Array2D.h.

◆ col_begin() [1/2]

template<class T >
Array2D< T >::col_iterator Array2D< T >::col_begin ( int  c)

Get column iterator.

Definition at line 391 of file Array2D.h.

References Physics::c.

Referenced by LUMatrix< T >::backSubstitute(), and Matrix< T >::dotm().

◆ col_begin() [2/2]

template<class T >
Array2D< T >::const_col_iterator Array2D< T >::col_begin ( int  c) const

Get column iterator.

Definition at line 409 of file Array2D.h.

References Physics::c.

◆ col_end() [1/2]

template<class T >
Array2D< T >::col_iterator Array2D< T >::col_end ( int  c)

Get column iterator.

Definition at line 400 of file Array2D.h.

References Physics::c.

◆ col_end() [2/2]

template<class T >
Array2D< T >::const_col_iterator Array2D< T >::col_end ( int  c) const

Get column iterator.

Definition at line 418 of file Array2D.h.

References Physics::c.

◆ end() [1/2]

template<class T >
Array2D< T >::iterator Array2D< T >::end
inline

Get pointer past end of data.

Definition at line 325 of file Array2D.h.

Referenced by Array2D< T >::Array2D(), and Array2D< T >::operator=().

◆ end() [2/2]

template<class T >
Array2D< T >::const_iterator Array2D< T >::end
inline

Get pointer past end of data.

Definition at line 337 of file Array2D.h.

◆ getColumn()

template<class T >
void Array2D< T >::getColumn ( Array1D< T > &  toArray,
int  c 
) const

Fetch column.

Definition at line 427 of file Array2D.h.

References Array1D< T >::begin(), Physics::c, and Array1D< T >::size().

Here is the call graph for this function:

◆ getRow()

template<class T >
void Array2D< T >::getRow ( Array1D< T > &  toArray,
int  r 
) const

Fetch row.

Definition at line 434 of file Array2D.h.

References Array1D< T >::begin(), and Array1D< T >::size().

Here is the call graph for this function:

◆ ncols()

template<class T >
int Array2D< T >::ncols
inline

◆ nrows()

template<class T >
int Array2D< T >::nrows
inline

◆ operator()() [1/2]

template<class T >
T & Array2D< T >::operator() ( int  r,
int  c 
)
inline

Get element reference.

Definition at line 283 of file Array2D.h.

References Physics::c.

◆ operator()() [2/2]

template<class T >
const T & Array2D< T >::operator() ( int  r,
int  c 
) const
inline

Get element value.

Definition at line 292 of file Array2D.h.

References Physics::c.

◆ operator=()

template<class T >
Array2D< T > & Array2D< T >::operator= ( const Array2D< T > &  rhs)
inline

Definition at line 265 of file Array2D.h.

References Array2D< T >::begin(), begin(), Array2D< T >::cols, Array2D< T >::end(), Array2D< T >::len, Array2D< T >::rows, and Attrib::Legacy::Distribution::T.

Referenced by Matrix< T >::operator=().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T >
Array2D< T >::row_iterator Array2D< T >::operator[] ( int  r)

Get row iterator.

Definition at line 379 of file Array2D.h.

◆ operator[]() [2/2]

template<class T >
Array2D< T >::const_row_iterator Array2D< T >::operator[] ( int  r) const

Get row iterator.

Definition at line 385 of file Array2D.h.

◆ putColumn()

template<class T >
void Array2D< T >::putColumn ( const Array1D< T > &  fromArray,
int  c 
)

Store column.

Definition at line 441 of file Array2D.h.

References Array1D< T >::begin(), Physics::c, Array1D< T >::end(), and Array1D< T >::size().

Here is the call graph for this function:

◆ putRow()

template<class T >
void Array2D< T >::putRow ( const Array1D< T > &  fromArray,
int  r 
)

Store row.

Definition at line 450 of file Array2D.h.

References Array1D< T >::begin(), Array1D< T >::end(), and Array1D< T >::size().

Here is the call graph for this function:

◆ row_begin() [1/2]

template<class T >
Array2D< T >::row_iterator Array2D< T >::row_begin ( int  r)

Get row iterator.

Definition at line 343 of file Array2D.h.

◆ row_begin() [2/2]

template<class T >
Array2D< T >::const_row_iterator Array2D< T >::row_begin ( int  r) const

Get row iterator.

Definition at line 361 of file Array2D.h.

◆ row_end() [1/2]

template<class T >
Array2D< T >::row_iterator Array2D< T >::row_end ( int  r)

Get row iterator.

Definition at line 352 of file Array2D.h.

◆ row_end() [2/2]

template<class T >
Array2D< T >::const_row_iterator Array2D< T >::row_end ( int  r) const

Get row iterator.

Definition at line 370 of file Array2D.h.

◆ size()

template<class T >
int Array2D< T >::size
inline

Get total size (rows times columns).

Definition at line 313 of file Array2D.h.

◆ swapColumns()

template<class T >
void Array2D< T >::swapColumns ( int  c1,
int  c2 
)

Exchange columns.

Definition at line 459 of file Array2D.h.

◆ swapRows()

template<class T >
void Array2D< T >::swapRows ( int  row1,
int  row2 
)

Exchange rows.

Definition at line 465 of file Array2D.h.

Member Data Documentation

◆ cols

template<class T >
int Array2D< T >::cols
protected

Definition at line 221 of file Array2D.h.

Referenced by Matrix< T >::Matrix(), and Array2D< T >::operator=().

◆ data

template<class T >
T* Array2D< T >::data
protected

Definition at line 225 of file Array2D.h.

Referenced by Matrix< T >::Matrix().

◆ len

template<class T >
int Array2D< T >::len
protected

Definition at line 222 of file Array2D.h.

Referenced by Array2D< T >::operator=().

◆ rows

template<class T >
int Array2D< T >::rows
protected

Definition at line 220 of file Array2D.h.

Referenced by Matrix< T >::Matrix(), and Array2D< T >::operator=().


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