bicgstabFabric.hh

Go to the documentation of this file.
1 
6 #ifndef BiCGStabfabric_hh
7 #define BiCGStabfabric_hh
8 
9 #if __GNUC__ == 2
10 # include <float.h>
11 # define EPS DBL_EPSILON
12 #else
13 # include <limits>
14 # define EPS std::numeric_limits<double>::epsilon()
15 #endif
16 #include "bicgstab.hh"
17 #include "solverFabric.hh"
18 
19 namespace concepts {
20 
21  // ************************************************************** BiCGStabFabric **
22 
26  template<typename F, typename G = F>
27  class BiCGStabFabric : public PrecondSolverFabric<F,G> {
28  public:
36  int maxit = 0, bool relres = false, bool throwing = true)
37  : maxeps_(maxeps), maxit_(maxit), relres_(relres),
38  throwing_(throwing) {}
39  virtual Operator<F>* operator()() {
40  return NULL;
41  }
42  virtual Operator<F>* operator()(Operator<F>& matrix) {
43  return new BiCGStab<F>(matrix, maxeps_, maxit_, relres_, throwing_);
44  }
45  virtual Operator<F>* operator()(Operator<F>& matrix, Operator<G>& precond)
46  {
47  return new BiCGStab<F>(matrix, precond, maxeps_, maxit_, relres_,
48  throwing_);
49  }
50  protected:
51  virtual std::ostream& info(std::ostream& os) const {
52  return os << concepts::typeOf(*this) << "(maxeps = " << maxeps_ << ", maxit = "
53  << maxit_ << ", relres = " << relres_ << ')';
54  }
55  private:
59  int maxit_;
61  bool relres_;
65  bool throwing_;
66  };
67 
68 } // concepts
69 
70 #endif // BiCGStabfabric_hh
Abstract fabric class for linear solvers with preconditoner.
Definition: solverFabric.hh:46
virtual Operator< F > * operator()(Operator< F > &matrix)
Solves a symmetric system of linear equations with BiConjugate Gradient Stabilized (BICGSTAB).
Definition: bicgstab.hh:34
Real maxeps_
Convergence criteria for the solver.
Fabric class for conjugate gradients: BiCGStab.
virtual Operator< F > * operator()(Operator< F > &matrix, Operator< G > &precond)
Abstract class for an operator.
Definition: ARPACK.hh:16
bool relres_
Convergence criteria for the solver.
#define EPS
int maxit_
Convergence criteria for the solver.
virtual std::ostream & info(std::ostream &os) const
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
virtual Operator< F > * operator()()
Creates a linear solver from matrix.
BiCGStabFabric(Real maxeps=EPS, int maxit=0, bool relres=false, bool throwing=true)
Constructor.
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
bool throwing_
false: best solution is given, when non converging true: exception is thrown, when non converging
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich