|
AGX Dynamics
2.35.0.1
|
Base class of custom implementations of contact point constraints. More...
#include <ElementaryContactPoint.h>
Inheritance diagram for agx::ElementaryContactPoint:Classes | |
| struct | InputData |
| Input data of the geometry contact, which is constant for all contact points. More... | |
Public Member Functions | |
| Real | calculateImpactSpeed (Real restitution, Vec3f direction, const InputData &inputData) const |
| Calculates the impact speed > 0 along the a given direction. More... | |
| Real | calculateNormalImpactSpeed (const agxCollide::ContactPoint &contactPoint, const InputData &inputData) const |
| Calculates the impact speed > 0 along the normal of the given contact point. More... | |
| virtual void | configure (agxCollide::ContactPoint &contactPoint, const InputData &inputData)=0 |
| Configure the contact point constraint given contact point and geometry contact related data. More... | |
| virtual UInt | getBounds (RangeReal *bounds, UInt row, Real h) const override |
| Writes m_normalForceRange of the contact point at row 0 by default and setting all other rows to [-0, 0]. More... | |
| Vec3 | getCmOffset1 () const |
| Vec3 | getCmOffset2 () const |
| Vec3 | getContactPointPosition () const |
| virtual UInt | getVelocity (Real *v, UInt row) const override |
| Writes the local m_velocity buffer to the solver. More... | |
| virtual UInt | getViolation (Real *g, UInt row) override |
| Writes the contact point violation at row 0 by default. More... | |
| virtual void | initialize (agxCollide::ContactPoint &contactPoint, const InputData &inputData) final |
| Initializes some convenient data and calls 'configure' which is the implementation dependent initialization. More... | |
| virtual Bool | isImpacting () const override |
| Impacting if the velocity at row 0 is larger than zero. More... | |
| virtual void | onPostSolve (agxCollide::ContactPoint &contactPoint, const Real *solution, Real h) const =0 |
| Callback when the solver is done. More... | |
| virtual void | renderDebug () const |
| Render debug things using agxRender::RenderSingleton. More... | |
Public Member Functions inherited from agx::ElementaryConstraint | |
| AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agx::ElementaryConstraint) | |
| void | copyRowFrom (const ElementaryConstraint *source, agx::UInt sourceRow, agx::UInt destRow) |
Copy configuration row from the given ElementaryConstraint into this. More... | |
| agx::Real | getCompliance (agx::UInt row=0) const |
| virtual agx::Real | getCurrentForce (const agx::UInt row=0) const |
| Returns the force applied last time step by this elementary constraint. More... | |
| const agx::Real * | getCurrentForces () const |
| agx::Real | getDamping (agx::UInt row=0) const |
| agx::Real | getElasticity (agx::UInt row=0) const |
| virtual agx::Bool | getEnable () const |
| agx::RangeReal & | getForceRange (const agx::UInt row=0) |
| const agx::RangeReal & | getForceRange (const agx::UInt row=0) const |
| virtual agx::UInt | getJacobian (agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) |
| Returns the Jacobian of this elementary constraint. More... | |
| const agx::ElementaryConstraint::NameType & | getName () const |
| virtual agx::ConstraintNlmcpCallback * | getNlCallback () const |
| agx::UInt | getNumRows () const |
| agx::RegularizationParameters * | getRegularizationParameters (const agx::UInt row=0) |
| const agx::RegularizationParameters * | getRegularizationParameters (const agx::UInt row=0) const |
| virtual agx::Bool | isActive () const |
An elementary constraint is defined to be active if enabled. More... | |
| virtual void | linearizeCompliance (const agx::Real *violations, agx::Real *epsilons, agx::Real minPerturbation) const |
| Modify epsilon so that this ElementaryConstraint appear to be linear in the "normal" deformantion space instead any other space that the ElementaryConstraint may be using. More... | |
| virtual agx::UInt | postSolveCallback (const agx::Real *solution, agx::UInt row, agx::Real h) |
| Callback after solve, with the solution. More... | |
| virtual void | prepare () |
| Prepare call. More... | |
| void | reset () |
| Reset call. More... | |
| virtual void | restore (agxStream::InputArchive &in) override |
| Restore this object from stream. More... | |
| virtual void | restoreLightData (agxStream::StorageStream &str) override |
| Restore structural independent data from stream. More... | |
| virtual void | setAttachmentPair (const agx::AttachmentPair *ap) |
| Call for elementary constraints dependent on attachment pairs. More... | |
| void | setCompliance (agx::Real compliance) |
| void | setCompliance (agx::Real compliance, int row) |
Assign compliance for a given row, or all rows if row = -1 (default). More... | |
| void | setDamping (agx::Real damping) |
| void | setDamping (agx::Real damping, int row) |
Assign damping for a given row, or all rows if row = -1 (default). More... | |
| void | setElasticity (agx::Real elasticity) |
| void | setElasticity (agx::Real elasticity, int row) |
Assign elasticity for a given row, or all rows if row = -1 (default). More... | |
| virtual void | setEnable (agx::Bool enable) |
| Enable/disable this elementary constraint. More... | |
| void | setForceRange (agx::RangeReal forceRange, const agx::UInt row=0) |
| Assign force range to a given row. More... | |
| void | setForceRange (agx::Real lower, agx::Real upper, const agx::UInt row=0) |
| Assign force range to a given row. More... | |
| void | setName (const agx::ElementaryConstraint::NameType &name) |
| Name this elementary constraint. More... | |
| virtual void | store (agxStream::OutputArchive &out) const override |
| Store this object to stream. More... | |
| virtual void | storeLightData (agxStream::StorageStream &str) const override |
| Store structural independent data to stream. More... | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. More... | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. More... | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
Public Member Functions inherited from agxStream::Serializable | |
| virtual | ~Serializable () |
| Destructor for normal C++ use but hidden from SWIG bindings. More... | |
| virtual const char * | getClassName () const |
| bool | getEnableSerialization () const |
| bool | getEnableUuidGeneration () |
| agx::UInt32 | getIndex () const |
| This index is given at creation of this object. More... | |
| virtual StorageAgent * | getStorageAgent () const =0 |
| agx::Uuid | getUuid () const |
| bool | isFinished () const |
| void | setEnableSerialization (bool flag) |
| Set to false to disable serialization of this object. More... | |
| void | setFinished () |
| Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More... | |
| void | setUuid (const agx::Uuid &uuid) |
| Explicitly set a Uuid on a serializable object. More... | |
Static Public Member Functions | |
| static Real | calculateNormalEpsilonAsCompliance (const agxCollide::ContactPoint &contactPoint, const InputData &inputData) |
| Material properties of the normal using utility functions used in the solver. More... | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Public Member Functions inherited from agxStream::Serializable | |
| static void | setEnableUuidGeneration (bool flag) |
| Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More... | |
Protected Member Functions | |
| ElementaryContactPoint (UInt numRows) | |
| Construct given total number of rows per contact point. More... | |
| virtual | ~ElementaryContactPoint () |
Protected Member Functions inherited from agx::ElementaryConstraint | |
| ElementaryConstraint (agx::Bool enable, agx::UInt numRows, agx::RegularizationParameters *regParamsBuffer, agx::Real *lastForcesBuffer, agx::RangeReal *userBoundsBuffer) | |
| Construct given data. More... | |
| virtual | ~ElementaryConstraint () |
| Reference counted object, protected destructor. More... | |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Protected Member Functions inherited from agxStream::Serializable | |
| Serializable () | |
| Default constructor. More... | |
| Serializable (const Serializable &other) | |
| Copy constructor. More... | |
| void | generateUuid () |
Protected Attributes | |
| Vec3 | m_cmOffset1 |
| Vec3 | m_cmOffset2 |
| Vec3 | m_contactPointPosition |
| Bool | m_frictionEnabled |
| RangeReal | m_normalForceRange |
| Real | m_normalViolation |
| Vec3 | m_relativeSurfaceVelocity |
| RealValarray | m_velocity |
Protected Attributes inherited from agx::ElementaryConstraint | |
| agx::Bool | m_enable |
| enabled More... | |
| agx::ref_ptr< agx::Referenced > | m_internalData |
| custom, internal data More... | |
| agx::Real * | m_lfs |
| last forces More... | |
| agx::ElementaryConstraint::NameType | m_name |
| name More... | |
| agx::UInt | m_numRows |
| number of rows More... | |
| agx::RegularizationParameters * | m_rps |
| regularization parameters More... | |
| agx::RangeReal * | m_ubs |
| user bounds More... | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
Additional Inherited Members | |
Public Types inherited from agx::ElementaryConstraint | |
| typedef agx::Name | NameType |
| typedef agx::VectorPOD< agx::ElementaryConstraint * > | PtrContainer |
| typedef agx::Vector< agx::ref_ptr< agx::ElementaryConstraint > > | RefContainer |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Base class of custom implementations of contact point constraints.
These contact point constraints are treated as ordinary constraints, meaning the default contact solving pipelines of the solver are bypassed.
The forces/torques applied by this contact point implementation are written back to the geometry contact before they're exposed to the users (or AMOR).
NOTE: The default implementations in this base class assumes one normal and the rest of the rows to be tangents. Only the normal row 0 can generate impact if the speed of m_velocity[0] > 0. The pre-calculated m_normalViolation and m_normalForceRange are written in getViolation and getBounds to local row 0, and the rest of the rows are 0 (or [-0, 0] for force range) for the rest of the rows. Override these methods if the implementation needs/should do something else.
Definition at line 41 of file ElementaryContactPoint.h.
|
protected |
Construct given total number of rows per contact point.
Serialization is and should be disabled because the contact points this constraint is based is not stored and will be regenerated when a simulation has been read.
| numRows | - total number of rows per contact point |
|
protectedvirtual |
| Real agx::ElementaryContactPoint::calculateImpactSpeed | ( | Real | restitution, |
| Vec3f | direction, | ||
| const InputData & | inputData | ||
| ) | const |
Calculates the impact speed > 0 along the a given direction.
If the speed < inputData.impactCondition, 0.0 is returned, i.e., the contact is considered to be impacting if this method returns a value > 0.0.
| restitution | - restitution >= 0 in the given direction |
| direction | - direction along the impact speed should be calculated |
| inputData | - input data for the contact |
|
static |
Material properties of the normal using utility functions used in the solver.
Note that the utility functions are calculating the diagonal perturbation, but the constraint (when solved) will, again, be asked to calculate the diagonal perturbation. Reversing the calculated epsilon to a compliance by: c_eps = h^2 (1 + 4d / h) * eps / 4 This will results in 'eps' reaching the solver at the end.
Note that the return value of this method is dependent on the state of the "use contact area approach" in the contact material.
| contactPoint | - contact point with contact area (only used when contactMaterial.getUseContactAreaApproach() == true) |
| inputData | - input data for the contact |
| Real agx::ElementaryContactPoint::calculateNormalImpactSpeed | ( | const agxCollide::ContactPoint & | contactPoint, |
| const InputData & | inputData | ||
| ) | const |
Calculates the impact speed > 0 along the normal of the given contact point.
If the speed < inputData.impactCondition, 0.0 is returned, i.e., the contact is considered to be impacting if this method returns a value > 0.0.
| contactPoint | - contact point with normal |
| inputData | - input data for the contact |
|
pure virtual |
Configure the contact point constraint given contact point and geometry contact related data.
All inputs has been validated and this method should not fail. I.e., the contact point is valid and enabled so the constraints should be created.
| contactPoint | - contact point to create the constraint for |
| inputData | - input data for the contact |
|
overridevirtual |
Writes m_normalForceRange of the contact point at row 0 by default and setting all other rows to [-0, 0].
Reimplemented from agx::ElementaryConstraint.
|
inline |
Definition at line 197 of file ElementaryContactPoint.h.
References m_cmOffset1.
|
inline |
Definition at line 202 of file ElementaryContactPoint.h.
References m_cmOffset2.
|
inline |
Definition at line 207 of file ElementaryContactPoint.h.
References m_contactPointPosition.
Writes the local m_velocity buffer to the solver.
Reimplemented from agx::ElementaryConstraint.
Writes the contact point violation at row 0 by default.
Reimplemented from agx::ElementaryConstraint.
|
finalvirtual |
Initializes some convenient data and calls 'configure' which is the implementation dependent initialization.
|
overridevirtual |
Impacting if the velocity at row 0 is larger than zero.
Reimplemented from agx::ElementaryConstraint.
|
pure virtual |
Callback when the solver is done.
Write back "localForce", "tangentU" and "tangentV" to the contact point for all post-data to be in sync with ordinary contacts.
The "local" force is represented as: [0] = x: normal force [1] = y: primary tangential/friction force [2] = z: secondary tangential/friction force For example, if this is an implementation of a normal with two tangents, local force should be set as: contactPoint.localForce() = Vec3( solution[ 0 ], solution[ 1 ], solution[ 2 ] ) / h; Note that the solution has to be divided by the time step.
| contactPoint | - contact point for this elementary constraint to write data to |
| solution | - solution from the solver, indices [0, getNumRows()) accessible |
| h | - time step size |
|
virtual |
Render debug things using agxRender::RenderSingleton.
This method is called from a step listener, post.
|
protected |
Definition at line 188 of file ElementaryContactPoint.h.
Referenced by getCmOffset1().
|
protected |
Definition at line 189 of file ElementaryContactPoint.h.
Referenced by getCmOffset2().
|
protected |
Definition at line 187 of file ElementaryContactPoint.h.
Referenced by getContactPointPosition().
|
protected |
Definition at line 193 of file ElementaryContactPoint.h.
|
protected |
Definition at line 192 of file ElementaryContactPoint.h.
|
protected |
Definition at line 191 of file ElementaryContactPoint.h.
|
protected |
Definition at line 190 of file ElementaryContactPoint.h.
|
protected |
Definition at line 194 of file ElementaryContactPoint.h.