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_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_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 ContactableGet_ndof_x ()=0
 Get the number of DOFs affected by this object (position part).
 
virtual int ContactableGet_ndof_w ()=0
 Get the number of DOFs affected by this object (speed part).
 
virtual void ContactableGetStateBlock_x (ChState &x)=0
 Get all the DOFs packed in a single vector (position part).
 
virtual void ContactableGetStateBlock_w (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 ChVector GetContactPoint (const ChVector<> &loc_point, const ChState &state_x)=0
 Express the local point in absolute frame, for the given state position.
 
virtual ChVector GetContactPointSpeed (const ChVector<> &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 ChVector GetContactPointSpeed (const ChVector<> &abs_point)=0
 Get the absolute speed of point abs_point if attached to the surface.
 
virtual ChCoordsys GetCsysForCollisionModel ()=0
 Return the coordinate system for the associated collision model. More...
 
virtual void ContactForceLoadResidual_F (const ChVector<> &F, const ChVector<> &T, const ChVector<> &abs_point, ChVectorDynamic<> &R)=0
 Apply the given force & torque at the given location and load into the global generalized force array. More...
 
virtual void ContactComputeQ (const ChVector<> &F, const ChVector<> &T, const ChVector<> &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 &marchive)
 Method to allow serialization of transient data to archives.
 
void ArchiveIn (ChArchiveIn &marchive)
 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, ChAparticle)

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

Increment the provided state of this object by the given state-delta increment.

Compute: x_new = x + dw.

Implemented in chrono::fea::ChContactTriangleXYZROT, chrono::fea::ChContactNodeXYZROT, chrono::fea::ChContactTriangleXYZ, chrono::ChAparticle, and chrono::fea::ChContactNodeXYZ.

◆ ContactComputeQ()

virtual void chrono::ChContactable::ContactComputeQ ( const ChVector<> &  F,
const ChVector<> &  T,
const ChVector<> &  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

Implemented in chrono::fea::ChContactTriangleXYZROT, chrono::fea::ChContactNodeXYZROT, chrono::fea::ChContactTriangleXYZ, chrono::ChAparticle, and chrono::fea::ChContactNodeXYZ.

◆ ContactForceLoadResidual_F()

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

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

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

Implemented in chrono::fea::ChContactTriangleXYZROT, chrono::fea::ChContactNodeXYZROT, chrono::fea::ChContactTriangleXYZ, chrono::ChAparticle, and chrono::fea::ChContactNodeXYZ.

◆ GetContactPointSpeed()

virtual ChVector chrono::ChContactable::GetContactPointSpeed ( const ChVector<> &  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::ChContactNodeXYZROT, chrono::fea::ChContactTriangleXYZ, chrono::ChAparticle, and chrono::fea::ChContactNodeXYZ.

◆ GetCsysForCollisionModel()

virtual ChCoordsys chrono::ChContactable::GetCsysForCollisionModel ( )
pure virtual

Return the coordinate system for the associated collision model.

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

Implemented in chrono::fea::ChContactTriangleXYZROT, chrono::fea::ChContactNodeXYZROT, chrono::fea::ChContactTriangleXYZ, chrono::ChAparticle, and chrono::fea::ChContactNodeXYZ.

◆ 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::ChContactNodeXYZROT, chrono::fea::ChContactTriangleXYZ, chrono::ChAparticle, 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