MBSim

Project Page
newton_method_jacobian_functions.h
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 NUMERICSNEWTONMEHTODFUNCTION_H_
00021 #define NUMERICSNEWTONMEHTODFUNCTION_H_
00022 
00023 #include <fmatvec/fmatvec.h>
00024 #include <mbsim/functions/function.h>
00025 
00026 namespace MBSim {
00027 
00031   class NewtonJacobianFunction : public Function<fmatvec::SqrMat(fmatvec::Vec)> {
00032     public:
00036     NewtonJacobianFunction();
00037 
00038     /*
00039      * \brief destructor
00040      */
00041     virtual ~NewtonJacobianFunction() {
00042     }
00043 
00044     /* GETTER / SETTER*/
00045     virtual void setFunction(Function<fmatvec::Vec(fmatvec::Vec)> * function_) {
00046       function = function_;
00047     }
00048     /*****************/
00049 
00050     /*INHERITED INTERFACE*/
00051     virtual fmatvec::SqrMat operator ()(const fmatvec::Vec &x) = 0;
00052     /*********************/
00053 
00054     protected:
00055     Function<fmatvec::Vec(fmatvec::Vec)> *function;
00056   };
00057 
00061   class NumericalNewtonJacobianFunction : public NewtonJacobianFunction {
00062     public:
00066       NumericalNewtonJacobianFunction();
00067 
00068       /*
00069        * \brief destructor
00070        */
00071       virtual ~NumericalNewtonJacobianFunction() {
00072       }
00073 
00074       /*INHERITED INTERFACE*/
00075       virtual fmatvec::SqrMat operator ()(const fmatvec::Vec &x);
00076   };
00077 
00083   class ConstantNewtonJacobianFunction : public NewtonJacobianFunction {
00084     public:
00088       ConstantNewtonJacobianFunction();
00089 
00090       /*
00091        * \brief destructor
00092        */
00093       virtual ~ConstantNewtonJacobianFunction() {
00094       }
00095 
00096       /*INHERITED INTERFACE*/
00097       virtual fmatvec::SqrMat operator ()(const fmatvec::Vec &x, Function<fmatvec::Vec(fmatvec::Vec)> *function);
00098 
00099   };
00100 
00106   class FixpointNewtonJacobianFunction : public NewtonJacobianFunction {
00107     public:
00111       FixpointNewtonJacobianFunction();
00112 
00113       /*
00114        * \brief destructor
00115        */
00116       virtual ~FixpointNewtonJacobianFunction() {
00117       }
00118 
00119       /*INHERITED INTERFACE*/
00120       virtual fmatvec::SqrMat operator ()(const fmatvec::Vec &x, Function<fmatvec::Vec(fmatvec::Vec)> *function);
00121   };
00122 }
00123 #endif // NUMERICSNEWTONMEHTODFUNCTION_H_