Reference documentation for deal.II version GIT eef19498cf 2022-10-05 14:45:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
petsc_block_sparse_matrix.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2004 - 2022 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.md at
12 // the top level directory of deal.II.
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 
26 # include <deal.II/lac/exceptions.h>
29 
30 # include <cmath>
31 
33 
34 
35 
36 namespace PETScWrappers
37 {
38  namespace MPI
39  {
67  class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix>
68  {
69  public:
74 
79 
91 
103  BlockSparseMatrix() = default;
104 
108  ~BlockSparseMatrix() override = default;
109 
115  operator=(const BlockSparseMatrix &);
116 
127  operator=(const double d);
128 
142  void
143  reinit(const size_type n_block_rows, const size_type n_block_columns);
144 
145 
155  void
156  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
166  reinit(const std::vector<IndexSet> & sizes,
167  const BlockDynamicSparsityPattern &bdsp,
168  const MPI_Comm & com);
169 
170 
171 
176  void
177  vmult(BlockVector &dst, const BlockVector &src) const;
178 
183  void
184  vmult(BlockVector &dst, const Vector &src) const;
185 
190  void
191  vmult(Vector &dst, const BlockVector &src) const;
192 
197  void
198  vmult(Vector &dst, const Vector &src) const;
199 
205  void
206  Tvmult(BlockVector &dst, const BlockVector &src) const;
207 
212  void
213  Tvmult(BlockVector &dst, const Vector &src) const;
214 
219  void
220  Tvmult(Vector &dst, const BlockVector &src) const;
221 
226  void
227  Tvmult(Vector &dst, const Vector &src) const;
228 
236  void
237  collect_sizes();
238 
243  std::vector<IndexSet>
245 
251  std::vector<IndexSet>
253 
259  std::uint64_t
260  n_nonzero_elements() const;
261 
266  const MPI_Comm &
267  get_mpi_communicator() const;
268 
274  };
275 
276 
277 
280  // ------------- inline and template functions -----------------
281 
282  inline BlockSparseMatrix &
284  {
286 
287  for (size_type r = 0; r < this->n_block_rows(); ++r)
288  for (size_type c = 0; c < this->n_block_cols(); ++c)
289  this->block(r, c) = d;
290 
291  return *this;
292  }
293 
294 
295 
296  inline void
298  {
300  }
301 
302 
303 
304  inline void
306  {
308  }
309 
310 
311 
312  inline void
314  {
316  }
317 
318 
319 
320  inline void
321  BlockSparseMatrix::vmult(Vector &dst, const Vector &src) const
322  {
324  }
325 
326 
327  inline void
329  {
331  }
332 
333 
334 
335  inline void
337  {
339  }
340 
341 
342 
343  inline void
345  {
347  }
348 
349 
350 
351  inline void
352  BlockSparseMatrix::Tvmult(Vector &dst, const Vector &src) const
353  {
355  }
356 
357  } // namespace MPI
358 
359 } // namespace PETScWrappers
360 
361 
363 
364 
365 #endif // DEAL_II_WITH_PETSC
366 
367 #endif // dealii_petsc_block_sparse_matrix_h
void Tvmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
void Tvmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
BlockType & block(const unsigned int row, const unsigned int column)
void Tvmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
unsigned int n_block_rows() const
MatrixIterator< BlockMatrixIterators::Accessor< BlockMatrixBase, true > > const_iterator
void vmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
types::global_dof_index size_type
typename BlockType::value_type value_type
void vmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
unsigned int n_block_cols() const
MatrixIterator< BlockMatrixIterators::Accessor< BlockMatrixBase, false > > iterator
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void Tvmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void Tvmult(BlockVector &dst, const BlockVector &src) const
void vmult(BlockVector &dst, const BlockVector &src) const
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
std::vector< IndexSet > locally_owned_domain_indices() const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:457
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:458
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
#define Assert(cond, exc)
Definition: exceptions.h:1501
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)