AGXDynamics  2.31.1.0
GenericConstraint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 
19 #include <agx/Constraint.h>
21 
22 namespace agx
23 {
24  class GenericConstraintComplianceMatrix;
25 
54  {
55  public:
63 
72 
81 
94  void setSupportComplianceMatrix( agx::Bool enable, agx::Bool isStaticSize = false );
95 
102  GenericConstraintComplianceMatrix* getComplianceMatrix() const;
103 
104  public:
108  virtual void onAddNotification();
109 
113  virtual void onRemoveNotification();
114 
121  virtual agx::Bool onPreSolve();
122 
126  virtual void onPostSolve();
127 
133  virtual void updateComplianceMatrix( GenericConstraintComplianceMatrix* matrix );
134 
135  public:
136 #ifndef SWIG
137  static void onPreSolveCallback( const agxSDK::Simulation* simulation );
138  static void onPostSolveCallback( const agxSDK::Simulation* simulation );
139  static void onCleanup( const agxSDK::Simulation* simulation );
140 #endif
141 
142  public:
143  int getNumDOF() const override;
144  void render( class agxRender::RenderManager* manager, float scale ) const override;
145 
146  protected:
147  virtual ~GenericConstraint();
148 
149 #ifndef SWIG
150  virtual void addNotification() override;
151  virtual void removeNotification() override;
152 #endif
153  };
154 
164  {
165  public:
171  GenericConstraintComplianceMatrix( UInt32 maxSize, Bool isStaticSize );
172 
178  Real get( UInt32 row, UInt32 col ) const;
179 
185  void set( UInt32 row, UInt32 col, Real value );
186 
190  UInt32 size() const;
191 
197  void reset( UInt32 size );
198 
202  const UInt32Vector& getDiagonalUpdates() const;
203 
207  Bool isStaticSize() const;
208 
209  protected:
214 
215  private:
219  UInt32 calculateIndex( UInt32 row, UInt32 col ) const;
220 
224  UInt32 arraySize() const;
225 
226  private:
227  RealVector m_data;
228  UInt32 m_size;
229  UInt32 m_maxSize;
230  Bool m_isStaticSize;
231  UInt32Vector m_diagonalUpdates;
232  };
233 
235 }
bool Bool
Definition: Integer.h:48
#define m_size
Definition: Vector.h:429
#define AGXPHYSICS_EXPORT
The base class for a constraint.
Definition: Constraint.h:86
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
Base class providing referencing counted objects.
Definition: Referenced.h:113
Namespace agx contains the dynamics/math part of the AGX Dynamics API.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
Generic constraint which by default is empty of elementary constraints.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:52
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
Compliance matrix data containing the lower triangle (including the diagonal) of the compliance matri...
double Real
Definition: Real.h:42
uint32_t UInt32
Definition: Integer.h:40