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)
 
T getElement (unsigned long ColIndex, unsigned long RowIndex) const
 
T at (unsigned long ColIndex, unsigned long RowIndex) const
 
T 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

◆ Matrix() [1/4]

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

Default constructor, creates an empty Matrix

◆ Matrix() [2/4]

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

Copy constructor

◆ Matrix() [3/4]

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

Constructor, creates a Matrix containing Size elements

◆ Matrix() [4/4]

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

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

◆ ~Matrix()

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

Destructor

Member Function Documentation

◆ allocate()

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

◆ at()

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

◆ clear()

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

Clears the Matrix (empty and size is 0)

◆ data()

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

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

◆ fill()

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

Fills the Matrix with given value

◆ get()

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

◆ getColsNbr()

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

Returns the number of columns of the Matrix

Returns
number of columns

◆ getElement()

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

◆ getRowsNbr()

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

Returns the number of rows of the Matrix

Returns
number of rows

◆ getSize()

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

◆ init()

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

◆ operator=()

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

Allocation operator

◆ set()

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

Sets a new value for element at the given index

◆ setData()

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)

◆ setElement()

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

Sets a new value for element at the given index

◆ size()

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

Returns the full size of the Matrix

Member Data Documentation

◆ m_ColsNbr

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

◆ m_Data

template<class T>
T* openfluid::core::Matrix< T >::m_Data
protected

◆ m_RowsNbr

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

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