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>
255 template <
typename VectorType>
263 template <
typename VectorType>
264 template<
class Matrix,
class Preconditioner>
269 const Preconditioner &precond)
const 271 if (solver_name==
"richardson")
274 solver.
solve(A,x,b,precond);
276 else if (solver_name==
"cg")
279 solver.
solve(A,x,b,precond);
281 else if (solver_name==
"minres")
284 solver.
solve(A,x,b,precond);
286 else if (solver_name==
"bicgstab")
289 solver.
solve(A,x,b,precond);
291 else if (solver_name==
"gmres")
294 solver.
solve(A,x,b,precond);
296 else if (solver_name==
"fgmres")
299 solver.
solve(A,x,b,precond);
302 Assert(
false,ExcSolverDoesNotExist(solver_name));
306 template <
typename VectorType>
313 template <
typename VectorType>
316 return "richardson|cg|bicgstab|gmres|fgmres|minres";
320 template <
typename VectorType>
328 template <
typename VectorType>
336 template <
typename VectorType>
340 richardson_data=data;
344 template <
typename VectorType>
352 template <
typename VectorType>
360 template <
typename VectorType>
368 DEAL_II_NAMESPACE_CLOSE
void set_control(SolverControl &ctrl)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &precondition)
SolverCG< VectorType >::AdditionalData cg_data
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 &precondition)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &precondition)
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 &precondition)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &precondition)
void select(const std::string &name)
SolverFGMRES< VectorType >::AdditionalData fgmres_data
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &precondition)
SolverMinRes< VectorType >::AdditionalData minres_data
SmartPointer< SolverControl, SolverSelector< VectorType > > control