$extrastylesheet
linear_implicit_system.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 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_LINEAR_IMPLICIT_SYSTEM_H
00021 #define LIBMESH_LINEAR_IMPLICIT_SYSTEM_H
00022 
00023 // Local Includes
00024 #include "libmesh/implicit_system.h"
00025 
00026 // C++ includes
00027 #include <cstddef>
00028 
00029 namespace libMesh
00030 {
00031 
00032 
00033 // Forward Declarations
00034 template <typename T> class LinearSolver;
00035 template <typename T> class ShellMatrix;
00036 
00037 
00046 // ------------------------------------------------------------
00047 // LinearImplicitSystem class definition
00048 
00049 class LinearImplicitSystem : public ImplicitSystem
00050 {
00051 public:
00052 
00057   LinearImplicitSystem (EquationSystems& es,
00058                         const std::string& name,
00059                         const unsigned int number);
00060 
00064   virtual ~LinearImplicitSystem ();
00065 
00069   typedef LinearImplicitSystem sys_type;
00070 
00074   typedef ImplicitSystem Parent;
00075 
00079   sys_type & system () { return *this; }
00080 
00085   virtual void clear ();
00086 
00090   virtual void init_data ();
00091 
00096   virtual void reinit ();
00097 
00104   virtual void assemble () { ImplicitSystem::assemble(); }
00105 
00111   virtual void restrict_solve_to (const SystemSubset* subset,
00112                                   const SubsetSolveMode subset_solve_mode=SUBSET_ZERO);
00113 
00117   virtual void solve ();
00118 
00123   virtual LinearSolver<Number> *get_linear_solver() const;
00124 
00129   virtual void release_linear_solver(LinearSolver<Number> *) const;
00130 
00135   virtual void assembly(bool get_residual, bool get_jacobian,
00136                         bool apply_heterogeneous_constraints = false);
00137 
00142   virtual std::string system_type () const { return "LinearImplicit"; }
00143 
00150   UniquePtr<LinearSolver<Number> > linear_solver;
00151 
00156   unsigned int n_linear_iterations() const { return _n_linear_iterations; }
00157 
00161   Real final_linear_residual() const { return _final_linear_residual; }
00162 
00172   void attach_shell_matrix (ShellMatrix<Number>* shell_matrix);
00173 
00177   void detach_shell_matrix (void) { attach_shell_matrix(NULL); }
00178 
00183   ShellMatrix<Number>* get_shell_matrix(void) { return _shell_matrix; }
00184 
00185 protected:
00186 
00191   unsigned int _n_linear_iterations;
00192 
00196   Real _final_linear_residual;
00197 
00201   ShellMatrix<Number>* _shell_matrix;
00202 
00206   const SystemSubset* _subset;
00207 
00212   SubsetSolveMode _subset_solve_mode;
00213 };
00214 
00215 
00216 } // namespace libMesh
00217 
00218 
00219 // ------------------------------------------------------------
00220 // LinearImplicitSystem inline methods
00221 
00222 
00223 #endif // LIBMESH_LINEAR_IMPLICIT_SYSTEM_H