Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | List of all members
Nektar::DiagonalMatrixFuncs Struct Reference

#include <MatrixFuncs.h>

Static Public Member Functions

static boost::tuples::tuple
< unsigned int, unsigned int > 
Advance (const unsigned int totalRows, const unsigned int totalColumns, const unsigned int curRow, const unsigned int curColumn)
 
template<typename DataType >
static void Invert (unsigned int rows, unsigned int columns, Array< OneD, DataType > &data)
 
static unsigned int GetRequiredStorageSize (unsigned int rows, unsigned int columns)
 
static unsigned int CalculateIndex (unsigned int row, unsigned int col)
 

Detailed Description

Definition at line 210 of file MatrixFuncs.h.

Member Function Documentation

boost::tuples::tuple< unsigned int, unsigned int > Nektar::DiagonalMatrixFuncs::Advance ( const unsigned int  totalRows,
const unsigned int  totalColumns,
const unsigned int  curRow,
const unsigned int  curColumn 
)
static

Definition at line 333 of file MatrixFuncs.cpp.

References ASSERTL0.

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

335  {
336  ASSERTL0(curRow == curColumn, "Iteration of a diagonal matrix is only valid along the diagonal.");
337 
338  unsigned int nextRow = curRow;
339  unsigned int nextColumn = curColumn;
340 
341  if( nextRow < totalRows )
342  {
343  ++nextRow;
344  ++nextColumn;
345  }
346 
347  if( nextRow >= totalRows )
348  {
349  nextRow = std::numeric_limits<unsigned int>::max();
350  nextColumn = std::numeric_limits<unsigned int>::max();
351  }
352 
353  return boost::tuples::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
354  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
unsigned int Nektar::DiagonalMatrixFuncs::CalculateIndex ( unsigned int  row,
unsigned int  col 
)
static

Definition at line 362 of file MatrixFuncs.cpp.

Referenced by Nektar::ConstMatrix< DataType >::CalculateIndex().

363  {
364  if( row == col )
365  {
366  return row;
367  }
368  else
369  {
370  return std::numeric_limits<unsigned int>::max();
371  }
372  }
unsigned int Nektar::DiagonalMatrixFuncs::GetRequiredStorageSize ( unsigned int  rows,
unsigned int  columns 
)
static

Definition at line 356 of file MatrixFuncs.cpp.

References ASSERTL0.

Referenced by Nektar::ConstMatrix< DataType >::GetRequiredStorageSize().

357  {
358  ASSERTL0(rows==columns, "Diagonal matrices must be square.");
359  return rows;
360  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
template<typename DataType >
static void Nektar::DiagonalMatrixFuncs::Invert ( unsigned int  rows,
unsigned int  columns,
Array< OneD, DataType > &  data 
)
inlinestatic

Definition at line 217 of file MatrixFuncs.h.

References ASSERTL0.

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

219  {
220  ASSERTL0(rows==columns, "Only square matrices can be inverted.");
221  for(unsigned int i = 0; i < rows; ++i)
222  {
223  data[i] = 1.0/data[i];
224  }
225  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188