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 <mbsim/utils/function.h>
00024 
00025 #include <fmatvec/fmatvec.h>
00026 
00027 namespace MBSim {
00028 
00032   class NewtonJacobianFunction : public Function1<fmatvec::SqrMat, fmatvec::Vec> {
00033     public:
00037     NewtonJacobianFunction();
00038 
00039     /*
00040      * \brief destructor
00041      */
00042     virtual ~NewtonJacobianFunction() {
00043     }
00044 
00045     /* GETTER / SETTER*/
00046     virtual void setFunction(Function1<fmatvec::Vec, fmatvec::Vec> * function_) {
00047       function = function_;
00048     }
00049     /*****************/
00050 
00051     /*INHERITED INTERFACE*/
00052     virtual fmatvec::SqrMat operator ()(const fmatvec::Vec & x, const void* = NULL) = 0;
00053     /*********************/
00054 
00055     protected:
00056     Function1<fmatvec::Vec, fmatvec::Vec> * function;
00057   };
00058 
00062   class NumericalNewtonJacobianFunction : public NewtonJacobianFunction {
00063     public:
00067       NumericalNewtonJacobianFunction();
00068 
00069       /*
00070        * \brief destructor
00071        */
00072       virtual ~NumericalNewtonJacobianFunction() {
00073       }
00074 
00075       /*INHERITED INTERFACE*/
00076       virtual fmatvec::SqrMat operator ()(const fmatvec::Vec & x, const void* = NULL);
00077 
00078 
00079   };
00080 
00086   class ConstantNewtonJacobianFunction : public NewtonJacobianFunction {
00087     public:
00091       ConstantNewtonJacobianFunction();
00092 
00093       /*
00094        * \brief destructor
00095        */
00096       virtual ~ConstantNewtonJacobianFunction() {
00097       }
00098 
00099       /*INHERITED INTERFACE*/
00100       virtual fmatvec::SqrMat operator ()(const fmatvec::Vec & x, Function1<fmatvec::Vec, fmatvec::Vec> * function);
00101 
00102   };
00103 
00109   class FixpointNewtonJacobianFunction : public NewtonJacobianFunction {
00110     public:
00114       FixpointNewtonJacobianFunction();
00115 
00116       /*
00117        * \brief destructor
00118        */
00119       virtual ~FixpointNewtonJacobianFunction() {
00120       }
00121 
00122       /*INHERITED INTERFACE*/
00123       virtual fmatvec::SqrMat operator ()(const fmatvec::Vec & x, Function1<fmatvec::Vec, fmatvec::Vec> * function);
00124   };
00125 }
00126 #endif // NUMERICSNEWTONMEHTODFUNCTION_H_