Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_FORCE_CUSTOM_H_ 00002 #define SimTK_SIMBODY_FORCE_CUSTOM_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 00036 namespace SimTK { 00037 00193 class SimTK_SIMBODY_EXPORT Force::Custom : public Force { 00194 public: 00195 class Implementation; 00204 Custom(GeneralForceSubsystem& forces, Implementation* implementation); 00205 00207 Custom() {} 00208 // don't let Doxygen see this 00210 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Custom, CustomImpl, Force); 00212 protected: 00213 const Implementation& getImplementation() const; 00214 Implementation& updImplementation(); 00215 }; 00216 00221 class SimTK_SIMBODY_EXPORT Force::Custom::Implementation { 00222 public: 00223 virtual ~Implementation() { } 00235 virtual void calcForce(const State& state, Vector_<SpatialVec>& bodyForces, Vector_<Vec3>& particleForces, Vector& mobilityForces) const = 0; 00241 virtual Real calcPotentialEnergy(const State& state) const = 0; 00247 virtual bool dependsOnlyOnPositions() const { 00248 return false; 00249 } 00253 virtual void realizeTopology(State& state) const {} 00254 virtual void realizeModel(State& state) const {} 00255 virtual void realizeInstance(const State& state) const {} 00256 virtual void realizeTime(const State& state) const {} 00257 virtual void realizePosition(const State& state) const {} 00258 virtual void realizeVelocity(const State& state) const {} 00259 virtual void realizeDynamics(const State& state) const {} 00260 virtual void realizeAcceleration(const State& state) const {} 00261 virtual void realizeReport(const State& state) const {} 00263 00266 virtual void calcDecorativeGeometryAndAppend 00267 (const State& state, Stage stage, 00268 Array_<DecorativeGeometry>& geometry) const {} 00269 00270 }; 00271 00272 } // namespace SimTK 00273 00274 #endif // SimTK_SIMBODY_FORCE_CUSTOM_H_