16 #ifndef dealii_block_sparse_matrix_h 17 #define dealii_block_sparse_matrix_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/table.h> 22 #include <deal.II/lac/block_matrix_base.h> 23 #include <deal.II/lac/block_vector.h> 24 #include <deal.II/lac/sparse_matrix.h> 25 #include <deal.II/lac/block_sparsity_pattern.h> 26 #include <deal.II/lac/exceptions.h> 30 DEAL_II_NAMESPACE_OPEN
49 template <
typename number>
67 typedef typename BaseClass::pointer pointer;
68 typedef typename BaseClass::const_pointer const_pointer;
69 typedef typename BaseClass::reference reference;
70 typedef typename BaseClass::const_reference const_reference;
71 typedef typename BaseClass::size_type size_type;
213 template <
typename block_number>
221 template <
typename block_number,
222 typename nonblock_number>
224 const Vector<nonblock_number> &src)
const;
230 template <
typename block_number,
231 typename nonblock_number>
232 void vmult (Vector<nonblock_number> &dst,
239 template <
typename nonblock_number>
240 void vmult (Vector<nonblock_number> &dst,
241 const Vector<nonblock_number> &src)
const;
248 template <
typename block_number>
256 template <
typename block_number,
257 typename nonblock_number>
259 const Vector<nonblock_number> &src)
const;
265 template <
typename block_number,
266 typename nonblock_number>
267 void Tvmult (Vector<nonblock_number> &dst,
274 template <
typename nonblock_number>
275 void Tvmult (Vector<nonblock_number> &dst,
276 const Vector<nonblock_number> &src)
const;
290 template <
class BlockVectorType>
292 const BlockVectorType &src,
293 const number omega = 1.)
const;
300 template <
typename number2>
302 const Vector<number2> &src,
303 const number omega = 1.)
const;
331 const unsigned int precision = 3,
332 const bool scientific =
true,
333 const unsigned int width = 0,
334 const char *zero_string =
" ",
335 const double denominator = 1.)
const;
364 template <
typename number>
371 for (size_type r=0; r<this->n_block_rows(); ++r)
372 for (size_type c=0; c<this->n_block_cols(); ++c)
373 this->block(r,c) = d;
380 template <
typename number>
381 template <
typename block_number>
387 BaseClass::vmult_block_block (dst, src);
392 template <
typename number>
393 template <
typename block_number,
394 typename nonblock_number>
398 const Vector<nonblock_number> &src)
const 400 BaseClass::vmult_block_nonblock (dst, src);
405 template <
typename number>
406 template <
typename block_number,
407 typename nonblock_number>
413 BaseClass::vmult_nonblock_block (dst, src);
418 template <
typename number>
419 template <
typename nonblock_number>
423 const Vector<nonblock_number> &src)
const 425 BaseClass::vmult_nonblock_nonblock (dst, src);
430 template <
typename number>
431 template <
typename block_number>
437 BaseClass::Tvmult_block_block (dst, src);
442 template <
typename number>
443 template <
typename block_number,
444 typename nonblock_number>
448 const Vector<nonblock_number> &src)
const 450 BaseClass::Tvmult_block_nonblock (dst, src);
455 template <
typename number>
456 template <
typename block_number,
457 typename nonblock_number>
463 BaseClass::Tvmult_nonblock_block (dst, src);
468 template <
typename number>
469 template <
typename nonblock_number>
473 const Vector<nonblock_number> &src)
const 475 BaseClass::Tvmult_nonblock_nonblock (dst, src);
480 template <
typename number>
481 template <
class BlockVectorType>
486 const BlockVectorType &src,
487 const number omega)
const 490 Assert (dst.n_blocks() == this->n_block_rows(),
492 Assert (src.n_blocks() == this->n_block_cols(),
497 for (size_type i=0; i<this->n_block_rows(); ++i)
498 this->block(i,i).precondition_Jacobi (dst.block(i),
505 template <
typename number>
506 template <
typename number2>
511 const Vector<number2> &src,
512 const number omega)
const 517 Assert (this->n_block_cols() == 1,
518 ExcMessage (
"This function only works if the matrix has " 520 Assert (this->n_block_rows() == 1,
521 ExcMessage (
"This function only works if the matrix has " 526 this->block(0,0).precondition_Jacobi (dst, src, omega);
530 DEAL_II_NAMESPACE_CLOSE
532 #endif // dealii_block_sparse_matrix_h
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
virtual ~BlockSparseMatrix()
void Tvmult(BlockVector< block_number > &dst, const BlockVector< block_number > &src) const
BaseClass::value_type value_type
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
const BlockSparsityPattern & get_sparsity_pattern() const
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
#define DeclException0(Exception0)
BlockType::value_type value_type
std::size_t memory_consumption() const
size_type n_actually_nonzero_elements(const double threshold=0.0) const
BlockMatrixBase< SparseMatrix< number > > BaseClass
static ::ExceptionBase & ExcNotQuadratic()
SmartPointer< const BlockSparsityPattern, BlockSparseMatrix< number > > sparsity_pattern
BlockSparseMatrix()=default
size_type n_nonzero_elements() const
BaseClass::BlockType BlockType
static ::ExceptionBase & ExcBlockDimensionMismatch()
virtual void reinit(const BlockSparsityPattern &sparsity)
void vmult(BlockVector< block_number > &dst, const BlockVector< block_number > &src) const
size_type get_row_length(const size_type row) const
void print_formatted(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const unsigned int width=0, const char *zero_string=" ", const double denominator=1.) const
void precondition_Jacobi(BlockVectorType &dst, const BlockVectorType &src, const number omega=1.) const