Simbody  3.4 (development)
CableSpring.h
Go to the documentation of this file.
00001 #ifndef SimTK_SIMBODY_CABLE_SPRING_H_
00002 #define SimTK_SIMBODY_CABLE_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) 2012-13 Stanford University and the Authors.        *
00013  * Authors: 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/common.h"
00029 #include "simbody/internal/Force.h"
00030 #include "simbody/internal/CablePath.h"
00031 
00037 namespace SimTK {
00038 
00090 class SimTK_SIMBODY_EXPORT CableSpring : public Force {
00091 public:
00092 
00115 CableSpring(GeneralForceSubsystem&  forces, 
00116             const CablePath&        path, 
00117             Real                    defaultStiffness, 
00118             Real                    defaultSlackLength, 
00119             Real                    defaultDissipationCoef);
00120 
00122 CableSpring() {}
00123 
00124 
00125 //------------------------------------------------------------------------------
00146 CableSpring& setDefaultStiffness(Real stiffness);
00152 CableSpring& setDefaultSlackLength(Real slackLength);
00158 CableSpring& setDefaultDissipationCoef(Real dissipation);
00159 
00162 Real getDefaultStiffness() const;
00165 Real getDefaultSlackLength() const;
00169 Real getDefaultDissipationCoef() const;
00174 //------------------------------------------------------------------------------
00199 const CableSpring& setStiffness(State&      state, 
00200                                 Real        stiffness) const;
00208 const CableSpring& setSlackLength(State&    state, 
00209                                   Real      slackLength) const;
00217 const CableSpring& setDissipationCoef(State&    state, 
00218                                       Real      dissipationCoef) const;
00219 
00225 Real getStiffness(const State& state) const;
00231 Real getSlackLength(const State& state) const;
00239 Real getDissipationCoef(const State& state)   const;
00244 //------------------------------------------------------------------------------
00262 Real getLength(const State& state) const;
00267 //------------------------------------------------------------------------------
00286 Real getLengthDot(const State& state) const;
00287 
00292 //------------------------------------------------------------------------------
00311 Real getTension(const State& state) const;
00316 //------------------------------------------------------------------------------
00330 Real getPotentialEnergy(const State& state) const;
00331 
00342 Real getPowerDissipation(const State& state) const;
00343 
00356 Real getDissipatedEnergy(const State& state) const;
00357 
00370 void setDissipatedEnergy(State& state, Real energy) const;
00379 const CablePath& getCablePath() const; // Don't show this in Doxygen.
00383 class Impl;
00384 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS
00385     (CableSpring, CableSpring::Impl, Force);
00387 };
00388 
00389 } // namespace SimTK
00390 
00391 #endif // SimTK_SIMBODY_CABLE_SPRING_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines