Simbody 3.7
MultibodySystem.h
Go to the documentation of this file.
1#ifndef SimTK_SIMBODY_MULTIBODY_SYSTEM_H_
2#define SimTK_SIMBODY_MULTIBODY_SYSTEM_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) 2005-12 Stanford University and the Authors. *
13 * Authors: 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
30#include <vector>
31
32namespace SimTK {
33
34class SimbodyMatterSubsystem;
35class ForceSubsystem;
36class DecorationSubsystem;
37class GeneralContactSubsystem;
38
39
49public:
52
53 // Steals ownership of the source; returns subsystem ID number.
55
59 bool hasMatterSubsystem() const;
60
65
69 bool hasContactSubsystem() const;
70
71
74 const Real calcPotentialEnergy(const State&) const;
77 const Real calcKineticEnergy(const State&) const;
80 Real calcEnergy(const State& s) const {
81 return calcPotentialEnergy(s)+calcKineticEnergy(s);
82 }
83
84 // These methods are for use by our constituent subsystems to communicate
85 // with each other and with the MultibodySystem as a whole.
86
87 // These cache entries belong to the global subsystem, which zeroes them at
88 // the start of the corresponding stage. They are filled in by the force
89 // subsystems when they are realized to each stage. Forces are cumulative
90 // from stage to stage, so the Dynamics stage includes everything. That may
91 // then be accessed by the matter subsystem in Acceleration stage to
92 // generate the accelerations.
95 const Vector& getMobilityForces (const State&, Stage) const;
96
97 // These routines are for use by force subsystems during Dynamics stage.
101
102 // Private implementation.
104 class MultibodySystemRep& updRep();
105 const MultibodySystemRep& getRep() const;
106protected:
107 explicit MultibodySystem(MultibodySystemRep*);
108};
109
110
111} // namespace SimTK
112
113#endif // SimTK_SIMBODY_MULTIBODY_SYSTEM_H_
Includes internal headers providing declarations for the basic SimTK Core classes,...
Every Simbody header and source file should include this header before any other Simbody header.
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This is the client-side handle class encapsulating the hidden implementation of the DecorationSubsyst...
Definition: DecorationSubsystem.h:54
This is logically an abstract class, more specialized than "Subsystem" but not yet concrete.
Definition: ForceSubsystem.h:36
This class performs collision detection for use in contact modeling.
Definition: GeneralContactSubsystem.h:57
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
int setContactSubsystem(GeneralContactSubsystem &)
DecorationSubsystem & updDecorationSubsystem()
Real calcEnergy(const State &s) const
Calculate the total energy of the system.
Definition: MultibodySystem.h:80
bool hasDecorationSubsystem() const
const DecorationSubsystem & getDecorationSubsystem() const
Vector_< SpatialVec > & updRigidBodyForces(const State &, Stage) const
const MultibodySystemRep & getRep() const
const Vector_< SpatialVec > & getRigidBodyForces(const State &, Stage) const
const GeneralContactSubsystem & getContactSubsystem() const
int addForceSubsystem(ForceSubsystem &)
bool hasContactSubsystem() const
Vector_< Vec3 > & updParticleForces(const State &, Stage) const
bool hasMatterSubsystem() const
class MultibodySystemRep & updRep()
int setMatterSubsystem(SimbodyMatterSubsystem &)
const Vector_< Vec3 > & getParticleForces(const State &, Stage) const
const SimbodyMatterSubsystem & getMatterSubsystem() const
int setDecorationSubsystem(DecorationSubsystem &)
MultibodySystem(MultibodySystemRep *)
Vector & updMobilityForces(const State &, Stage) const
const Vector & getMobilityForces(const State &, Stage) const
MultibodySystem(SimbodyMatterSubsystem &m)
const Real calcPotentialEnergy(const State &) const
Calculate the total potential energy of the system.
GeneralContactSubsystem & updContactSubsystem()
SimTK_PIMPL_DOWNCAST(MultibodySystem, System)
const Real calcKineticEnergy(const State &) const
Calculate the total kinetic energy of the system.
SimbodyMatterSubsystem & updMatterSubsystem()
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133
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 base class that serves as the parent of all SimTK System objects; most commonly Simbody's...
Definition: System.h:97
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