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 100 of file MatrixFuncs.cpp.

103{
104 boost::ignore_unused(totalRows, totalColumns);
105 unsigned int nextRow = curRow;
106 unsigned int nextColumn = curColumn;
107
108 return std::tuple<unsigned int, unsigned int>(nextRow, nextColumn);
109}

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 77 of file MatrixFuncs.cpp.

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

References CalculateNumberOfDiags(), and CalculateNumberOfRows().

Referenced by Nektar::BandedMatrixStoragePolicyUnitTests::BOOST_AUTO_TEST_CASE(), and Nektar::ConstMatrix< DataType >::CalculateIndex().

◆ CalculateNumberOfDiags()

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

Definition at line 52 of file MatrixFuncs.cpp.

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

Referenced by CalculateIndex(), and CalculateNumberOfRows().

◆ CalculateNumberOfRows()

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

Definition at line 69 of file MatrixFuncs.cpp.

72{
73 return CalculateNumberOfDiags(totalRows, subDiags) +
74 CalculateNumberOfDiags(totalRows, superDiags) + 1;
75}

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 44 of file MatrixFuncs.cpp.

47{
48 return CalculateNumberOfRows(totalRows, subDiags, superDiags) *
49 totalColumns;
50}

References CalculateNumberOfRows().

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