16 #ifndef dealii_solver_selector_h 17 #define dealii_solver_selector_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/smartpointer.h> 22 #include <deal.II/lac/solver.h> 23 #include <deal.II/lac/vector.h> 24 #include <deal.II/lac/vector_memory.h> 25 #include <deal.II/lac/solver_control.h> 26 #include <deal.II/lac/solver_cg.h> 27 #include <deal.II/lac/solver_bicgstab.h> 28 #include <deal.II/lac/solver_gmres.h> 29 #include <deal.II/lac/solver_minres.h> 30 #include <deal.II/lac/vector_memory.h> 31 #include <deal.II/lac/solver_richardson.h> 32 #include <deal.II/lac/precondition.h> 34 DEAL_II_NAMESPACE_OPEN
97 template <
typename VectorType = Vector<
double> >
121 template <
class Matrix,
class Preconditioner>
122 void solve (
const Matrix &A,
125 const Preconditioner &precond)
const;
131 void select(
const std::string &name);
142 ::AdditionalData &data);
148 ::AdditionalData &data);
154 ::AdditionalData &data);
160 ::AdditionalData &data);
166 ::AdditionalData &data);
172 ::AdditionalData &data);
192 std::string, <<
"Solver " << arg1 <<
" does not exist. Use one of " 245 template <
typename VectorType>
250 template <
typename VectorType>
258 template <
typename VectorType>
259 template <
class Matrix,
class Preconditioner>
264 const Preconditioner &precond)
const 266 if (solver_name==
"richardson")
269 solver.
solve(A,x,b,precond);
271 else if (solver_name==
"cg")
274 solver.
solve(A,x,b,precond);
276 else if (solver_name==
"minres")
279 solver.
solve(A,x,b,precond);
281 else if (solver_name==
"bicgstab")
284 solver.
solve(A,x,b,precond);
286 else if (solver_name==
"gmres")
289 solver.
solve(A,x,b,precond);
291 else if (solver_name==
"fgmres")
294 solver.
solve(A,x,b,precond);
297 Assert(
false,ExcSolverDoesNotExist(solver_name));
301 template <
typename VectorType>
308 template <
typename VectorType>
311 return "richardson|cg|bicgstab|gmres|fgmres|minres";
315 template <
typename VectorType>
323 template <
typename VectorType>
331 template <
typename VectorType>
335 richardson_data=data;
339 template <
typename VectorType>
347 template <
typename VectorType>
355 template <
typename VectorType>
363 DEAL_II_NAMESPACE_CLOSE
void set_control(SolverControl &ctrl)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
SolverCG< VectorType >::AdditionalData cg_data
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
void solve(const Matrix &A, VectorType &x, const VectorType &b, const Preconditioner &precond) const
static ::ExceptionBase & ExcSolverDoesNotExist(std::string arg1)
SolverBicgstab< VectorType >::AdditionalData bicgstab_data
void set_data(const typename SolverRichardson< VectorType > ::AdditionalData &data)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
static std::string get_solver_names()
SolverGMRES< VectorType >::AdditionalData gmres_data
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
SolverRichardson< VectorType >::AdditionalData richardson_data
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
void select(const std::string &name)
SolverFGMRES< VectorType >::AdditionalData fgmres_data
SolverMinRes< VectorType >::AdditionalData minres_data
SmartPointer< SolverControl, SolverSelector< VectorType > > control