Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
openfluid::core::Matrix< T > Class Template Reference

#include <core/Matrix.hpp>

Collaboration diagram for openfluid::core::Matrix< T >:
Collaboration graph
[legend]

Public Member Functions

 Matrix ()
 
 Matrix (const Matrix &Matrix)
 
 Matrix (unsigned long ColsNbr, unsigned long RowsNbr)
 
 Matrix (unsigned long ColsNbr, unsigned long RowsNbr, T InitValue)
 
virtual ~Matrix ()
 
unsigned long getColsNbr () const
 
unsigned long getRowsNbr () const
 
unsigned long getSize () const
 
unsigned long size () const
 
T * data () const
 
void setData (T *Data, unsigned long ColsNbr, unsigned long RowsNbr)
 
getElement (unsigned long ColIndex, unsigned long RowIndex) const
 
at (unsigned long ColIndex, unsigned long RowIndex) const
 
get (unsigned long ColIndex, unsigned long RowIndex) const
 
void setElement (unsigned long ColIndex, unsigned long RowIndex, T Element)
 
void set (unsigned long ColIndex, unsigned long RowIndex, T Element)
 
Matrix< T > & operator= (const Matrix &A)
 
void fill (const T &Val)
 
void clear ()
 

Protected Member Functions

bool allocate (unsigned long ColsNbr, unsigned long RowsNbr)
 
void init ()
 

Protected Attributes

T * m_Data
 
unsigned long m_ColsNbr
 
unsigned long m_RowsNbr
 

Detailed Description

template<class T>
class openfluid::core::Matrix< T >

Template class for matrix data

Constructor & Destructor Documentation

template<class T >
openfluid::core::Matrix< T >::Matrix ( )

Default constructor, creates an empty Matrix

template<class T >
openfluid::core::Matrix< T >::Matrix ( const Matrix< T > &  Matrix)

Copy constructor

template<class T >
openfluid::core::Matrix< T >::Matrix ( unsigned long  ColsNbr,
unsigned long  RowsNbr 
)

Constructor, creates a Matrix containing Size elements

template<class T>
openfluid::core::Matrix< T >::Matrix ( unsigned long  ColsNbr,
unsigned long  RowsNbr,
InitValue 
)

Constructor, creates a Matrix containing Size elements, initialized with value InitValue

template<class T>
virtual openfluid::core::Matrix< T >::~Matrix ( )
inlinevirtual

Destructor

Member Function Documentation

template<class T >
bool openfluid::core::Matrix< T >::allocate ( unsigned long  ColsNbr,
unsigned long  RowsNbr 
)
protected
template<class T>
T openfluid::core::Matrix< T >::at ( unsigned long  ColIndex,
unsigned long  RowIndex 
) const
inline

Returns the element of the Matrix for index Index

template<class T >
void openfluid::core::Matrix< T >::clear ( )

Clears the Matrix (empty and size is 0)

template<class T>
T* openfluid::core::Matrix< T >::data ( ) const
inline

Returns a pointer to the content of the Matrix (like C arrays)

template<class T>
void openfluid::core::Matrix< T >::fill ( const T &  Val)

Fills the Matrix with given value

template<class T>
T openfluid::core::Matrix< T >::get ( unsigned long  ColIndex,
unsigned long  RowIndex 
) const
inline

Returns the element of the Matrix for index Index

template<class T>
unsigned long openfluid::core::Matrix< T >::getColsNbr ( ) const
inline

Returns the number of columns of the Matrix

Returns
number of columns
template<class T >
T openfluid::core::Matrix< T >::getElement ( unsigned long  ColIndex,
unsigned long  RowIndex 
) const

Returns the element of the Matrix for index Index

template<class T>
unsigned long openfluid::core::Matrix< T >::getRowsNbr ( ) const
inline

Returns the number of rows of the Matrix

Returns
number of rows
template<class T>
unsigned long openfluid::core::Matrix< T >::getSize ( ) const
inline

Returns the full size of the Matrix (number of columns x number of rows)

Returns
size of the Matrix
template<class T >
void openfluid::core::Matrix< T >::init ( )
protected
template<class T >
Matrix< T > & openfluid::core::Matrix< T >::operator= ( const Matrix< T > &  A)

Allocation operator

template<class T>
void openfluid::core::Matrix< T >::set ( unsigned long  ColIndex,
unsigned long  RowIndex,
Element 
)
inline

Sets a new value for element at the given index

template<class T>
void openfluid::core::Matrix< T >::setData ( T *  Data,
unsigned long  ColsNbr,
unsigned long  RowsNbr 
)

Sets data from a pointer to a content (like C arrays)

template<class T>
void openfluid::core::Matrix< T >::setElement ( unsigned long  ColIndex,
unsigned long  RowIndex,
Element 
)

Sets a new value for element at the given index

template<class T>
unsigned long openfluid::core::Matrix< T >::size ( ) const
inline

Returns the full size of the Matrix

Member Data Documentation

template<class T>
unsigned long openfluid::core::Matrix< T >::m_ColsNbr
protected
template<class T>
T* openfluid::core::Matrix< T >::m_Data
protected
template<class T>
unsigned long openfluid::core::Matrix< T >::m_RowsNbr
protected

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