MBSim |
Project Page |
00001 /* Copyright (C) 2004-2012 MBSim Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 * Contact: martin.o.foerg@googlemail.com 00018 */ 00019 00020 #ifndef NUMERICS_MULTI_DIMENSIONAL_FIXPOINT_SOLVER_H_ 00021 #define NUMERICS_MULTI_DIMENSIONAL_FIXPOINT_SOLVER_H_ 00022 00023 #include <fmatvec/fmatvec.h> 00024 00025 #include <mbsim/numerics/functions/criteria_functions.h> 00026 00027 namespace MBSim { 00028 00034 class MultiDimensionalFixpointSolver { 00035 public: 00039 MultiDimensionalFixpointSolver(); 00040 00041 /* 00042 * \brief constructor 00043 * \param fct pointer to used fix-point-function 00044 */ 00045 MultiDimensionalFixpointSolver(Function1<fmatvec::Vec, fmatvec::Vec> *function_); 00046 00047 virtual ~MultiDimensionalFixpointSolver(){}; 00048 00049 /* GETTER / SETTER */ 00056 void setFunction(Function1<fmatvec::Vec, fmatvec::Vec> *function_) {function = function_;} 00057 int getInfo() { 00058 return info; 00059 } 00060 std::vector<double> getNorms() { 00061 return norms; 00062 } 00063 double getNumberOfIterations() { 00064 return iter; 00065 } 00066 double getNumberOfMaximalIterations() { 00067 return itermax; 00068 } 00069 void setNumberOfMaximalIterations(int itermax_) { 00070 itermax = itermax_; 00071 } 00072 void setCriteriaFunction(CriteriaFunction * criteria_) { 00073 criteria = criteria_; 00074 } 00075 /*******************/ 00076 00077 fmatvec::Vec solve(const fmatvec::Vec &initialGuess); 00078 00079 private: 00083 Function1<fmatvec::Vec, fmatvec::Vec> *function; 00084 00085 /* 00086 * \brief criteria function 00087 * 00088 * This function defines the criteria when to stop the fixpoint iteration 00089 */ 00090 CriteriaFunction *criteria; 00091 00095 int iter; 00096 00100 double itermax; 00101 00105 std::vector<double> norms; 00106 00110 int info; 00111 }; 00112 00113 } /* namespace MBSim */ 00114 #endif /* MULTI_DIMENSIONAL_FIXPOINT_SOLVER_H_ */
1.8.0