Reference documentation for deal.II version 8.4.2
petsc_parallel_block_sparse_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2004 - 2015 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_parallel_block_sparse_matrix_h
17 #define dealii__petsc_parallel_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/block_sparsity_pattern.h>
27 # include <deal.II/lac/petsc_parallel_sparse_matrix.h>
28 # include <deal.II/lac/petsc_parallel_block_vector.h>
29 # include <deal.II/lac/exceptions.h>
30 # include <cmath>
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 
35 
36 namespace PETScWrappers
37 {
38  namespace MPI
39  {
40 
68  class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix>
69  {
70  public:
75 
80 
85  typedef BaseClass::pointer pointer;
86  typedef BaseClass::const_pointer const_pointer;
87  typedef BaseClass::reference reference;
88  typedef BaseClass::const_reference const_reference;
89  typedef BaseClass::size_type size_type;
92 
105 
110 
117 
128  operator = (const double d);
129 
143  void reinit (const size_type n_block_rows,
144  const size_type n_block_columns);
145 
146 
156  void reinit(const std::vector<IndexSet> &rows,
157  const std::vector<IndexSet> &cols,
158  const BlockDynamicSparsityPattern &bdsp,
159  const MPI_Comm &com);
160 
161 
165  void reinit(const std::vector<IndexSet> &sizes,
166  const BlockDynamicSparsityPattern &bdsp,
167  const MPI_Comm &com);
168 
169 
170 
175  void vmult (BlockVector &dst,
176  const BlockVector &src) const;
177 
182  void vmult (BlockVector &dst,
183  const Vector &src) const;
184 
189  void vmult (Vector &dst,
190  const BlockVector &src) const;
191 
196  void vmult (Vector &dst,
197  const Vector &src) const;
198 
204  void Tvmult (BlockVector &dst,
205  const BlockVector &src) const;
206 
211  void Tvmult (BlockVector &dst,
212  const Vector &src) const;
213 
218  void Tvmult (Vector &dst,
219  const BlockVector &src) const;
220 
225  void Tvmult (Vector &dst,
226  const Vector &src) const;
227 
235  void collect_sizes ();
236 
241  const MPI_Comm &get_mpi_communicator () const;
242 
248  };
249 
250 
251 
254 // ------------- inline and template functions -----------------
255 
256  inline
259  {
260  Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
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 }
351 
352 
353 DEAL_II_NAMESPACE_CLOSE
354 
355 
356 #endif // DEAL_II_WITH_PETSC
357 
358 #endif // dealii__petsc_parallel_block_sparse_matrix_h
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
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
unsigned int n_block_cols() const
void Tvmult(BlockVector &dst, const BlockVector &src) const
#define Assert(cond, exc)
Definition: exceptions.h:294
BlockType::value_type value_type
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
void reinit(const size_type n_block_rows, const size_type n_block_columns)
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
BlockType & block(const unsigned int row, const unsigned int column)
void vmult(BlockVector &dst, const BlockVector &src) const
unsigned int n_block_rows() const