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 > 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 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. 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 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>
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 
)
protected

Definition at line 232 of file MatrixBase.cpp.

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

232  :
233  m_size(),
234  m_transpose('N')
235  {
236  m_size[0] = rows;
237  m_size[1] = columns;
238  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:115
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.

241  :
242  m_size(),
243  m_transpose(rhs.m_transpose)
244  {
245  m_size[0] = rhs.m_size[0];
246  m_size[1] = rhs.m_size[1];
247  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:115

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.

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

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

Definition at line 273 of file MatrixBase.cpp.

273 { 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.

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

184  {
185  switch(type)
186  {
187  case eFULL:
188  return FullMatrixFuncs::GetRequiredStorageSize(rows, columns);
189  break;
190  case eDIAGONAL:
191  return DiagonalMatrixFuncs::GetRequiredStorageSize(rows, columns);
192  break;
193  case eUPPER_TRIANGULAR:
195  break;
196  case eLOWER_TRIANGULAR:
198  break;
199  case eSYMMETRIC:
201  return SymmetricMatrixFuncs::GetRequiredStorageSize(rows, columns);
202  break;
203  case eBANDED:
204  return BandedMatrixFuncs::GetRequiredStorageSize(rows, columns,
205  subDiags, superDiags);
206  break;
207  case eSYMMETRIC_BANDED:
209  {
210  ASSERTL1(subDiags==superDiags,
211  std::string("Number of sub- and superdiagonals should ") +
212  std::string("be equal for a symmetric banded matrix"));
214  superDiags);
215  }
216  break;
218  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
219  break;
221  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
222  break;
223 
224  default:
225  NEKERROR(ErrorUtil::efatal, "Unhandled matrix type");
226  }
227 
228  return 0;
229  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:158
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:191
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 103 of file MatrixBase.cpp.

103 { return m_size; }
unsigned int m_size[2]
Definition: MatrixBase.hpp:115
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

Definition at line 59 of file MatrixBase.cpp.

60  {
61  return v_GetStorageType();
62  }
virtual MatrixStorage v_GetStorageType() const =0
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedColumns ( char  transpose) const

Definition at line 90 of file MatrixBase.cpp.

91  {
92  if( transpose == 'N' )
93  {
94  return m_size[1];
95  }
96  else
97  {
98  return m_size[0];
99  }
100  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:115
template<typename DataType >
unsigned int Nektar::ConstMatrix< DataType >::GetTransposedRows ( char  transpose) const

Definition at line 71 of file MatrixBase.cpp.

72  {
73  if( transpose == 'N' )
74  {
75  return m_size[0];
76  }
77  else
78  {
79  return m_size[1];
80  }
81  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:115
template<typename DataType >
char Nektar::ConstMatrix< DataType >::GetTransposeFlag ( ) const

Definition at line 120 of file MatrixBase.cpp.

121  {
122  return v_GetTransposeFlag();
123  }
virtual char v_GetTransposeFlag() const
Definition: MatrixBase.cpp:279
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:84
unsigned int GetRows() const
Definition: MatrixBase.cpp:65
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:213
template<typename DataType>
ConstMatrix< DataType > & Nektar::ConstMatrix< DataType >::operator= ( const ConstMatrix< DataType > &  rhs)
protected

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=().

251  {
252  m_size[0] = rhs.m_size[0];
253  m_size[1] = rhs.m_size[1];
254  m_transpose = rhs.m_transpose;
255  return *this;
256  }
unsigned int m_size[2]
Definition: MatrixBase.hpp:115
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.

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

Definition at line 267 of file MatrixBase.cpp.

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

Definition at line 106 of file MatrixBase.cpp.

Referenced by Nektar::Transpose().

107  {
108  if( m_transpose == 'N' )
109  {
110  m_transpose = 'T';
111  }
112  else
113  {
114  m_transpose = 'N';
115  }
116  v_Transpose();
117  }
virtual void v_Transpose()
Definition: MatrixBase.cpp:276
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
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>
char Nektar::ConstMatrix< DataType >::m_transpose
private

Definition at line 116 of file MatrixBase.hpp.

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