Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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_
This is the base class from which all Force element handle classes derive.
Definition: Force.h:50
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Custom()
Default constructor creates an empty handle.
Definition: Force_Custom.h:207
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:50
virtual bool dependsOnlyOnPositions() const
Get whether this force depends only on the position variables (q), not on the velocies (u) or auxilia...
Definition: Force_Custom.h:247
The SimTK::Array_ container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:577
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:276
virtual void realizePosition(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:257
virtual void realizeDynamics(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:259
This class is used to define new force elements.
Definition: Force_Custom.h:193
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
virtual void realizeTopology(State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:253
virtual void realizeTime(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:256
virtual void realizeReport(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:261
This is the vector class intended to appear in user code for large, variable size column vectors...
Definition: BigMatrix.h:171
virtual void realizeVelocity(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:258
virtual ~Implementation()
Definition: Force_Custom.h:223
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem.
Definition: GeneralForceSubsystem.h:47
virtual void realizeAcceleration(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:260
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
virtual void realizeInstance(const State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:255
virtual void realizeModel(State &state) const
The following methods may optionally be overridden to do specialized realization for a Force...
Definition: Force_Custom.h:254
Every custom force requires implementation of a class that is derived from this abstract class...
Definition: Force_Custom.h:221