Simbody  3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Force_Custom.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_FORCE_CUSTOM_H_
2 #define SimTK_SIMBODY_FORCE_CUSTOM_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm) *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2008-13 Stanford University and the Authors. *
13  * Authors: Peter Eastman, Michael Sherman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
27 #include "SimTKcommon.h"
28 #include "simbody/internal/Force.h"
29 
36 namespace SimTK {
37 
194 public:
195  class Implementation;
204  Custom(GeneralForceSubsystem& forces, Implementation* implementation);
205 
207  Custom() {}
208  // don't let Doxygen see this
212 protected:
213  const Implementation& getImplementation() const;
214  Implementation& updImplementation();
215 };
216 
222 public:
223  virtual ~Implementation() { }
235  virtual void calcForce(const State& state, Vector_<SpatialVec>& bodyForces, Vector_<Vec3>& particleForces, Vector& mobilityForces) const = 0;
241  virtual Real calcPotentialEnergy(const State& state) const = 0;
247  virtual bool dependsOnlyOnPositions() const {
248  return false;
249  }
253  virtual void realizeTopology(State& state) const {}
254  virtual void realizeModel(State& state) const {}
255  virtual void realizeInstance(const State& state) const {}
256  virtual void realizeTime(const State& state) const {}
257  virtual void realizePosition(const State& state) const {}
258  virtual void realizeVelocity(const State& state) const {}
259  virtual void realizeDynamics(const State& state) const {}
260  virtual void realizeAcceleration(const State& state) const {}
261  virtual void realizeReport(const State& state) const {}
263 
266  virtual void calcDecorativeGeometryAndAppend
267  (const State& state, Stage stage,
268  Array_<DecorativeGeometry>& geometry) const {}
269 
270 };
271 
272 } // namespace SimTK
273 
274 #endif // SimTK_SIMBODY_FORCE_CUSTOM_H_