Simbody  3.5
Assembler.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_ASSEMBLER_H_
2 #define SimTK_SIMBODY_ASSEMBLER_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) 2010-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"
31 
32 #include <set>
33 #include <map>
34 #include <cassert>
35 #include <cmath>
36 
37 namespace SimTK {
38 
39 SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex);
40 
41 class AssemblyCondition;
42 
149  typedef std::set<MobilizedBodyIndex> LockedMobilizers;
150  typedef std::set<MobilizerQIndex> QSet;
151  typedef std::map<MobilizedBodyIndex, QSet> LockedQs;
152  typedef std::map<MobilizerQIndex, Vec2> QRanges;
153  typedef std::map<MobilizedBodyIndex, QRanges> RestrictedQs;
154 public:
155 
159 
163 class AssembleFailed;
167 class TrackFailed;
168 
186 explicit Assembler(const MultibodySystem& system);
187 
199  "Assembler::setTolerance()", "The requested error tolerance %g"
200  " is illegal; we require 0 <= tolerance, with 0 indicating that"
201  " the default tolerance (accuracy/10) is to be used.", tolerance);
202  this->tolerance = tolerance;
203  return *this;
204 }
210  return tolerance > 0 ? tolerance
211  : (accuracy > 0 ? accuracy/10 : Real(0.1)/OODefaultAccuracy);
212 }
213 
223 Assembler& setAccuracy(Real accuracy=0) {
224  SimTK_ERRCHK2_ALWAYS(0 <= accuracy && accuracy < 1,
225  "Assembler::setAccuracy()", "The requested accuracy %g is illegal;"
226  " we require 0 <= accuracy < 1, with 0 indicating that the default"
227  " accuracy (%g) is to be used.", Real(1)/OODefaultAccuracy, accuracy);
228  this->accuracy = accuracy;
229  return *this;
230 }
234 { return accuracy > 0 ? accuracy : Real(1)/OODefaultAccuracy; }
235 
236 
244 { assert(systemConstraints.isValid());
245  setAssemblyConditionWeight(systemConstraints,weight);
246  return *this; }
247 
252 { assert(systemConstraints.isValid());
253  return getAssemblyConditionWeight(systemConstraints); }
254 
261 Assembler& setAssemblyConditionWeight(AssemblyConditionIndex condition,
262  Real weight) {
263  SimTK_INDEXCHECK_ALWAYS(condition, conditions.size(),
264  "Assembler::setAssemblyConditionWeight()");
265  SimTK_ERRCHK1_ALWAYS(weight >= 0, "Assembler::setAssemblyConditionWeight()",
266  "Illegal weight %g; weight must be nonnegative.", weight);
267  uninitialize();
268  weights[condition] = weight;
269  return *this;
270 }
271 
278 Real getAssemblyConditionWeight(AssemblyConditionIndex condition) const {
279  SimTK_INDEXCHECK_ALWAYS(condition, conditions.size(),
280  "Assembler::getAssemblyConditionWeight()");
281  return weights[condition];
282 }
283 
288 AssemblyConditionIndex
289  adoptAssemblyError(AssemblyCondition* p);
298 AssemblyConditionIndex
299  adoptAssemblyGoal(AssemblyCondition* p, Real weight=1);
300 
301 
308  uninitialize();
309  getMatterSubsystem().convertToEulerAngles(state, internalState);
310  system.realizeModel(internalState);
311  return *this;
312 }
319 void initialize() const;
322 void initialize(const State& state)
323 { setInternalState(state); initialize(); }
330 
337 Real assemble();
338 
347 Real track(Real frameTime = -1);
348 
355 Real assemble(State& state) {
356  setInternalState(state);
357  Real achievedCost = assemble(); // throws if it fails
358  updateFromInternalState(state);
359  return achievedCost;
360 }
361 
362 
366 Real calcCurrentGoal() const;
375 Real calcCurrentErrorNorm() const;
376 
377 
382 void updateFromInternalState(State& state) const {
383  system.realizeModel(state); // allocates q's if they haven't been yet
384  if (!getMatterSubsystem().getUseEulerAngles(state)) {
385  State tempState;
386  getMatterSubsystem().convertToQuaternions(getInternalState(),
387  tempState);
388  state.updQ() = tempState.getQ();
389  } else
390  state.updQ() = getInternalState().getQ();
391 }
401 
406 { uninitialize(); userLockedMobilizers.insert(mbx); }
413 { uninitialize(); userLockedMobilizers.erase(mbx); }
414 
427 { uninitialize(); userLockedQs[mbx].insert(qx); }
428 
434 { LockedQs::iterator p = userLockedQs.find(mbx);
435  if (p == userLockedQs.end()) return;
436  QSet& qs = p->second;
437  if (qs.erase(qx)) { // returns 0 if nothing erased
438  uninitialize();
439  if (qs.empty())
440  userLockedQs.erase(p); // remove the whole mobilized body
441  }
442 }
443 
450  Real lowerBound, Real upperBound)
451 { SimTK_ERRCHK2_ALWAYS(lowerBound <= upperBound, "Assembler::restrictQ()",
452  "The given range [%g,%g] is illegal because the lower bound is"
453  " greater than the upper bound.", lowerBound, upperBound);
454  if (lowerBound == -Infinity && upperBound == Infinity)
455  { unrestrictQ(mbx,qx); return; }
456  uninitialize();
457  userRestrictedQs[mbx][qx] = Vec2(lowerBound,upperBound);
458 }
459 
460 
466 { RestrictedQs::iterator p = userRestrictedQs.find(mbx);
467  if (p == userRestrictedQs.end()) return;
468  QRanges& qranges = p->second;
469  if (qranges.erase(qx)) { // returns 0 if nothing erased
470  uninitialize();
471  if (qranges.empty())
472  userRestrictedQs.erase(p); // remove the whole mobilized body
473  }
474 }
487 int getNumGoalEvals() const;
489 int getNumErrorEvals() const;
491 int getNumGoalGradientEvals() const;
493 int getNumErrorJacobianEvals() const;
496 int getNumAssemblySteps() const;
499 int getNumInitializations() const;
503 void resetStats() const;
511 
515 { forceNumericalGradient = yesno; }
519 { forceNumericalJacobian = yesno; }
520 
526 void setUseRMSErrorNorm(bool yesno)
527 { useRMSErrorNorm = yesno; }
531 bool isUsingRMSErrorNorm() const {return useRMSErrorNorm;}
532 
537 void uninitialize() const;
540 bool isInitialized() const {return alreadyInitialized;}
541 
548 const State& getInternalState() const {return internalState;}
549 
553 void addReporter(const EventReporter& reporter) {
554  reporters.push_back(&reporter);
555 }
556 
560 int getNumFreeQs() const
561 { return freeQ2Q.size(); }
562 
566 QIndex getQIndexOfFreeQ(FreeQIndex freeQIndex) const
567 { return freeQ2Q[freeQIndex]; }
568 
573 FreeQIndex getFreeQIndexOfQ(QIndex qx) const
574 { return q2FreeQ[qx]; }
575 
578 Vec2 getFreeQBounds(FreeQIndex freeQIndex) const {
579  if (!lower.size()) return Vec2(-Infinity, Infinity);
580  else return Vec2(lower[freeQIndex], upper[freeQIndex]);
581 }
582 
587 { return system; }
591 { return system.getMatterSubsystem(); }
596 ~Assembler();
597 
598 
599 
600 //------------------------------------------------------------------------------
601  private: // methods
602 //------------------------------------------------------------------------------
603 // Note that the internalState is realized to Stage::Position on return.
604 void setInternalStateFromFreeQs(const Vector& freeQs) {
605  assert(freeQs.size() == getNumFreeQs());
606  Vector& q = internalState.updQ();
607  for (FreeQIndex fx(0); fx < getNumFreeQs(); ++fx)
608  q[getQIndexOfFreeQ(fx)] = freeQs[fx];
609  system.realize(internalState, Stage::Position);
610 }
611 
612 Vector getFreeQsFromInternalState() const {
613  Vector freeQs(getNumFreeQs());
614  const Vector& q = internalState.getQ();
615  for (FreeQIndex fx(0); fx < getNumFreeQs(); ++fx)
616  freeQs[fx] = q[getQIndexOfFreeQ(fx)];
617  return freeQs;
618 }
619 
620 void reinitializeWithExtraQsLocked
621  (const Array_<QIndex>& toBeLocked) const;
622 
623 
624 
625 //------------------------------------------------------------------------------
626  private: // data members
627 //------------------------------------------------------------------------------
628 const MultibodySystem& system;
629 Array_<const EventReporter*> reporters; // just references; don't delete
630 
631 // These members affect the behavior of the assembly algorithm.
632 static const int OODefaultAccuracy = 1000; // 1/accuracy if acc==0
633 Real accuracy; // 0 means use 1/OODefaultAccuracy
634 Real tolerance; // 0 means use accuracy/10
635 bool forceNumericalGradient; // ignore analytic gradient methods
636 bool forceNumericalJacobian; // ignore analytic Jacobian methods
637 bool useRMSErrorNorm; // what norm defines success?
638 
639 // Changes to any of these data members set isInitialized()=false.
640 State internalState;
641 
642 // These are the mobilizers that were set in lockMobilizer(). They are
643 // separate from those involved in individually-locked q's.
644 LockedMobilizers userLockedMobilizers;
645 // These are locks placed on individual q's; they are independent of the
646 // locked mobilizer settings.
647 LockedQs userLockedQs;
648 // These are range restrictions placed on individual q's.
649 RestrictedQs userRestrictedQs;
650 
651 // These are (condition,weight) pairs with weight==Infinity meaning
652 // constraint; weight==0 meaning currently ignored; and any other
653 // positive weight meaning a goal.
655  conditions;
657 
658 // We always have an assembly condition for the Constraints which are
659 // enabled in the System; this is the index which can be used to
660 // retrieve that condition. The default weight is Infinity.
661 AssemblyConditionIndex systemConstraints;
662 
663 
664 // These are filled in when the Assembler is initialized.
665 mutable bool alreadyInitialized;
666 
667 // These are extra q's we removed for numerical reasons.
668 mutable Array_<QIndex> extraQsLocked;
669 
670 // These represent restrictions on the independent variables (q's).
671 mutable std::set<QIndex> lockedQs;
672 mutable Array_<FreeQIndex,QIndex> q2FreeQ; // nq of these
673 mutable Array_<QIndex,FreeQIndex> freeQ2Q; // nfreeQ of these
674 // 0 length if no bounds; otherwise, index by FreeQIndex.
675 mutable Vector lower, upper;
676 
677 // These represent the active assembly conditions.
678 mutable Array_<AssemblyConditionIndex> errors;
679 mutable Array_<int> nTermsPerError;
681 
682 class AssemblerSystem; // local class
683 mutable AssemblerSystem* asmSys;
684 mutable Optimizer* optimizer;
685 
686 mutable int nAssemblySteps; // count assemble() and track() calls
687 mutable int nInitializations; // # times we had to reinitialize
688 
689 friend class AssemblerSystem;
690 };
691 
692 } // namespace SimTK
693 
694 #endif // SimTK_SIMBODY_ASSEMBLER_H_
packed CNTs PAGEREF _Toc249698919 h HYPERLINK l _Toc249698920 CNT packing vs compiler packing PAGEREF _Toc249698920 h HYPERLINK l _Toc249698921 Construction and assignment of CNTs PAGEREF _Toc249698921 h HYPERLINK l _Toc249698922 Operators on CNTs PAGEREF _Toc249698922 h HYPERLINK l _Toc249698923 Element access PAGEREF _Toc249698923 h HYPERLINK l _Toc249698924 Arithmetic PAGEREF _Toc249698924 h HYPERLINK l _Toc249698925 Summary of CNTs PAGEREF _Toc249698925 h HYPERLINK l _Toc249698926 Types for linear algebra PAGEREF _Toc249698926 h HYPERLINK l _Toc249698927 Large Vector and Matrix types PAGEREF _Toc249698927 h HYPERLINK l _Toc249698928 Available storage types TBD PAGEREF _Toc249698928 h HYPERLINK l _Toc249698929 Matrix characteristics PAGEREF _Toc249698929 h HYPERLINK l _Toc249698930 Matrix character commitments PAGEREF _Toc249698930 h HYPERLINK l _Toc249698931 Element type PAGEREF _Toc249698931 h HYPERLINK l _Toc249698932 Outline PAGEREF _Toc249698932 h HYPERLINK l _Toc249698933 Size PAGEREF _Toc249698933 h HYPERLINK l _Toc249698934 Structure PAGEREF _Toc249698934 h HYPERLINK l _Toc249698935 Conditioning PAGEREF _Toc249698935 h HYPERLINK l _Toc249698936 Sparsity PAGEREF _Toc249698936 h HYPERLINK l _Toc249698937 Storage formats PAGEREF _Toc249698937 h HYPERLINK l _Toc249698938 Matrix views PAGEREF _Toc249698938 h HYPERLINK l _Toc249698939 Element filters PAGEREF _Toc249698939 h HYPERLINK l _Toc249698940 Factorizations PAGEREF _Toc249698940 h HYPERLINK l _Toc249698941 Available factorizations TBD PAGEREF _Toc249698941 h HYPERLINK l _Toc249698942 Operator reference TBD PAGEREF _Toc249698942 h HYPERLINK l _Toc249698943 Acknowledgments PAGEREF _Toc249698943 h HYPERLINK l _Toc249698944 References PAGEREF _Toc249698944 h Purpose of this document To describe the goals
Definition: Simmatrix.doc:53
void unlockQ(MobilizedBodyIndex mbx, MobilizerQIndex qx)
Unlock one of this mobilizer&#39;s q&#39;s if it was locked.
Definition: Assembler.h:433
Vector & updQ(SubsystemIndex)
void lockQ(MobilizedBodyIndex mbx, MobilizerQIndex qx)
Lock one of this mobilizer&#39;s q&#39;s at its initial value.
Definition: Assembler.h:426
#define SimTK_ERRCHK2_ALWAYS(cond, whereChecked, fmt, a1, a2)
Definition: ExceptionMacros.h:289
void unlockMobilizer(MobilizedBodyIndex mbx)
Unlock this mobilizer as a whole; some of its q&#39;s may remain locked if they were locked individually...
Definition: Assembler.h:412
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex)
void initialize(const State &state)
Set the internal State and initialize.
Definition: Assembler.h:322
Assembler & setErrorTolerance(Real tolerance=0)
Set the assembly error tolerance.
Definition: Assembler.h:197
const SimbodyMatterSubsystem & getMatterSubsystem() const
#define SimTK_ERRCHK1_ALWAYS(cond, whereChecked, fmt, a1)
Definition: ExceptionMacros.h:285
API for SimTK Simmath&#39;s optimizers.
Definition: Optimizer.h:355
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
void addReporter(const EventReporter &reporter)
Given a reference to an EventReporter, use this Reporter to provide progress reporting.
Definition: Assembler.h:553
void updateFromInternalState(State &state) const
Given an existing State that is suitable for the Assembler&#39;s System, update its q&#39;s from those found ...
Definition: Assembler.h:382
void realize(const State &state, Stage stage=Stage::HighestRuntime) const
Realize the given state to the indicated stage.
Real getSystemConstraintsWeight() const
Return the current weight being given to the System&#39;s built-in Constraints; the default is Infinity...
Definition: Assembler.h:251
int size() const
Definition: VectorBase.h:396
that it contains events that have triggered but have not been processed Thus it is not a legitimate point along the system’s trajectory and should never be returned to the caller For discussion we label this “improper” state EMBED Equation DSMT4 The event handler will correct the state creating a modified state with time still at thigh but not triggering any events We label the modified state EMBED Equation DSMT4 Once the system’s handler the state EMBED Equation DSMT4 can be output as part of the trajectory and used as the initial condition for the next continuous interval Thus the time stepper generates the sequence of legitimate trajectory points just prior to event immediately followed by EMBED Equation DSMT4 which is the time at which the but after the event handler has modified the state to deal with those events Consecutive intervals I and I will consist of trajectory points EMBED Equation DSMT4 with round brackets indicating that EMBED Equation DSMT4 is not part of the trajectory Event handlers Event handlers are solvers which are able to take a state in an resolve the set up appropriate event triggers for the next and report back to the time stepper the degree to which the system continuity has been so that the integrator can be reinitialized appropriately An event handler can also indicate that the simulation should be in which case the time stepper will return the final state to its caller and disallow further time stepping Other event types Not all events have to be localized There are several special case clock user interrupt control is returned to the time stepper The time stepper can then declare that a scheduled event has call the system’s event and reinitialize the integrator if continuity has been violated Time advanced events occur whenever the integrator has advanced time that at the end of every successful internal integration step These are generally restricted to discrete variable updates which do not affect the continuous system
Definition: SimmathUserGuide.doc:227
Assembler & setAssemblyConditionWeight(AssemblyConditionIndex condition, Real weight)
Set the weight to be used for this AssemblyCondition.
Definition: Assembler.h:261
Assembler & setInternalState(const State &state)
Set the Assembler&#39;s internal state from an existing state which must be suitable for use with the Ass...
Definition: Assembler.h:307
Every Simbody header and source file should include this header before any other Simbody header...
Vec2 getFreeQBounds(FreeQIndex freeQIndex) const
Return the allowable range for a particular free q.
Definition: Assembler.h:578
This Study attempts to find a configuration (set of joint coordinates q) of a Simbody MultibodySystem...
Definition: Assembler.h:148
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
F Î IÁ A7 Î Î ¶ µ e2 Ì ½6 ÃJ ÿÿÿÿ °Ûþ ¿Ê …8 q2 L F ô F ¸ ½6 F ½6 p IÁ IÁ Î IÁ IÁ IÁ IÁ IÁ C7 C7 Î IÁ IÁ IÁ IÁ IÁ IÁ IÁ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ F IÁ IÁ IÁ IÁ IÁ IÁ IÁ IÁ IÁ â Michael Peter Eastman Permission is hereby free of to any person obtaining a copy of this to deal in the Document without including without limitation the rights to and or sell copies of the and to permit persons to whom the Document is furnished to do subject to the following WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR ARISING OUT OF OR IN CONNECTION WITH THE DOCUMENT OR THE USE OR OTHER DEALINGS IN THE DOCUMENT Acknowledgment SimTK software and all related activities are funded by the HYPERLINK vectors and matrices PAGEREF _Toc251069768 h HYPERLINK l _Toc251069769 Linear algebra PAGEREF _Toc251069769 h HYPERLINK l _Toc251069770 Solving Linear Systems(SimTK::FactorLU)PAGEREF _Toc251069770\h5HYPERLINK\l"_Toc251069771"3.2 Linear Least Squares(SimTK otherwise the best guess is that tevent is in the middle of the window Finite width localization windows create a likelihood that multiple events will occur within the same window We cannot say with certainty in what order these events so for precise treatment they must be considered simultaneous If an approximate ordering is acceptable then the integrator’s tevent guesses can be used to order the events within the but even those may be identical for some and in any case the integrator cannot guarantee that the events actually occurred in the order they appear when sorted by estimated time of occurrence If more precise information is then the localization window must be made at the cost of increased computation time Once an event has been localized to an acceptable tolerance
Definition: SimmathUserGuide.doc:41
const MultibodySystem & getMultibodySystem() const
Return a reference to the MultibodySystem associated with this Assembler (that is, the System that was supplied in the Assembler&#39;s constructor.
Definition: Assembler.h:586
bool isUsingRMSErrorNorm() const
Determine whether we are currently using the RMS norm for constraint errors; if not we&#39;re using the d...
Definition: Assembler.h:531
Real assemble(State &state)
Given an initial value for the State, modify the q&#39;s in it to satisfy all the assembly conditions to ...
Definition: Assembler.h:355
void setForceNumericalGradient(bool yesno)
This is useful for debugging but should not be used otherwise since the analytic gradient is to be pr...
Definition: Assembler.h:514
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:276
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
void unrestrictQ(MobilizedBodyIndex mbx, MobilizerQIndex qx)
Unrestrict a particular generalized coordinate q if it was previously restricted. ...
Definition: Assembler.h:465
The SimTK::Array_<T> container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty irrevocable copyright license to prepare Derivative Works publicly publicly and distribute the Work and such Derivative Works in Source or Object form Grant of Patent License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty have offer to and otherwise transfer the where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed Redistribution You may reproduce and distribute copies of the Work or Derivative Works thereof in any with or without and in Source or Object provided that You meet the following conditions
Definition: LICENSE.txt:87
Real getErrorToleranceInUse() const
Obtain the tolerance setting that will be used during the next assemble() or track() call...
Definition: Assembler.h:209
Spatial configuration available.
Definition: Stage.h:58
void realizeModel(State &state) const
Realize the model to be used for subsequent computations with the given state.
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
QIndex getQIndexOfFreeQ(FreeQIndex freeQIndex) const
Return the absolute q index associated with a free q.
Definition: Assembler.h:566
int getNumFreeQs() const
Return the number of q&#39;s which are free to be changed by this already-initialized assembly analysis...
Definition: Assembler.h:560
Unique integer type for Subsystem-local q indexing.
#define SimTK_DEFINE_UNIQUE_LOCAL_INDEX_TYPE(PARENT, NAME)
Define a local Index class within a Parent class.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:446
#define SimTK_INDEXCHECK_ALWAYS(ix, ub, where)
Definition: ExceptionMacros.h:106
const Real Infinity
This is the IEEE positive infinity constant for this implementation of the default-precision Real typ...
Real getAccuracyInUse() const
Obtain the accuracy setting that will be used during the next assemble() or track() call...
Definition: Assembler.h:233
Real getAssemblyConditionWeight(AssemblyConditionIndex condition) const
Return the weight currently in use for this AssemblyCondition.
Definition: Assembler.h:278
void lockMobilizer(MobilizedBodyIndex mbx)
Lock this mobilizer at its starting position.
Definition: Assembler.h:405
void setUseRMSErrorNorm(bool yesno)
Use an RMS norm for the assembly errors rather than the default infinity norm (max absolute value)...
Definition: Assembler.h:526
An EventReporter is an object that defines an event that can occur within a system.
Definition: EventReporter.h:53
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
Definition: Study.h:56
void restrictQ(MobilizedBodyIndex mbx, MobilizerQIndex qx, Real lowerBound, Real upperBound)
Restrict a q to remain within a given range.
Definition: Assembler.h:449
The Mobilizer associated with each MobilizedBody, once modeled, has a specific number of generalized ...
void setForceNumericalJacobian(bool yesno)
This is useful for debugging but should not be used otherwise since the analytic Jacobian is to be pr...
Definition: Assembler.h:518
const Vector & getQ(SubsystemIndex) const
Per-subsystem access to the global shared variables.
const State & getInternalState() const
This provides read-only access to the Assembler&#39;s internal State; you probably should use updateFromI...
Definition: Assembler.h:548
Define an assembly condition consisting of a scalar goal and/or a related set of assembly error equat...
Definition: AssemblyCondition.h:44
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133
FreeQIndex getFreeQIndexOfQ(QIndex qx) const
A subset of the q&#39;s will be used as free q&#39;s for solving the assembly problem.
Definition: Assembler.h:573
bool isInitialized() const
Check whether the Assembler has been initialized since the last change was made to its contents...
Definition: Assembler.h:540
Assembler & setSystemConstraintsWeight(Real weight)
Change how the System&#39;s enabled built-in Constraints are weighted as compared to other assembly condi...
Definition: Assembler.h:243
const SimbodyMatterSubsystem & getMatterSubsystem() const
Return a reference to the SimbodyMatterSubsystem that is contained in the MultibodySystem that is ass...
Definition: Assembler.h:590
Assembler & setAccuracy(Real accuracy=0)
Set the accuracy to which a solution should be pursued.
Definition: Assembler.h:223
Vec< 2 > Vec2
This is the most common 2D vector type: a column of 2 Real values stored consecutively in memory (pac...
Definition: SmallMatrix.h:126