Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_FORCE_DISCRETE_FORCES_H_ 00002 #define SimTK_SIMBODY_FORCE_DISCRETE_FORCES_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) 2013 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/Force.h" 00029 00035 namespace SimTK { 00036 00041 class SimTK_SIMBODY_EXPORT Force::DiscreteForces : public Force { 00042 public: 00049 DiscreteForces(GeneralForceSubsystem& forces, 00050 const SimbodyMatterSubsystem& matter); 00051 00052 00054 DiscreteForces() {} 00055 00058 void clearAllForces(State& state) const { 00059 clearAllMobilityForces(state); 00060 clearAllBodyForces(state); 00061 } 00062 00065 void clearAllMobilityForces(State& state) const; 00068 void clearAllBodyForces(State& state) const; 00069 00082 void setOneMobilityForce(State& state, const MobilizedBody& mobod, 00083 MobilizerUIndex whichU, Real force) const; 00084 00099 void setOneBodyForce(State& state, const MobilizedBody& mobod, 00100 const SpatialVec& spatialForceInG) const; 00101 00120 void addForceToBodyPoint(State& state, const MobilizedBody& mobod, 00121 const Vec3& pointInB, 00122 const Vec3& forceInG) const; 00123 00132 void setAllMobilityForces(State& state, const Vector& f) const; 00133 00144 void setAllBodyForces(State& state, 00145 const Vector_<SpatialVec>& bodyForcesInG) const; 00146 00151 Real getOneMobilityForce(const State& state, const MobilizedBody& mobod, 00152 MobilizerUIndex whichU) const; 00153 00158 SpatialVec getOneBodyForce(const State& state, 00159 const MobilizedBody& mobod) const; 00160 00166 const Vector& getAllMobilityForces(const State& state) const; 00172 const Vector_<SpatialVec>& getAllBodyForces(const State& state) const; 00173 00175 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DiscreteForces, 00176 DiscreteForcesImpl, Force); 00178 }; 00179 00180 } // namespace SimTK 00181 00182 #endif // SimTK_SIMBODY_FORCE_DISCRETE_FORCES_H_