libMesh
petsc_diff_solver.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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_DIFF_SOLVER_H
21 #define LIBMESH_PETSC_DIFF_SOLVER_H
22 
23 #include "libmesh/libmesh_common.h"
24 
25 #ifdef LIBMESH_HAVE_PETSC
26 
27 // Local includes
28 #include "libmesh/diff_solver.h"
29 #include "libmesh/petsc_macro.h"
30 #include "libmesh/petsc_dm_wrapper.h"
31 
32 // PETSc includes
33 #ifdef I
34 # define LIBMESH_SAW_I
35 #endif
36 #include <petscsnes.h>
37 #ifndef LIBMESH_SAW_I
38 # undef I // Avoid complex.h contamination
39 #endif
40 
41 namespace libMesh
42 {
43 
56 {
57 public:
62  explicit
64 
68  virtual ~PetscDiffSolver ();
69 
70  typedef DiffSolver Parent;
71 
76  virtual void reinit () override;
77 
81  virtual void init () override;
82 
86  void clear ();
87 
93  virtual unsigned int solve () override;
94 
95 protected:
96 
100  SNES _snes;
101 
105 #if !PETSC_VERSION_LESS_THAN(3,7,3)
106 #if defined(LIBMESH_ENABLE_AMR) && defined(LIBMESH_HAVE_METAPHYSICL)
108 #endif
109 #endif
110 
111 private:
112 
116  void setup_petsc_data();
117 };
118 
119 } // namespace libMesh
120 
121 #endif // #ifdef LIBMESH_HAVE_PETSC
122 
123 #endif // LIBMESH_PETSC_DIFF_SOLVER_H
libMesh::PetscDiffSolver::clear
void clear()
The clear function.
Definition: petsc_diff_solver.C:223
libMesh::ImplicitSystem
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...
Definition: implicit_system.h:57
libMesh::PetscDiffSolver::~PetscDiffSolver
virtual ~PetscDiffSolver()
Destructor.
Definition: petsc_diff_solver.C:216
libMesh::PetscDiffSolver::Parent
DiffSolver Parent
Definition: petsc_diff_solver.h:70
libMesh::PetscDiffSolver::_dm_wrapper
PetscDMWrapper _dm_wrapper
Wrapper object for interacting with PetscDM.
Definition: petsc_diff_solver.h:107
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::DiffSolver
This is a generic class that defines a solver to handle ImplicitSystem classes, including NonlinearIm...
Definition: diff_solver.h:70
libMesh::DiffSolver::system
const sys_type & system() const
Definition: diff_solver.h:137
libMesh::PetscDiffSolver::setup_petsc_data
void setup_petsc_data()
Common helper function to setup PETSc data structures.
Definition: petsc_diff_solver.C:355
libMesh::PetscDMWrapper
This class defines a wrapper around the PETSc DM infrastructure.
Definition: petsc_dm_wrapper.h:95
libMesh::PetscDiffSolver::reinit
virtual void reinit() override
The reinitialization function.
Definition: petsc_diff_solver.C:239
libMesh::PetscDiffSolver::solve
virtual unsigned int solve() override
This method performs a solve.
Definition: petsc_diff_solver.C:309
libMesh::PetscDiffSolver::PetscDiffSolver
PetscDiffSolver(sys_type &system)
Constructor.
Definition: petsc_diff_solver.C:199
libMesh::PetscDiffSolver
This class defines a solver which uses a PETSc SNES context to handle a DifferentiableSystem.
Definition: petsc_diff_solver.h:55
libMesh::PetscDiffSolver::init
virtual void init() override
The initialization function.
Definition: petsc_diff_solver.C:205
libMesh::PetscDiffSolver::_snes
SNES _snes
Nonlinear solver context.
Definition: petsc_diff_solver.h:100