Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public 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 >:
Inheritance graph
[legend]
Collaboration diagram for Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >:
Collaboration graph
[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
ThisType
const_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
 
boost::shared_ptr< const
InnerType
GetBlock (unsigned int row, unsigned int column) const
 
boost::shared_ptr< InnerType > & GetBlock (unsigned int row, unsigned int column)
 
void SetBlock (unsigned int row, unsigned int column, boost::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 boost::shared_ptr
< ThisType
CreateWrapper (const boost::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)
 

Private Member Functions

void Initialize (const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock)
 
virtual boost::call_traits
< NumberType >::value_type 
v_GetValue (unsigned int row, unsigned int column) const
 
virtual unsigned int v_GetStorageSize () const
 
virtual void v_Transpose ()
 

Static Private Member Functions

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

Private Attributes

Array< OneD, boost::shared_ptr
< InnerType > > 
m_data
 
boost::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
 

Additional Inherited Members

- 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
 

Detailed Description

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

Definition at line 52 of file BlockMatrix.hpp.

Member Typedef Documentation

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

Definition at line 58 of file BlockMatrix.hpp.

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

Definition at line 131 of file BlockMatrix.hpp.

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

Definition at line 64 of file BlockMatrix.hpp.

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

Definition at line 63 of file BlockMatrix.hpp.

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

Definition at line 55 of file BlockMatrix.hpp.

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

Definition at line 130 of file BlockMatrix.hpp.

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

Definition at line 57 of file BlockMatrix.hpp.

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

Definition at line 56 of file BlockMatrix.hpp.

Constructor & Destructor Documentation

template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( MatrixStorage  type = eFULL)
explicit
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 54 of file BlockMatrix.cpp.

56  :
57  BaseType(numberOfBlockRows*rowsPerBlock, numberOfBlockColumns*columnsPerBlock,type),
58  m_data(),
59  m_rowSizes(numberOfBlockRows),
60  m_columnSizes(numberOfBlockColumns),
61  m_storageSize(0),
62  m_numberOfBlockRows(numberOfBlockRows),
63  m_numberOfBlockColumns(numberOfBlockColumns)
64  {
66  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
67  for(unsigned int i = 1; i <= numberOfBlockRows; ++i)
68  {
69  m_rowSizes[i-1] = i*rowsPerBlock-1;
70  }
71 
72  for(unsigned int i = 1; i <= numberOfBlockColumns; ++i)
73  {
74  m_columnSizes[i-1] = i*columnsPerBlock-1;
75  }
76  }
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 79 of file BlockMatrix.cpp.

81  :
82  BaseType(std::accumulate(rowsPerBlock, rowsPerBlock + numberOfBlockRows, 0),
83  std::accumulate(columnsPerBlock, columnsPerBlock + numberOfBlockColumns, 0),
84  type),
85  m_data(),
86  m_rowSizes(numberOfBlockRows),
87  m_columnSizes(numberOfBlockColumns),
88  m_storageSize(0),
89  m_numberOfBlockRows(numberOfBlockRows),
90  m_numberOfBlockColumns(numberOfBlockColumns)
91  {
93  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
94  Initialize(rowsPerBlock, columnsPerBlock);
95  }
void Initialize(const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock)
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 98 of file BlockMatrix.cpp.

100  :
101  BaseType(std::accumulate(rowsPerBlock.data(), rowsPerBlock.data() + numberOfBlockRows, 0),
102  std::accumulate(columnsPerBlock.data(), columnsPerBlock.data() + numberOfBlockColumns, 0),
103  type),
104  m_data(),
105  m_rowSizes(numberOfBlockRows),
106  m_columnSizes(numberOfBlockColumns),
107  m_storageSize(0),
108  m_numberOfBlockRows(numberOfBlockRows),
109  m_numberOfBlockColumns(numberOfBlockColumns)
110  {
112  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
113  Initialize(rowsPerBlock.data(), columnsPerBlock.data());
114  }
void Initialize(const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock)
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 117 of file BlockMatrix.cpp.

119  :
120  BaseType(std::accumulate(rowsPerBlock.begin(), rowsPerBlock.end(), 0),
121  std::accumulate(columnsPerBlock.begin(), columnsPerBlock.end(), 0),
122  type),
123  m_data(),
124  m_rowSizes(rowsPerBlock.num_elements()),
125  m_columnSizes(columnsPerBlock.num_elements()),
126  m_storageSize(0),
127  m_numberOfBlockRows(rowsPerBlock.num_elements()),
128  m_numberOfBlockColumns(columnsPerBlock.num_elements())
129  {
131  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
132  Initialize(rowsPerBlock.data(), columnsPerBlock.data());
133  }
void Initialize(const unsigned int *rowsPerBlock, const unsigned int *columnsPerBlock)
template<typename DataType , typename InnerMatrixType >
Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NekMatrix ( const ThisType rhs)

Member Function Documentation

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

Definition at line 365 of file BlockMatrix.cpp.

References Nektar::iterator.

365 { return iterator(*this, 0, 0); }
template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::const_iterator Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::begin ( ) const

Definition at line 371 of file BlockMatrix.cpp.

371 { return const_iterator(*this, 0, 0); }
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::CalculateBlockIndex ( unsigned int  row,
unsigned int  column 
) const
template<typename DataType , typename InnerMatrixType >
static ThisType Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::CreateWrapper ( const ThisType rhs)
static
template<typename DataType , typename InnerMatrixType >
static boost::shared_ptr<ThisType> Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::CreateWrapper ( const boost::shared_ptr< ThisType > &  rhs)
static
template<typename DataType , typename InnerMatrixType >
NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::iterator Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::end ( )

Definition at line 368 of file BlockMatrix.cpp.

References Nektar::iterator.

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

Definition at line 374 of file BlockMatrix.cpp.

374 { return const_iterator(*this); }
template<typename DataType , typename InnerMatrixType >
boost::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 188 of file BlockMatrix.cpp.

References ASSERTL2.

189  {
190  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
191  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
192  std::string(" rows"));
193  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
194  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
195  std::string(" columns"));
196  int x = CalculateBlockIndex(row,column);
197  if (x < 0)
198  {
199  return boost::shared_ptr<const InnerType>();
200  }
201  else
202  {
203  return m_data[x];
204  }
205  }
unsigned int CalculateBlockIndex(unsigned int row, unsigned int column) const
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
template<typename DataType , typename InnerMatrixType >
boost::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 209 of file BlockMatrix.cpp.

References ASSERTL2.

210  {
211  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
212  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
213  std::string(" rows"));
214  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
215  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
216  std::string(" columns"));
217  int x = CalculateBlockIndex(row,column);
218  if (x == -1)
219  {
220  return m_nullBlockPtr;
221  }
222  else
223  {
224  return m_data[x];
225  }
226  }
unsigned int CalculateBlockIndex(unsigned int row, unsigned int column) const
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
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 167 of file BlockMatrix.cpp.

References ASSERTL2.

168  {
169  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
170  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
171  std::string(" rows"));
172  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
173  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
174  std::string(" columns"));
175  int x = CalculateBlockIndex(row,column);
176  if (x == -1)
177  {
178  return 0;
179  }
180  else
181  {
182  return m_data[x].get();
183  }
184  }
unsigned int CalculateBlockIndex(unsigned int row, unsigned int column) const
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
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 348 of file BlockMatrix.cpp.

351  {
352  if( this->GetTransposeFlag() == 'T' )
353  {
354  rowSizes = m_columnSizes;
355  colSizes = m_rowSizes;
356  }
357  else
358  {
359  rowSizes = m_rowSizes;
360  colSizes = m_columnSizes;
361  }
362  }
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfBlockColumns ( ) const

Definition at line 309 of file BlockMatrix.cpp.

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

Definition at line 296 of file BlockMatrix.cpp.

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

Definition at line 335 of file BlockMatrix.cpp.

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 391 of file BlockMatrix.cpp.

References ASSERTL2.

392  {
393  ASSERTL2(block < totalBlocks, std::string("Block Element ") + boost::lexical_cast<std::string>(block) +
394  std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(totalBlocks) +
395  std::string(" blocks."));
396  if( block == 0 )
397  {
398  return sizes[block]+1;
399  }
400  else
401  {
402  return sizes[block] - sizes[block-1];
403  }
404  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfRowsInBlockRow ( unsigned int  blockRow) const

Definition at line 322 of file BlockMatrix.cpp.

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

Definition at line 152 of file BlockMatrix.cpp.

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

Definition at line 290 of file BlockMatrix.cpp.

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 407 of file BlockMatrix.cpp.

408  {
409  m_storageSize = this->GetRows()*this->GetColumns();
410  if (this->GetRows() > 0)
411  {
412  m_rowSizes[0] = rowsPerBlock[0] - 1;
413  for(unsigned int i = 1; i < m_numberOfBlockRows; ++i)
414  {
415  m_rowSizes[i] = rowsPerBlock[i] + m_rowSizes[i-1];
416  }
417  }
418  if (this->GetColumns() > 0)
419  {
420  m_columnSizes[0] = columnsPerBlock[0] - 1;
421  for(unsigned int i = 1; i < m_numberOfBlockColumns; ++i)
422  {
423  m_columnSizes[i] = columnsPerBlock[i] + m_columnSizes[i-1];
424  }
425  }
426  }
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 244 of file BlockMatrix.cpp.

References ASSERTL2.

245  {
246  ASSERTL2(row < this->GetRows(), std::string("Row ") + boost::lexical_cast<std::string>(row) +
247  std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(this->GetRows()) +
248  std::string(" rows"));
249  ASSERTL2(col < this->GetColumns(), std::string("Column ") + boost::lexical_cast<std::string>(col) +
250  std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(this->GetColumns()) +
251  std::string(" columns"));
252 
253 
254  const Array<OneD, unsigned int>* rowSizes = &m_rowSizes;
255  const Array<OneD, unsigned int>* columnSizes = &m_columnSizes;
256 
257  if( this->GetTransposeFlag() == 'T' )
258  {
259  std::swap(rowSizes, columnSizes);
260  }
261 
262  unsigned int blockRow = std::lower_bound(rowSizes->begin(), rowSizes->end(), row) - rowSizes->begin();
263  unsigned int blockColumn = std::lower_bound(columnSizes->begin(), columnSizes->end(), col) - columnSizes->begin();
264  const boost::shared_ptr<const InnerType> block = GetBlock(blockRow, blockColumn);
265 
266  unsigned int actualRow = row;
267  if( blockRow > 0 )
268  {
269  actualRow = row-((*rowSizes)[blockRow-1])-1;
270  }
271 
272  unsigned int actualCol = col;
273  if( blockColumn > 0 )
274  {
275  actualCol = col-((*columnSizes)[blockColumn-1])-1;
276  }
277 
278 
279  if( block )
280  {
281  return (*block)(actualRow, actualCol);
282  }
283  else
284  {
285  return m_zeroElement;
286  }
287  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
boost::shared_ptr< const InnerType > GetBlock(unsigned int row, unsigned int column) const
template<typename DataType , typename InnerMatrixType >
void Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::SetBlock ( unsigned int  row,
unsigned int  column,
boost::shared_ptr< InnerType > &  m 
)

Definition at line 229 of file BlockMatrix.cpp.

References ASSERTL2.

230  {
231  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
232  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
233  std::string(" rows"));
234  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
235  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
236  std::string(" columns"));
237  m_data[CalculateBlockIndex(row, column)] = InnerType::CreateWrapper(m);
238  }
unsigned int CalculateBlockIndex(unsigned int row, unsigned int column) const
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_GetStorageSize ( ) const
privatevirtual
template<typename DataType , typename InnerMatrixType >
boost::call_traits< typename NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::NumberType >::value_type Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_GetValue ( unsigned int  row,
unsigned int  column 
) const
privatevirtual

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

Definition at line 430 of file BlockMatrix.cpp.

431  {
432  return (*this)(row, column);
433  }
template<typename DataType , typename InnerMatrixType >
void Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_Transpose ( )
privatevirtual

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

Definition at line 442 of file BlockMatrix.cpp.

443  {
444  BOOST_FOREACH(boost::shared_ptr<InnerType> ptr, m_data)
445  {
446  if( ptr.get() != 0 )
447  {
448  ptr->Transpose();
449  }
450  }
451  }

Member Data Documentation

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

Definition at line 206 of file BlockMatrix.hpp.

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

Definition at line 203 of file BlockMatrix.hpp.

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

Definition at line 204 of file BlockMatrix.hpp.

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

Definition at line 209 of file BlockMatrix.hpp.

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

Definition at line 208 of file BlockMatrix.hpp.

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

Definition at line 205 of file BlockMatrix.hpp.

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

Definition at line 207 of file BlockMatrix.hpp.

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

Definition at line 210 of file BlockMatrix.hpp.