MechanicalState.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 :: Framework                              *
00020 *                                                                             *
00021 * Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
00022 * H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
00023 * M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
00024 *                                                                             *
00025 * Contact information: contact@sofa-framework.org                             *
00026 ******************************************************************************/
00027 #ifndef SOFA_CORE_COMPONENTMODEL_BEHAVIOR_MECHANICALSTATE_H
00028 #define SOFA_CORE_COMPONENTMODEL_BEHAVIOR_MECHANICALSTATE_H
00029 
00030 #include <sofa/core/componentmodel/behavior/BaseMechanicalState.h>
00031 #include <sofa/core/componentmodel/behavior/State.h>
00032 
00033 namespace sofa
00034 {
00035 
00036 namespace core
00037 {
00038 
00039 namespace componentmodel
00040 {
00041 
00042 namespace behavior
00043 {
00044 
00068 template<class TDataTypes>
00069 class MechanicalState : public BaseMechanicalState, public State<TDataTypes>
00070 {
00071 public:
00072     typedef TDataTypes DataTypes;
00074     typedef typename DataTypes::Real Real;
00076     typedef typename DataTypes::Coord Coord;
00078     typedef typename DataTypes::Deriv Deriv;
00080     typedef typename DataTypes::VecReal VecReal;
00082     typedef typename DataTypes::VecCoord VecCoord;
00084     typedef typename DataTypes::VecDeriv VecDeriv;
00086     typedef typename DataTypes::SparseDeriv SparseDeriv;
00088     typedef typename DataTypes::SparseVecDeriv SparseVecDeriv;
00090     typedef typename DataTypes::VecConst VecConst;
00091 
00092     virtual ~MechanicalState() { }
00093 
00095     virtual VecDeriv* getVfree() = 0;
00097     virtual VecDeriv* getV() = 0;
00099     virtual VecDeriv* getF() = 0;
00101     virtual VecDeriv* getExternalForces() = 0;
00103     virtual VecDeriv* getDx() = 0;
00105     virtual VecConst* getC() = 0;
00107     virtual VecCoord* getXfree() = 0;
00109     virtual VecCoord* getX() = 0;
00111     virtual VecCoord* getX0() = 0; 
00112 
00114     virtual const VecCoord* getX()  const = 0;
00116     virtual const VecDeriv* getV()  const = 0;
00118     virtual const VecDeriv* getF()  const = 0;
00120     virtual const VecDeriv* getExternalForces() const = 0;
00122     virtual const VecDeriv* getDx() const = 0;
00124     virtual const VecConst* getC() const = 0;
00126     virtual const VecCoord* getXfree()  const = 0;
00128     virtual const VecDeriv* getVfree() const = 0;
00130     virtual const VecCoord* getX0()  const = 0; 
00132     virtual const VecDeriv* getV0()  const = 0;
00133 
00135     virtual VecCoord* getVecCoord(unsigned int index) = 0;
00136 
00138     virtual const VecCoord* getVecCoord(unsigned int index) const = 0;
00139 
00141     virtual VecDeriv* getVecDeriv(unsigned int index) = 0;
00142 
00144     virtual const VecDeriv* getVecDeriv(unsigned int index) const = 0;
00145 
00147     virtual VecConst* getVecConst(unsigned int index) = 0;
00148 
00150     virtual const VecConst* getVecConst(unsigned int index) const = 0;
00151 
00152 
00154     virtual void getIndicesInSpace(sofa::helper::vector<unsigned>& /*indices*/, Real /*xmin*/, Real /*xmax*/,Real /*ymin*/, Real /*ymax*/, Real /*zmin*/, Real /*zmax*/) const=0;
00155 
00157     virtual void setConstraintId(unsigned int ) = 0;
00159     virtual sofa::helper::vector<unsigned int>& getConstraintId() = 0;
00160     
00161     
00162     virtual std::string getTemplateName() const
00163     {
00164       return templateName(this);
00165     }
00166 
00167     static std::string templateName(const MechanicalState<DataTypes>* = NULL)
00168     {
00169       return DataTypes::Name();
00170     }
00171 
00172     static std::string Name(const State<DataTypes>* = NULL)
00173     {
00174       return std::string("MechanicalState");
00175     }
00176 
00177 };
00178 
00179 } // namespace behavior
00180 
00181 } // namespace componentmodel
00182 
00183 } // namespace core
00184 
00185 } // namespace sofa
00186 
00187 #endif

Generated on Sun Nov 23 02:29:10 2008 for Sofa by  doxygen 1.5.7.1