Nektar++
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Nektar::ConstMatrix< DataType > Class Template Referenceabstract

#include <MatrixBase.hpp>

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

Public Member Functions

virtual ~ConstMatrix ()=default
 
boost::call_traits< DataType >::value_type operator() (unsigned int row, unsigned int column) const
 
unsigned int GetStorageSize () const
 
MatrixStorage GetType () 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, MatrixStorage policy=eFULL)
 
 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. More...
 
void SetTransposeFlag (char newValue)
 
char GetRawTransposeFlag () const
 
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 void v_Transpose ()
 
virtual char v_GetTransposeFlag () const
 

Private Attributes

unsigned int m_size [2]
 
char m_transpose
 
MatrixStorage m_storageType
 

Detailed Description

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

Definition at line 53 of file MatrixBase.hpp.

Constructor & Destructor Documentation

◆ ~ConstMatrix()

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

◆ ConstMatrix() [1/2]

template<typename DataType >
Nektar::ConstMatrix< DataType >::ConstMatrix ( unsigned int  rows,
unsigned int  columns,
MatrixStorage  policy = eFULL 
)
protected

Definition at line 221 of file MatrixBase.cpp.

223 : m_size(), m_transpose('N'), m_storageType(policy)
224{
225 m_size[0] = rows;
226 m_size[1] = columns;
227}
unsigned int m_size[2]
Definition: MatrixBase.hpp:128
MatrixStorage m_storageType
Definition: MatrixBase.hpp:130

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

◆ ConstMatrix() [2/2]

template<typename DataType >
Nektar::ConstMatrix< DataType >::ConstMatrix ( const ConstMatrix< DataType > &  rhs)
protected

Definition at line 230 of file MatrixBase.cpp.

231 : m_size(), m_transpose(rhs.m_transpose), m_storageType(rhs.m_storageType)
232{
233 m_size[0] = rhs.m_size[0];
234 m_size[1] = rhs.m_size[1];
235}

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

Member Function Documentation

◆ CalculateIndex()

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 110 of file MatrixBase.cpp.

114{
115 if (transpose == 'T')
116 {
117 std::swap(row, col);
118 }
119 switch (type)
120 {
121 case eFULL:
122 return FullMatrixFuncs::CalculateIndex(numRows, numColumns, row,
123 col);
124 break;
125 case eDIAGONAL:
127 break;
130 break;
132 return LowerTriangularMatrixFuncs::CalculateIndex(numColumns, row,
133 col);
134 break;
135 case eSYMMETRIC:
138 break;
139 case eBANDED:
141 numRows, numColumns, row, col, numSubDiags, numSuperDiags);
142 break;
145 {
146 ASSERTL1(numSubDiags == numSuperDiags,
147 std::string("Number of sub- and superdiagonals should ") +
148 std::string("be equal for a symmetric banded matrix"));
150 numSuperDiags);
151 }
152 break;
154 NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
155 break;
157 NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
158 break;
159
160 default:
161 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
162 }
163
164 return std::numeric_limits<unsigned int>::max();
165}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
@ eLOWER_TRIANGULAR_BANDED
@ ePOSITIVE_DEFINITE_SYMMETRIC_BANDED
@ ePOSITIVE_DEFINITE_SYMMETRIC
@ eUPPER_TRIANGULAR_BANDED
static unsigned int CalculateIndex(unsigned int totalRows, unsigned int totalColumns, unsigned int row, unsigned int column, unsigned int sub, unsigned int super)
Definition: MatrixFuncs.cpp:75
static unsigned int CalculateIndex(unsigned int row, unsigned int col)
static unsigned int CalculateIndex(unsigned int totalRows, unsigned int totalColumns, unsigned int curRow, unsigned int curColumn)
static unsigned int CalculateIndex(unsigned int totalColumns, unsigned int curRow, unsigned int curColumn)
static unsigned int CalculateIndex(unsigned int curRow, unsigned int curColumn, unsigned int nSuperDiags)
static unsigned int CalculateIndex(unsigned int curRow, unsigned int curColumn)
static unsigned int CalculateIndex(unsigned int curRow, unsigned int curColumn)

Referenced by Nektar::NekMatrix< DataType, StandardMatrixTag >::CalculateIndex().

◆ GetColumns()

template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetColumns

◆ GetRawTransposeFlag()

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

Definition at line 116 of file MatrixBase.hpp.

117 {
118 return m_transpose;
119 }

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

◆ GetRequiredStorageSize()

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 168 of file MatrixBase.cpp.

171{
172 switch (type)
173 {
174 case eFULL:
175 return FullMatrixFuncs::GetRequiredStorageSize(rows, columns);
176 break;
177 case eDIAGONAL:
179 break;
182 columns);
183 break;
186 columns);
187 break;
188 case eSYMMETRIC:
191 break;
192 case eBANDED:
194 rows, columns, subDiags, superDiags);
195 break;
198 {
199 ASSERTL1(subDiags == superDiags,
200 std::string("Number of sub- and superdiagonals should ") +
201 std::string("be equal for a symmetric banded matrix"));
203 rows, columns, superDiags);
204 }
205 break;
207 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
208 break;
210 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
211 break;
212
213 default:
214 NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
215 }
216
217 return 0;
218}
static unsigned int GetRequiredStorageSize(unsigned int totalRows, unsigned int totalColumns, unsigned int subDiags, unsigned int superDiags)
Calculates and returns the storage size required.
Definition: MatrixFuncs.cpp:42
static unsigned int GetRequiredStorageSize(unsigned int rows, unsigned int columns)
static unsigned int GetRequiredStorageSize(unsigned int rows, unsigned int columns)
static unsigned int GetRequiredStorageSize(unsigned int rows, unsigned int columns, unsigned int nSubSuperDiags)
static unsigned int GetRequiredStorageSize(unsigned int rows, unsigned int columns)
static unsigned int GetRequiredStorageSize(unsigned int rows, unsigned int columns)

References ASSERTL1, Nektar::eBANDED, Nektar::eDIAGONAL, Nektar::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::FullMatrixFuncs::GetRequiredStorageSize(), Nektar::TriangularMatrixFuncs::GetRequiredStorageSize(), Nektar::SymmetricMatrixFuncs::GetRequiredStorageSize(), Nektar::DiagonalMatrixFuncs::GetRequiredStorageSize(), Nektar::SymmetricBandedMatrixFuncs::GetRequiredStorageSize(), Nektar::BandedMatrixFuncs::GetRequiredStorageSize(), and NEKERROR.

Referenced by Nektar::NekMatrix< DataType, StandardMatrixTag >::GetRequiredStorageSize().

◆ GetRows()

template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetRows

◆ GetSize()

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

Definition at line 85 of file MatrixBase.cpp.

86{
87 return m_size;
88}

◆ GetStorageSize()

template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetStorageSize

Definition at line 56 of file MatrixBase.cpp.

57{
58 return v_GetStorageSize();
59}
virtual unsigned int v_GetStorageSize() const =0

◆ GetStorageType()

template<typename DataType >
MatrixStorage Nektar::ConstMatrix< DataType >::GetStorageType ( ) const
inline

Definition at line 69 of file MatrixBase.hpp.

70 {
71 return m_storageType;
72 }

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

◆ GetTransposedColumns()

template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedColumns ( char  transpose) const

Definition at line 79 of file MatrixBase.cpp.

80{
81 return (transpose == 'N') ? m_size[1] : m_size[0];
82}

◆ GetTransposedRows()

template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedRows ( char  transpose) const

Definition at line 67 of file MatrixBase.cpp.

68{
69 return (transpose == 'N') ? m_size[0] : m_size[1];
70}

◆ GetTransposeFlag()

template<typename DataType >
char Nektar::ConstMatrix< DataType >::GetTransposeFlag

◆ GetType()

template<typename DataType >
MatrixStorage Nektar::ConstMatrix< DataType >::GetType ( ) const
inline

Definition at line 64 of file MatrixBase.hpp.

65 {
66 return m_storageType;
67 }

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

Referenced by Nektar::Transpose().

◆ operator()()

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

Definition at line 42 of file MatrixBase.cpp.

43{
44 ASSERTL2(row < GetRows(),
45 std::string("Row ") + std::to_string(row) +
46 std::string(" requested in a matrix with a maximum of ") +
47 std::to_string(GetRows()) + std::string(" rows"));
48 ASSERTL2(column < GetColumns(),
49 std::string("Column ") + std::to_string(column) +
50 std::string(" requested in a matrix with a maximum of ") +
51 std::to_string(GetColumns()) + std::string(" columns"));
52 return v_GetValue(row, column);
53}
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Definition: ErrorUtil.hpp:265
unsigned int GetRows() const
Definition: MatrixBase.cpp:61
virtual boost::call_traits< DataType >::value_type v_GetValue(unsigned int row, unsigned int column) const =0
unsigned int GetColumns() const
Definition: MatrixBase.cpp:73

References ASSERTL2.

◆ operator=()

template<typename DataType >
ConstMatrix< DataType > & Nektar::ConstMatrix< DataType >::operator= ( const ConstMatrix< DataType > &  rhs)
protected

Definition at line 238 of file MatrixBase.cpp.

240{
241 m_size[0] = rhs.m_size[0];
242 m_size[1] = rhs.m_size[1];
243 m_transpose = rhs.m_transpose;
244 m_storageType = rhs.m_storageType;
245 return *this;
246}

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

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

◆ Resize()

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 249 of file MatrixBase.cpp.

250{
251 m_size[0] = rows;
252 m_size[1] = columns;
253}

◆ SetTransposeFlag()

template<typename DataType >
void Nektar::ConstMatrix< DataType >::SetTransposeFlag ( char  newValue)
protected

Definition at line 256 of file MatrixBase.cpp.

257{
258 m_transpose = newValue;
259}

◆ Transpose()

template<typename DataType >
void Nektar::ConstMatrix< DataType >::Transpose

Definition at line 90 of file MatrixBase.cpp.

91{
92 if (m_transpose == 'N')
93 {
94 m_transpose = 'T';
95 }
96 else
97 {
98 m_transpose = 'N';
99 }
100 v_Transpose();
101}
virtual void v_Transpose()
Definition: MatrixBase.cpp:261

Referenced by Nektar::Transpose().

◆ v_GetStorageSize()

template<typename DataType >
virtual unsigned int Nektar::ConstMatrix< DataType >::v_GetStorageSize ( ) const
protectedpure virtual

◆ v_GetTransposeFlag()

template<typename DataType >
char Nektar::ConstMatrix< DataType >::v_GetTransposeFlag
protectedvirtual

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

Definition at line 266 of file MatrixBase.cpp.

267{
268 return m_transpose;
269}

◆ v_GetValue()

template<typename DataType >
virtual boost::call_traits< DataType >::value_type Nektar::ConstMatrix< DataType >::v_GetValue ( unsigned int  row,
unsigned int  column 
) const
protectedpure virtual

◆ v_Transpose()

template<typename DataType >
void Nektar::ConstMatrix< DataType >::v_Transpose
protectedvirtual

Member Data Documentation

◆ m_size

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

◆ m_storageType

template<typename DataType >
MatrixStorage Nektar::ConstMatrix< DataType >::m_storageType
private

◆ m_transpose

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