petsc_dm_nonlinear_solver.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_PETSC_DM_NONLINEAR_SOLVER_H 00021 #define LIBMESH_PETSC_DM_NONLINEAR_SOLVER_H 00022 00023 #include "libmesh/petsc_macro.h" 00024 00025 // This only works with petsc-3.3 and above. 00026 #if !PETSC_VERSION_LESS_THAN(3,3,0) 00027 00028 // Petsc include files. 00029 #include <petscsnes.h> 00030 #include <petsc-private/dmimpl.h> 00031 00032 00033 00034 // Local includes 00035 #include "libmesh/petsc_nonlinear_solver.h" 00036 00037 namespace libMesh 00038 { 00039 // Register the DM_libMesh constructor with PETSc so that we can do DMSetType(dm, DMLIBMESH); 00040 void PetscDMRegister(); 00041 00042 // Set a libMesh NonlinearImplicitSystem on a DM_libMesh 00043 void PetscDMSetSystem(DM, NonlinearImplicitSystem&); 00044 00045 // Get a libMesh NonlinearImplicitSystem from a DM_libMesh, or throw error if none has been set 00046 void PetscDMGetSystem(DM, NonlinearImplicitSystem*&); 00047 00048 00049 00050 00051 00059 template <typename T> 00060 class PetscDMNonlinearSolver : public PetscNonlinearSolver<T> 00061 { 00062 public: 00066 typedef NonlinearImplicitSystem sys_type; 00067 00071 explicit 00072 PetscDMNonlinearSolver (sys_type& system); 00073 00077 ~PetscDMNonlinearSolver (); 00078 00079 00083 virtual void init (); 00084 00089 virtual std::pair<unsigned int, Real> solve (SparseMatrix<T>&, // System Jacobian Matrix 00090 NumericVector<T>&, // Solution vector 00091 NumericVector<T>&, // Residual vector 00092 const double, // Stopping tolerance 00093 const unsigned int); // N. Iterations 00094 00095 }; 00096 00097 } // namespace libMesh 00098 00099 00100 #endif // #if !PETSC_VERSION_LESS_THAN(3,3,0) 00101 #endif // LIBMESH_PETSC_DM_NONLINEAR_SOLVER_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: