AGX Dynamics  2.37.2.0
MergedBodySolverData.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 
20 
21 #include <agx/MergedBody.h>
22 
23 namespace agxSDK
24 {
25  class GeometryContactMergeSplitAlgorithm;
26  class ConstraintMergeSplitAlgorithm;
27 
32  {
33  public:
37  struct ForceFrame
38  {
42  };
43 
47  struct ForceData
48  {
50  : graphNodeIndex( agx::InvalidIndex )
51  {
52  }
53 
54  ForceData( agx::UInt graphNodeIndex,
55  const agx::Vec3& force,
56  const agx::Vec3& torque )
57  : graphNodeIndex( graphNodeIndex ), force( force ), torque( torque )
58  {
59  }
60 
64  };
65 
66  public:
71 
72  public:
77 
81  void collectData( const agx::MergedBody* mergedBody,
82  const MergeSplitPostSolveData& data,
83  const GlobalGraphNodeIndexContainer* externalInteractions,
84  const GeometryContactMergeSplitAlgorithm* geometryContactAlgorithm,
85  const ConstraintMergeSplitAlgorithm* constraintAlgorithm );
86 
90  const BodyForceDataContainer& getForceData() const;
91 
95  const ForceDataVector* tryGetForceData( const agx::RigidBody* rb ) const;
96 
100  const agx::MergedBody* getMergedBody() const;
101 
108  agx::Bool calculateContactEdgeStrength( const agx::RigidBody* rb,
109  MergedBodySolverData::ForceFrame& contactStrength ) const;
110 
114  using ContactEdgeStrengthVisitor = std::function<void( ForceFrame, const agx::RigidBody* )>;
115 
119  using ContactEdgeStrengthVisitorPredicate = std::function<agx::Bool( const agx::RigidBody* )>;
120 
127  void traverseContactEdgeStrength( const agx::RigidBody* rb,
129  ContactEdgeStrengthVisitor visitor ) const;
130 
131  private:
132  const agx::MergedBody* m_mergedBody;
134  BodyForceDataContainer m_bodyForceDataContainer;
135  };
136 
138  {
139  return m_mergedBody;
140  }
141 }
Force frame where the resultant force is u + v + n.
Collection of external (active) interactions, interacting with merged rigid bodies.
bool Bool
Definition: Integer.h:48
Object containing force and torque from a graph node.
#define AGXPHYSICS_EXPORT
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
std::function< void(ForceFrame, const agx::RigidBody *)> ContactEdgeStrengthVisitor
Visitor callback where ForceFrame is edge strength in world coordinates and &#39;otherRb&#39;.
const agx::MergedBody * getMergedBody() const
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:55
uint32_t UInt
Definition: Integer.h:34
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
VectorPOD< UInt > UIntVector
std::function< agx::Bool(const agx::RigidBody *)> ContactEdgeStrengthVisitorPredicate
Predicate to calculate force frame and visit ContactEdgeStrengthVisitor.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
agx::Vec3 torque
Torque in world coordinates.
agx::UInt graphNodeIndex
Graph node index such that type = postSolveData.getType( graphNodeIndex ).
agx::Vec3 force
Force in world coordinates.
Inheritance with partial specialization due to bug with ref_ptr containers.
ForceData(agx::UInt graphNodeIndex, const agx::Vec3 &force, const agx::Vec3 &torque)
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30