Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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
 
MatrixStorage GetType () const
 
unsigned int GetNumberOfBlockRows () const
 
unsigned int GetNumberOfBlockColumns () const
 
unsigned int GetNumberOfRowsInBlockRow (unsigned int blockRow) const
 
unsigned int GetNumberOfColumnsInBlockColumn (unsigned int blockCol) 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 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 MatrixStorage v_GetStorageType () 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
 
MatrixStorage m_storageType
 

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)
 
 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

Definition at line 42 of file BlockMatrix.cpp.

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

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

83  :
84  BaseType(std::accumulate(rowsPerBlock, rowsPerBlock + numberOfBlockRows, 0),
85  std::accumulate(columnsPerBlock, columnsPerBlock + numberOfBlockColumns, 0)),
86  m_data(),
87  m_rowSizes(numberOfBlockRows),
88  m_columnSizes(numberOfBlockColumns),
89  m_storageSize(0),
90  m_numberOfBlockRows(numberOfBlockRows),
91  m_numberOfBlockColumns(numberOfBlockColumns),
92  m_storageType(type)
93  {
95  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
96  Initialize(rowsPerBlock, columnsPerBlock);
97  }
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 100 of file BlockMatrix.cpp.

102  :
103  BaseType(std::accumulate(rowsPerBlock.data(), rowsPerBlock.data() + numberOfBlockRows, 0),
104  std::accumulate(columnsPerBlock.data(), columnsPerBlock.data() + numberOfBlockColumns, 0)),
105  m_data(),
106  m_rowSizes(numberOfBlockRows),
107  m_columnSizes(numberOfBlockColumns),
108  m_storageSize(0),
109  m_numberOfBlockRows(numberOfBlockRows),
110  m_numberOfBlockColumns(numberOfBlockColumns),
111  m_storageType(type)
112  {
114  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
115  Initialize(rowsPerBlock.data(), columnsPerBlock.data());
116  }
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 119 of file BlockMatrix.cpp.

121  :
122  BaseType(std::accumulate(rowsPerBlock.begin(), rowsPerBlock.end(), 0),
123  std::accumulate(columnsPerBlock.begin(), columnsPerBlock.end(), 0)),
124  m_data(),
125  m_rowSizes(rowsPerBlock.num_elements()),
126  m_columnSizes(columnsPerBlock.num_elements()),
127  m_storageSize(0),
128  m_numberOfBlockRows(rowsPerBlock.num_elements()),
129  m_numberOfBlockColumns(columnsPerBlock.num_elements()),
130  m_storageType(type)
131  {
133  m_data = Array<OneD, boost::shared_ptr<InnerType> >(m_storageSize, boost::shared_ptr<InnerType>());
134  Initialize(rowsPerBlock.data(), columnsPerBlock.data());
135  }
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

Definition at line 162 of file BlockMatrix.cpp.

163  {
164  unsigned int blockRows = GetNumberOfBlockRows();
165  unsigned int blockCols = GetNumberOfBlockColumns();
166 
167  if( this->GetTransposeFlag() == 'T' )
168  {
169  std::swap(blockRows, blockCols);
170  }
171 
172  return BaseType::CalculateIndex(this->GetStorageType(),
173  row, column, blockRows, blockCols, this->GetTransposeFlag());
174  }
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 199 of file BlockMatrix.cpp.

References ASSERTL2.

200  {
201  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
202  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
203  std::string(" rows"));
204  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
205  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
206  std::string(" columns"));
207  int x = CalculateBlockIndex(row,column);
208  if (x < 0)
209  {
210  return boost::shared_ptr<const InnerType>();
211  }
212  else
213  {
214  return m_data[x];
215  }
216  }
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:213
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 220 of file BlockMatrix.cpp.

References ASSERTL2.

221  {
222  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
223  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
224  std::string(" rows"));
225  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
226  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
227  std::string(" columns"));
228  int x = CalculateBlockIndex(row,column);
229  if (x == -1)
230  {
231  return m_nullBlockPtr;
232  }
233  else
234  {
235  return m_data[x];
236  }
237  }
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:213
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 178 of file BlockMatrix.cpp.

References ASSERTL2.

179  {
180  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
181  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
182  std::string(" rows"));
183  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
184  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
185  std::string(" columns"));
186  int x = CalculateBlockIndex(row,column);
187  if (x == -1)
188  {
189  return 0;
190  }
191  else
192  {
193  return m_data[x].get();
194  }
195  }
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:213
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfBlockColumns ( ) const

Definition at line 326 of file BlockMatrix.cpp.

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

Definition at line 313 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 352 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:213
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetNumberOfRowsInBlockRow ( unsigned int  blockRow) const

Definition at line 339 of file BlockMatrix.cpp.

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

Definition at line 155 of file BlockMatrix.cpp.

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

Definition at line 301 of file BlockMatrix.cpp.

template<typename DataType , typename InnerMatrixType >
MatrixStorage Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::GetType ( ) const

Definition at line 307 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 255 of file BlockMatrix.cpp.

References ASSERTL2.

256  {
257  ASSERTL2(row < this->GetRows(), std::string("Row ") + boost::lexical_cast<std::string>(row) +
258  std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(this->GetRows()) +
259  std::string(" rows"));
260  ASSERTL2(col < this->GetColumns(), std::string("Column ") + boost::lexical_cast<std::string>(col) +
261  std::string(" requested in a matrix with a maximum of ") + boost::lexical_cast<std::string>(this->GetColumns()) +
262  std::string(" columns"));
263 
264 
265  const Array<OneD, unsigned int>* rowSizes = &m_rowSizes;
266  const Array<OneD, unsigned int>* columnSizes = &m_columnSizes;
267 
268  if( this->GetTransposeFlag() == 'T' )
269  {
270  std::swap(rowSizes, columnSizes);
271  }
272 
273  unsigned int blockRow = std::lower_bound(rowSizes->begin(), rowSizes->end(), row) - rowSizes->begin();
274  unsigned int blockColumn = std::lower_bound(columnSizes->begin(), columnSizes->end(), col) - columnSizes->begin();
275  const boost::shared_ptr<const InnerType> block = GetBlock(blockRow, blockColumn);
276 
277  unsigned int actualRow = row;
278  if( blockRow > 0 )
279  {
280  actualRow = row-((*rowSizes)[blockRow-1])-1;
281  }
282 
283  unsigned int actualCol = col;
284  if( blockColumn > 0 )
285  {
286  actualCol = col-((*columnSizes)[blockColumn-1])-1;
287  }
288 
289 
290  if( block )
291  {
292  return (*block)(actualRow, actualCol);
293  }
294  else
295  {
296  return m_zeroElement;
297  }
298  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:213
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 240 of file BlockMatrix.cpp.

References ASSERTL2.

241  {
242  ASSERTL2(row < m_numberOfBlockRows, std::string("Row ") + boost::lexical_cast<std::string>(row) +
243  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockRows) +
244  std::string(" rows"));
245  ASSERTL2(column < m_numberOfBlockColumns, std::string("Column ") + boost::lexical_cast<std::string>(column) +
246  std::string(" requested in a block matrix with a maximum of ") + boost::lexical_cast<std::string>(m_numberOfBlockColumns) +
247  std::string(" columns"));
248  m_data[CalculateBlockIndex(row, column)] = InnerType::CreateWrapper(m);
249  }
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:213
template<typename DataType , typename InnerMatrixType >
unsigned int Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_GetStorageSize ( ) const
privatevirtual
template<typename DataType , typename InnerMatrixType >
MatrixStorage Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::v_GetStorageType ( ) 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 448 of file BlockMatrix.cpp.

449  {
450  BOOST_FOREACH(boost::shared_ptr<InnerType> ptr, m_data)
451  {
452  if( ptr.get() != 0 )
453  {
454  ptr->Transpose();
455  }
456  }
457  }

Member Data Documentation

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

Definition at line 207 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 204 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 205 of file BlockMatrix.hpp.

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

Definition at line 210 of file BlockMatrix.hpp.

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

Definition at line 209 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 206 of file BlockMatrix.hpp.

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

Definition at line 208 of file BlockMatrix.hpp.

template<typename DataType , typename InnerMatrixType >
MatrixStorage Nektar::NekMatrix< NekMatrix< DataType, InnerMatrixType >, BlockMatrixTag >::m_storageType
private

Definition at line 211 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 212 of file BlockMatrix.hpp.