Force_Gravity.h

Go to the documentation of this file.
00001 #ifndef SimTK_SIMBODY_FORCE_GRAVITY_H_
00002 #define SimTK_SIMBODY_FORCE_GRAVITY_H_
00003 /* -------------------------------------------------------------------------- *
00004  *                      SimTK Core: SimTK Simbody(tm)                         *
00005  * -------------------------------------------------------------------------- *
00006  * This is part of the SimTK Core biosimulation toolkit originating from      *
00007  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00008  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00009  * Medical Research, grant U54 GM072970. See https://simtk.org.               *
00010  *                                                                            *
00011  * Portions copyright (c) 2010 Stanford University and the Authors.           *
00012  * Authors: Michael Sherman                                                   *
00013  * Contributors:                                                              *
00014  *                                                                            *
00015  * Permission is hereby granted, free of charge, to any person obtaining a    *
00016  * copy of this software and associated documentation files (the "Software"), *
00017  * to deal in the Software without restriction, including without limitation  *
00018  * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
00019  * and/or sell copies of the Software, and to permit persons to whom the      *
00020  * Software is furnished to do so, subject to the following conditions:       *
00021  *                                                                            *
00022  * The above copyright notice and this permission notice shall be included in *
00023  * all copies or substantial portions of the Software.                        *
00024  *                                                                            *
00025  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
00026  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
00027  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
00028  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
00029  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
00030  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
00031  * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
00032  * -------------------------------------------------------------------------- */
00033 
00034 #include "SimTKcommon.h"
00035 #include "simbody/internal/Force.h"
00036 
00042 namespace SimTK {
00043 
00069 class SimTK_SIMBODY_EXPORT Force::Gravity : public Force {
00070 public:
00071 
00072 
00073 //------------------------------------------------------------------------------
00086 
00107 Gravity(GeneralForceSubsystem&          forces, 
00108         const SimbodyMatterSubsystem&   matter,
00109         const Vec3&                     gravity);
00110 
00142 Gravity(GeneralForceSubsystem&          forces, 
00143         const SimbodyMatterSubsystem&   matter,
00144         const UnitVec3&                 down,
00145         Real                            g,
00146         Real                            zeroHeight = 0);
00147 
00160 Gravity& setDefaultGravityVector(const Vec3& gravity);
00161 
00170 Gravity& setDefaultDownDirection(const UnitVec3& down);
00171 
00182 Gravity& setDefaultMagnitude(Real g);
00183 
00192 Gravity& setDefaultZeroHeight(Real zeroHeight);
00193 
00196 Vec3 getDefaultGravityVector() const;
00199 const UnitVec3& getDefaultDownDirection() const;
00201 Real getDefaultMagnitude() const;
00204 Real getDefaultZeroHeight() const;
00205 
00210 //------------------------------------------------------------------------------
00226 
00240 const Gravity& setGravityVector(State& state, const Vec3& gravity) const;
00241 
00253 const Gravity& setDownDirection(State&           state,
00254                                 const UnitVec3&  down) const;
00264 const Gravity& setMagnitude(State& state, Real g) const;
00275 const Gravity& setZeroHeight(State& state, Real hz) const;
00276 
00285 Vec3 getGravityVector(const State& state) const;
00293 const UnitVec3& getDownDirection(const State& state) const;
00301 Real getMagnitude(const State& state) const;
00310 Real getZeroHeight(const State& state) const;
00311 
00316 //------------------------------------------------------------------------------
00325 
00336 Real getPotentialEnergy(const State& state) const;
00345 const SpatialVec& 
00346     getBodyForce(const State& state, MobilizedBodyIndex mobod) const;
00347 
00348 // Particles aren't supported yet so don't show this in Doxygen.
00356 const Vec3& 
00357     getParticleForce(const State& state, ParticleIndex particle) const;
00360 
00362 // Don't show this in Doxygen.
00364 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Gravity, GravityImpl, Force);
00366 };
00367 
00368 } // namespace SimTK
00369 
00370 #endif // SimTK_SIMBODY_FORCE_GRAVITY_H_

Generated on Thu Aug 12 16:37:06 2010 for SimTKcore by  doxygen 1.6.1