UncoupledConstraintCorrection.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                               SOFA :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
00024 ******************************************************************************/
00025 #ifndef SOFA_COMPONENT_CONSTRAINT_UNCOUPLEDCONSTRAINTCORRECTION_H
00026 #define SOFA_COMPONENT_CONSTRAINT_UNCOUPLEDCONSTRAINTCORRECTION_H
00027 
00028 #include <sofa/core/componentmodel/behavior/BaseConstraintCorrection.h>
00029 #include <sofa/core/componentmodel/behavior/MechanicalState.h>
00030 
00031 
00032 namespace sofa
00033 {
00034 
00035 namespace component
00036 {
00037 
00038 namespace constraint
00039 {
00040 
00041 using namespace sofa::core;
00042 using namespace sofa::core::componentmodel;
00046 template<class TDataTypes>
00047 class UncoupledConstraintCorrection : public componentmodel::behavior::BaseConstraintCorrection
00048 {
00049 public:
00050     typedef TDataTypes DataTypes;
00051     typedef typename DataTypes::VecCoord VecCoord;
00052     typedef typename DataTypes::VecDeriv VecDeriv;
00053     typedef typename DataTypes::VecConst VecConst;
00054     typedef typename DataTypes::Coord Coord;
00055     typedef typename DataTypes::Deriv Deriv;
00056 
00057     UncoupledConstraintCorrection(behavior::MechanicalState<DataTypes> *mm = NULL);
00058 
00059     virtual ~UncoupledConstraintCorrection();
00060 
00061     virtual void init();
00062 
00064     behavior::MechanicalState<DataTypes>* getMState() { return mstate; }
00065 
00066     virtual void getCompliance(defaulttype::BaseMatrix *W);
00067 
00068     virtual void applyContactForce(const defaulttype::BaseVector *f);
00069 
00070     virtual void resetContactForce();
00071 
00074     template<class T>
00075     static bool canCreate(T*& obj, objectmodel::BaseContext* context, objectmodel::BaseObjectDescription* arg)
00076     {
00077         if (dynamic_cast<behavior::MechanicalState<DataTypes>*>(context->getMechanicalState()) == NULL)
00078             return false;
00079         return BaseObject::canCreate(obj, context, arg);
00080     }
00081 
00082     virtual std::string getTemplateName() const
00083     {
00084         return templateName(this);
00085     }
00086 
00087     static std::string templateName(const UncoupledConstraintCorrection<DataTypes>* = NULL)
00088     {
00089         return DataTypes::Name();
00090     }
00091 
00092 protected:
00093     behavior::MechanicalState<DataTypes> *mstate;
00094 };
00095 
00096 } // namespace collision
00097 
00098 } // namespace component
00099 
00100 } // namespace sofa
00101 
00102 #endif

Generated on Sun Nov 23 02:46:24 2008 for Sofa by  doxygen 1.5.7.1