MBSim

Project Page
damping_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 NUMERICS_DAMPINGFUNCITONS_H_
00021 #define NUMERICS_DAMPINGFUNCITONS_H_
00022 
00023 #include <mbsim/numerics/functions/criteria_functions.h>
00024 
00025 namespace MBSim {
00026 
00027   class DampingFunction : public Function2<double, fmatvec::Vec, fmatvec::Vec> {
00028     public:
00032     DampingFunction();
00033 
00034     /*
00035      * \brief destructor
00036      */
00037     virtual ~DampingFunction() {
00038     }
00039 
00040     /* GETTER / SETTER*/
00041     void setFunction(Function1<fmatvec::Vec, fmatvec::Vec> * function_) {
00042       function = function_;
00043     }
00044     void setCriteriaFunction(CriteriaFunction * criteria_) {
00045       criteria = criteria_;
00046     }
00047     /******************/
00048 
00049     virtual double operator ()(const fmatvec::Vec & x, const fmatvec::Vec & dx, const void * = NULL) = 0;
00050 
00051     protected:
00055     Function1<fmatvec::Vec, fmatvec::Vec> *function;
00056 
00060     CriteriaFunction * criteria;
00061 
00062   };
00063 
00064   class StandardDampingFunction : public DampingFunction {
00065 
00066     public:
00070       StandardDampingFunction(unsigned int kmax_ = 300);
00071 
00072       /*
00073        * \brief destructor
00074        */
00075       virtual ~StandardDampingFunction() {
00076       }
00077 
00078       virtual double operator ()(const fmatvec::Vec & x, const fmatvec::Vec & dx, const void * = NULL);
00079 
00080     protected:
00084       unsigned int kmax;
00085   };
00086 }
00087 #endif //NUMERICS_DAMPINGFUNCITONS_H_