AGX Dynamics  2.35.0.1
MergedBodySolverData.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 
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 
91 
95  const ForceDataVector* tryGetForceData( const agx::RigidBody* rb ) const;
96 
100  const agx::MergedBody* getMergedBody() const;
101 
109  MergedBodySolverData::ForceFrame& contactStrength ) const;
110 
114  using ContactEdgeStrengthVisitor = std::function<void( ForceFrame, const agx::RigidBody* )>;
115 
120 
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 }
#define AGXPHYSICS_EXPORT
Collection of external (active) interactions, interacting with merged rigid bodies.
std::function< void(ForceFrame, const agx::RigidBody *)> ContactEdgeStrengthVisitor
Visitor callback where ForceFrame is edge strength in world coordinates and 'otherRb'.
std::function< agx::Bool(const agx::RigidBody *)> ContactEdgeStrengthVisitorPredicate
Predicate to calculate force frame and visit ContactEdgeStrengthVisitor.
const ForceDataVector * tryGetForceData(const agx::RigidBody *rb) const
void collectData(const agx::MergedBody *mergedBody, const MergeSplitPostSolveData &data, const GlobalGraphNodeIndexContainer *externalInteractions, const GeometryContactMergeSplitAlgorithm *geometryContactAlgorithm, const ConstraintMergeSplitAlgorithm *constraintAlgorithm)
Collect data given sources.
void traverseContactEdgeStrength(const agx::RigidBody *rb, ContactEdgeStrengthVisitorPredicate pred, ContactEdgeStrengthVisitor visitor) const
Traverses all contact edges associated to rb where the visitor arguments are the edge strength and ot...
const agx::MergedBody * getMergedBody() const
agx::Bool calculateContactEdgeStrength(const agx::RigidBody *rb, MergedBodySolverData::ForceFrame &contactStrength) const
Calculates the total contact edge strength given merged rigid body.
const BodyForceDataContainer & getForceData() const
MergedBodySolverData()
Default constructor.
Inheritance with partial specialization due to bug with ref_ptr containers.
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:56
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Vector containing 'raw' data.
Definition: agx/Vector.h:246
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:48
VectorPOD< UInt > UIntVector
uint32_t UInt
Definition: Integer.h:34
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
Object containing force and torque from a graph node.
agx::Vec3 force
Force in world coordinates.
agx::Vec3 torque
Torque in world coordinates.
ForceData(agx::UInt graphNodeIndex, const agx::Vec3 &force, const agx::Vec3 &torque)
agx::UInt graphNodeIndex
Graph node index such that type = postSolveData.getType( graphNodeIndex ).
Force frame where the resultant force is u + v + n.