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

#include <MatrixFuncs.h>

Inheritance diagram for Nektar::UpperTriangularMatrixFuncs:
Inheritance graph
[legend]
Collaboration diagram for Nektar::UpperTriangularMatrixFuncs:
Collaboration graph
[legend]

Static Public Member Functions

static unsigned int CalculateIndex (unsigned int curRow, unsigned int curColumn)
 
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)
 
- Static Public Member Functions inherited from Nektar::TriangularMatrixFuncs
static unsigned int GetRequiredStorageSize (unsigned int rows, unsigned int columns)
 

Detailed Description

Definition at line 177 of file MatrixFuncs.h.

Member Function Documentation

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

Definition at line 179 of file MatrixFuncs.cpp.

References ASSERTL1.

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

181  {
182  ASSERTL1(totalRows == totalColumns, "Triangular matrices must be square.");
183  ASSERTL1(curRow < totalRows, "Attemping to iterate through an element on row " +
184  boost::lexical_cast<std::string>(curRow) + " of a (" +
185  boost::lexical_cast<std::string>(totalRows) + ", " +
186  boost::lexical_cast<std::string>(totalColumns) + " upper triangular matrix.");
187  ASSERTL1(curColumn < totalColumns, "Attemping to iterate through an element on row " +
188  boost::lexical_cast<std::string>(curColumn) + " of a (" +
189  boost::lexical_cast<std::string>(totalRows) + ", " +
190  boost::lexical_cast<std::string>(totalColumns) + " upper triangular matrix.");
191  ASSERTL1(curRow <= curColumn, "Attemping to iterate through element (" +
192  boost::lexical_cast<std::string>(curRow) + ", " +
193  boost::lexical_cast<std::string>(curColumn) + ") of a (" +
194  boost::lexical_cast<std::string>(totalRows) + ", " +
195  boost::lexical_cast<std::string>(totalColumns) + " upper triangular matrix.");
196 
197  unsigned int nextRow = curRow;
198  unsigned int nextColumn = curColumn;
199 
200  if( nextRow <= nextColumn )
201  {
202  ++nextRow;
203  }
204 
205  if( nextRow > nextColumn )
206  {
207  ++nextColumn;
208  nextRow = 0;
209  }
210 
211  if( nextColumn >= totalColumns )
212  {
213  nextRow = std::numeric_limits<unsigned int>::max();
214  nextColumn = std::numeric_limits<unsigned int>::max();
215  }
216 
217  return boost::tuples::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
218  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
unsigned int Nektar::UpperTriangularMatrixFuncs::CalculateIndex ( unsigned int  curRow,
unsigned int  curColumn 
)
static

Definition at line 166 of file MatrixFuncs.cpp.

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

167  {
168  if( curRow <= curColumn )
169  {
170  return curRow + curColumn*(curColumn+1)/2;
171  }
172  else
173  {
174  return std::numeric_limits<unsigned int>::max();
175  }
176  }