Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
petsc_parallel_block_sparse_matrix.h
1 // ---------------------------------------------------------------------
2 // @f$Id: petsc_parallel_block_sparse_matrix.h 30040 2013-07-18 17:06:48Z 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_parallel_block_sparse_matrix_h
18 #define __deal2__petsc_parallel_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/block_sparsity_pattern.h>
28 # include <deal.II/lac/petsc_parallel_sparse_matrix.h>
29 # include <deal.II/lac/petsc_parallel_block_vector.h>
30 # include <deal.II/lac/exceptions.h>
31 # include <cmath>
32 
34 
35 
36 
37 namespace PETScWrappers
38 {
39  namespace MPI
40  {
41 
68  class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix>
69  {
70  public:
76 
82 
88  typedef BaseClass::pointer pointer;
89  typedef BaseClass::const_pointer const_pointer;
90  typedef BaseClass::reference reference;
91  typedef BaseClass::const_reference const_reference;
92  typedef BaseClass::size_type size_type;
95 
118 
123 
132 
150  operator = (const double d);
151 
178  void reinit (const size_type n_block_rows,
179  const size_type n_block_columns);
180 
181 
191  void reinit(const std::vector<IndexSet> &rows,
192  const std::vector<IndexSet> &cols,
194  const MPI_Comm &com);
195 
196 
200  void reinit(const std::vector<IndexSet> &sizes,
202  const MPI_Comm &com);
203 
204 
205 
211  void vmult (BlockVector &dst,
212  const BlockVector &src) const;
213 
221  void vmult (BlockVector &dst,
222  const Vector &src) const;
223 
231  void vmult (Vector &dst,
232  const BlockVector &src) const;
233 
241  void vmult (Vector &dst,
242  const Vector &src) const;
243 
252  void Tvmult (BlockVector &dst,
253  const BlockVector &src) const;
254 
262  void Tvmult (BlockVector &dst,
263  const Vector &src) const;
264 
272  void Tvmult (Vector &dst,
273  const BlockVector &src) const;
274 
282  void Tvmult (Vector &dst,
283  const Vector &src) const;
284 
297  void collect_sizes ();
298 
304  const MPI_Comm &get_mpi_communicator () const;
305 
312  };
313 
314 
315 
318 // ------------- inline and template functions -----------------
319 
320  inline
323  {
325 
326  for (size_type r=0; r<this->n_block_rows(); ++r)
327  for (size_type c=0; c<this->n_block_cols(); ++c)
328  this->block(r,c) = d;
329 
330  return *this;
331  }
332 
333 
334 
335  inline
336  void
338  const BlockVector &src) const
339  {
340  BaseClass::vmult_block_block (dst, src);
341  }
342 
343 
344 
345  inline
346  void
348  const Vector &src) const
349  {
351  }
352 
353 
354 
355  inline
356  void
358  const BlockVector &src) const
359  {
361  }
362 
363 
364 
365  inline
366  void
368  const Vector &src) const
369  {
371  }
372 
373 
374  inline
375  void
377  const BlockVector &src) const
378  {
380  }
381 
382 
383 
384  inline
385  void
387  const Vector &src) const
388  {
390  }
391 
392 
393 
394  inline
395  void
397  const BlockVector &src) const
398  {
400  }
401 
402 
403 
404  inline
405  void
407  const Vector &src) const
408  {
410  }
411 
412  }
413 
414 }
415 
416 
417 DEAL_II_NAMESPACE_CLOSE
418 
419 
420 #endif // DEAL_II_WITH_PETSC
421 
422 #endif // __deal2__petsc_parallel_block_sparse_matrix_h
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void reinit(const size_type n_block_rows, const size_type n_block_columns)
const MPI_Comm & get_mpi_communicator() const
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
void vmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
void Tvmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
unsigned int n_block_rows() const
void Tvmult(BlockVector &dst, const BlockVector &src) const
#define Assert(cond, exc)
Definition: exceptions.h:299
unsigned int n_block_cols() const
BlockType & block(const unsigned int row, const unsigned int column)
BlockType::value_type value_type
void vmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
void Tvmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
void Tvmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void vmult(BlockVector &dst, const BlockVector &src) const
::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
void Tvmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const