Manual for OpenFLUID 2.1.11

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

Detailed Description

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

Template class for matrix data

#include <core/Matrix.hpp>

Public Member Functions

 Matrix ()
 
 Matrix (const Matrix &Other)
 
 Matrix (unsigned long ColsNbr, unsigned long RowsNbr)
 
 Matrix (unsigned long ColsNbr, unsigned long RowsNbr, const T &InitValue)
 
Matrix< T > & operator= (const Matrix &Other)
 
Matrix< T > & operator= (Matrix &&Other)
 
virtual ~Matrix ()=default
 
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, const T &Val)
 
void set (unsigned long ColIndex, unsigned long RowIndex, const T &Val)
 
void fill (const T &Val)
 
void clear ()
 

Protected Member Functions

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

Protected Attributes

std::unique_ptr< T[]> m_Data
 
unsigned long m_ColsNbr
 
unsigned long m_RowsNbr
 

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 > &  Other)

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,
const T &  InitValue 
)

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

◆ ~Matrix()

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

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=() [1/2]

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

Assignment operator

◆ operator=() [2/2]

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

Move assignment operator

◆ set()

template<class T >
void openfluid::core::Matrix< T >::set ( unsigned long  ColIndex,
unsigned long  RowIndex,
const T &  Val 
)
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,
const T &  Val 
)

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 >
std::unique_ptr<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: