Reference documentation for deal.II version 9.2.0
\(\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 - 2020 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 
258  const MPI_Comm &
259  get_mpi_communicator() const;
260 
266  };
267 
268 
269 
272  // ------------- inline and template functions -----------------
273 
274  inline BlockSparseMatrix &
276  {
278 
279  for (size_type r = 0; r < this->n_block_rows(); ++r)
280  for (size_type c = 0; c < this->n_block_cols(); ++c)
281  this->block(r, c) = d;
282 
283  return *this;
284  }
285 
286 
287 
288  inline void
290  {
292  }
293 
294 
295 
296  inline void
298  {
300  }
301 
302 
303 
304  inline void
306  {
308  }
309 
310 
311 
312  inline void
313  BlockSparseMatrix::vmult(Vector &dst, const Vector &src) const
314  {
316  }
317 
318 
319  inline void
321  {
323  }
324 
325 
326 
327  inline void
329  {
331  }
332 
333 
334 
335  inline void
337  {
339  }
340 
341 
342 
343  inline void
344  BlockSparseMatrix::Tvmult(Vector &dst, const Vector &src) const
345  {
347  }
348 
349  } // namespace MPI
350 
351 } // namespace PETScWrappers
352 
353 
355 
356 
357 #endif // DEAL_II_WITH_PETSC
358 
359 #endif // dealii_petsc_block_sparse_matrix_h
PETScWrappers::MPI::BlockSparseMatrix::vmult
void vmult(BlockVector &dst, const BlockVector &src) const
Definition: petsc_block_sparse_matrix.h:289
BlockMatrixBase< SparseMatrix >::const_iterator
MatrixIterator< BlockMatrixIterators::Accessor< BlockMatrixBase, true > > const_iterator
Definition: block_matrix_base.h:376
PETScWrappers::MPI::BlockSparseMatrix::Tvmult
void Tvmult(BlockVector &dst, const BlockVector &src) const
Definition: petsc_block_sparse_matrix.h:320
PETScWrappers::MPI::BlockSparseMatrix::const_pointer
BaseClass::const_pointer const_pointer
Definition: petsc_block_sparse_matrix.h:85
BlockMatrixBase< SparseMatrix >::vmult_block_nonblock
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
PETScWrappers
Definition: petsc_block_sparse_matrix.h:36
PETScWrappers::MPI::BlockSparseMatrix::reinit
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockMatrixBase< SparseMatrix >::n_block_cols
unsigned int n_block_cols() const
BlockMatrixBase< SparseMatrix >::size_type
types::global_dof_index size_type
Definition: block_matrix_base.h:370
PETScWrappers::MPI::BlockSparseMatrix::collect_sizes
void collect_sizes()
Definition: petsc_parallel_block_sparse_matrix.cc:109
BlockMatrixBase< SparseMatrix >::Tvmult_nonblock_nonblock
void Tvmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
SparseMatrix
Definition: sparse_matrix.h:497
petsc_sparse_matrix.h
MPI_Comm
BlockDynamicSparsityPattern
Definition: block_sparsity_pattern.h:521
exceptions.h
BlockMatrixBase< SparseMatrix >::vmult_nonblock_nonblock
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
BlockMatrixBase< SparseMatrix >::reference
value_type & reference
Definition: block_matrix_base.h:368
block_sparsity_pattern.h
BlockMatrixBase< SparseMatrix >::n_block_rows
unsigned int n_block_rows() const
Physics::Elasticity::Kinematics::d
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
MatrixIterator
Definition: matrix_iterator.h:35
BlockMatrixBase< SparseMatrix >::Tvmult_nonblock_block
void Tvmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
BlockMatrixBase< SparseMatrix >::value_type
typename BlockType::value_type value_type
Definition: block_matrix_base.h:364
BlockMatrixBase< SparseMatrix >::block
BlockType & block(const unsigned int row, const unsigned int column)
BlockMatrixBase< SparseMatrix >::vmult_nonblock_block
void vmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
BlockMatrixBase< SparseMatrix >::const_reference
const value_type & const_reference
Definition: block_matrix_base.h:369
PETScWrappers::MPI::BlockSparseMatrix::value_type
BaseClass::value_type value_type
Definition: petsc_block_sparse_matrix.h:83
BlockMatrixBase
Definition: affine_constraints.h:1903
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
petsc_block_vector.h
PETScWrappers::MPI::BlockSparseMatrix::pointer
BaseClass::pointer pointer
Definition: petsc_block_sparse_matrix.h:84
BlockMatrixBase< SparseMatrix >::const_pointer
const value_type * const_pointer
Definition: block_matrix_base.h:367
PETScWrappers::MPI::BlockSparseMatrix::BlockSparseMatrix
BlockSparseMatrix()=default
PETScWrappers::MPI::BlockVector
Definition: petsc_block_vector.h:61
PETScWrappers::MPI::Vector
Definition: petsc_vector.h:158
BlockMatrixBase< SparseMatrix >::vmult_block_block
void vmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
PETScWrappers::MPI::BlockSparseMatrix::~BlockSparseMatrix
~BlockSparseMatrix() override=default
PETScWrappers::MPI::BlockSparseMatrix::reference
BaseClass::reference reference
Definition: petsc_block_sparse_matrix.h:86
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
block_matrix_base.h
BlockMatrixBase< SparseMatrix >::BlockType
SparseMatrix BlockType
Definition: block_matrix_base.h:358
PETScWrappers::MPI::BlockSparseMatrix::locally_owned_domain_indices
std::vector< IndexSet > locally_owned_domain_indices() const
Definition: petsc_parallel_block_sparse_matrix.cc:115
BlockMatrixBase< SparseMatrix >::Tvmult_block_nonblock
void Tvmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
PETScWrappers::MPI::BlockSparseMatrix::size_type
BaseClass::size_type size_type
Definition: petsc_block_sparse_matrix.h:88
BlockMatrixBase< SparseMatrix >::iterator
MatrixIterator< BlockMatrixIterators::Accessor< BlockMatrixBase, false > > iterator
Definition: block_matrix_base.h:373
PETScWrappers::MPI::BlockSparseMatrix::const_reference
BaseClass::const_reference const_reference
Definition: petsc_block_sparse_matrix.h:87
config.h
StandardExceptions::ExcScalarAssignmentOnlyForZeroValue
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
PETScWrappers::MPI::BlockSparseMatrix::operator=
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
Definition: petsc_parallel_block_sparse_matrix.cc:27
BlockMatrixBase< SparseMatrix >::Tvmult_block_block
void Tvmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
BlockMatrixBase< SparseMatrix >::pointer
value_type * pointer
Definition: block_matrix_base.h:366
PETScWrappers::MPI::BlockSparseMatrix::get_mpi_communicator
const MPI_Comm & get_mpi_communicator() const
Definition: petsc_parallel_block_sparse_matrix.cc:137
PETScWrappers::MPI::BlockSparseMatrix
Definition: petsc_block_sparse_matrix.h:67
PETScWrappers::MPI::BlockSparseMatrix::locally_owned_range_indices
std::vector< IndexSet > locally_owned_range_indices() const
Definition: petsc_parallel_block_sparse_matrix.cc:126