22 #define REPORT_SYSTEM_JOB_ENABLE 1 23 #if REPORT_SYSTEM_JOB_ENABLE 35 #define REPORT_SYSTEM_JOB_EX( str )\ 36 auto sjrtb = agxUtil::TimerBlock( []( agx::UInt64 start, agx::UInt64 stop )\ 38 agx::Thread::getCurrentThread()->reportSystemJob( start, stop, str );\ 41 #define REPORT_SYSTEM_JOB\ 42 const char* AGX_CONCAT(agx_functionName,__LINE__) = __FUNCTION__; \ 43 auto sjrtb = agxUtil::TimerBlock( [AGX_CONCAT(agx_functionName,__LINE__)]( agx::UInt64 start, agx::UInt64 stop )\ 45 agx::Thread::getCurrentThread()->reportSystemJob( start, stop, AGX_CONCAT(agx_functionName,__LINE__) );\ 48 #define REPORT_SYSTEM_JOB_EX( str ) 49 #define REPORT_SYSTEM_JOB 56 class WireDistanceCompositeConstraint;
61 namespace MergeSplitUtils
76 return ( linVel + ( angVel ^ ( point - cmPos ) ) );
115 return ( relVel + ( angVel1 ^ ( point - cmPos1 ) ) + ( ( point - cmPos2 ) ^ angVel2 ) );
155 : shouldSplit( false ), rbTop( nullptr ), rbBottom( nullptr ) {}
199 agx::MergedBody::EdgeInteraction::InteractionTag edgeTag,
208 using BfsQueueContainer = std::queue<const agx::RigidBody*>;
210 VisitedContainer visited;
211 VisitedPairContainer visitedPairs;
212 BfsQueueContainer bfsQueue;
214 const auto visit = [&visited, &bfsQueue](
const agx::RigidBody* rb )
217 visited.insert( rb );
223 SymmetricRigidBodyPtrPair rb1Rb2Pair( rb1, rb2 );
224 if ( visitedPairs.contains( rb1Rb2Pair ) )
227 visitedPairs.insert( rb1Rb2Pair );
235 auto front = bfsQueue.front();
240 visit( referenceEdge.getRigidBody1() );
241 while ( !bfsQueue.empty() ) {
242 const auto rb = pop();
246 for (
const auto neighbor : *neighbors ) {
247 if ( visitedPair( neighbor, rb ) )
250 const auto edges = mergedBody.
getEdges( neighbor, rb );
252 auto oneHasEdgeTag =
false;
253 for (
const auto& edge : *edges ) {
254 const auto edgeHasTag = edge->isTagged( edgeTag );
255 oneHasEdgeTag = oneHasEdgeTag || edgeHasTag;
256 if ( edge != &referenceEdge && edgeHasTag ) {
258 result.
push_back( edge->template as<T>() );
265 const auto visitThisNeighbor = neighbor !=
nullptr &&
267 ( !bounceAtNonSplittableBodies || handler.
maySplit( neighbor ) ) &&
268 !visited.contains( neighbor );
269 if ( visitThisNeighbor )
312 using State = agx::BitState<EState, agx::UInt32>;
331 State getState()
const;
364 const agxWire::WireDistanceCompositeConstraint* m_wire;
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Inheritance with partial specialization due to bug with ref_ptr containers.
AGXPHYSICS_EXPORT ExternalForceSplitResult shouldSplitGivenExternalForce(agxSDK::MergedBodySolverData::ForceFrame edgeStrength, const agx::RigidBody *rb, const agx::RigidBody *otherRb, const agx::Vec3 &externalForces, const agx::Vec3 &externalTorques, const agx::Vec3 &gravity, const agxSDK::MergeSplitHandler &handler)
Checks if two bodies should split given edge strength force frame and external forces.
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a) ...
Force frame where the resultant force is u + v + n.
AGXPHYSICS_EXPORT agxSDK::MergedBodySolverData::ForceFrame calculateContactForceFrame(const agx::RigidBody *refRb, const agx::MergedBody::GeometryContactEdgeInteraction *contactEdge, const MergeSplitHandler *handler=nullptr)
Calculates force frame (edge strength) given reference rigid body, contact edge and optionally an mer...
GeometryContactEdgeInteraction()
Default constructor used by serialization.
Base class for a merge split algorithm handling a set of merged bodies.
const agx::RigidBodyPtrVector * getNeighbors(const agx::RigidBody *rb) const
bool contains(const T2 &element) const
Test if the vector contains a certain element.
#define AGXPHYSICS_EXPORT
void collectConnectingEdges(const T &referenceEdge, agx::MergedBody::EdgeInteraction::InteractionTag edgeTag, agx::Bool bounceAtNonSplittableBodies, const agx::MergedBody &mergedBody, const MergeSplitHandler &handler, CollectConnectingEdgesPtrContainer< T > &result)
Collects edges of given type/tag that are connected within a merged body.
ExternalForceSplitResult()
const agx::RigidBody * rbBottom
agx::Vec3 calculateRelativePointVelocity(const agx::Vec3 &point, const agx::Vec3 &relVel, const agx::Vec3 &cmPos1, const agx::Vec3 &angVel1, const agx::Vec3 &cmPos2, const agx::Vec3 &angVel2)
Calculates relative velocity at a point relative to two bodies.
Structure holding several "normal" rigid bodies.
The body fixed node is attached to a body at a given offset.
agx::Bool maySplit(const agx::RigidBody *rb) const
Interface and placeholder of controllers/helpers for wires.
Vector containing 'raw' data.
const EdgeInteractionRefContainer * getEdges(const agx::RigidBody *rb1, const agx::RigidBody *rb2) const
Implements a Wire model with adaptive resolution.
agx::Real calculateImpactSpeed(const agx::Vec3 &point, const agx::Vec3f &normal, const agx::Vec3 &relVel, const agx::Vec3 &cmPos1, const agx::Vec3 &angVel1, const agx::Vec3 &cmPos2, const agx::Vec3 &angVel2)
Calculates impact speed of two rigid bodies given contact point and normal.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
The rigid body class, combining a geometric model and a frame of reference.
const agx::RigidBody * rbTop
Wire merged state segment along a wire.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
agx::BitState< EState, agx::UInt32 > State
Class defining a node that is part of a wire.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
void push_back(const T2 &value)