libMesh
linear_implicit_system.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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_LINEAR_IMPLICIT_SYSTEM_H
21 #define LIBMESH_LINEAR_IMPLICIT_SYSTEM_H
22 
23 // Local Includes
24 #include "libmesh/implicit_system.h"
25 
26 // C++ includes
27 #include <cstddef>
28 
29 namespace libMesh
30 {
31 
32 
33 // Forward Declarations
34 template <typename T> class LinearSolver;
35 template <typename T> class ShellMatrix;
36 
37 
50 {
51 public:
52 
58  const std::string & name,
59  const unsigned int number);
60 
64  virtual ~LinearImplicitSystem ();
65 
70 
75 
79  sys_type & system () { return *this; }
80 
85  virtual void clear () libmesh_override;
86 
90  virtual void init_data () libmesh_override;
91 
96  virtual void reinit () libmesh_override;
97 
104  virtual void assemble () libmesh_override { ImplicitSystem::assemble(); }
105 
111  virtual void restrict_solve_to (const SystemSubset * subset,
112  const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) libmesh_override;
113 
117  virtual void solve () libmesh_override;
118 
123  virtual LinearSolver<Number> * get_linear_solver() const libmesh_override;
124 
129  virtual void release_linear_solver(LinearSolver<Number> *) const libmesh_override;
130 
135  virtual void assembly(bool get_residual,
136  bool get_jacobian,
137  bool apply_heterogeneous_constraints = false,
138  bool apply_no_constraints = false) libmesh_override;
139 
144  virtual std::string system_type () const libmesh_override { return "LinearImplicit"; }
145 
153 
158  unsigned int n_linear_iterations() const { return _n_linear_iterations; }
159 
164 
174  void attach_shell_matrix (ShellMatrix<Number> * shell_matrix);
175 
180 
186 
187 protected:
188 
193  unsigned int _n_linear_iterations;
194 
199 
204 
209 
215 };
216 
217 } // namespace libMesh
218 
219 #endif // LIBMESH_LINEAR_IMPLICIT_SYSTEM_H
virtual std::string system_type() const libmesh_override
unsigned int n_linear_iterations() const
ShellMatrix< Number > * get_shell_matrix()
void attach_shell_matrix(ShellMatrix< Number > *shell_matrix)
This function enables the user to provide a shell matrix, i.e.
This is the EquationSystems class.
ShellMatrix< Number > * _shell_matrix
User supplies shell matrix or NULL if no shell matrix is used.
unsigned int _n_linear_iterations
The number of linear iterations required to solve the linear system Ax=b.
Set dofs outside the subset to zero.
This class provides a specific system class.
LinearImplicitSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
const class libmesh_nullptr_t libmesh_nullptr
SubsetSolveMode _subset_solve_mode
If restrict-solve-to-subset mode is active, this member decides what happens with the dofs outside th...
The libMesh namespace provides an interface to certain functionality in the library.
const std::string & name() const
Definition: system.h:1998
virtual void clear() libmesh_override
Clear all the data structures associated with the system.
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual void assembly(bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) libmesh_override
Assembles a residual in rhs and/or a jacobian in matrix, as requested.
virtual LinearSolver< Number > * get_linear_solver() const libmesh_override
virtual void assemble() libmesh_override
Prepares matrix and _dof_map for matrix assembly.
virtual void reinit() libmesh_override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
This is a base class for classes which represent subsets of the dofs of a System. ...
Definition: system_subset.h:42
ImplicitSystem Parent
The type of the parent.
virtual void restrict_solve_to(const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) libmesh_override
After calling this method, any solve will be limited to the given subset.
Real _final_linear_residual
The final residual for the linear system Ax=b.
virtual void init_data() libmesh_override
Initializes new data members of the system.
LinearImplicitSystem sys_type
The type of system.
virtual void release_linear_solver(LinearSolver< Number > *) const libmesh_override
Releases a pointer to a linear solver acquired by this->get_linear_solver()
UniquePtr< LinearSolver< Number > > linear_solver
The LinearSolver defines the interface used to solve the linear_implicit system.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int number() const
Definition: system.h:2006
void detach_shell_matrix()
Detaches a shell matrix.
SubsetSolveMode
defines an enum for the question what happens to the dofs outside the given subset when a system is s...
const SystemSubset * _subset
The current subset on which to solve (or NULL if none).
virtual void assemble() libmesh_override
Prepares matrix and rhs for system assembly, then calls user assembly function.
virtual void solve() libmesh_override
Assembles & solves the linear system A*x=b.
virtual ~LinearImplicitSystem()
Destructor.
This class provides a specific system class.