20#ifndef LIBMESH_PRECONDITIONER_H
21#define LIBMESH_PRECONDITIONER_H
25#include "libmesh/libmesh_common.h"
26#include "libmesh/reference_counted_object.h"
27#include "libmesh/libmesh.h"
28#include "libmesh/parallel_object.h"
37template <
typename T>
class SparseMatrix;
38template <
typename T>
class NumericVector;
39template <
typename T>
class ShellMatrix;
76 static std::unique_ptr<Preconditioner<T>>
167 _is_initialized =
false;
176 _is_initialized =
false;
177 _preconditioner_type = pct;
void ErrorVector unsigned int
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
An object whose state is distributed along a set of processors.
const Parallel::Communicator & comm() const
This class provides a uniform interface for preconditioners.
void set_type(const PreconditionerType pct)
Sets the type of preconditioner to use.
bool _is_initialized
Flag indicating if the data structures have been initialized.
void set_matrix(SparseMatrix< Number > &mat)
Sets the matrix to be preconditioned.
PreconditionerType _preconditioner_type
Enum stating with type of preconditioner to use.
virtual void apply(const NumericVector< T > &x, NumericVector< T > &y)=0
Computes the preconditioned vector y based on input vector x.
virtual void init()
Initialize data structures if not done so already.
PreconditionerType type() const
virtual ~Preconditioner()
Destructor.
virtual bool initialized() const
virtual void setup()
This is called every time the "operator might have changed".
virtual void zero()
Can be used to zero items relevant to the preconditioner.
SparseMatrix< T > * _matrix
The matrix P... ie the matrix to be preconditioned.
virtual void clear()
Release all memory and clear data structures.
static std::unique_ptr< Preconditioner< T > > build_preconditioner(const libMesh::Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a Preconditioner using the linear solver package specified by solver_package,...
This class implements reference counting.
The libMesh namespace provides an interface to certain functionality in the library.
SolverPackage default_solver_package()
SolverPackage
Defines an enum for various linear solver packages.
PreconditionerType
Defines an enum for preconditioner types.