Reference documentation for deal.II version 8.5.1
petsc_block_sparse_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2004 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__petsc_block_sparse_matrix_h
17 #define dealii__petsc_block_sparse_matrix_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_PETSC
23 
24 # include <deal.II/base/table.h>
25 # include <deal.II/lac/block_matrix_base.h>
26 # include <deal.II/lac/petsc_sparse_matrix.h>
27 # include <deal.II/lac/petsc_block_vector.h>
28 # include <deal.II/lac/exceptions.h>
29 
30 # include <cmath>
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 
35 
36 namespace PETScWrappers
37 {
38 
66  class BlockSparseMatrix : public BlockMatrixBase<PETScWrappers::SparseMatrix>
67  {
68  public:
73 
78 
83  typedef BaseClass::pointer pointer;
84  typedef BaseClass::const_pointer const_pointer;
85  typedef BaseClass::reference reference;
86  typedef BaseClass::const_reference const_reference;
87  typedef BaseClass::size_type size_type;
90 
103 
108 
115 
126  operator = (const double d);
127 
141  void reinit (const size_type n_block_rows,
142  const size_type n_block_columns);
143 
150  void collect_sizes ();
151 
156  void vmult (BlockVector &dst,
157  const BlockVector &src) const;
158 
163  void vmult (BlockVector &dst,
164  const Vector &src) const;
165 
170  void vmult (Vector &dst,
171  const BlockVector &src) const;
172 
177  void vmult (Vector &dst,
178  const Vector &src) const;
179 
185  void Tvmult (BlockVector &dst,
186  const BlockVector &src) const;
187 
192  void Tvmult (BlockVector &dst,
193  const Vector &src) const;
194 
199  void Tvmult (Vector &dst,
200  const BlockVector &src) const;
201 
206  void Tvmult (Vector &dst,
207  const Vector &src) const;
208 
213  std::vector< size_type > locally_owned_domain_sizes() const;
214 
220  std::vector< size_type > locally_owned_range_sizes() const;
221 
227 
237  int, int, int, int,
238  << "The blocks [" << arg1 << ',' << arg2 << "] and ["
239  << arg3 << ',' << arg4 << "] have differing row numbers.");
244  int, int, int, int,
245  << "The blocks [" << arg1 << ',' << arg2 << "] and ["
246  << arg3 << ',' << arg4 << "] have differing column numbers.");
248  };
249 
250 
251 
254 // ------------- inline and template functions -----------------
255 
256  inline
259  {
261 
262  for (size_type r=0; r<this->n_block_rows(); ++r)
263  for (size_type c=0; c<this->n_block_cols(); ++c)
264  this->block(r,c) = d;
265 
266  return *this;
267  }
268 
269 
270 
271  inline
272  void
274  const BlockVector &src) const
275  {
276  BaseClass::vmult_block_block (dst, src);
277  }
278 
279 
280 
281  inline
282  void
284  const Vector &src) const
285  {
287  }
288 
289 
290 
291  inline
292  void
294  const BlockVector &src) const
295  {
297  }
298 
299 
300 
301  inline
302  void
304  const Vector &src) const
305  {
307  }
308 
309 
310  inline
311  void
313  const BlockVector &src) const
314  {
316  }
317 
318 
319 
320  inline
321  void
323  const Vector &src) const
324  {
326  }
327 
328 
329 
330  inline
331  void
333  const BlockVector &src) const
334  {
336  }
337 
338 
339 
340  inline
341  void
343  const Vector &src) const
344  {
346  }
347 
348 }
349 
350 DEAL_II_NAMESPACE_CLOSE
351 
352 #endif // DEAL_II_WITH_PETSC
353 
354 #endif // dealii__petsc_block_sparse_matrix_h
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
void vmult(BlockVector &dst, const BlockVector &src) const
std::vector< size_type > locally_owned_domain_sizes() const
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
void vmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
void Tvmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void Tvmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
void Tvmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
void vmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
void Tvmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
static ::ExceptionBase & ExcIncompatibleRowNumbers(int arg1, int arg2, int arg3, int arg4)
void Tvmult(BlockVector &dst, const BlockVector &src) const
void reinit(const size_type n_block_rows, const size_type n_block_columns)
#define Assert(cond, exc)
Definition: exceptions.h:313
BlockType::value_type value_type
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
BlockType & block(const unsigned int row, const unsigned int column)
BlockMatrixBase< SparseMatrix > BaseClass
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:600
static ::ExceptionBase & ExcIncompatibleColNumbers(int arg1, int arg2, int arg3, int arg4)
std::vector< size_type > locally_owned_range_sizes() const