petsc_dm_nonlinear_solver.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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_DM_NONLINEAR_SOLVER_H
21 #define LIBMESH_PETSC_DM_NONLINEAR_SOLVER_H
22 
23 #include "libmesh/petsc_macro.h"
24 
25 // This only works with petsc-3.3 and above.
26 #if !PETSC_VERSION_LESS_THAN(3,3,0)
27 
28 // Petsc include files.
29 #include <petscsnes.h>
30 #include <petsc-private/dmimpl.h>
31 
32 
33 
34 // Local includes
36 
37 namespace libMesh
38 {
39  // Register the DM_libMesh constructor with PETSc so that we can do DMSetType(dm, DMLIBMESH);
40  void PetscDMRegister();
41 
42  // Set a libMesh NonlinearImplicitSystem on a DM_libMesh
43  void PetscDMSetSystem(DM, NonlinearImplicitSystem&);
44 
45  // Get a libMesh NonlinearImplicitSystem from a DM_libMesh, or throw error if none has been set
46  void PetscDMGetSystem(DM, NonlinearImplicitSystem*&);
47 
48 
49 
50 
51 
59 template <typename T>
61 {
62 public:
67 
71  explicit
73 
78 
79 
83  virtual void init ();
84 
89  virtual std::pair<unsigned int, Real> solve (SparseMatrix<T>&, // System Jacobian Matrix
90  NumericVector<T>&, // Solution vector
91  NumericVector<T>&, // Residual vector
92  const double, // Stopping tolerance
93  const unsigned int); // N. Iterations
94 
95 };
96 
97 } // namespace libMesh
98 
99 
100 #endif // #if !PETSC_VERSION_LESS_THAN(3,3,0)
101 #endif // LIBMESH_PETSC_DM_NONLINEAR_SOLVER_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:06 UTC

Hosted By:
SourceForge.net Logo