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

#include <MatrixFuncs.h>

Static Public Member Functions

static unsigned int GetRequiredStorageSize (unsigned int totalRows, unsigned int totalColumns, unsigned int subDiags, unsigned int superDiags)
 Calculates and returns the storage size required. More...
 
static unsigned int CalculateNumberOfDiags (unsigned int totalRows, unsigned int diags)
 
static unsigned int CalculateNumberOfRows (unsigned int totalRows, unsigned int subDiags, unsigned int superDiags)
 
static unsigned int CalculateIndex (unsigned int totalRows, unsigned int totalColumns, unsigned int row, unsigned int column, unsigned int sub, unsigned int super)
 
static std::tuple< unsigned int, unsigned int > Advance (const unsigned int totalRows, const unsigned int totalColumns, const unsigned int curRow, const unsigned int curColumn)
 

Detailed Description

Definition at line 48 of file MatrixFuncs.h.

Member Function Documentation

◆ Advance()

std::tuple< unsigned int, unsigned int > Nektar::BandedMatrixFuncs::Advance ( const unsigned int  totalRows,
const unsigned int  totalColumns,
const unsigned int  curRow,
const unsigned int  curColumn 
)
static

Definition at line 97 of file MatrixFuncs.cpp.

101{
102 unsigned int nextRow = curRow;
103 unsigned int nextColumn = curColumn;
104
105 return std::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
106}

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

◆ CalculateIndex()

unsigned int Nektar::BandedMatrixFuncs::CalculateIndex ( unsigned int  totalRows,
unsigned int  totalColumns,
unsigned int  row,
unsigned int  column,
unsigned int  sub,
unsigned int  super 
)
static

Definition at line 75 of file MatrixFuncs.cpp.

78{
79 if ((column <= row &&
80 (row - column) <= CalculateNumberOfDiags(totalRows, sub)) ||
81 (column > row &&
82 (column - row) <= CalculateNumberOfDiags(totalRows, super)))
83 {
84 unsigned int elementRow =
85 CalculateNumberOfDiags(totalRows, super) + row - column;
86 unsigned int elementColumn = column;
87
88 return elementRow +
89 elementColumn * CalculateNumberOfRows(totalRows, sub, super);
90 }
91 else
92 {
93 return std::numeric_limits<unsigned int>::max();
94 }
95}
static unsigned int CalculateNumberOfRows(unsigned int totalRows, unsigned int subDiags, unsigned int superDiags)
Definition: MatrixFuncs.cpp:67
static unsigned int CalculateNumberOfDiags(unsigned int totalRows, unsigned int diags)
Definition: MatrixFuncs.cpp:50

References CalculateNumberOfDiags(), and CalculateNumberOfRows().

Referenced by Nektar::BandedMatrixStoragePolicyUnitTests::BOOST_AUTO_TEST_CASE().

◆ CalculateNumberOfDiags()

unsigned int Nektar::BandedMatrixFuncs::CalculateNumberOfDiags ( unsigned int  totalRows,
unsigned int  diags 
)
static

Definition at line 50 of file MatrixFuncs.cpp.

52{
53 if (diags != std::numeric_limits<unsigned int>::max())
54 {
55 return diags;
56 }
57 else if (totalRows > 0)
58 {
59 return totalRows - 1;
60 }
61 else
62 {
63 return 0;
64 }
65}

Referenced by CalculateIndex(), and CalculateNumberOfRows().

◆ CalculateNumberOfRows()

unsigned int Nektar::BandedMatrixFuncs::CalculateNumberOfRows ( unsigned int  totalRows,
unsigned int  subDiags,
unsigned int  superDiags 
)
static

Definition at line 67 of file MatrixFuncs.cpp.

70{
71 return CalculateNumberOfDiags(totalRows, subDiags) +
72 CalculateNumberOfDiags(totalRows, superDiags) + 1;
73}

References CalculateNumberOfDiags().

Referenced by Nektar::BandedMatrixStoragePolicyUnitTests::BOOST_AUTO_TEST_CASE(), CalculateIndex(), and GetRequiredStorageSize().

◆ GetRequiredStorageSize()

unsigned int Nektar::BandedMatrixFuncs::GetRequiredStorageSize ( unsigned int  totalRows,
unsigned int  totalColumns,
unsigned int  subDiags,
unsigned int  superDiags 
)
static

Calculates and returns the storage size required.

This method assumes that the matrix will be used with LU factorizationa and allocates additional storage as appropriate.

Definition at line 42 of file MatrixFuncs.cpp.

45{
46 return CalculateNumberOfRows(totalRows, subDiags, superDiags) *
47 totalColumns;
48}

References CalculateNumberOfRows().

Referenced by Nektar::BandedMatrixStoragePolicyUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::LinearSystem::FactorMatrix(), and Nektar::ConstMatrix< DataType >::GetRequiredStorageSize().