Reference documentation for deal.II version GIT d77e5ebb0a 2023-01-27 22:35: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_matrix_free.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2012 - 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_matrix_free_h
17 #define dealii_petsc_matrix_free_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_PETSC
23 # include <deal.II/lac/exceptions.h>
27 
28 
29 
30 namespace PETScWrappers
31 {
59  class MatrixFree : public MatrixBase
60  {
61  public:
65  MatrixFree();
66 
81  MatrixFree(const MPI_Comm & communicator,
82  const unsigned int m,
83  const unsigned int n,
84  const unsigned int local_rows,
85  const unsigned int local_columns);
86 
98  MatrixFree(const MPI_Comm & communicator,
99  const unsigned int m,
100  const unsigned int n,
101  const std::vector<unsigned int> &local_rows_per_process,
102  const std::vector<unsigned int> &local_columns_per_process,
103  const unsigned int this_process);
104 
110  MatrixFree(const unsigned int m,
111  const unsigned int n,
112  const unsigned int local_rows,
113  const unsigned int local_columns);
114 
120  MatrixFree(const unsigned int m,
121  const unsigned int n,
122  const std::vector<unsigned int> &local_rows_per_process,
123  const std::vector<unsigned int> &local_columns_per_process,
124  const unsigned int this_process);
125 
131  void
132  reinit(const MPI_Comm & communicator,
133  const unsigned int m,
134  const unsigned int n,
135  const unsigned int local_rows,
136  const unsigned int local_columns);
137 
143  void
144  reinit(const MPI_Comm & communicator,
145  const unsigned int m,
146  const unsigned int n,
147  const std::vector<unsigned int> &local_rows_per_process,
148  const std::vector<unsigned int> &local_columns_per_process,
149  const unsigned int this_process);
150 
155  void
156  reinit(const unsigned int m,
157  const unsigned int n,
158  const unsigned int local_rows,
159  const unsigned int local_columns);
160 
165  void
166  reinit(const unsigned int m,
167  const unsigned int n,
168  const std::vector<unsigned int> &local_rows_per_process,
169  const std::vector<unsigned int> &local_columns_per_process,
170  const unsigned int this_process);
171 
176  void
177  clear();
178 
190  virtual void
191  vmult(VectorBase &dst, const VectorBase &src) const = 0;
192 
205  virtual void
206  Tvmult(VectorBase &dst, const VectorBase &src) const = 0;
207 
219  virtual void
220  vmult_add(VectorBase &dst, const VectorBase &src) const = 0;
221 
234  virtual void
235  Tvmult_add(VectorBase &dst, const VectorBase &src) const = 0;
236 
245  virtual void
246  vmult(Vec &dst, const Vec &src) const;
247 
248  private:
260  static int
261  matrix_free_mult(Mat A, Vec src, Vec dst);
262 
268  void
269  do_reinit(const MPI_Comm & comm,
270  const unsigned int m,
271  const unsigned int n,
272  const unsigned int local_rows,
273  const unsigned int local_columns);
274  };
275 
276 
277 
278 } // namespace PETScWrappers
279 
281 
282 #endif // DEAL_II_WITH_PETSC
283 
284 #endif
virtual void Tvmult(VectorBase &dst, const VectorBase &src) const =0
void reinit(const MPI_Comm &communicator, const unsigned int m, const unsigned int n, const unsigned int local_rows, const unsigned int local_columns)
virtual void vmult_add(VectorBase &dst, const VectorBase &src) const =0
static int matrix_free_mult(Mat A, Vec src, Vec dst)
virtual void Tvmult_add(VectorBase &dst, const VectorBase &src) const =0
void do_reinit(const MPI_Comm &comm, const unsigned int m, const unsigned int n, const unsigned int local_rows, const unsigned int local_columns)
virtual void vmult(VectorBase &dst, const VectorBase &src) const =0
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:461
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:462
static const char A
const MPI_Comm & comm