Nektar++
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private 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 ()
 
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
 

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 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 54 of file MatrixBase.hpp.

Constructor & Destructor Documentation

◆ ~ConstMatrix()

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

Definition at line 37 of file MatrixBase.cpp.

37 {}

◆ ConstMatrix() [1/2]

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

Definition at line 225 of file MatrixBase.cpp.

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType().

226  :
227  m_size(),
228  m_transpose('N'),
229  m_storageType(policy)
230  {
231  m_size[0] = rows;
232  m_size[1] = columns;
233  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:123
MatrixStorage m_storageType
Definition: MatrixBase.hpp:125

◆ ConstMatrix() [2/2]

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

Definition at line 236 of file MatrixBase.cpp.

236  :
237  m_size(),
238  m_transpose(rhs.m_transpose),
239  m_storageType(rhs.m_storageType)
240  {
241  m_size[0] = rhs.m_size[0];
242  m_size[1] = rhs.m_size[1];
243  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:123
MatrixStorage m_storageType
Definition: MatrixBase.hpp:125
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

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

Referenced by Nektar::NekMatrix< DataType, StandardMatrixTag >::CalculateIndex(), and Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType().

123  {
124  if(transpose == 'T' )
125  {
126  std::swap(row, col);
127  }
128  switch(type)
129  {
130  case eFULL:
131  return FullMatrixFuncs::CalculateIndex(numRows, numColumns, row, col);
132  break;
133  case eDIAGONAL:
134  return DiagonalMatrixFuncs::CalculateIndex(row, col);
135  break;
136  case eUPPER_TRIANGULAR:
138  break;
139  case eLOWER_TRIANGULAR:
140  return LowerTriangularMatrixFuncs::CalculateIndex(numColumns, row, col);
141  break;
142  case eSYMMETRIC:
144  return SymmetricMatrixFuncs::CalculateIndex(row, col);
145  break;
146  case eBANDED:
147  return BandedMatrixFuncs::CalculateIndex(numRows, numColumns,
148  row, col, numSubDiags, numSuperDiags);
149  break;
150  case eSYMMETRIC_BANDED:
152  {
153  ASSERTL1(numSubDiags==numSuperDiags,
154  std::string("Number of sub- and superdiagonals should ") +
155  std::string("be equal for a symmetric banded matrix"));
157  numSuperDiags);
158  }
159  break;
161  NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
162  break;
164  NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
165  break;
166 
167  default:
168  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
169  }
170 
171  return std::numeric_limits<unsigned int>::max();
172  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
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:71
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 totalColumns, unsigned int curRow, unsigned int curColumn)
static unsigned int CalculateIndex(unsigned int curRow, unsigned int curColumn)
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)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ GetColumns()

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

◆ GetRawTransposeFlag()

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

Definition at line 112 of file MatrixBase.hpp.

113  {
114  return m_transpose;
115  }

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

Referenced by Nektar::NekMatrix< DataType, StandardMatrixTag >::GetRequiredStorageSize(), and Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType().

177  {
178  switch(type)
179  {
180  case eFULL:
181  return FullMatrixFuncs::GetRequiredStorageSize(rows, columns);
182  break;
183  case eDIAGONAL:
184  return DiagonalMatrixFuncs::GetRequiredStorageSize(rows, columns);
185  break;
186  case eUPPER_TRIANGULAR:
188  break;
189  case eLOWER_TRIANGULAR:
191  break;
192  case eSYMMETRIC:
194  return SymmetricMatrixFuncs::GetRequiredStorageSize(rows, columns);
195  break;
196  case eBANDED:
197  return BandedMatrixFuncs::GetRequiredStorageSize(rows, columns,
198  subDiags, superDiags);
199  break;
200  case eSYMMETRIC_BANDED:
202  {
203  ASSERTL1(subDiags==superDiags,
204  std::string("Number of sub- and superdiagonals should ") +
205  std::string("be equal for a symmetric banded matrix"));
207  superDiags);
208  }
209  break;
211  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
212  break;
214  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
215  break;
216 
217  default:
218  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
219  }
220 
221  return 0;
222  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
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)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
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:44

◆ GetRows()

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

◆ GetSize()

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

◆ GetStorageSize()

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

Definition at line 52 of file MatrixBase.cpp.

53  {
54  return v_GetStorageSize();
55  }
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  }
MatrixStorage m_storageType
Definition: MatrixBase.hpp:125

◆ GetTransposedColumns()

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

Definition at line 83 of file MatrixBase.cpp.

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType().

84  {
85  if( transpose == 'N' )
86  {
87  return m_size[1];
88  }
89  else
90  {
91  return m_size[0];
92  }
93  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:123

◆ GetTransposedRows()

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

Definition at line 64 of file MatrixBase.cpp.

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType().

65  {
66  if( transpose == 'N' )
67  {
68  return m_size[0];
69  }
70  else
71  {
72  return m_size[1];
73  }
74  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:123

◆ GetTransposeFlag()

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

◆ GetType()

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

Definition at line 64 of file MatrixBase.hpp.

Referenced by Nektar::Transpose().

65  {
66  return m_storageType;
67  }
MatrixStorage m_storageType
Definition: MatrixBase.hpp:125

◆ operator()()

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

Definition at line 40 of file MatrixBase.cpp.

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

◆ operator=()

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

Definition at line 246 of file MatrixBase.cpp.

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType(), and Nektar::Matrix< DataType >::operator=().

247  {
248  m_size[0] = rhs.m_size[0];
249  m_size[1] = rhs.m_size[1];
250  m_transpose = rhs.m_transpose;
251  m_storageType = rhs.m_storageType;
252  return *this;
253  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:123
MatrixStorage m_storageType
Definition: MatrixBase.hpp:125
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

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

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType().

258  {
259  m_size[0] = rows;
260  m_size[1] = columns;
261  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:123

◆ SetTransposeFlag()

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

◆ Transpose()

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

Definition at line 99 of file MatrixBase.cpp.

Referenced by Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >::GetStorageType(), and Nektar::Transpose().

100  {
101  if( m_transpose == 'N' )
102  {
103  m_transpose = 'T';
104  }
105  else
106  {
107  m_transpose = 'N';
108  }
109  v_Transpose();
110  }
virtual void v_Transpose()
Definition: MatrixBase.cpp:270

◆ v_GetStorageSize()

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

◆ v_GetTransposeFlag()

template<typename DataType >
char Nektar::ConstMatrix< DataType >::v_GetTransposeFlag ( ) const
privatevirtual

◆ v_GetValue()

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

◆ v_Transpose()

template<typename DataType >
void Nektar::ConstMatrix< DataType >::v_Transpose ( )
privatevirtual

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