Simbody 3.7
Loading...
Searching...
No Matches
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"
29
36namespace SimTK {
37
194public:
195 class Implementation;
204 Custom(GeneralForceSubsystem& forces, Implementation* implementation);
205
208
// don't let Doxygen see this
212protected:
215};
216
222public:
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 }
261 virtual bool shouldBeParallelIfPossible() const {
262 return false;
263 }
267 virtual void realizeTopology(State& state) const {}
268 virtual void realizeModel(State& state) const {}
269 virtual void realizeInstance(const State& state) const {}
270 virtual void realizeTime(const State& state) const {}
271 virtual void realizePosition(const State& state) const {}
272 virtual void realizeVelocity(const State& state) const {}
273 virtual void realizeDynamics(const State& state) const {}
274 virtual void realizeAcceleration(const State& state) const {}
275 virtual void realizeReport(const State& state) const {}
277
281 (const State& state, Stage stage,
282 Array_<DecorativeGeometry>& geometry) const {}
283
284};
285
286} // namespace SimTK
287
288#endif // SimTK_SIMBODY_FORCE_CUSTOM_H_
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition PrivateImplementation.h:343
Includes internal headers providing declarations for the basic SimTK Core classes,...
#define SimTK_SIMBODY_EXPORT
Definition Simbody/include/simbody/internal/common.h:68
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition Array.h:1520
Every custom force requires implementation of a class that is derived from this abstract class....
Definition Force_Custom.h:221
virtual void calcForce(const State &state, Vector_< SpatialVec > &bodyForces, Vector_< Vec3 > &particleForces, Vector &mobilityForces) const =0
Calculate the force for a given state.
virtual void realizeModel(State &state) const
Definition Force_Custom.h:268
virtual void realizeTime(const State &state) const
Definition Force_Custom.h:270
virtual bool shouldBeParallelIfPossible() const
Returns a boolean flag telling Simbody whether this Force type should be calculated in parallel if po...
Definition Force_Custom.h:261
virtual void realizePosition(const State &state) const
Definition Force_Custom.h:271
virtual void realizeTopology(State &state) const
The following methods may optionally be overridden to do specialized realization for a Force.
Definition Force_Custom.h:267
virtual void calcDecorativeGeometryAndAppend(const State &state, Stage stage, Array_< DecorativeGeometry > &geometry) const
Override this if you want to generate some geometry for the visualizer to display.
Definition Force_Custom.h:281
virtual ~Implementation()
Definition Force_Custom.h:223
virtual void realizeInstance(const State &state) const
Definition Force_Custom.h:269
virtual void realizeAcceleration(const State &state) const
Definition Force_Custom.h:274
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
virtual void realizeReport(const State &state) const
Definition Force_Custom.h:275
virtual void realizeDynamics(const State &state) const
Definition Force_Custom.h:273
virtual Real calcPotentialEnergy(const State &state) const =0
Calculate this force's contribution to the potential energy of the System.
virtual void realizeVelocity(const State &state) const
Definition Force_Custom.h:272
This class is used to define new force elements.
Definition Force_Custom.h:193
Implementation & updImplementation()
const Implementation & getImplementation() const
Custom()
Default constructor creates an empty handle.
Definition Force_Custom.h:207
Custom(GeneralForceSubsystem &forces, Implementation *implementation)
Create a Custom force.
This is the base class from which all Force element handle classes derive.
Definition Force.h:50
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem.
Definition GeneralForceSubsystem.h:47
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition Stage.h:66
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition State.h:280
This is the vector class intended to appear in user code for large, variable size column vectors.
Definition Vector_.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
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:606