Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
petsc_block_sparse_matrix.h
1 // ---------------------------------------------------------------------
2 // @f$Id: petsc_block_sparse_matrix.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2004 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__petsc_block_sparse_matrix_h
18 #define __deal2__petsc_block_sparse_matrix_h
19 
20 
21 #include <deal.II/base/config.h>
22 
23 #ifdef DEAL_II_WITH_PETSC
24 
25 # include <deal.II/base/table.h>
26 # include <deal.II/lac/block_matrix_base.h>
27 # include <deal.II/lac/petsc_sparse_matrix.h>
28 # include <deal.II/lac/petsc_block_vector.h>
29 # include <deal.II/lac/exceptions.h>
30 
31 # include <cmath>
32 
33 DEAL_II_NAMESPACE_OPEN
34 
35 
36 
37 namespace PETScWrappers
38 {
39 
66  class BlockSparseMatrix : public BlockMatrixBase<PETScWrappers::SparseMatrix>
67  {
68  public:
74 
80 
86  typedef BaseClass::pointer pointer;
87  typedef BaseClass::const_pointer const_pointer;
88  typedef BaseClass::reference reference;
89  typedef BaseClass::const_reference const_reference;
90  typedef BaseClass::size_type size_type;
93 
116 
121 
129 
146  operator = (const double d);
147 
174  void reinit (const size_type n_block_rows,
175  const size_type n_block_columns);
176 
189  void collect_sizes ();
190 
196  void vmult (BlockVector &dst,
197  const BlockVector &src) const;
198 
206  void vmult (BlockVector &dst,
207  const Vector &src) const;
208 
216  void vmult (Vector &dst,
217  const BlockVector &src) const;
218 
226  void vmult (Vector &dst,
227  const Vector &src) const;
228 
237  void Tvmult (BlockVector &dst,
238  const BlockVector &src) const;
239 
247  void Tvmult (BlockVector &dst,
248  const Vector &src) const;
249 
257  void Tvmult (Vector &dst,
258  const BlockVector &src) const;
259 
267  void Tvmult (Vector &dst,
268  const Vector &src) const;
269 
276 
284  DeclException4 (ExcIncompatibleRowNumbers,
285  int, int, int, int,
286  << "The blocks [" << arg1 << ',' << arg2 << "] and ["
287  << arg3 << ',' << arg4 << "] have differing row numbers.");
291  DeclException4 (ExcIncompatibleColNumbers,
292  int, int, int, int,
293  << "The blocks [" << arg1 << ',' << arg2 << "] and ["
294  << arg3 << ',' << arg4 << "] have differing column numbers.");
296  };
297 
298 
299 
302 // ------------- inline and template functions -----------------
303 
304  inline
307  {
309 
310  for (size_type r=0; r<this->n_block_rows(); ++r)
311  for (size_type c=0; c<this->n_block_cols(); ++c)
312  this->block(r,c) = d;
313 
314  return *this;
315  }
316 
317 
318 
319  inline
320  void
322  const BlockVector &src) const
323  {
324  BaseClass::vmult_block_block (dst, src);
325  }
326 
327 
328 
329  inline
330  void
332  const Vector &src) const
333  {
335  }
336 
337 
338 
339  inline
340  void
342  const BlockVector &src) const
343  {
345  }
346 
347 
348 
349  inline
350  void
352  const Vector &src) const
353  {
355  }
356 
357 
358  inline
359  void
361  const BlockVector &src) const
362  {
364  }
365 
366 
367 
368  inline
369  void
371  const Vector &src) const
372  {
374  }
375 
376 
377 
378  inline
379  void
381  const BlockVector &src) const
382  {
384  }
385 
386 
387 
388  inline
389  void
391  const Vector &src) const
392  {
394  }
395 
396 }
397 
398 DEAL_II_NAMESPACE_CLOSE
399 
400 #endif // DEAL_II_WITH_PETSC
401 
402 #endif // __deal2__petsc_block_sparse_matrix_h
void vmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
void Tvmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
void Tvmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
void vmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
DeclException4(ExcIncompatibleRowNumbers, int, int, int, int,<< "The blocks ["<< arg1<< ','<< arg2<< "] and ["<< arg3<< ','<< arg4<< "] have differing row numbers.")
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
void Tvmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
BlockType::value_type value_type
#define Assert(cond, exc)
Definition: exceptions.h:299
void vmult(BlockVector &dst, const BlockVector &src) const
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void Tvmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
BlockMatrixBase< SparseMatrix > BaseClass
void reinit(const size_type n_block_rows, const size_type n_block_columns)
::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
void Tvmult(BlockVector &dst, const BlockVector &src) const
BlockType & block(const unsigned int row, const unsigned int column)