1 #ifndef SimTK_SimTKCOMMON_SYSTEM_H_
2 #define SimTK_SimTKCOMMON_SYSTEM_H_
36 class DecorativeGeometry;
37 class DefaultSystemSubsystem;
38 class ScheduledEventHandler;
39 class ScheduledEventReporter;
40 class TriggeredEventHandler;
41 class TriggeredEventReporter;
133 System& setUseUniformBackground(
bool useUniformBackground);
164 void setHasTimeAdvancedEvents(
bool);
170 bool getUseUniformBackground()
const;
173 Real getDefaultTimeScale()
const;
176 Real getDefaultLengthScale()
const;
179 bool hasTimeAdvancedEvents()
const;
234 const State& realizeTopology()
const;
250 const State& getDefaultState()
const;
253 State& updDefaultState();
273 void realizeModel(
State& state)
const;
367 void project(
State& state,
Real accuracy=-1)
const;
384 void projectQ(
State& state,
Real accuracy=-1)
const;
403 void projectU(
State& state,
Real accuracy=-1)
const;
512 bool prescribeQ(
State& state)
const;
529 bool prescribeU(
State& state)
const;
586 void handleEvents(
State& state,
595 void reportEvents(
const State& state,
607 void calcEventTriggerInfo(
const State& state,
615 void calcTimeOfNextScheduledEvent(
const State& state,
618 bool includeCurrentTime)
const;
623 void calcTimeOfNextScheduledReport(
const State& state,
626 bool includeCurrentTime)
const;
684 void multiplyByN(
const State& state,
const Vector& u,
687 void multiplyByNTranspose(
const State& state,
const Vector& fq,
690 void multiplyByNPInv(
const State& state,
const Vector& dq,
693 void multiplyByNPInvTranspose(
const State& state,
const Vector& fu,
708 void resetAllCountersToZero();
715 int getNumRealizationsOfThisStage(
Stage)
const;
720 int getNumRealizeCalls()
const;
725 int getNumPrescribeQCalls()
const;
727 int getNumPrescribeUCalls()
const;
733 int getNumProjectQCalls()
const;
735 int getNumFailedProjectQCalls()
const;
738 int getNumQProjections()
const;
741 int getNumQErrorEstimateProjections()
const;
745 int getNumProjectUCalls()
const;
747 int getNumFailedProjectUCalls()
const;
750 int getNumUProjections()
const;
753 int getNumUErrorEstimateProjections()
const;
760 int getNumHandlerCallsThatChangedStage(
Stage)
const;
764 int getNumHandleEventCalls()
const;
768 int getNumReportEventCalls()
const;
789 const String& getName()
const;
791 const String& getVersion()
const;
798 int getNumSubsystems()
const;
813 inline operator const Subsystem&()
const;
823 bool systemTopologyHasBeenRealized()
const;
839 void setSystemTopologyCacheVersion(
StageVersion topoVersion)
const;
850 void invalidateSystemTopologyCache()
const;
859 void calcDecorativeGeometryAndAppend(
const State&,
Stage,
865 bool isSameSystem(
const System& otherSystem)
const;
888 bool isOwnerHandle()
const;
890 bool isEmptyHandle()
const;
917 void findSubsystemEventIds
926 const Guts& getGuts()
const;
939 inline System::operator
const Subsystem&()
const {
return getDefaultSubsystem();}
940 inline System::operator
Subsystem&() {
return updDefaultSubsystem();}
992 { optionSet=0; setAccuracyDefaults();
return *
this; }
999 requiredAccuracy = accuracy > 0 ? accuracy
1007 assert(0 < overshoot && overshoot <= 1);
1008 desiredOvershoot = overshoot;
1016 projectionLimit = limit;
1023 { optionSet &= ~(unsigned)opt;
return *
this; }
1026 { optionSet |= (unsigned)opt;
return *
this; }
1043 { optionSet |= opts.optionSet;
return *
this; }
1045 { optionSet &= opts.optionSet;
return *
this; }
1047 { optionSet &= ~opts.optionSet;
return *
this; }
1053 Real requiredAccuracy;
1054 Real desiredOvershoot;
1055 Real projectionLimit;
1058 void setAccuracyDefaults() {
1090 m_anyChangeMade = m_projectionLimitExceeded =
false;
1091 m_numIterations = 0;
1093 m_normOnEntrance = m_normOnExit =
NaN;
1104 { assert(
isValid());
return m_worstError; }
1106 { assert(
isValid());
return m_projectionLimitExceeded; }
1109 { m_exitStatus=status;
return *
this; }
1111 { m_anyChangeMade=changeMade;
return *
this; }
1113 { m_projectionLimitExceeded=limitExceeded;
return *
this; }
1115 { m_numIterations=numIterations;
return *
this; }
1117 { m_normOnEntrance=
norm; m_worstError=worstError;
return *
this; }
1119 { m_normOnExit=
norm;
return *
this; }
1122 bool m_anyChangeMade;
1123 bool m_projectionLimitExceeded;
1124 int m_numIterations;
1126 Real m_normOnEntrance;
1137 unsigned int optionSet;
1153 operator bool()
const {
return optionSet != 0;}
1178 #endif // SimTK_SimTKCOMMON_SYSTEM_H_