Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::ConstMatrix< DataType > Class Template Reference

#include <MatrixBase.hpp>

Inheritance diagram for Nektar::ConstMatrix< DataType >:
Inheritance graph
[legend]

Public Member Functions

virtual ~ConstMatrix ()
boost::call_traits< DataType >
::value_type 
operator() (unsigned int row, unsigned int column) const
unsigned int GetStorageSize () const
MatrixStorage GetStorageType () const
unsigned int GetRows () const
unsigned int GetTransposedRows (char transpose) const
unsigned int GetColumns () const
unsigned int GetTransposedColumns (char transpose) const
const unsigned int * GetSize () const
void Transpose ()
char GetTransposeFlag () const

Static Public Member Functions

static unsigned int CalculateIndex (MatrixStorage type, unsigned int row, unsigned int col, unsigned int numRows, unsigned int numColumns, const char transpose= 'N', unsigned int numSubDiags=0, unsigned int numSuperDiags=0)
static unsigned int GetRequiredStorageSize (MatrixStorage type, unsigned int rows, unsigned int columns, unsigned int subDiags=0, unsigned int superDiags=0)

Protected Member Functions

 ConstMatrix (unsigned int rows, unsigned int columns)
 ConstMatrix (const ConstMatrix< DataType > &rhs)
ConstMatrix< DataType > & operator= (const ConstMatrix< DataType > &rhs)
void Resize (unsigned int rows, unsigned int columns)
 Resets the rows and columns in the array. This method does not update the data storage to match the new row and column counts.
void SetTransposeFlag (char newValue)
char GetRawTransposeFlag () const

Private Member Functions

virtual boost::call_traits
< DataType >::value_type 
v_GetValue (unsigned int row, unsigned int column) const =0
virtual unsigned int v_GetStorageSize () const =0
virtual MatrixStorage v_GetStorageType () const =0
virtual void v_Transpose ()
virtual char v_GetTransposeFlag () const

Private Attributes

unsigned int m_size [2]
char m_transpose

Detailed Description

template<typename DataType>
class Nektar::ConstMatrix< DataType >

Definition at line 57 of file MatrixBase.hpp.

Constructor & Destructor Documentation

template<typename DataType >
Nektar::ConstMatrix< DataType >::~ConstMatrix ( )
virtual

Definition at line 38 of file MatrixBase.cpp.

{}
template<typename DataType >
Nektar::ConstMatrix< DataType >::ConstMatrix ( unsigned int  rows,
unsigned int  columns 
)
protected

Definition at line 232 of file MatrixBase.cpp.

References Nektar::ConstMatrix< DataType >::m_size.

:
m_size(),
{
m_size[0] = rows;
m_size[1] = columns;
}
template<typename DataType>
Nektar::ConstMatrix< DataType >::ConstMatrix ( const ConstMatrix< DataType > &  rhs)
protected

Definition at line 241 of file MatrixBase.cpp.

References Nektar::ConstMatrix< DataType >::m_size.

:
m_size(),
m_transpose(rhs.m_transpose)
{
m_size[0] = rhs.m_size[0];
m_size[1] = rhs.m_size[1];
}

Member Function Documentation

template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::CalculateIndex ( MatrixStorage  type,
unsigned int  row,
unsigned int  col,
unsigned int  numRows,
unsigned int  numColumns,
const char  transpose = 'N',
unsigned int  numSubDiags = 0,
unsigned int  numSuperDiags = 0 
)
static

Definition at line 126 of file MatrixBase.cpp.

References ASSERTL1, Nektar::BandedMatrixFuncs::CalculateIndex(), Nektar::FullMatrixFuncs::CalculateIndex(), Nektar::UpperTriangularMatrixFuncs::CalculateIndex(), Nektar::LowerTriangularMatrixFuncs::CalculateIndex(), Nektar::SymmetricMatrixFuncs::CalculateIndex(), Nektar::DiagonalMatrixFuncs::CalculateIndex(), Nektar::SymmetricBandedMatrixFuncs::CalculateIndex(), Nektar::eBANDED, Nektar::eDIAGONAL, ErrorUtil::efatal, Nektar::eFULL, Nektar::eLOWER_TRIANGULAR, Nektar::eLOWER_TRIANGULAR_BANDED, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC_BANDED, Nektar::eSYMMETRIC, Nektar::eSYMMETRIC_BANDED, Nektar::eUPPER_TRIANGULAR, Nektar::eUPPER_TRIANGULAR_BANDED, and NEKERROR.

{
if(transpose == 'T' )
{
std::swap(row, col);
}
switch(type)
{
case eFULL:
return FullMatrixFuncs::CalculateIndex(numRows, numColumns, row, col);
break;
case eDIAGONAL:
break;
break;
return LowerTriangularMatrixFuncs::CalculateIndex(numColumns, row, col);
break;
case eSYMMETRIC:
break;
case eBANDED:
return BandedMatrixFuncs::CalculateIndex(numRows, numColumns,
row, col, numSubDiags, numSuperDiags);
break;
{
ASSERTL1(numSubDiags==numSuperDiags,
std::string("Number of sub- and superdiagonals should ") +
std::string("be equal for a symmetric banded matrix"));
numSuperDiags);
}
break;
NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
break;
NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
break;
default:
NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
}
return std::numeric_limits<unsigned int>::max();
}
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetColumns ( ) const

Definition at line 84 of file MatrixBase.cpp.

Referenced by Nektar::AddEqualNegatedLhs(), Nektar::MultiplyEqual(), Nektar::NegateInPlace(), Nektar::NekMatrix< DataType, StandardMatrixTag >::operator==(), Nektar::SubtractEqualNegatedLhs(), and Nektar::Transpose().

template<typename DataType >
char Nektar::ConstMatrix< DataType >::GetRawTransposeFlag ( ) const
protected

Definition at line 273 of file MatrixBase.cpp.

{ return m_transpose; }
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetRequiredStorageSize ( MatrixStorage  type,
unsigned int  rows,
unsigned int  columns,
unsigned int  subDiags = 0,
unsigned int  superDiags = 0 
)
static

Definition at line 182 of file MatrixBase.cpp.

References ASSERTL1, Nektar::eBANDED, Nektar::eDIAGONAL, ErrorUtil::efatal, Nektar::eFULL, Nektar::eLOWER_TRIANGULAR, Nektar::eLOWER_TRIANGULAR_BANDED, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC_BANDED, Nektar::eSYMMETRIC, Nektar::eSYMMETRIC_BANDED, Nektar::eUPPER_TRIANGULAR, Nektar::eUPPER_TRIANGULAR_BANDED, Nektar::BandedMatrixFuncs::GetRequiredStorageSize(), Nektar::FullMatrixFuncs::GetRequiredStorageSize(), Nektar::TriangularMatrixFuncs::GetRequiredStorageSize(), Nektar::DiagonalMatrixFuncs::GetRequiredStorageSize(), Nektar::TriangularBandedMatrixFuncs::GetRequiredStorageSize(), and NEKERROR.

{
switch(type)
{
case eFULL:
break;
case eDIAGONAL:
break;
break;
break;
case eSYMMETRIC:
break;
case eBANDED:
subDiags, superDiags);
break;
{
ASSERTL1(subDiags==superDiags,
std::string("Number of sub- and superdiagonals should ") +
std::string("be equal for a symmetric banded matrix"));
superDiags);
}
break;
NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
break;
NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
break;
default:
NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
}
return 0;
}
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetRows ( ) const

Definition at line 65 of file MatrixBase.cpp.

Referenced by Nektar::AddEqualNegatedLhs(), Nektar::MultiplyEqual(), Nektar::NegateInPlace(), Nektar::NekMatrix< DataType, StandardMatrixTag >::operator==(), Nektar::SubtractEqualNegatedLhs(), and Nektar::Transpose().

template<typename DataType >
const unsigned int * Nektar::ConstMatrix< DataType >::GetSize ( ) const

Definition at line 103 of file MatrixBase.cpp.

{ return m_size; }
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetStorageSize ( ) const

Reimplemented in Nektar::NekMatrix< DataType, StandardMatrixTag >, Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >, and Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, ScaledMatrixTag >.

Definition at line 53 of file MatrixBase.cpp.

{
return v_GetStorageSize();
}
template<typename DataType >
MatrixStorage Nektar::ConstMatrix< DataType >::GetStorageType ( ) const

Definition at line 59 of file MatrixBase.cpp.

{
return v_GetStorageType();
}
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedColumns ( char  transpose) const

Definition at line 90 of file MatrixBase.cpp.

{
if( transpose == 'N' )
{
return m_size[1];
}
else
{
return m_size[0];
}
}
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedRows ( char  transpose) const

Definition at line 71 of file MatrixBase.cpp.

{
if( transpose == 'N' )
{
return m_size[0];
}
else
{
return m_size[1];
}
}
template<typename DataType >
char Nektar::ConstMatrix< DataType >::GetTransposeFlag ( ) const

Reimplemented in Nektar::NekMatrix< DataType, StandardMatrixTag >.

Definition at line 120 of file MatrixBase.cpp.

{
}
template<typename DataType >
boost::call_traits< DataType >::value_type Nektar::ConstMatrix< DataType >::operator() ( unsigned int  row,
unsigned int  column 
) const

Reimplemented in Nektar::NekMatrix< DataType, StandardMatrixTag >, Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >, and Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, ScaledMatrixTag >.

Definition at line 41 of file MatrixBase.cpp.

References ASSERTL2.

{
ASSERTL2(row < GetRows(), std::string("Row ") + boost::lexical_cast<std::string>(row) +
std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(GetRows()) +
std::string(" rows"));
ASSERTL2(column < GetColumns(), std::string("Column ") + boost::lexical_cast<std::string>(column) +
std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(GetColumns()) +
std::string(" columns"));
return v_GetValue(row, column);
}
template<typename DataType>
ConstMatrix< DataType > & Nektar::ConstMatrix< DataType >::operator= ( const ConstMatrix< DataType > &  rhs)
protected

Reimplemented in Nektar::Matrix< DataType >.

Definition at line 250 of file MatrixBase.cpp.

References Nektar::ConstMatrix< DataType >::m_size, and Nektar::ConstMatrix< DataType >::m_transpose.

Referenced by Nektar::Matrix< DataType >::operator=().

{
m_size[0] = rhs.m_size[0];
m_size[1] = rhs.m_size[1];
m_transpose = rhs.m_transpose;
return *this;
}
template<typename DataType >
void Nektar::ConstMatrix< DataType >::Resize ( unsigned int  rows,
unsigned int  columns 
)
protected

Resets the rows and columns in the array. This method does not update the data storage to match the new row and column counts.

Definition at line 260 of file MatrixBase.cpp.

{
m_size[0] = rows;
m_size[1] = columns;
}
template<typename DataType >
void Nektar::ConstMatrix< DataType >::SetTransposeFlag ( char  newValue)
protected

Definition at line 267 of file MatrixBase.cpp.

{
m_transpose = newValue;
}
template<typename DataType >
void Nektar::ConstMatrix< DataType >::Transpose ( )

Definition at line 106 of file MatrixBase.cpp.

Referenced by Nektar::Transpose().

{
if( m_transpose == 'N' )
{
m_transpose = 'T';
}
else
{
m_transpose = 'N';
}
}
template<typename DataType>
virtual unsigned int Nektar::ConstMatrix< DataType >::v_GetStorageSize ( ) const
privatepure virtual
template<typename DataType>
virtual MatrixStorage Nektar::ConstMatrix< DataType >::v_GetStorageType ( ) const
privatepure virtual
template<typename DataType >
char Nektar::ConstMatrix< DataType >::v_GetTransposeFlag ( ) const
privatevirtual

Definition at line 279 of file MatrixBase.cpp.

{ return m_transpose; }
template<typename DataType>
virtual boost::call_traits<DataType>::value_type Nektar::ConstMatrix< DataType >::v_GetValue ( unsigned int  row,
unsigned int  column 
) const
privatepure virtual
template<typename DataType >
void Nektar::ConstMatrix< DataType >::v_Transpose ( )
privatevirtual

Definition at line 276 of file MatrixBase.cpp.

{}

Member Data Documentation

template<typename DataType>
unsigned int Nektar::ConstMatrix< DataType >::m_size[2]
private

Definition at line 115 of file MatrixBase.hpp.

Referenced by Nektar::ConstMatrix< DataType >::ConstMatrix(), and Nektar::ConstMatrix< DataType >::operator=().

template<typename DataType>
char Nektar::ConstMatrix< DataType >::m_transpose
private

Definition at line 116 of file MatrixBase.hpp.

Referenced by Nektar::ConstMatrix< DataType >::operator=().