Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

rdContactForceSet Class Reference

A class for holding and managing a set of contacts for a model. More...

#include <rdContactForceSet.h>

Inheritance diagram for rdContactForceSet:

rdPtrArray rdObject List of all members.

Public Member Functions

 rdContactForceSet ()
 Default constructor.

 rdContactForceSet (const char *aFileName)
 Construct an actuator from file.

virtual ~rdContactForceSet ()
 Destructor.

void setModel (rdModel *aModel)
 Set the model for which actuation is provided.

rdModelgetModel ()
 Get a pointer to the model which is actuated.

rdContactForcesetContactForce (rdContactForce *aContact)
 Set the contact object at the first empty index.

rdContactForcesetContactForce (int aIndex, rdContactForce *aContact)
 Set the actuator at an index.

rdContactForcegetContactForce (int aIndex) const
 Get the actuator at an index.

int getNYP ()
 Get the total number of actuator pseudostates.

int getPseudoStatesIndex (int aWhichActuator)
 Get the index for the pseudostates array for a particular contact.

void setPseudoStates (const double aY[])
 Set the pseudostates for all contacts in the model.

void getPseudoStates (double rY[])
 Get the pseudostates for all contacts in the model.

void computeContact ()
 For each contact, compute all necessary quantities.

void updatePseudoStates ()
 Update the pseudostates of all contact forces.

void apply ()
 For each contact, apply the force(s) (or torque(s)) to the model.

bool check () const
 Check that all contacts are valid.

void updateObject (bool aDeep=true)
 Update this object based on its XML node.

void updateNode (bool aDeep=true)
 Update the XML node representing this object.

void generateNode (IDOM_Element *aParent)
 Generate an XML node representing this object.


Static Public Member Functions

void RegisterType (const rdContactForce &aContact)
 Register a supported contact force type.


Protected Attributes

rdPtrArray _defaultContactForces
 Expandable array of default contact force objects.

rdModel_model
 Model on which the contact forces act.

int _nyp
 Number of pseudostates.

int * _pseudoIndex
 Pseudostates index.


Private Member Functions

void setNull ()
 Set the data members of this actuator to their null values.

void constructPseudoStatesIndex ()
 Construct the pseudostates index.

void constructDefaultContacts ()
 Construct the default contact forces.


Static Private Attributes

rdPtrArray _ContactForceTypes
 Expandable array of supported contact force types.


Detailed Description

A class for holding and managing a set of contacts for a model.

A contact is distinguished from a general actuator in that it has no states and no controls. However, a contact can have pseudostates (variables that are not only a function of the states, but also of the time history of the states).

Author:
Frank C. Anderson
Version:
1.0


Constructor & Destructor Documentation

rdContactForceSet::rdContactForceSet const char *  aFileName  ) 
 

Construct an actuator from file.

Parameters:
aFileName Name of the file.


Member Function Documentation

void rdContactForceSet::generateNode IDOM_Element *  aParent  )  [virtual]
 

Generate an XML node representing this object.

Parameters:
aParent Intended parent of the node to be generated. If aParent is NULL, the intent is for this object to serve as the root element of a new document.

Reimplemented from rdObject.

rdContactForce * rdContactForceSet::getContactForce int  aIndex  )  const
 

Get the actuator at an index.

Parameters:
aIndex Array index of the actuator to be returned.
Returns:
Contact at index aIndex.

rdModel * rdContactForceSet::getModel  ) 
 

Get a pointer to the model which is actuated.

Returns:
Pointer to the model.

int rdContactForceSet::getNYP  ) 
 

Get the total number of actuator pseudostates.

Returns:
Total number of actuator pseudostates.

void rdContactForceSet::getPseudoStates double  rY[]  ) 
 

Get the pseudostates for all contacts in the model.

See getPseudoStatesIndex() for a description of the assumed layout of the pseudostates array.

Parameters:
rY Array of pseudostates for all contacts. The first element of aYP is assumed to be the beginning of the pseudo states for the contacts.
See also:
getPseudoStatesIndex()

int rdContactForceSet::getPseudoStatesIndex int  aWhichActuator  ) 
 

Get the index for the pseudostates array for a particular contact.

The pseudostates that characterize all the contact forces of a model are held by the model in an array of values. The convention used by rdContactSet is that the pseudostates for an actuator are held in this array sequentially:

PseudoStatesArray Act Act State yp[ictx+0] 0 0 yp[ictx+1] 0 1 yp[ictx+2] 0 2 yp[ictx+3] 1 0 yp[ictx+4] 3 0 yp[ictx+5] 3 1 ... ... ...

Notice that not all contacts need have the same number of pseudostates. In the above example, contact 0 has 3 pseudostates, contact 1 has 1 pseudostate, contact 2 has 0 pseudostates, and contact 3 has 2 pseudostates.

Note also that it is assumed that the indeces are computed as though the contact pseudostates start at the beginning of the pseudostates array. In actuality the contact pseudostates may start in the middle of some larger array. The index ictx above indexes where in the pseudostate array yp the contact pseudostates begin. It should be apparent to the caller what this number is and should account for as necessary.

This method returns the array index that marks the beginning of the pseudostates for a particular contact. In the event the contact has no pseudostates, -1 is returned. For the above example, the following values of aWhich would produce the following return values:

aWhich Return 0 0 1 3 2 -1 3 4

Parameters:
aWhich The number (or index) of the contact whose pseudostate index is desired.
Returns:
Array index that marks the beginning of the pseudostates for the specified contact. In the event the contact has no pseudostates, -1 is returned.

void rdContactForceSet::RegisterType const rdContactForce aContact  )  [static]
 

Register a supported contact force type.

Any contact type that is supported can be written to and read from an XML file. The contact force must have implemented the following methods to be supported: 1) copy constructor (e.g., rdSpring::rdSpring(const rdSpring &aSpring)) 2) virtual rdContactForce* copy() const, 3) virtual rdContactForce* copy(IDOM_Element*) const, 4) rdContactForce& operator=() (!! with the appropriate return type), 5) virtual void updateObject(bool aDeep=true), 6) virtual void updateNode(bool aDeep=true), and 7) virtual void generateNode(IDOM_Element *aParent).

Because this method is static, registration of contact types needs to be done only once per process and an rdContactForceSet does not need to be instantiated to do so.

This method makes a copy of the specified contact, so the caller may continue to use the spacified contact force (aContactForce) for whatever purpose.

Parameters:
aContact Contact of the type to be added (must be derived from rdContactForce).

rdContactForce * rdContactForceSet::setContactForce int  aIndex,
rdContactForce aContact
 

Set the actuator at an index.

Sending in NULL for the rdContactForce pointer essentially removes the actuator at aIndex from the array of actuators. Note however that the caller is responsible for deleting any actuators that are removed from this list in this way. For this reason, the actuator pointer previously held at aIndex is returned by this method.

It is also permissible to send in any positive value for aIndex, and there can be gaps in the array of actuators. However, it is advisible to use setContacts(rdContactForce*) when adding an actutor so the array of actuators remains contiguous.

Parameters:
aIndex Array index where the actuator is to be stored.
aContact Contact pointer.
Returns:
Pointer to the actuator previously held at aIndex.

rdContactForce * rdContactForceSet::setContactForce rdContactForce aContact  ) 
 

Set the contact object at the first empty index.

This method should always return NULL. If it does not return NULL, it means that a contact object was already stored at what was thought to be the first empty location.

Parameters:
aIndex Array index where the actuator is to be stored.
aContact Contact.
Returns:
Pointer to the actuator previously held.

void rdContactForceSet::setModel rdModel aModel  ) 
 

Set the model for which actuation is provided.

Returns:
Pointer to the model.

void rdContactForceSet::setPseudoStates const double  aY[]  ) 
 

Set the pseudostates for all contacts in the model.

See getPseudoStatesIndex() for a description of the assumed layout of the pseudostates array.

Parameters:
aYP Array of pseudostates for all contacts. The first element of aYP is assumed to be the beginning of the pseudo states for the contacts.
See also:
getPseudoStatesIndex()

void rdContactForceSet::updateObject bool  aDeep = true  )  [virtual]
 

Update this object based on its XML node.

Parameters:
aDeep If true, update this object and all its child objects (that is, member variables that are rdObject's); if false, update only the member variables that are not rdObject's.

Reimplemented from rdPtrArray.

void rdContactForceSet::updatePseudoStates  ) 
 

Update the pseudostates of all contact forces.

Pseudostates are quantities that are not integrated but that depend on the time history of a simulation (e.g., spring set points).


The documentation for this class was generated from the following files:
Generated on Wed Aug 20 02:17:09 2003 for Simulation Software by doxygen1.3