Simbody  3.4 (development)
Force_MobilityLinearSpring.h
Go to the documentation of this file.
00001 #ifndef SimTK_SIMBODY_FORCE_MOBILITY_LINEAR_SPRING_H_
00002 #define SimTK_SIMBODY_FORCE_MOBILITY_LINEAR_SPRING_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                               Simbody(tm)                                  *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK biosimulation toolkit originating from           *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
00011  *                                                                            *
00012  * Portions copyright (c) 2008-13 Stanford University and the Authors.        *
00013  * Authors: Peter Eastman, Michael Sherman                                    *
00014  * Contributors:                                                              *
00015  *                                                                            *
00016  * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
00017  * not use this file except in compliance with the License. You may obtain a  *
00018  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
00019  *                                                                            *
00020  * Unless required by applicable law or agreed to in writing, software        *
00021  * distributed under the License is distributed on an "AS IS" BASIS,          *
00022  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
00023  * See the License for the specific language governing permissions and        *
00024  * limitations under the License.                                             *
00025  * -------------------------------------------------------------------------- */
00026 
00027 #include "SimTKcommon.h"
00028 #include "simbody/internal/Force.h"
00029 
00035 namespace SimTK {
00036 
00049 class SimTK_SIMBODY_EXPORT Force::MobilityLinearSpring : public Force {
00050 public:
00066     MobilityLinearSpring(GeneralForceSubsystem& forces, 
00067                          const MobilizedBody&   mobod, 
00068                          MobilizerQIndex        whichQ, 
00069                          Real                   defaultStiffness, 
00070                          Real                   defaultQZero);
00071     
00074     MobilityLinearSpring() {}
00075 
00088     MobilityLinearSpring& setDefaultStiffness(Real defaultStiffness);
00089 
00090 
00104     MobilityLinearSpring& setDefaultQZero(Real defaultQZero);
00105 
00109     Real getDefaultStiffness() const;
00113     Real getDefaultQZero() const;
00114 
00128     const MobilityLinearSpring& setStiffness(State&     state, 
00129                                              Real       stiffness) const;
00130 
00145     const MobilityLinearSpring& setQZero(State&     state, 
00146                                          Real       qZero) const;
00147 
00152     Real getStiffness(const State& state) const;
00153 
00158     Real getQZero(const State& state) const;
00159 
00167     MobilityLinearSpring(GeneralForceSubsystem& forces, 
00168                          const MobilizedBody&   mobod, 
00169                          int                    whichQ, 
00170                          Real                   defaultStiffness, 
00171                          Real                   defaultQZero)
00172     {   // Invoke the other constructor.
00173         new(this) MobilityLinearSpring(forces, mobod, MobilizerQIndex(whichQ),
00174                                        defaultStiffness, defaultQZero);
00175     }
00179     SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(MobilityLinearSpring, 
00180                                              MobilityLinearSpringImpl, Force);
00182 };
00183 
00184 } // namespace SimTK
00185 
00186 #endif // SimTK_SIMBODY_FORCE_MOBILITY_LINEAR_SPRING_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines