OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
FArray2D< T, M, N > Class Template Reference

A templated representation for 2-dimensional arrays. More...

#include <FArray2D.h>

Inheritance diagram for FArray2D< T, M, N >:
Collaboration diagram for FArray2D< T, M, N >:

Public Types

typedef T value_type
 The value type of the array.
typedef T * iterator
 Iterator for the array.
typedef const T * const_iterator
 Iterator for constant array.
typedef T * row_iterator
 Iterator for access by rows.
typedef const T * const_row_iterator
 Iterator for access by rows.
typedef FSlice< T, N > col_iterator
 Iterator for access by columns.
typedef FConstSlice< T, N > const_col_iterator
 Iterator for access by columns.

Public Member Functions

 FArray2D ()
 Default constructor.
 FArray2D (const T &t)
 Constructor.
 FArray2D (const FArray2D &)
 Copy constructor.
const FArray2D< T, M, N > & operator= (const FArray2D< T, M, N > &)
 Assignment.
T & operator() (int r, int c)
 Get element.
const T & operator() (int r, int c) const
 Get element.
int nrows () const
 Get number of rows.
int ncols () const
 Get number of columns.
int size () const
 Get total size.
iterator begin ()
 Get beginning of data.
iterator end ()
 Get pointer past end of data.
const_iterator begin () const
 Get beginning of data.
const_iterator end () const
 Get pointer past end of data.
row_iterator row_begin (int r)
 Get row iterator.
row_iterator row_end (int r)
 Get row iterator.
const_row_iterator row_begin (int r) const
 Get row iterator.
const_row_iterator row_end (int r) const
 Get row iterator.
row_iterator operator[] (int r)
 Get row iterator.
const_row_iterator operator[] (int r) const
 Get row iterator.
col_iterator col_begin (int c)
 Get column iterator.
col_iterator col_end (int c)
 Get column iterator.
const_col_iterator col_begin (int c) const
 Get column iterator.
const_col_iterator col_end (int c) const
 Get column iterator.
void getColumn (FArray1D< T, M > &toArray, int c) const
 Fetch column.
void getRow (FArray1D< T, N > &toArray, int r) const
 Fetch row.
void putColumn (const FArray1D< T, M > &fromArray, int c)
 Store column.
void putRow (const FArray1D< T, N > &fromArray, int r)
 Store row.
void swapColumns (int c1, int c2)
 Exchange columns.
void swapRows (int r1, int r2)
 Exchange rows.

Protected Attributes

data [M *N]

Static Protected Attributes

static const int SIZE = M *N

Detailed Description

template<class T, int M, int N>
class FArray2D< T, M, N >

A templated representation for 2-dimensional arrays.

Definition at line 40 of file FArray2D.h.

Member Typedef Documentation

◆ col_iterator

template<class T, int M, int N>
typedef FSlice<T, N> FArray2D< T, M, N >::col_iterator

Iterator for access by columns.

Definition at line 60 of file FArray2D.h.

◆ const_col_iterator

template<class T, int M, int N>
typedef FConstSlice<T, N> FArray2D< T, M, N >::const_col_iterator

Iterator for access by columns.

Definition at line 63 of file FArray2D.h.

◆ const_iterator

template<class T, int M, int N>
typedef const T* FArray2D< T, M, N >::const_iterator

Iterator for constant array.

Definition at line 51 of file FArray2D.h.

◆ const_row_iterator

template<class T, int M, int N>
typedef const T* FArray2D< T, M, N >::const_row_iterator

Iterator for access by rows.

Definition at line 57 of file FArray2D.h.

◆ iterator

template<class T, int M, int N>
typedef T* FArray2D< T, M, N >::iterator

Iterator for the array.

Definition at line 48 of file FArray2D.h.

◆ row_iterator

template<class T, int M, int N>
typedef T* FArray2D< T, M, N >::row_iterator

Iterator for access by rows.

Definition at line 54 of file FArray2D.h.

◆ value_type

template<class T, int M, int N>
typedef T FArray2D< T, M, N >::value_type

The value type of the array.

Definition at line 45 of file FArray2D.h.

Constructor & Destructor Documentation

◆ FArray2D() [1/3]

template<class T, int M, int N>
FArray2D< T, M, N >::FArray2D ( )
inline

Default constructor.

Definition at line 210 of file FArray2D.h.

References begin(), and end().

Referenced by FArray2D(), and operator=().

Here is the call graph for this function:

◆ FArray2D() [2/3]

template<class T, int M, int N>
FArray2D< T, M, N >::FArray2D ( const T & t)
inlineexplicit

Constructor.

Definition at line 216 of file FArray2D.h.

References begin(), and end().

Here is the call graph for this function:

◆ FArray2D() [3/3]

template<class T, int M, int N>
FArray2D< T, M, N >::FArray2D ( const FArray2D< T, M, N > & rhs)

Copy constructor.

Definition at line 222 of file FArray2D.h.

References begin(), end(), and FArray2D().

Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::iterator FArray2D< T, M, N >::begin ( )
inline

Get beginning of data.

Definition at line 271 of file FArray2D.h.

References data.

Referenced by FArray2D(), FMatrix< T, R, C >::operator+=(), operator-(), FMatrix< T, R, C >::operator-=(), and operator=().

◆ begin() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_iterator FArray2D< T, M, N >::begin ( ) const
inline

Get beginning of data.

Definition at line 283 of file FArray2D.h.

References data.

◆ col_begin() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::col_iterator FArray2D< T, M, N >::col_begin ( int c)

Get column iterator.

Definition at line 343 of file FArray2D.h.

References begin(), and c.

Referenced by FLUMatrix< T, N >::backSubstitute(), getColumn(), operator*(), operator*(), putColumn(), swapColumns(), and FMatrix< T, R, C >::transpose().

Here is the call graph for this function:

◆ col_begin() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_col_iterator FArray2D< T, M, N >::col_begin ( int c) const

Get column iterator.

Definition at line 361 of file FArray2D.h.

References begin(), and c.

Here is the call graph for this function:

◆ col_end() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::col_iterator FArray2D< T, M, N >::col_end ( int c)

Get column iterator.

Definition at line 352 of file FArray2D.h.

References c, and end().

Referenced by getColumn(), and swapColumns().

Here is the call graph for this function:

◆ col_end() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_col_iterator FArray2D< T, M, N >::col_end ( int c) const

Get column iterator.

Definition at line 370 of file FArray2D.h.

References c, and end().

Here is the call graph for this function:

◆ end() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::iterator FArray2D< T, M, N >::end ( )
inline

Get pointer past end of data.

Definition at line 277 of file FArray2D.h.

References data, and SIZE.

Referenced by FArray2D(), operator-(), and operator=().

◆ end() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_iterator FArray2D< T, M, N >::end ( ) const
inline

Get pointer past end of data.

Definition at line 289 of file FArray2D.h.

References data, and SIZE.

◆ getColumn()

template<class T, int M, int N>
void FArray2D< T, M, N >::getColumn ( FArray1D< T, M > & toArray,
int c ) const

Fetch column.

Definition at line 379 of file FArray2D.h.

References FArray1D< T, N >::begin(), c, col_begin(), and col_end().

Here is the call graph for this function:

◆ getRow()

template<class T, int M, int N>
void FArray2D< T, M, N >::getRow ( FArray1D< T, N > & toArray,
int r ) const

Fetch row.

Definition at line 385 of file FArray2D.h.

References FArray1D< T, N >::begin(), row_begin(), and row_end().

Here is the call graph for this function:

◆ ncols()

template<class T, int M, int N>
int FArray2D< T, M, N >::ncols ( ) const
inline

Get number of columns.

Definition at line 259 of file FArray2D.h.

◆ nrows()

template<class T, int M, int N>
int FArray2D< T, M, N >::nrows ( ) const
inline

Get number of rows.

Definition at line 253 of file FArray2D.h.

◆ operator()() [1/2]

template<class T, int M, int N>
T & FArray2D< T, M, N >::operator() ( int r,
int c )
inline

Get element.

Definition at line 235 of file FArray2D.h.

References c, and data.

◆ operator()() [2/2]

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

Get element.

Definition at line 244 of file FArray2D.h.

References c, and data.

◆ operator=()

template<class T, int M, int N>
const FArray2D< T, M, N > & FArray2D< T, M, N >::operator= ( const FArray2D< T, M, N > & rhs)

Assignment.

Definition at line 228 of file FArray2D.h.

References begin(), end(), and FArray2D().

Referenced by FMatrix< T, R, C >::operator=(), and FMatrix< T, R, C >::operator=().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::row_iterator FArray2D< T, M, N >::operator[] ( int r)

Get row iterator.

Definition at line 331 of file FArray2D.h.

References data.

◆ operator[]() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_row_iterator FArray2D< T, M, N >::operator[] ( int r) const

Get row iterator.

Definition at line 337 of file FArray2D.h.

References data.

◆ putColumn()

template<class T, int M, int N>
void FArray2D< T, M, N >::putColumn ( const FArray1D< T, M > & fromArray,
int c )

Store column.

Definition at line 391 of file FArray2D.h.

References FArray1D< T, N >::begin(), c, col_begin(), and FArray1D< T, N >::end().

Here is the call graph for this function:

◆ putRow()

template<class T, int M, int N>
void FArray2D< T, M, N >::putRow ( const FArray1D< T, N > & fromArray,
int r )

Store row.

Definition at line 397 of file FArray2D.h.

References FArray1D< T, N >::begin(), FArray1D< T, N >::end(), and row_begin().

Here is the call graph for this function:

◆ row_begin() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::row_iterator FArray2D< T, M, N >::row_begin ( int r)

Get row iterator.

Definition at line 295 of file FArray2D.h.

References data.

Referenced by getRow(), operator*(), operator*(), putRow(), and swapRows().

◆ row_begin() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_row_iterator FArray2D< T, M, N >::row_begin ( int r) const

Get row iterator.

Definition at line 313 of file FArray2D.h.

References data.

◆ row_end() [1/2]

template<class T, int M, int N>
FArray2D< T, M, N >::row_iterator FArray2D< T, M, N >::row_end ( int r)

Get row iterator.

Definition at line 304 of file FArray2D.h.

References data.

Referenced by getRow(), operator*(), operator*(), and swapRows().

◆ row_end() [2/2]

template<class T, int M, int N>
FArray2D< T, M, N >::const_row_iterator FArray2D< T, M, N >::row_end ( int r) const

Get row iterator.

Definition at line 322 of file FArray2D.h.

References data.

◆ size()

template<class T, int M, int N>
int FArray2D< T, M, N >::size ( ) const
inline

Get total size.

Definition at line 265 of file FArray2D.h.

References SIZE.

◆ swapColumns()

template<class T, int M, int N>
void FArray2D< T, M, N >::swapColumns ( int c1,
int c2 )

Exchange columns.

Definition at line 403 of file FArray2D.h.

References col_begin(), and col_end().

Here is the call graph for this function:

◆ swapRows()

template<class T, int M, int N>
void FArray2D< T, M, N >::swapRows ( int r1,
int r2 )

Exchange rows.

Definition at line 409 of file FArray2D.h.

References row_begin(), and row_end().

Here is the call graph for this function:

Member Data Documentation

◆ data

template<class T, int M, int N>
T FArray2D< T, M, N >::data[M *N]
protected

◆ SIZE

template<class T, int M, int N>
const int FArray2D< T, M, N >::SIZE = M *N
staticprotected

Definition at line 202 of file FArray2D.h.

Referenced by end(), end(), and size().


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