libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
petsc_preconditioner.h
浏览该文件的文档.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2023 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_PETSC_PRECONDITIONER_H
21 #define LIBMESH_PETSC_PRECONDITIONER_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #ifdef LIBMESH_HAVE_PETSC
26 
27 // libMesh includes
28 #include "libmesh/preconditioner.h"
29 #include "libmesh/libmesh_common.h"
30 #include "libmesh/reference_counted_object.h"
31 #include "libmesh/libmesh.h"
32 #include "libmesh/petsc_macro.h"
33 #include "libmesh/wrapped_petsc.h"
34 
35 // Petsc includes
36 #include "petscpc.h"
37 
38 namespace libMesh
39 {
40 
41 // forward declarations
42 template <typename T> class SparseMatrix;
43 template <typename T> class NumericVector;
44 template <typename T> class ShellMatrix;
45 enum PreconditionerType : int;
46 
47 namespace libMesh
48 {
49 
56 template <typename T>
57 class PetscPreconditioner : public Preconditioner<T>
58 {
59 public:
60 
66  PetscPreconditioner (const libMesh::Parallel::Communicator & comm_in);
67 
71  virtual ~PetscPreconditioner () = default;
72 
79  virtual void apply(const NumericVector<T> & x, NumericVector<T> & y) override;
80 
84  virtual void clear () override;
85 
89  virtual void init () override;
90 
96  PC pc();
97 
104  static void set_petsc_preconditioner_type (const PreconditionerType & preconditioner_type, PC & pc);
105 
106 protected:
107 
111  WrappedPetsc<PC> _pc;
112 
116  Mat _mat;
117 
118 private:
125  static void set_petsc_subpreconditioner_type(const PCType type, PC & pc);
126 };
127 
128 } // namespace libMesh
129 
130 #endif // #ifdef LIBMESH_HAVE_PETSC
131 #endif // LIBMESH_PETSC_PRECONDITIONER_H