Nektar++
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag > Class Template Reference

#include <BlockMatrix.hpp>

Inheritance diagram for Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >:
[legend]

Classes

class  iterator_base
 

Public Types

typedef NekMatrix< DataType, InnerMatrixType > InnerType
 
typedef NekMatrix< InnerType, BlockMatrixTag > ThisType
 
typedef InnerType::NumberType NumberType
 
typedef ConstMatrix< NumberTypeBaseType
 
typedef InnerType::GetValueType GetValueType
 
typedef InnerType::ConstGetValueType ConstGetValueType
 
typedef iterator_base< ThisTypeiterator
 
typedef iterator_base< const ThisTypeconst_iterator
 

Public Member Functions

 NekMatrix (MatrixStorage type=eFULL)
 
 NekMatrix (unsigned int numberOfBlockRows, unsigned int numberOfBlockColumns, unsigned int rowsPerBlock, unsigned int columnsPerBlock, MatrixStorage type=eFULL)
 
 NekMatrix (unsigned int numberOfBlockRows, unsigned int numberOfBlockColumns, const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock, MatrixStorage type=eFULL)
 
 NekMatrix (unsigned int numberOfBlockRows, unsigned int numberOfBlockColumns, const Array< OneD, const unsigned int > &rowsPerBlock, const Array< OneD, const unsigned int > &columnsPerBlock, MatrixStorage type=eFULL)
 
 NekMatrix (const Array< OneD, const unsigned int > &rowsPerBlock, const Array< OneD, const unsigned int > &columnsPerBlock, MatrixStorage type=eFULL)
 
 NekMatrix (const ThisType &rhs)
 
unsigned int GetRequiredStorageSize () const
 
unsigned int CalculateBlockIndex (unsigned int row, unsigned int column) const
 
const InnerTypeGetBlockPtr (unsigned int row, unsigned int column) const
 
std::shared_ptr< const InnerTypeGetBlock (unsigned int row, unsigned int column) const
 
std::shared_ptr< InnerType > & GetBlock (unsigned int row, unsigned int column)
 
void SetBlock (unsigned int row, unsigned int column, std::shared_ptr< InnerType > &m)
 
ConstGetValueType operator() (unsigned int row, unsigned int col) const
 
unsigned int GetStorageSize () const
 
unsigned int GetNumberOfBlockRows () const
 
unsigned int GetNumberOfBlockColumns () const
 
unsigned int GetNumberOfRowsInBlockRow (unsigned int blockRow) const
 
unsigned int GetNumberOfColumnsInBlockColumn (unsigned int blockCol) const
 
void GetBlockSizes (Array< OneD, unsigned int > &rowSizes, Array< OneD, unsigned int > &colSizes) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
- Public Member Functions inherited from Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >
virtual ~ConstMatrix ()
 
boost::call_traits< NekMatrix< DataType, InnerMatrixType >::NumberType >::value_type operator() (unsigned int row, unsigned int column) const
 
unsigned int GetStorageSize () const
 
MatrixStorage GetType () const
 
MatrixStorage GetStorageType () const
 
unsigned int GetRows () const
 
unsigned int GetTransposedRows (char transpose) const
 
unsigned int GetColumns () const
 
unsigned int GetTransposedColumns (char transpose) const
 
const unsigned int * GetSize () const
 
void Transpose ()
 
char GetTransposeFlag () const
 

Static Public Member Functions

static ThisType CreateWrapper (const ThisType &rhs)
 
static std::shared_ptr< ThisTypeCreateWrapper (const std::shared_ptr< ThisType > &rhs)
 
- Static Public Member Functions inherited from Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >
static unsigned int CalculateIndex (MatrixStorage type, unsigned int row, unsigned int col, unsigned int numRows, unsigned int numColumns, const char transpose='N', unsigned int numSubDiags=0, unsigned int numSuperDiags=0)
 
static unsigned int GetRequiredStorageSize (MatrixStorage type, unsigned int rows, unsigned int columns, unsigned int subDiags=0, unsigned int superDiags=0)
 

Protected Member Functions

boost::call_traits< NumberType >::value_type v_GetValue (unsigned int row, unsigned int column) const override
 
unsigned int v_GetStorageSize () const override
 
void v_Transpose () override
 
- Protected Member Functions inherited from Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >
 ConstMatrix (unsigned int rows, unsigned int columns, MatrixStorage policy=eFULL)
 
 ConstMatrix (const ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType > &rhs)
 
ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType > & operator= (const ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType > &rhs)
 
void Resize (unsigned int rows, unsigned int columns)
 Resets the rows and columns in the array. This method does not update the data storage to match the new row and column counts. More...
 
void SetTransposeFlag (char newValue)
 
char GetRawTransposeFlag () const
 
virtual boost::call_traits< NekMatrix< DataType, InnerMatrixType >::NumberType >::value_type v_GetValue (unsigned int row, unsigned int column) const=0
 
virtual unsigned int v_GetStorageSize () const=0
 
virtual void v_Transpose ()
 
virtual char v_GetTransposeFlag () const
 

Private Member Functions

void Initialize (const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock)
 

Static Private Member Functions

static unsigned int GetNumberOfElementsInBlock (unsigned int block, unsigned int totalBlocks, const Array< OneD, unsigned int > &sizes)
 

Private Attributes

Array< OneD, std::shared_ptr< InnerType > > m_data
 
std::shared_ptr< InnerTypem_nullBlockPtr
 
Array< OneD, unsigned int > m_rowSizes
 
Array< OneD, unsigned int > m_columnSizes
 
unsigned int m_storageSize
 
unsigned int m_numberOfBlockRows
 
unsigned int m_numberOfBlockColumns
 

Static Private Attributes

static NumberType m_zeroElement
 

Detailed Description

template<typename DataType, typename InnerMatrixType>
class Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >

Definition at line 49 of file BlockMatrix.hpp.

Member Typedef Documentation

◆ BaseType

template<typename DataType , typename InnerMatrixType >
typedef ConstMatrix<NumberType> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::BaseType

Definition at line 57 of file BlockMatrix.hpp.

◆ const_iterator

template<typename DataType , typename InnerMatrixType >
typedef iterator_base<const ThisType> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::const_iterator

Definition at line 125 of file BlockMatrix.hpp.

◆ ConstGetValueType

template<typename DataType , typename InnerMatrixType >
typedef InnerType::ConstGetValueType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::ConstGetValueType

Definition at line 63 of file BlockMatrix.hpp.

◆ GetValueType

template<typename DataType , typename InnerMatrixType >
typedef InnerType::GetValueType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetValueType

Definition at line 62 of file BlockMatrix.hpp.

◆ InnerType

template<typename DataType , typename InnerMatrixType >
typedef NekMatrix<DataType, InnerMatrixType> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::InnerType

Definition at line 54 of file BlockMatrix.hpp.

◆ iterator

template<typename DataType , typename InnerMatrixType >
typedef iterator_base<ThisType> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::iterator

Definition at line 124 of file BlockMatrix.hpp.

◆ NumberType

template<typename DataType , typename InnerMatrixType >
typedef InnerType::NumberType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NumberType

Definition at line 56 of file BlockMatrix.hpp.

◆ ThisType

template<typename DataType , typename InnerMatrixType >
typedef NekMatrix<InnerType, BlockMatrixTag> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::ThisType

Definition at line 55 of file BlockMatrix.hpp.

Constructor & Destructor Documentation

◆ NekMatrix() [1/6]

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( MatrixStorage  type = eFULL)
explicit

◆ NekMatrix() [2/6]

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( unsigned int  numberOfBlockRows,
unsigned int  numberOfBlockColumns,
unsigned int  rowsPerBlock,
unsigned int  columnsPerBlock,
MatrixStorage  type = eFULL 
)

Definition at line 50 of file BlockMatrix.cpp.

53 : BaseType(numberOfBlockRows * rowsPerBlock,
54 numberOfBlockColumns * columnsPerBlock, type),
55 m_data(), m_rowSizes(numberOfBlockRows),
56 m_columnSizes(numberOfBlockColumns), m_storageSize(0),
57 m_numberOfBlockRows(numberOfBlockRows),
58 m_numberOfBlockColumns(numberOfBlockColumns)
59{
61 m_data = Array<OneD, std::shared_ptr<InnerType>>(
62 m_storageSize, std::shared_ptr<InnerType>());
63 for (unsigned int i = 1; i <= numberOfBlockRows; ++i)
64 {
65 m_rowSizes[i - 1] = i * rowsPerBlock - 1;
66 }
67
68 for (unsigned int i = 1; i <= numberOfBlockColumns; ++i)
69 {
70 m_columnSizes[i - 1] = i * columnsPerBlock - 1;
71 }
72}

◆ NekMatrix() [3/6]

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( unsigned int  numberOfBlockRows,
unsigned int  numberOfBlockColumns,
const unsigned int *  rowsPerBlock,
const unsigned int *  columnsPerBlock,
MatrixStorage  type = eFULL 
)

Definition at line 75 of file BlockMatrix.cpp.

79 : BaseType(
80 std::accumulate(rowsPerBlock, rowsPerBlock + numberOfBlockRows, 0),
81 std::accumulate(columnsPerBlock,
82 columnsPerBlock + numberOfBlockColumns, 0),
83 type),
84 m_data(), m_rowSizes(numberOfBlockRows),
85 m_columnSizes(numberOfBlockColumns), m_storageSize(0),
86 m_numberOfBlockRows(numberOfBlockRows),
87 m_numberOfBlockColumns(numberOfBlockColumns)
88{
90 m_data = Array<OneD, std::shared_ptr<InnerType>>(
91 m_storageSize, std::shared_ptr<InnerType>());
92 Initialize(rowsPerBlock, columnsPerBlock);
93}
void Initialize(const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock)

◆ NekMatrix() [4/6]

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( unsigned int  numberOfBlockRows,
unsigned int  numberOfBlockColumns,
const Array< OneD, const unsigned int > &  rowsPerBlock,
const Array< OneD, const unsigned int > &  columnsPerBlock,
MatrixStorage  type = eFULL 
)

Definition at line 96 of file BlockMatrix.cpp.

100 : BaseType(std::accumulate(rowsPerBlock.data(),
101 rowsPerBlock.data() + numberOfBlockRows, 0),
102 std::accumulate(columnsPerBlock.data(),
103 columnsPerBlock.data() + numberOfBlockColumns,
104 0),
105 type),
106 m_data(), m_rowSizes(numberOfBlockRows),
107 m_columnSizes(numberOfBlockColumns), m_storageSize(0),
108 m_numberOfBlockRows(numberOfBlockRows),
109 m_numberOfBlockColumns(numberOfBlockColumns)
110{
112 m_data = Array<OneD, std::shared_ptr<InnerType>>(
113 m_storageSize, std::shared_ptr<InnerType>());
114 Initialize(rowsPerBlock.data(), columnsPerBlock.data());
115}

◆ NekMatrix() [5/6]

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( const Array< OneD, const unsigned int > &  rowsPerBlock,
const Array< OneD, const unsigned int > &  columnsPerBlock,
MatrixStorage  type = eFULL 
)

Definition at line 118 of file BlockMatrix.cpp.

121 : BaseType(
122 std::accumulate(rowsPerBlock.begin(), rowsPerBlock.end(), 0),
123 std::accumulate(columnsPerBlock.begin(), columnsPerBlock.end(), 0),
124 type),
125 m_data(), m_rowSizes(rowsPerBlock.size()),
126 m_columnSizes(columnsPerBlock.size()), m_storageSize(0),
127 m_numberOfBlockRows(rowsPerBlock.size()),
128 m_numberOfBlockColumns(columnsPerBlock.size())
129{
131 m_data = Array<OneD, std::shared_ptr<InnerType>>(
132 m_storageSize, std::shared_ptr<InnerType>());
133 Initialize(rowsPerBlock.data(), columnsPerBlock.data());
134}

◆ NekMatrix() [6/6]

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( const ThisType rhs)

Member Function Documentation

◆ begin() [1/2]

template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::iterator Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::begin

Definition at line 417 of file BlockMatrix.cpp.

418{
419 return iterator(*this, 0, 0);
420}

◆ begin() [2/2]

template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::const_iterator Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::begin

Definition at line 433 of file BlockMatrix.cpp.

434{
435 return const_iterator(*this, 0, 0);
436}

◆ CalculateBlockIndex()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::CalculateBlockIndex ( unsigned int  row,
unsigned int  column 
) const

Definition at line 161 of file BlockMatrix.cpp.

◆ CreateWrapper() [1/2]

template<typename DataType , typename InnerMatrixType >
static std::shared_ptr< ThisType > Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::CreateWrapper ( const std::shared_ptr< ThisType > &  rhs)
static

◆ CreateWrapper() [2/2]

template<typename DataType , typename InnerMatrixType >
static ThisType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::CreateWrapper ( const ThisType rhs)
static

◆ end() [1/2]

template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::iterator Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::end

Definition at line 425 of file BlockMatrix.cpp.

426{
427 return iterator(*this);
428}

◆ end() [2/2]

template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::const_iterator Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::end

Definition at line 441 of file BlockMatrix.cpp.

442{
443 return const_iterator(*this);
444}

◆ GetBlock() [1/2]

template<typename DataType , typename InnerMatrixType >
std::shared_ptr< typename NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::InnerType > & Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetBlock ( unsigned int  row,
unsigned int  column 
)

Definition at line 231 of file BlockMatrix.cpp.

233{
234 ASSERTL2(
235 this->GetTransposeFlag() == 'N' ? row < m_numberOfBlockRows
237 std::string("Row ") + std::to_string(row) +
238 std::string(" requested in a block matrix with a maximum of ") +
239 std::to_string(m_numberOfBlockRows) + std::string(" rows"));
240 ASSERTL2(
241 this->GetTransposeFlag() == 'N' ? column < m_numberOfBlockColumns
242 : column < m_numberOfBlockRows,
243 std::string("Column ") + std::to_string(column) +
244 std::string(" requested in a block matrix with a maximum of ") +
245 std::to_string(m_numberOfBlockColumns) + std::string(" columns"));
246 int x = CalculateBlockIndex(row, column);
247 if (x == -1)
248 {
249 return m_nullBlockPtr;
250 }
251 else
252 {
253 return m_data[x];
254 }
255}
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Definition: ErrorUtil.hpp:265
unsigned int CalculateBlockIndex(unsigned int row, unsigned int column) const

References ASSERTL2.

◆ GetBlock() [2/2]

template<typename DataType , typename InnerMatrixType >
std::shared_ptr< const typename NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::InnerType > Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetBlock ( unsigned int  row,
unsigned int  column 
) const

Definition at line 202 of file BlockMatrix.cpp.

204{
205 ASSERTL2(
206 this->GetTransposeFlag() == 'N' ? row < m_numberOfBlockRows
208 std::string("Row ") + std::to_string(row) +
209 std::string(" requested in a block matrix with a maximum of ") +
210 std::to_string(m_numberOfBlockRows) + std::string(" rows"));
211 ASSERTL2(
212 this->GetTransposeFlag() == 'N' ? column < m_numberOfBlockColumns
213 : column < m_numberOfBlockRows,
214 std::string("Column ") + std::to_string(column) +
215 std::string(" requested in a block matrix with a maximum of ") +
216 std::to_string(m_numberOfBlockColumns) + std::string(" columns"));
217 int x = CalculateBlockIndex(row, column);
218 if (x < 0)
219 {
220 return std::shared_ptr<const InnerType>();
221 }
222 else
223 {
224 return m_data[x];
225 }
226}

References ASSERTL2.

◆ GetBlockPtr()

template<typename DataType , typename InnerMatrixType >
const NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::InnerType * Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetBlockPtr ( unsigned int  row,
unsigned int  column 
) const

Definition at line 173 of file BlockMatrix.cpp.

175{
176 ASSERTL2(
177 this->GetTransposeFlag() == 'N' ? row < m_numberOfBlockRows
179 std::string("Row ") + std::to_string(row) +
180 std::string(" requested in a block matrix with a maximum of ") +
181 std::to_string(m_numberOfBlockRows) + std::string(" rows"));
182 ASSERTL2(
183 this->GetTransposeFlag() == 'N' ? column < m_numberOfBlockColumns
184 : column < m_numberOfBlockColumns,
185 std::string("Column ") + std::to_string(column) +
186 std::string(" requested in a block matrix with a maximum of ") +
187 std::to_string(m_numberOfBlockColumns) + std::string(" columns"));
188 int x = CalculateBlockIndex(row, column);
189 if (x == -1)
190 {
191 return nullptr;
192 }
193 else
194 {
195 return m_data[x].get();
196 }
197}

References ASSERTL2.

◆ GetBlockSizes()

template<typename DataType , typename InnerMatrixType >
void Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetBlockSizes ( Array< OneD, unsigned int > &  rowSizes,
Array< OneD, unsigned int > &  colSizes 
) const

Definition at line 398 of file BlockMatrix.cpp.

401{
402 if (this->GetTransposeFlag() == 'T')
403 {
404 rowSizes = m_columnSizes;
405 colSizes = m_rowSizes;
406 }
407 else
408 {
409 rowSizes = m_rowSizes;
410 colSizes = m_columnSizes;
411 }
412}

◆ GetNumberOfBlockColumns()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfBlockColumns

Definition at line 353 of file BlockMatrix.cpp.

354{
355 if (this->GetTransposeFlag() == 'N')
356 {
358 }
359 else
360 {
361 return m_numberOfBlockRows;
362 }
363}

◆ GetNumberOfBlockRows()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfBlockRows

Definition at line 339 of file BlockMatrix.cpp.

340{
341 if (this->GetTransposeFlag() == 'N')
342 {
343 return m_numberOfBlockRows;
344 }
345 else
346 {
348 }
349}

◆ GetNumberOfColumnsInBlockColumn()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfColumnsInBlockColumn ( unsigned int  blockCol) const

Definition at line 382 of file BlockMatrix.cpp.

384{
385 if (this->GetTransposeFlag() == 'T')
386 {
388 m_rowSizes);
389 }
390 else
391 {
394 }
395}
static unsigned int GetNumberOfElementsInBlock(unsigned int block, unsigned int totalBlocks, const Array< OneD, unsigned int > &sizes)

◆ GetNumberOfElementsInBlock()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfElementsInBlock ( unsigned int  block,
unsigned int  totalBlocks,
const Array< OneD, unsigned int > &  sizes 
)
staticprivate

Definition at line 465 of file BlockMatrix.cpp.

469{
470 ASSERTL2(block < totalBlocks,
471 std::string("Block Element ") + std::to_string(block) +
472 std::string(" requested in a matrix with a maximum of ") +
473 std::to_string(totalBlocks) + std::string(" blocks."));
474 if (block == 0)
475 {
476 return sizes[block] + 1;
477 }
478 else
479 {
480 return sizes[block] - sizes[block - 1];
481 }
482}

References ASSERTL2.

◆ GetNumberOfRowsInBlockRow()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfRowsInBlockRow ( unsigned int  blockRow) const

Definition at line 366 of file BlockMatrix.cpp.

368{
369 if (this->GetTransposeFlag() == 'N')
370 {
372 m_rowSizes);
373 }
374 else
375 {
378 }
379}

◆ GetRequiredStorageSize()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetRequiredStorageSize

Definition at line 152 of file BlockMatrix.cpp.

153{
154 return BaseType::GetRequiredStorageSize(this->GetStorageType(),
155 this->GetNumberOfBlockRows(),
157}

◆ GetStorageSize()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetStorageSize

Definition at line 332 of file BlockMatrix.cpp.

333{
334 return m_storageSize;
335}

◆ Initialize()

template<typename DataType , typename InnerMatrixType >
void Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::Initialize ( const unsigned int *  rowsPerBlock,
const unsigned int *  columnsPerBlock 
)
private

Definition at line 486 of file BlockMatrix.cpp.

488{
489 m_storageSize = this->GetRows() * this->GetColumns();
490 if (this->GetRows() > 0)
491 {
492 m_rowSizes[0] = rowsPerBlock[0] - 1;
493 for (unsigned int i = 1; i < m_numberOfBlockRows; ++i)
494 {
495 m_rowSizes[i] = rowsPerBlock[i] + m_rowSizes[i - 1];
496 }
497 }
498 if (this->GetColumns() > 0)
499 {
500 m_columnSizes[0] = columnsPerBlock[0] - 1;
501 for (unsigned int i = 1; i < m_numberOfBlockColumns; ++i)
502 {
503 m_columnSizes[i] = columnsPerBlock[i] + m_columnSizes[i - 1];
504 }
505 }
506}

◆ operator()()

template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::ConstGetValueType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::operator() ( unsigned int  row,
unsigned int  col 
) const

Definition at line 279 of file BlockMatrix.cpp.

281{
282 ASSERTL2(row < this->GetRows(),
283 std::string("Row ") + std::to_string(row) +
284 std::string(" requested in a matrix with a maximum of ") +
285 std::to_string(this->GetRows()) + std::string(" rows"));
286 ASSERTL2(col < this->GetColumns(),
287 std::string("Column ") + std::to_string(col) +
288 std::string(" requested in a matrix with a maximum of ") +
289 std::to_string(this->GetColumns()) + std::string(" columns"));
290
291 const Array<OneD, unsigned int> *rowSizes = &m_rowSizes;
292 const Array<OneD, unsigned int> *columnSizes = &m_columnSizes;
293
294 if (this->GetTransposeFlag() == 'T')
295 {
296 std::swap(rowSizes, columnSizes);
297 }
298
299 unsigned int blockRow =
300 std::lower_bound(rowSizes->begin(), rowSizes->end(), row) -
301 rowSizes->begin();
302 unsigned int blockColumn =
303 std::lower_bound(columnSizes->begin(), columnSizes->end(), col) -
304 columnSizes->begin();
305 const std::shared_ptr<const InnerType> block =
306 GetBlock(blockRow, blockColumn);
307
308 unsigned int actualRow = row;
309 if (blockRow > 0)
310 {
311 actualRow = row - ((*rowSizes)[blockRow - 1]) - 1;
312 }
313
314 unsigned int actualCol = col;
315 if (blockColumn > 0)
316 {
317 actualCol = col - ((*columnSizes)[blockColumn - 1]) - 1;
318 }
319
320 if (block)
321 {
322 return (*block)(actualRow, actualCol);
323 }
324 else
325 {
326 return m_zeroElement;
327 }
328}
std::shared_ptr< const InnerType > GetBlock(unsigned int row, unsigned int column) const

References ASSERTL2.

◆ SetBlock()

template<typename DataType , typename InnerMatrixType >
void Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::SetBlock ( unsigned int  row,
unsigned int  column,
std::shared_ptr< InnerType > &  m 
)

Definition at line 258 of file BlockMatrix.cpp.

260{
261 ASSERTL2(
262 this->GetTransposeFlag() == 'N' ? row < m_numberOfBlockRows
264 std::string("Row ") + std::to_string(row) +
265 std::string(" requested in a block matrix with a maximum of ") +
266 std::to_string(m_numberOfBlockRows) + std::string(" rows"));
267 ASSERTL2(
268 this->GetTransposeFlag() == 'N' ? column < m_numberOfBlockColumns
269 : column < m_numberOfBlockRows,
270 std::string("Column ") + std::to_string(column) +
271 std::string(" requested in a block matrix with a maximum of ") +
272 std::to_string(m_numberOfBlockColumns) + std::string(" columns"));
273 m_data[CalculateBlockIndex(row, column)] = InnerType::CreateWrapper(m);
274}

References ASSERTL2.

◆ v_GetStorageSize()

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_GetStorageSize
overrideprotectedvirtual

◆ v_GetValue()

template<typename DataType , typename InnerMatrixType >
boost::call_traits< typenameNekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NumberType >::value_type Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_GetValue ( unsigned int  row,
unsigned int  column 
) const
overrideprotectedvirtual

Implements Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >.

Definition at line 512 of file BlockMatrix.cpp.

514{
515 return (*this)(row, column);
516}

◆ v_Transpose()

template<typename DataType , typename InnerMatrixType >
void Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_Transpose
overrideprotectedvirtual

Reimplemented from Nektar::ConstMatrix< NekMatrix< DataType, InnerMatrixType >::NumberType >.

Definition at line 527 of file BlockMatrix.cpp.

528{
529 for (auto &ptr : m_data)
530 {
531 if (ptr.get() != nullptr)
532 {
533 ptr->Transpose();
534 }
535 }
536}

Member Data Documentation

◆ m_columnSizes

template<typename DataType , typename InnerMatrixType >
Array<OneD, unsigned int> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_columnSizes
private

Definition at line 222 of file BlockMatrix.hpp.

◆ m_data

template<typename DataType , typename InnerMatrixType >
Array<OneD, std::shared_ptr<InnerType> > Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_data
private

Definition at line 219 of file BlockMatrix.hpp.

◆ m_nullBlockPtr

template<typename DataType , typename InnerMatrixType >
std::shared_ptr<InnerType> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_nullBlockPtr
private

Definition at line 220 of file BlockMatrix.hpp.

◆ m_numberOfBlockColumns

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_numberOfBlockColumns
private

Definition at line 225 of file BlockMatrix.hpp.

◆ m_numberOfBlockRows

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_numberOfBlockRows
private

Definition at line 224 of file BlockMatrix.hpp.

◆ m_rowSizes

template<typename DataType , typename InnerMatrixType >
Array<OneD, unsigned int> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_rowSizes
private

Definition at line 221 of file BlockMatrix.hpp.

◆ m_storageSize

template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_storageSize
private

Definition at line 223 of file BlockMatrix.hpp.

◆ m_zeroElement

template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NumberType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_zeroElement
staticprivate

Definition at line 226 of file BlockMatrix.hpp.