Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

operator/cgFabric.hh
Go to the documentation of this file.
00001 // fabric class for CG
00002 
00003 #ifndef CGfabric_hh
00004 #define CGfabric_hh
00005 
00006 #if __GNUC__ == 2
00007 #  include <float.h>
00008 #  define EPS DBL_EPSILON
00009 #else
00010 #  include <limits>
00011 #  define EPS std::numeric_limits<double>::epsilon()
00012 #endif
00013 #include "cg.hh"
00014 #include "solverFabric.hh"
00015 
00016 namespace concepts {
00017 
00018   // ************************************************************** CGFabric **
00019 
00023   template<typename F>
00024   class CGFabric : public SolverFabric<F> {
00025   public:
00033     CGFabric(Real maxeps = EPS, int maxit = 0, bool relres = false,
00034        bool throwing = true)
00035       : maxeps_(maxeps), maxit_(maxit), relres_(relres), throwing_(throwing) {}
00036     virtual Operator<F>* operator()(Operator<F>& matrix) {
00037       return new CG<F>(matrix, maxeps_, maxit_, relres_, throwing_);
00038     }
00039   protected:
00040     virtual std::ostream& info(std::ostream& os) const {
00041       return os << "CGFabric(maxeps = " << maxeps_ << ", maxit = "
00042     << maxit_ << ", relres = " << relres_ << ')';
00043     }
00044   private:
00046     Real maxeps_;
00048     int maxit_;
00050     bool relres_;
00054     bool throwing_;
00055   };
00056 
00057 } // concepts
00058 
00059 #endif // CGfabric_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)