1 #ifndef SimTK_SimTKCOMMON_SYSTEM_H_     2 #define SimTK_SimTKCOMMON_SYSTEM_H_    37 class DecorativeGeometry;
    38 class DefaultSystemSubsystem;
    39 class ScheduledEventHandler;
    40 class ScheduledEventReporter;
    41 class TriggeredEventHandler;
    42 class TriggeredEventReporter;
   134 System& setUseUniformBackground(
bool useUniformBackground);
   165 void setHasTimeAdvancedEvents(
bool); 
   171 bool getUseUniformBackground() 
const;
   174 Real getDefaultTimeScale() 
const;
   177 Real getDefaultLengthScale() 
const;
   180 bool hasTimeAdvancedEvents() 
const;
   235 const State& realizeTopology() 
const;
   251 const State& getDefaultState() 
const;
   254 State&       updDefaultState();
   274 void realizeModel(
State& state) 
const;
   368 void project(
State& state, 
Real accuracy=-1) 
const;
   385 void projectQ(
State& state, 
Real accuracy=-1) 
const;
   404 void projectU(
State& state, 
Real accuracy=-1) 
const;
   513 bool prescribeQ(
State& state) 
const;
   530 bool prescribeU(
State& state) 
const;
   587 void handleEvents(
State&                        state, 
   596 void reportEvents(
const State&                  state, 
   608 void calcEventTriggerInfo(
const State&              state,
   616 void calcTimeOfNextScheduledEvent(
const State&      state, 
   619                                   bool              includeCurrentTime) 
const;
   624 void calcTimeOfNextScheduledReport(
const State&     state, 
   627                                    bool             includeCurrentTime) 
const;
   685 void multiplyByN(
const State& state, 
const Vector& u, 
   688 void multiplyByNTranspose(
const State& state, 
const Vector& fq, 
   691 void multiplyByNPInv(
const State& state, 
const Vector& dq, 
   694 void multiplyByNPInvTranspose(
const State& state, 
const Vector& fu, 
   709 void resetAllCountersToZero();
   716 int getNumRealizationsOfThisStage(
Stage) 
const;
   721 int getNumRealizeCalls() 
const;
   726 int getNumPrescribeQCalls() 
const;
   728 int getNumPrescribeUCalls() 
const;
   734 int getNumProjectQCalls() 
const;
   736 int getNumFailedProjectQCalls() 
const;
   739 int getNumQProjections() 
const;
   742 int getNumQErrorEstimateProjections() 
const;
   746 int getNumProjectUCalls() 
const;
   748 int getNumFailedProjectUCalls() 
const;
   751 int getNumUProjections() 
const;
   754 int getNumUErrorEstimateProjections() 
const;
   761 int getNumHandlerCallsThatChangedStage(
Stage) 
const;
   765 int getNumHandleEventCalls() 
const;
   769 int getNumReportEventCalls() 
const;
   790 const String& getName()    
const;
   792 const String& getVersion() 
const;
   799 int getNumSubsystems() 
const;
   814 inline operator const Subsystem&() 
const; 
   824 bool systemTopologyHasBeenRealized() 
const;
   840 void setSystemTopologyCacheVersion(
StageVersion topoVersion) 
const;
   851 void invalidateSystemTopologyCache() 
const;
   860 void calcDecorativeGeometryAndAppend(
const State&, 
Stage, 
   866 bool isSameSystem(
const System& otherSystem) 
const;
   889 bool isOwnerHandle() 
const;
   891 bool isEmptyHandle() 
const;
   918     void findSubsystemEventIds
   927     const Guts& getGuts() 
const;
   932 {   updDefaultSubsystem().addEventHandler(handler); }
   934 {   updDefaultSubsystem().addEventHandler(handler); }
   936 {   getDefaultSubsystem().addEventReporter(handler); }
   938 {   getDefaultSubsystem().addEventReporter(handler); }
   940 inline System::operator 
const Subsystem&() 
const {
return getDefaultSubsystem();}
   941 inline System::operator 
Subsystem&() {
return updDefaultSubsystem();}
   966         UseInfinityNorm = 0x0004,
   970         ForceProjection = 0x0008,
   974         ForceFullNewton = 0x0010
   983     {   clear(); setRequiredAccuracy(accuracy); }
   987     {   clear(); setOption(opt); }
   993     {   optionSet=0; setAccuracyDefaults(); 
return *
this; }
  1000         requiredAccuracy = accuracy > 0 ? accuracy 
  1001                                         : getDefaultRequiredAccuracy();
  1008         assert(0 < overshoot && overshoot <= 1);
  1009         desiredOvershoot = overshoot;
  1017         projectionLimit = limit;
  1024     {   optionSet &= ~(unsigned)opt; 
return *
this; }
  1027     {   optionSet |= (unsigned)opt; 
return *
this; }
  1044     {   optionSet |= opts.optionSet; 
return *
this; }
  1046     {   optionSet &= opts.optionSet; 
return *
this; }
  1048     {   optionSet &= ~opts.optionSet; 
return *
this; }
  1054     Real     requiredAccuracy;
  1055     Real     desiredOvershoot; 
  1056     Real     projectionLimit;  
  1059     void setAccuracyDefaults() {
  1060         requiredAccuracy = getDefaultRequiredAccuracy();
  1061         desiredOvershoot = getDefaultOvershootFactor(); 
  1079         FailedToAchieveAccuracy = 1,
  1084         FailedToConverge        = 2    
  1090         m_exitStatus = Invalid;
  1091         m_anyChangeMade = m_projectionLimitExceeded = 
false;
  1092         m_numIterations = 0;
  1094         m_normOnEntrance = m_normOnExit = 
NaN;
  1097     bool    isValid()
        const {
return m_exitStatus != Invalid;}
  1105     {   assert(isValid());
return m_worstError; }
  1107     {   assert(isValid());
return m_projectionLimitExceeded; }
  1110     {   m_exitStatus=status; 
return *
this; }
  1112     {   m_anyChangeMade=changeMade; 
return *
this; }
  1114     {   m_projectionLimitExceeded=limitExceeded; 
return *
this; }
  1116     {   m_numIterations=numIterations; 
return *
this; }
  1118     {   m_normOnEntrance=
norm; m_worstError=worstError; 
return *
this; }
  1120     {   m_normOnExit=
norm; 
return *
this; }
  1123     bool    m_anyChangeMade;
  1124     bool    m_projectionLimitExceeded;
  1125     int     m_numIterations;
  1127     Real    m_normOnEntrance;   
  1138     unsigned int optionSet;
  1154     operator bool()
 const {
return optionSet != 0;}
  1179 #endif // SimTK_SimTKCOMMON_SYSTEM_H_ ScheduledEventReporter is a subclass of EventReporter for events that occur at a particular time that...
Definition: EventReporter.h:72
 
System(System::Guts *g)
Constructor for internal use only. 
Definition: System.h:884
 
ScheduledEventHandler is a subclass of EventHandler for events that occur at a particular time that i...
Definition: EventHandler.h:84
 
bool isOptionSet(Option opt) const 
Definition: System.h:1157
 
A Subsystem is expected to be part of a larger System and to have interdependencies with other subsys...
Definition: Subsystem.h:55
 
ProjectResults()
Definition: System.h:1069
 
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:218
 
ProjectResults & setNumIterations(int numIterations)
Definition: System.h:1115
 
ProjectOptions & operator|=(const ProjectOptions &opts)
Definition: System.h:1043
 
ProjectOptions & operator-=(const ProjectOptions &opts)
Definition: System.h:1047
 
RealizeOptions & operator|=(RealizeOptions opts)
Definition: System.h:1163
 
(NOT USED YET) Results for advanced users of realize() methods. 
Definition: System.h:1171
 
ProjectOptions(Real accuracy)
This constructor allows the default accuracy to be overridden while leaving all other options at thei...
Definition: System.h:982
 
bool isEmpty() const 
Definition: System.h:1155
 
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
 
int getNumIterations() const 
Definition: System.h:1101
 
ProjectOptions & operator&=(const ProjectOptions &opts)
Definition: System.h:1045
 
A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direct...
Definition: CoordinateAxis.h:244
 
Status getExitStatus() const 
Definition: System.h:1098
 
ProjectOptions(Option opt)
This constructor creates default options except one setting one non-default Option. 
Definition: System.h:986
 
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:50
 
bool getAnyChangeMade() const 
Definition: System.h:1100
 
Real getOvershootFactor() const 
Return the factor by which a project() method should try to do better than the required accuracy...
Definition: System.h:1033
 
void addEventReporter(ScheduledEventReporter *handler) const 
Add a ScheduledEventReporter to this System, which takes over ownership of the event reporter object...
Definition: System.h:935
 
ProjectOptions & setProjectionLimit(Real limit)
Project will fail immediately if the initial norm is greater than the projection limit, with status FailureToConverge. 
Definition: System.h:1015
 
ProjectResults & clear()
Restore this object to its default-constructed state, with the return status set to Invalid...
Definition: System.h:1089
 
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:593
 
ProjectOptions & clear()
Restore this object to its default-constructed state (no options selected, default accuracy and overs...
Definition: System.h:992
 
static Real getDefaultOvershootFactor()
Definition: System.h:1040
 
System()
Default constructor creates an empty handle. 
Definition: System.h:780
 
ProjectResults & setNormOnExit(Real norm)
Definition: System.h:1119
 
Guts & updSystemGuts()
Obtain a writable reference to the System::Guts object to which this handle refers. 
Definition: System.h:876
 
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:276
 
const Real NaN
This is the IEEE "not a number" constant for this implementation of the default-precision Real type; ...
 
Results for advanced users of project() methods. 
Definition: System.h:1067
 
These are all the possible causes for events. 
Definition: Event.h:123
 
static Real getDefaultRequiredAccuracy()
Definition: System.h:1039
 
int getWorstErrorOnEntrance() const 
Definition: System.h:1104
 
bool getProjectionLimitExceeded() const 
Definition: System.h:1106
 
Options for the advanced project() methods. 
Definition: System.h:950
 
Option
Definition: System.h:1142
 
ProjectResults & setProjectionLimitExceeded(bool limitExceeded)
Definition: System.h:1113
 
The SimTK::Array_<T> container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
 
Option
Definition: System.h:952
 
(NOT USED YET) Options for the advanced realize() methods. 
Definition: System.h:1137
 
bool isValid() const 
Definition: System.h:1097
 
const Guts & getSystemGuts() const 
Obtain a const reference to the System::Guts object to which this handle refers. 
Definition: System.h:872
 
RealizeOptions()
Definition: System.h:1148
 
ProjectOptions & operator-=(Option opt)
Definition: System.h:1051
 
Spatial configuration available. 
Definition: Stage.h:58
 
ProjectOptions & setRequiredAccuracy(Real accuracy)
The norm of the constraint errors must be driven to below this value for a project() to be considered...
Definition: System.h:999
 
The abstract parent of all Subsystem implementation classes. 
Definition: SubsystemGuts.h:47
 
bool isOptionSet(Option opt) const 
Definition: System.h:1037
 
float norm(const conjugate< float > &c)
Definition: conjugate.h:775
 
RealizeOptions & operator-=(Option opt)
Definition: System.h:1167
 
void addEventHandler(ScheduledEventHandler *handler)
Add a ScheduledEventHandler to this System, which takes over ownership of the event handler object...
Definition: System.h:931
 
ProjectResults & setAnyChangeMade(bool changeMade)
Definition: System.h:1111
 
const Real Infinity
This is the IEEE positive infinity constant for this implementation of the default-precision Real typ...
 
ProjectResults & setExitStatus(Status status)
Definition: System.h:1109
 
RealizeOptions & operator&=(RealizeOptions opts)
Definition: System.h:1164
 
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
 
Real getRequiredAccuracy() const 
Return the current value for the required accuracy option. 
Definition: System.h:1030
 
Declares the user-visible part of a SimTK::State, the implementation is done in a separate internal c...
 
This is the declaration for the System::Guts class, the abstract object to which a System handle poin...
Definition: SystemGuts.h:71
 
Status
Definition: System.h:1071
 
TriggeredEventHandler is a subclass of EventHandler for events that occur when some condition is sati...
Definition: EventHandler.h:109
 
ProjectOptions & setOption(Option opt)
Set a particular option. 
Definition: System.h:1026
 
This is the base class that serves as the parent of all SimTK System objects; most commonly Simbody's...
Definition: System.h:97
 
void clear()
Definition: System.h:1158
 
void clearOption(Option opt)
Definition: System.h:1159
 
bool hasGuts() const 
Return true if this System handle is not empty. 
Definition: System.h:886
 
ProjectOptions()
Default constructor sets options to their default values. 
Definition: System.h:978
 
Provide a unique integer type for identifying Subsystems. 
 
This is a concrete Subsystem that is part of every System. It provides a variety of services for the ...
Definition: System.h:910
 
Real getProjectionLimit() const 
Return the maximum norm we're allowed to attempt to correct. 
Definition: System.h:1035
 
Real getNormOnEntrance() const 
Definition: System.h:1102
 
Results returned by the handleEvent() method. 
Definition: Event.h:342
 
A new time has been realized. 
Definition: Stage.h:57
 
This is the header which should be included in user programs that would like to make use of all the S...
 
TriggeredEventReporter is a subclass of EventReporter for events that occur when some condition is sa...
Definition: EventReporter.h:96
 
Includes internal headers providing declarations for the basic SimTK Core classes. 
 
ProjectOptions & setOvershootFactor(Real overshoot)
Project will attempt to reach accuracy*overshoot but settle for just accuracy. 
Definition: System.h:1007
 
Real getNormOnExit() const 
Definition: System.h:1103
 
ProjectOptions & clearOption(Option opt)
Remove a given option from the set. 
Definition: System.h:1023
 
RealizeOptions(Option opt)
Definition: System.h:1151
 
RealizeOptions & operator|=(Option opt)
Definition: System.h:1166
 
ProjectOptions & operator|=(Option opt)
Definition: System.h:1050
 
int StageVersion
This is the type to use for Stage version numbers. 
Definition: State.h:160
 
void prescribe(State &state) const 
Set values for prescribed positions q and velocities u. 
Definition: System.h:488
 
ProjectResults & setNormOnEntrance(Real norm, int worstError)
Definition: System.h:1117
 
void setOption(Option opt)
Definition: System.h:1160
 
Options for the handleEvent() method. 
Definition: Event.h:266
 
This is a class to represent unique IDs for events in a type-safe way.