1 #ifndef SimTK_SIMBODY_CONTACT_TRACKER_SUBSYSTEM_H_     2 #define SimTK_SIMBODY_CONTACT_TRACKER_SUBSYSTEM_H_    34 class MultibodySystem;
    38 class ContactSnapshot;
   156 int getNumSurfaces() 
const;
   186                                         bool& reverseOrder) 
const;
   225 bool realizeActiveContacts(
const State& state, 
   227                            Real&        stepAdvice) 
const;
   232 bool realizePredictedContacts(
const State& state, 
   234                               Real&        stepAdvice) 
const;
   240 class ContactTrackerSubsystemImpl& updImpl();
   241 const ContactTrackerSubsystemImpl& getImpl() 
const;
   261 typedef std::map<ContactId,int>     ContactMap;
   264 typedef std::map<std::pair<ContactSurfaceIndex,ContactSurfaceIndex>, 
   274     m_id2contact.clear();
   275     m_surfPair2id.clear();
   292     assert(
id.isValid() && surf1.isValid() && surf2.isValid());
   295     if (surf1 > surf2) std::swap(surf1,surf2);
   297     assert(!hasContact(
id));
   298     assert(!hasContact(surf1,surf2));
   300     const int indx = m_contacts.size();
   301     m_contacts.push_back(contact); 
   302     m_id2contact[id] = indx;
   303     m_surfPair2id[std::make_pair(surf1,surf2)] = id;
   308 {   
return m_id2contact.find(
id) != m_id2contact.end(); }
   312 {   
if (surf1 > surf2) std::swap(surf1,surf2);
   313     return m_surfPair2id.find(std::make_pair(surf1,surf2)) 
   314         != m_surfPair2id.end(); }
   328     ContactMap::const_iterator p = m_id2contact.find(
id);
   329     return p==m_id2contact.end() ? empty : m_contacts[p->second]; }
   335 {   
if (surf1 > surf2) std::swap(surf1,surf2);
   336     SurfaceMap::const_iterator p = 
   337         m_surfPair2id.find(std::make_pair(surf1,surf2));
   338     return p==m_surfPair2id.end() ? 
ContactId() : p->second; }
   346 void removeContact(
int n) {
   347     assert(0 <= n && n < m_contacts.size());
   348     if (n+1 == m_contacts.size()) {
   349         m_contacts.pop_back(); 
   353     m_contacts[n] = m_contacts.back();  
   354     m_contacts.pop_back();              
   355     m_id2contact[m_contacts[n].getContactId()] = n;
   361 ContactMap          m_id2contact;   
   362 SurfaceMap          m_surfPair2id;  
   375 #endif // SimTK_SIMBODY_CONTACT_TRACKER_SUBSYSTEM_H_ A Subsystem is expected to be part of a larger System and to have interdependencies with other subsys...
Definition: Subsystem.h:55
 
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
 
Every Simbody header and source file should include this header before any other Simbody header...
 
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
 
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; ...
 
The SimTK::Array_<T> container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
 
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
 
std::ostream & operator<<(std::ostream &o, const ContactForce &f)
Definition: CompliantContactSubsystem.h:387
 
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
 
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:167
 
#define SimTK_PIMPL_DOWNCAST(Derived, Parent)                  
Similar to the above but for private implementation abstract classes, that is, abstract class hierarc...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:580