1 #ifndef SimTK_SIMBODY_ASSEMBLY_CONDITION_H_     2 #define SimTK_SIMBODY_ASSEMBLY_CONDITION_H_    50 :   name(name), assembler(0) {}
    99     const int status = calcErrors(state, err);
   103         "The default implementation of getNumErrors() depends on"   104         " calcErrors() but that method was not implemented for assembly"   105         " condition '%s'.", name.c_str());
   107         "The default implementation of getNumErrors() uses calcErrors()"   108         " which returned status %d (assembly condition '%s').", 
   109         status, name.c_str());
   119     const int status = calcErrors(state, err);
   124         "The default implementation of calcGoal() depends on calcErrors()"   125         " but that method was not implemented for assembly condition '%s'.",
   128         "The default implementation of calcGoal() uses calcErrors() which"   129         " returned status %d (assembly condition '%s').", 
   130         status, name.c_str());
   144 const char* 
getName()
 const {
return name.c_str();}
   153 {   assert(assembler); 
return *assembler;}
   158 {   
return myAssemblyConditionIndex; }
   172 {   
return getAssembler().getQIndexOfFreeQ(fx); }
   177 {   
return getAssembler().getFreeQIndexOfQ(qx); }
   180 {   
return getAssembler().getMultibodySystem(); }
   184 {   
return getMultibodySystem().getMatterSubsystem(); }
   190     if (isInAssembler()) getAssembler().initialize();
   191     else                 initializeCondition();
   199     if (isInAssembler()) getAssembler().uninitialize();
   200     else                 uninitializeCondition();
   209 void setAssembler(
const Assembler& assembler, AssemblyConditionIndex acx) {
   210     assert(!this->assembler);
   211     this->assembler = &assembler;
   212     this->myAssemblyConditionIndex = acx;
   217 AssemblyConditionIndex  myAssemblyConditionIndex;
   222 #endif // SimTK_SIMBODY_ASSEMBLY_CONDITION_H_ 
void initializeAssembler() const 
Call this method before doing anything that logically requires the Assembler, or at least this Assemb...
Definition: AssemblyCondition.h:188
 
QIndex getQIndexOfFreeQ(Assembler::FreeQIndex fx) const 
Ask the assembler where to find the actual q in the State that corresponds to a given free q; only va...
Definition: AssemblyCondition.h:171
 
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
 
ScalarNormSq normSqr() const 
This is the scalar Frobenius norm, and its square. 
Definition: MatrixBase.h:723
 
bool isInAssembler() const 
Test whether this AssemblyCondition has already been adopted by an Assembler. 
Definition: AssemblyCondition.h:148
 
int size() const 
Definition: VectorBase.h:396
 
#define SimTK_ERRCHK2_ALWAYS(cond, whereChecked, fmt, a1, a2)          
Definition: ExceptionMacros.h:289
 
AssemblyCondition(const String &name)
Base class constructor just takes the assembly condition name and saves it. 
Definition: AssemblyCondition.h:49
 
Every Simbody header and source file should include this header before any other Simbody header...
 
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
 
virtual int initializeCondition() const 
This is called whenever the Assembler is initialized in case this assembly condition wants to do some...
Definition: AssemblyCondition.h:61
 
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:276
 
virtual ~AssemblyCondition()
Destructor is virtual for use by derived classes. 
Definition: AssemblyCondition.h:53
 
const SimbodyMatterSubsystem & getMatterSubsystem() const 
Ask the assembler for the MultibodySystem with which it is associated and extract the SimbodyMatterSu...
Definition: AssemblyCondition.h:183
 
AssemblyConditionIndex getAssemblyConditionIndex() const 
Return the AssemblyConditionIndex of this concrete AssemblyCondition within the Assembler that has ad...
Definition: AssemblyCondition.h:157
 
virtual int getNumErrors(const State &state) const 
Override to supply an efficient method for determining how many errors will be returned by calcErrors...
Definition: AssemblyCondition.h:97
 
#define SimTK_ERRCHK1_ALWAYS(cond, whereChecked, fmt, a1)                
Definition: ExceptionMacros.h:285
 
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix. 
 
const Assembler & getAssembler() const 
Return the Assembler that has adopted this AssemblyCondition. 
Definition: AssemblyCondition.h:152
 
const MultibodySystem & getMultibodySystem() const 
Ask the assembler for the MultibodySystem with which it is associated. 
Definition: AssemblyCondition.h:179
 
void uninitializeAssembler() const 
Call this when modifying any parameter of the concrete AssemblyCondition that would require reinitial...
Definition: AssemblyCondition.h:197
 
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
 
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
 
virtual int calcGoalGradient(const State &state, Vector &gradient) const 
Override to supply an analytic gradient for this assembly condition's goal. 
Definition: AssemblyCondition.h:140
 
Unique integer type for Subsystem-local q indexing. 
 
virtual void uninitializeCondition() const 
This is called whenever the containing Assembler is uninitialized in case this assembly condition has...
Definition: AssemblyCondition.h:65
 
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
 
int getNumFreeQs() const 
Ask the assembler how many free q's there are; only valid after initialization but does not invoke in...
Definition: AssemblyCondition.h:167
 
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
 
virtual int calcErrorJacobian(const State &state, Matrix &jacobian) const 
Override to supply an analytic Jacobian for the assembly errors returned by calcErrors(). 
Definition: AssemblyCondition.h:87
 
Define an assembly condition consisting of a scalar goal and/or a related set of assembly error equat...
Definition: AssemblyCondition.h:44
 
const char * getName() const 
Return the name assigned to this AssemblyCondition on construction. 
Definition: AssemblyCondition.h:144
 
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133
 
virtual int calcErrors(const State &state, Vector &err) const 
Calculate the amount by which this assembly condition is violated by the q values in the given state...
Definition: AssemblyCondition.h:75
 
virtual int calcGoal(const State &state, Real &goal) const 
Calculate the current contribution (>= 0) of this assembly condition to the goal value that is being ...
Definition: AssemblyCondition.h:117
 
Assembler::FreeQIndex getFreeQIndexOfQ(QIndex qx) const 
Ask the assembler where to find the free q (if any) that corresponds to a given q in the State; only ...
Definition: AssemblyCondition.h:176