Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 > Singleton Referenceabstract

#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 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>
singleton 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.

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

Definition at line 226 of file MatrixBase.cpp.

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

227  :
228  m_size(),
229  m_transpose('N'),
230  m_storageType(policy)
231  {
232  m_size[0] = rows;
233  m_size[1] = columns;
234  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
MatrixStorage m_storageType
Definition: MatrixBase.hpp:128
template<typename DataType>
Nektar::ConstMatrix< DataType >::ConstMatrix ( const ConstMatrix< DataType > &  rhs)
protected

Definition at line 237 of file MatrixBase.cpp.

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

237  :
238  m_size(),
239  m_transpose(rhs.m_transpose),
240  m_storageType(rhs.m_storageType)
241  {
242  m_size[0] = rhs.m_size[0];
243  m_size[1] = rhs.m_size[1];
244  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
MatrixStorage m_storageType
Definition: MatrixBase.hpp:128

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 120 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.

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

124  {
125  if(transpose == 'T' )
126  {
127  std::swap(row, col);
128  }
129  switch(type)
130  {
131  case eFULL:
132  return FullMatrixFuncs::CalculateIndex(numRows, numColumns, row, col);
133  break;
134  case eDIAGONAL:
135  return DiagonalMatrixFuncs::CalculateIndex(row, col);
136  break;
137  case eUPPER_TRIANGULAR:
139  break;
140  case eLOWER_TRIANGULAR:
141  return LowerTriangularMatrixFuncs::CalculateIndex(numColumns, row, col);
142  break;
143  case eSYMMETRIC:
145  return SymmetricMatrixFuncs::CalculateIndex(row, col);
146  break;
147  case eBANDED:
148  return BandedMatrixFuncs::CalculateIndex(numRows, numColumns,
149  row, col, numSubDiags, numSuperDiags);
150  break;
151  case eSYMMETRIC_BANDED:
153  {
154  ASSERTL1(numSubDiags==numSuperDiags,
155  std::string("Number of sub- and superdiagonals should ") +
156  std::string("be equal for a symmetric banded matrix"));
158  numSuperDiags);
159  }
160  break;
162  NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
163  break;
165  NEKERROR(ErrorUtil::efatal, "Not yet implemented.");
166  break;
167 
168  default:
169  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
170  }
171 
172  return std::numeric_limits<unsigned int>::max();
173  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:191
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:70
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:228
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetColumns ( ) const
template<typename DataType>
char Nektar::ConstMatrix< DataType >::GetRawTransposeFlag ( ) const
inlineprotected

Definition at line 115 of file MatrixBase.hpp.

116  {
117  return m_transpose;
118  }
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 176 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.

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

178  {
179  switch(type)
180  {
181  case eFULL:
182  return FullMatrixFuncs::GetRequiredStorageSize(rows, columns);
183  break;
184  case eDIAGONAL:
185  return DiagonalMatrixFuncs::GetRequiredStorageSize(rows, columns);
186  break;
187  case eUPPER_TRIANGULAR:
189  break;
190  case eLOWER_TRIANGULAR:
192  break;
193  case eSYMMETRIC:
195  return SymmetricMatrixFuncs::GetRequiredStorageSize(rows, columns);
196  break;
197  case eBANDED:
198  return BandedMatrixFuncs::GetRequiredStorageSize(rows, columns,
199  subDiags, superDiags);
200  break;
201  case eSYMMETRIC_BANDED:
203  {
204  ASSERTL1(subDiags==superDiags,
205  std::string("Number of sub- and superdiagonals should ") +
206  std::string("be equal for a symmetric banded matrix"));
208  superDiags);
209  }
210  break;
212  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
213  break;
215  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
216  break;
217 
218  default:
219  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
220  }
221 
222  return 0;
223  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:191
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:228
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:43
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetRows ( ) const
template<typename DataType >
const unsigned int * Nektar::ConstMatrix< DataType >::GetSize ( ) const

Definition at line 97 of file MatrixBase.cpp.

97 { return m_size; }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetStorageSize ( ) const

Definition at line 53 of file MatrixBase.cpp.

54  {
55  return v_GetStorageSize();
56  }
virtual unsigned int v_GetStorageSize() const =0
template<typename DataType>
MatrixStorage Nektar::ConstMatrix< DataType >::GetStorageType ( ) const
inline

Definition at line 72 of file MatrixBase.hpp.

73  {
74  return m_storageType;
75  }
MatrixStorage m_storageType
Definition: MatrixBase.hpp:128
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedColumns ( char  transpose) const

Definition at line 84 of file MatrixBase.cpp.

85  {
86  if( transpose == 'N' )
87  {
88  return m_size[1];
89  }
90  else
91  {
92  return m_size[0];
93  }
94  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedRows ( char  transpose) const

Definition at line 65 of file MatrixBase.cpp.

66  {
67  if( transpose == 'N' )
68  {
69  return m_size[0];
70  }
71  else
72  {
73  return m_size[1];
74  }
75  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
template<typename DataType >
char Nektar::ConstMatrix< DataType >::GetTransposeFlag ( ) const

Definition at line 114 of file MatrixBase.cpp.

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

115  {
116  return v_GetTransposeFlag();
117  }
virtual char v_GetTransposeFlag() const
Definition: MatrixBase.cpp:274
template<typename DataType>
MatrixStorage Nektar::ConstMatrix< DataType >::GetType ( ) const
inline

Definition at line 67 of file MatrixBase.hpp.

Referenced by Nektar::Transpose().

68  {
69  return m_storageType;
70  }
MatrixStorage m_storageType
Definition: MatrixBase.hpp:128
template<typename DataType >
boost::call_traits< DataType >::value_type Nektar::ConstMatrix< DataType >::operator() ( unsigned int  row,
unsigned int  column 
) const

Definition at line 41 of file MatrixBase.cpp.

References ASSERTL2.

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

Definition at line 247 of file MatrixBase.cpp.

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

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

248  {
249  m_size[0] = rhs.m_size[0];
250  m_size[1] = rhs.m_size[1];
251  m_transpose = rhs.m_transpose;
253  return *this;
254  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
MatrixStorage m_storageType
Definition: MatrixBase.hpp:128
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 258 of file MatrixBase.cpp.

259  {
260  m_size[0] = rows;
261  m_size[1] = columns;
262  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:126
template<typename DataType >
void Nektar::ConstMatrix< DataType >::SetTransposeFlag ( char  newValue)
protected

Definition at line 265 of file MatrixBase.cpp.

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

Definition at line 100 of file MatrixBase.cpp.

Referenced by Nektar::Transpose().

101  {
102  if( m_transpose == 'N' )
103  {
104  m_transpose = 'T';
105  }
106  else
107  {
108  m_transpose = 'N';
109  }
110  v_Transpose();
111  }
virtual void v_Transpose()
Definition: MatrixBase.cpp:271
template<typename DataType>
virtual unsigned int Nektar::ConstMatrix< DataType >::v_GetStorageSize ( ) const
privatepure virtual
template<typename DataType >
char Nektar::ConstMatrix< DataType >::v_GetTransposeFlag ( ) const
privatevirtual
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

Member Data Documentation

template<typename DataType>
unsigned int Nektar::ConstMatrix< DataType >::m_size[2]
private
template<typename DataType>
MatrixStorage Nektar::ConstMatrix< DataType >::m_storageType
private
template<typename DataType>
char Nektar::ConstMatrix< DataType >::m_transpose
private