AGX Dynamics  2.35.0.1
GenericElementaryConstraint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
21 
22 namespace agx
23 {
54  {
55  public:
62 
69 
74 
91  agx::Real primaryFrictionCoefficient,
92  agx::Real secondaryFrictionCoefficient,
93  const agx::Vec3& contactPointPosition );
94 
101 
102  public:
110  virtual agx::Bool onPrepare();
111 
121  agx::GenericConstraintData* constraintData );
122 
123 #ifndef SWIG
124  public:
128  void fetchData();
129 #endif
130 
131  public:
132  void prepare() override;
133  agx::Bool isActive() const override;
134  agx::UInt getJacobian( agx::Jacobian6DOFElement* G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState ) override;
136  agx::UInt getVelocity( agx::Real* v, agx::UInt row ) const override;
137  agx::UInt getBounds( agx::RangeReal* bounds, agx::UInt row, agx::Real h ) const override;
138  agx::Bool isImpacting() const override;
139 #ifndef SWIG
141 #endif
142 
143  void setAttachmentPair( const agx::AttachmentPair* ap ) override;
144 
145  protected:
147 
148  private:
149  GenericConstraintBodyData m_rb1Data;
150  GenericConstraintBodyData m_rb2Data;
151  GenericConstraintData m_constraintData;
152  const AttachmentPair* m_attachmentPair;
153  Bool m_active;
154  ref_ptr<Referenced> m_multiTangentNlCallback;
155  };
156 }
#define AGXPHYSICS_EXPORT
Constraint attachment pair class.
Constraint solver callback interface with context and start rows for context.
Elementary constraint base class with interface and global constraint functionality.
Constraint body data used with GenericElementaryConstraint containing the per body Jacobian data.
Constraint data used with GenericElementaryConstraint containing data such as; constraint violation,...
Generic elementary constraint with minimal amount of user callbacks to reduce development/prototype t...
agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
void fetchData()
Performing callbacks and collecting data in serial.
GenericElementaryConstraint(agx::UInt numRows)
Construct given the number of rows in this elementary constraint.
void setEnableMultiTangentNlCallback(agx::Bool enable, agx::Real primaryFrictionCoefficient, agx::Real secondaryFrictionCoefficient, const agx::Vec3 &contactPointPosition)
agx::Bool isActive() const override
An elementary constraint is defined to be active if enabled.
agx::ConstraintNlmcpCallback * getNlCallback() const override
agx::UInt getVelocity(agx::Real *v, agx::UInt row) const override
Returns the velocity of this elementary constraint (extra, driving term on the right hand side).
virtual agx::Bool onPrepare()
Callback when the elementary constraints in the constraint receives the prepare call.
agx::Bool getEnableMultiTangentNlCallback() const
virtual void onWriteData(agx::GenericConstraintBodyData *rb1Data, agx::GenericConstraintBodyData *rb2Data, agx::GenericConstraintData *constraintData)
Callback when to write Jacobian and constraint data if this elementary constraint is active.
void prepare() override
Prepare call.
const agx::AttachmentPair * getAttachmentPair() const
agx::Bool isImpacting() const override
GenericElementaryConstraint(agx::UInt numRows, agx::Bool enable)
Construct given the number of rows in this elementary constraint and default enable flag.
void setAttachmentPair(const agx::AttachmentPair *ap) override
Call for elementary constraints dependent on attachment pairs.
agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
agx::UInt getBounds(agx::RangeReal *bounds, agx::UInt row, agx::Real h) const override
Returns the bounds of the Lagrange Multipliers (default (-inf, +inf)).
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:48
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42