Reference documentation for deal.II version 8.5.1
petsc_parallel_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_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  std::vector< IndexSet > locally_owned_domain_indices() const;
242 
248  std::vector< IndexSet > locally_owned_range_indices() const;
249 
254  const MPI_Comm &get_mpi_communicator () const;
255 
261  };
262 
263 
264 
267 // ------------- inline and template functions -----------------
268 
269  inline
272  {
274 
275  for (size_type r=0; r<this->n_block_rows(); ++r)
276  for (size_type c=0; c<this->n_block_cols(); ++c)
277  this->block(r,c) = d;
278 
279  return *this;
280  }
281 
282 
283 
284  inline
285  void
287  const BlockVector &src) const
288  {
289  BaseClass::vmult_block_block (dst, src);
290  }
291 
292 
293 
294  inline
295  void
297  const Vector &src) const
298  {
300  }
301 
302 
303 
304  inline
305  void
307  const BlockVector &src) const
308  {
310  }
311 
312 
313 
314  inline
315  void
317  const Vector &src) const
318  {
320  }
321 
322 
323  inline
324  void
326  const BlockVector &src) const
327  {
329  }
330 
331 
332 
333  inline
334  void
336  const Vector &src) const
337  {
339  }
340 
341 
342 
343  inline
344  void
346  const BlockVector &src) const
347  {
349  }
350 
351 
352 
353  inline
354  void
356  const Vector &src) const
357  {
359  }
360 
361  }
362 
363 }
364 
365 
366 DEAL_II_NAMESPACE_CLOSE
367 
368 
369 #endif // DEAL_II_WITH_PETSC
370 
371 #endif // dealii__petsc_parallel_block_sparse_matrix_h
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
std::vector< IndexSet > locally_owned_domain_indices() 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
unsigned int n_block_cols() const
void Tvmult(BlockVector &dst, const BlockVector &src) const
#define Assert(cond, exc)
Definition: exceptions.h:313
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