AGX Dynamics  2.37.2.0
WireContactDirectSolver.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
20 #include <agx/agx.h>
21 #include <agx/Referenced.h>
22 #include <agxWire/Node.h>
24 
25 #include <agxWire/WireSolver/WireSolveData.h>
26 
28 
29 namespace agxWire
30 {
31  class WireDistanceCompositeConstraint;
32 
33  typedef agx::Vector<ShapeContactNode*> ContactNodePtrVector;
34 
37  class AGXPHYSICS_EXPORT WireContactDirectSolver : public agx::Referenced
38  {
39  public:
40  WireContactDirectSolver();
41 
42  void solveSystem(agxWire::WireDistanceCompositeConstraint* wire, const agxWire::NodePtrVector& allNodes, const ContactNodePtrVector& contactNodes, agx::RealVector& newNodeVelocities,
43  agx::Real damping);
44 
45  void solveSystemKinematic(ContactNodePtrVector& contactNodes, agx::RealVector& newNodeVelocities, WireDistanceCompositeConstraint* ldcc, const agx::Real h);
46 
47  private:
48  bool doKinematicMove(WireDistanceCompositeConstraint* ldcc, ShapeContactNode* cln, agx::Real maxLengthDifference, bool ignoreFrictionAndMaxmovement = false, agx::Vec3 newShapePosition = agx::Vec3(0, 0, 0));
49  void moveRowByKinematics(WireDistanceCompositeConstraint* ldcc, agx::Vector< NodeIterator >& movableContactsOnOneMassless, const agx::Real extendedLength);
50  ~WireContactDirectSolver();
51 
52  struct SolveData
53  {
54  agx::Vec3Vector particlePoints; // p[0, n].
55  agx::Vec3Vector edgeNormals; // u[1, n-1].
56  agx::Vec3Vector surfaceNormals; // n[1, n-1].
57  agx::RealValarrayPOD segmentLengths; // l[0, n-1].
58  agx::Vec3Vector segmentNormals; // w[0, n-1].
59  agx::RealValarrayPOD wireTensions; // lambda[0, n].
60  agx::RealValarrayPOD gravityForces;
61  agx::Vec3Vector forces; // f[1, n-1].
62  agx::RealValarrayPOD masses;
63  agx::RealValarrayPOD forcesAlongEdgeNormals; // f_u[1, n-1].
64  agx::RealValarrayPOD normalForces; // f_n[1, n-1].
65  agx::RealValarrayPOD normalForceFromGravity;
66  agx::RealValarrayPOD frictionBounds; // b[1, n-1].
67  };
68 
69  SolveData m_solveData;
70  std::shared_ptr<agxWire::WireSolver::WireSimulation> m_solver;
71  };
72 
73 }
74 
#define AGXPHYSICS_EXPORT
Base class providing referencing counted objects.
Definition: Referenced.h:119
Templated vector class.
Definition: Vector.h:52
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
double Real
Definition: Real.h:42
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97