chrono::ChContactable Class Referenceabstract

Description

Interface for objects that generate contacts.

One should inherit from ChContactable_1vars, ChContactable_2vars etc. depending on the number of ChVariable objects contained in the object (i.e. the variable chunks to whom the contact point position depends, also the variables affected by contact force).

#include <ChContactable.h>

Inherited by chrono::ChContactable_1vars< 3 >, chrono::ChContactable_1vars< 6 >, chrono::ChContactable_2vars< 3, 3 >, chrono::ChContactable_3vars< 3, 3, 3 >, chrono::ChContactable_3vars< 6, 6, 6 >, chrono::ChContactable_1vars< T1 >, chrono::ChContactable_2vars< T1, T2 >, and chrono::ChContactable_3vars< T1, T2, T3 >.

Public Types

enum  eChContactableType {
  CONTACTABLE_UNKNOWN = 0, CONTACTABLE_6, CONTACTABLE_3, CONTACTABLE_33,
  CONTACTABLE_66, CONTACTABLE_333, CONTACTABLE_666
}
 Enum used for dispatcher optimization instead than rtti. More...
 

Public Member Functions

void AddCollisionModel (std::shared_ptr< ChCollisionModel > model)
 Add the collision model.
 
void AddCollisionShape (std::shared_ptr< ChCollisionShape > shape, const ChFrame<> &frame=ChFrame<>())
 Add a collision shape. More...
 
std::shared_ptr< ChCollisionModelGetCollisionModel () const
 Access the collision model.
 
virtual bool IsContactActive ()=0
 Indicate whether or not the object must be considered in collision detection.
 
virtual int GetContactableNumCoordsPosLevel ()=0
 Get the number of DOFs affected by this object (position part).
 
virtual int GetContactableNumCoordsVelLevel ()=0
 Get the number of DOFs affected by this object (speed part).
 
virtual void ContactableGetStateBlockPosLevel (ChState &x)=0
 Get all the DOFs packed in a single vector (position part).
 
virtual void ContactableGetStateBlockVelLevel (ChStateDelta &w)=0
 Get all the DOFs packed in a single vector (speed part).
 
virtual void ContactableIncrementState (const ChState &x, const ChStateDelta &dw, ChState &x_new)=0
 Increment the provided state of this object by the given state-delta increment. More...
 
virtual ChVector3d GetContactPoint (const ChVector3d &loc_point, const ChState &state_x)=0
 Express the local point in absolute frame, for the given state position.
 
virtual ChVector3d GetContactPointSpeed (const ChVector3d &loc_point, const ChState &state_x, const ChStateDelta &state_w)=0
 Get the absolute speed of a local point attached to the contactable. More...
 
virtual ChVector3d GetContactPointSpeed (const ChVector3d &abs_point)=0
 Get the absolute speed of point abs_point if attached to the surface.
 
virtual ChFrame GetCollisionModelFrame ()=0
 Return the frame of the associated collision model relative to the contactable object. More...
 
virtual void ContactForceLoadResidual_F (const ChVector3d &F, const ChVector3d &T, const ChVector3d &abs_point, ChVectorDynamic<> &R)=0
 Apply the given force & torque at the given location and load into the global generalized force vector. More...
 
virtual void ContactComputeQ (const ChVector3d &F, const ChVector3d &T, const ChVector3d &point, const ChState &state_x, ChVectorDynamic<> &Q, int offset)=0
 Compute a contiguous vector of generalized forces Q from a given force & torque at the given point. More...
 
virtual double GetContactableMass ()=0
 This can be useful in some SMC code:
 
virtual ChPhysicsItemGetPhysicsItem ()=0
 This is only for backward compatibility. More...
 
virtual eChContactableType GetContactableType () const =0
 This must return the proper eChContactableType enum, for allowing a faster collision dispatcher in ChContactContainer classes (this enum will be used instead of slow dynamic_cast<> to infer the type of ChContactable, if possible)
 
void SetUserData (const std::shared_ptr< void > &data)
 Set user-data associated with this contactable.
 
bool HasData () const
 Check if this contactable has associated user-data.
 
template<typename T >
std::shared_ptr< T > GetUserData () const
 Get the user-data using static cast to a known type.
 
void ArchiveOut (ChArchiveOut &archive_out)
 Method to allow serialization of transient data to archives.
 
void ArchiveIn (ChArchiveIn &archive_in)
 Method to allow deserialization of transient data from archives.
 

Protected Attributes

std::shared_ptr< ChCollisionModelcollision_model
 

Member Enumeration Documentation

◆ eChContactableType

Enum used for dispatcher optimization instead than rtti.

Enumerator
CONTACTABLE_UNKNOWN 

unknown contactable type

CONTACTABLE_6 

1 variable with 6 DOFs (e.g., ChBody, ChNodeFEAxyzrot)

CONTACTABLE_3 

1 variable with 3 DOFS (e.g., ChNodeFEAxyz, ChParticle)

CONTACTABLE_33 

2 variables, each with 3DOF (e.g., segments between 2 ChNodeFEAxyz nodes)

CONTACTABLE_66 

2 variables, each with 6 DOFs (e.g., triangle between 2 ChNodeFEAxyzrot nodes)

CONTACTABLE_333 

3 variables, each with 3 DOFs (e.g., triangle between 3 ChNodeFEAxyz nodes)

CONTACTABLE_666 

3 variables, each with 6 DOFs (e.g., triangle between 3 ChNodeFEAxyzrot nodes)

Member Function Documentation

◆ AddCollisionShape()

void chrono::ChContactable::AddCollisionShape ( std::shared_ptr< ChCollisionShape shape,
const ChFrame<> &  frame = ChFrame<>() 
)

Add a collision shape.

If this item does not have a collision model, one is created.

◆ ContactableIncrementState()

virtual void chrono::ChContactable::ContactableIncrementState ( const ChState x,
const ChStateDelta dw,
ChState x_new 
)
pure virtual

◆ ContactComputeQ()

virtual void chrono::ChContactable::ContactComputeQ ( const ChVector3d F,
const ChVector3d T,
const ChVector3d point,
const ChState state_x,
ChVectorDynamic<> &  Q,
int  offset 
)
pure virtual

Compute a contiguous vector of generalized forces Q from a given force & torque at the given point.

Used for computing stiffness matrix (square force jacobian) by backward differentiation. The force F and its application point are specified in the global frame. The torque T is specified in the global frame too. Each object must set the entries in Q corresponding to its variables, starting at the specified offset. If needed, the object states must be extracted from the provided state position.

Parameters
Fforce
Ttorque
pointapplication point
state_xglobal state vector
Qgeneralized force vector
offsetindex offset

Implemented in chrono::fea::ChContactTriangleXYZRot, chrono::fea::ChContactSegmentXYZRot, chrono::fea::ChContactNodeXYZRot, chrono::fea::ChContactTriangleXYZ, chrono::fea::ChContactSegmentXYZ, chrono::ChParticle, and chrono::fea::ChContactNodeXYZ.

◆ ContactForceLoadResidual_F()

virtual void chrono::ChContactable::ContactForceLoadResidual_F ( const ChVector3d F,
const ChVector3d T,
const ChVector3d abs_point,
ChVectorDynamic<> &  R 
)
pure virtual

Apply the given force & torque at the given location and load into the global generalized force vector.

The force F and its application point are specified in the absolute reference frame. The torque T is specified in the global frame too. Each object must update the entries in R corresponding to its variables. Force for example could come from a penalty model.

Parameters
Fforce
Ttorque
abs_pointapplication point
Rglobal generalized force vector

Implemented in chrono::fea::ChContactTriangleXYZRot, chrono::fea::ChContactSegmentXYZRot, chrono::fea::ChContactNodeXYZRot, chrono::fea::ChContactTriangleXYZ, chrono::fea::ChContactSegmentXYZ, chrono::ChParticle, and chrono::fea::ChContactNodeXYZ.

◆ GetCollisionModelFrame()

virtual ChFrame chrono::ChContactable::GetCollisionModelFrame ( )
pure virtual

Return the frame of the associated collision model relative to the contactable object.

ChCollisionModel might call this to get the position of the contact model (when rigid) and sync it.

Implemented in chrono::fea::ChContactTriangleXYZRot, chrono::fea::ChContactSegmentXYZRot, chrono::fea::ChContactNodeXYZRot, chrono::fea::ChContactTriangleXYZ, chrono::ChParticle, chrono::fea::ChContactNodeXYZ, and chrono::fea::ChContactSegmentXYZ.

◆ GetContactPointSpeed()

virtual ChVector3d chrono::ChContactable::GetContactPointSpeed ( const ChVector3d loc_point,
const ChState state_x,
const ChStateDelta state_w 
)
pure virtual

Get the absolute speed of a local point attached to the contactable.

The given point is assumed to be expressed in the local frame of this object. This function must use the provided states.

Implemented in chrono::fea::ChContactTriangleXYZRot, chrono::fea::ChContactSegmentXYZRot, chrono::fea::ChContactNodeXYZRot, chrono::fea::ChContactTriangleXYZ, chrono::fea::ChContactSegmentXYZ, chrono::fea::ChContactNodeXYZ, and chrono::ChParticle.

◆ GetPhysicsItem()

virtual ChPhysicsItem* chrono::ChContactable::GetPhysicsItem ( )
pure virtual

This is only for backward compatibility.

Note that in recent code the reference to the ChPhysicsItem should disappear. The ChPhysicsItem could be the ChContactable itself (ex. see the ChBody) or a container (ex. the ChMEsh, for ChContactTriangle)

Implemented in chrono::ChBody, chrono::fea::ChContactTriangleXYZRot, chrono::fea::ChContactSegmentXYZRot, chrono::fea::ChContactNodeXYZRot, chrono::fea::ChContactTriangleXYZ, chrono::fea::ChContactSegmentXYZ, chrono::ChParticle, and chrono::fea::ChContactNodeXYZ.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/physics/ChContactable.h
  • /builds/uwsbel/chrono/src/chrono/physics/ChContactable.cpp