Nektar++
Static Public Member Functions | List of all members
Nektar::UpperTriangularMatrixFuncs Struct Reference

#include <MatrixFuncs.h>

Inheritance diagram for Nektar::UpperTriangularMatrixFuncs:
[legend]

Static Public Member Functions

static unsigned int CalculateIndex (unsigned int curRow, unsigned int curColumn)
 
static std::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 196 of file MatrixFuncs.h.

Member Function Documentation

◆ Advance()

std::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 173 of file MatrixFuncs.cpp.

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

References ASSERTL1.

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

◆ CalculateIndex()

unsigned int Nektar::UpperTriangularMatrixFuncs::CalculateIndex ( unsigned int  curRow,
unsigned int  curColumn 
)
static

Definition at line 160 of file MatrixFuncs.cpp.

162 {
163  if (curRow <= curColumn)
164  {
165  return curRow + curColumn * (curColumn + 1) / 2;
166  }
167  else
168  {
169  return std::numeric_limits<unsigned int>::max();
170  }
171 }

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