00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: ConjugateGradientOptions.hpp,v 1.3 2007/06/09 10:37:09 delpinux Exp $ 00019 00020 #ifndef _CONJUGATE_GRADIENT_OPTIONS_HPP_ 00021 #define _CONJUGATE_GRADIENT_OPTIONS_HPP_ 00022 00023 #include <ParametrizableObject.hpp> 00024 00025 class ConjugateGradientOptions 00026 : public ParametrizableObject 00027 { 00028 private: 00029 std::ostream& put(std::ostream& os) const 00030 { 00031 os << this->identifier(); 00032 return os; 00033 } 00034 00035 public: 00036 static const char* identifier() 00037 { 00038 // autodoc: "specifies conjugate gradient options" 00039 return "cg"; 00040 } 00041 00042 real_t epsilon() 00043 { 00044 real_t eps = 0; 00045 get("epsilon",eps); 00046 return eps; 00047 } 00048 00049 int maxiter() 00050 { 00051 int maxiter = 0; 00052 get("maxiter",maxiter); 00053 return maxiter; 00054 } 00055 00056 explicit ConjugateGradientOptions() 00057 { 00058 // autodoc: "sets maximum number of iteration" 00059 add(new IntegerParameter(500, "maxiter")); 00060 // autodoc: "sets the required reduction factor of the residu" 00061 add(new DoubleParameter (1E-5,"epsilon")); 00062 } 00063 00064 ~ConjugateGradientOptions() 00065 { 00066 ; 00067 } 00068 }; 00069 #endif // _CONJUGATE_GRADIENT_OPTIONS_HPP_ 00070
1.5.6