29#ifndef DY_TGS_DYNAMICS_H
30#define DY_TGS_DYNAMICS_H
33#include "CmSpatialVector.h"
36#include "PxcThreadCoherentCache.h"
37#include "DyThreadContext.h"
38#include "PxcConstraintBlockStream.h"
39#include "DySolverBody.h"
41#include "PxsIslandManagerTypes.h"
42#include "PxvNphaseImplementationContext.h"
43#include "solver/PxSolverDefs.h"
44#include "PxsIslandSim.h"
56 class SimpleIslandManager;
63 class PxsIslandIndices;
64 struct PxsIndexedInteraction;
65 struct PxsIndexedContactManager;
75 struct SolverIslandParams;
76 struct ArticulationSolverDesc;
77 class DynamicsContext;
87 const IG::IslandId* islandIds;
89 PxU32* bodyRemapTable;
90 PxU32* nodeIndexArray;
99 PxU32 solverBodyOffset;
102 contactManagers(NULL), islandIds(NULL), numIslands(0), nodeIndexArray(NULL), constraintDescs(NULL), motionVelocities(NULL), bodyCoreArray(NULL),
116 PxU32 mArticulationOffset;
119 PxReal mBiasCoefficient;
120 PxI32 mSharedSolverIndex;
122 PxI32 mSharedRigidBodyIndex;
123 PxI32 mRigidBodyIntegratedCount;
124 PxI32 mSharedArticulationIndex;
125 PxI32 mArticulationIntegratedCount;
160#pragma warning( disable : 4324 )
181 const bool enableStabilization,
182 const bool useEnhancedDeterminism,
183 const PxReal lengthScale
203#if PX_ENABLE_SIM_STATS
204 void addThreadStats(
const ThreadContext::ThreadSimStats& stats);
206 PX_CATCH_UNDEFINED_ENABLE_SIM_STATS
223 virtual void update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask,
224 PxvNphaseImplementationContext* nphase,
225 const PxU32 maxPatchesPerCM,
const PxU32 maxArticulationLinks,
const PxReal dt,
const PxVec3& gravity, PxBitMapPinned& changedHandleMap);
227 void updatePostKinematic(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation,
228 PxBaseTask* lostTouchTask,
const PxU32 maxLinks);
230 virtual void processLostPatches(IG::SimpleIslandManager& , PxsContactManager** , PxU32 , PxsContactManagerOutputCounts* ){}
231 virtual void processFoundPatches(IG::SimpleIslandManager& , PxsContactManager** , PxU32 , PxsContactManagerOutputCounts* ) {}
235 virtual void setSimulationController(PxsSimulationController* simulationController){ mSimulationController = simulationController; }
241 virtual void getDataStreamBase(
void*& ,
void*& ,
void*& ){}
275 PxcScratchAllocator& scratchAllocator,
276 Cm::FlushPool& taskPool,
277 PxvSimStats& simStats,
278 PxTaskManager* taskManager,
279 PxVirtualAllocatorCallback* allocator,
280 PxsMaterialManager* materialManager,
281 IG::SimpleIslandManager* islandManager,
283 const bool enableStabilization,
284 const bool useEnhancedDeterminism,
285 const PxReal lengthScale
315 const PxU32 solverBodyOffset,
330 PxU32* nodeIndexArray,
const PxU32 bodyCount,
const PxVec3& gravity,
const PxReal dt, PxU32& posIters, PxU32& velIters, PxU32 iteration);
334 PxU32 setupArticulationInternalConstraints(
IslandContextStep& islandContext, PxReal dt, PxReal invStepDt);
338 PxReal invStepDt,
const PxReal biasCoefficient, PxI32 velIters);
343 template <
bool TSync>
349 const PxReal elapsedTime,
const PxReal minPenetration,
SolverContext& cache,
const PxU32 iterCount);
361 const PxTGSSolverBodyData*
const bodyDatas,
const PxU32 count, PxReal dt,
const PxU32 iteration, PxReal invTotalDt,
bool average,
367 PxU32 startIdx, PxU32 endIdx);
369 void updateArticulations(
Dy::ThreadContext& threadContext,
const PxU32 startIdx,
const PxU32 endIdx, PxReal dt);
374 const PxReal stepDt,
const PxReal invStepDt,
const PxU32 posIters,
const PxU32 velIters,
SolverContext& cache,
const PxReal ratio,
375 const PxReal biasCoefficient);
378 const PxReal stepDt,
const PxU32 posIters,
const PxU32 velIters, PxI32* solverCounts, PxI32* integrationCounts, PxI32* articulationIntegrationCounts,
379 PxI32* solverProgressCount, PxI32* integrationProgressCount, PxI32* articulationProgressCount, PxU32 solverUnrollSize, PxU32 integrationUnrollSize,
380 const PxReal ratio,
const PxReal biasCoefficient);
Definition CmFlushPool.h:49
Definition CmSpatialVector.h:46
Definition DyContext.h:76
PxReal mLengthScale
The length scale from PxTolerancesScale::length.
Definition DyContext.h:346
Definition DyTGSDynamics.cpp:3224
Definition DyTGSDynamics.h:164
virtual ~DynamicsTGSContext()
Destructor for DynamicsContext.
Definition DyTGSDynamics.cpp:371
virtual void mergeResults()
This method combines the results of several islands, e.g. constructing scene-level simulation statist...
Definition DyTGSDynamics.cpp:3399
void setDescFromIndices(PxSolverConstraintDesc &desc, const IG::IslandSim &islandSim, const PxsIndexedInteraction &constraint, const PxU32 solverBodyOffset, PxTGSSolverBodyVel *solverBodies)
fills in a PxSolverConstraintDesc from an indexed interaction
Definition DyTGSDynamics.cpp:377
static DynamicsTGSContext * create(PxcNpMemBlockPool *memBlockPool, PxcScratchAllocator &scratchAllocator, Cm::FlushPool &taskPool, PxvSimStats &simStats, PxTaskManager *taskManager, PxVirtualAllocatorCallback *allocator, PxsMaterialManager *materialManager, IG::SimpleIslandManager *islandManager, PxU64 contextID, const bool enableStabilization, const bool useEnhancedDeterminism, const PxReal lengthScale)
Creates a DynamicsContext associated with a PxsContext.
Definition DyTGSDynamics.cpp:146
void putThreadContext(ThreadContext *context)
Returns a thread context to the thread context pool.
Definition DyTGSDynamics.h:258
DynamicsTGSContext(PxcNpMemBlockPool *memBlockPool, PxcScratchAllocator &scratchAllocator, Cm::FlushPool &taskPool, PxvSimStats &simStats, PxTaskManager *taskManager, PxVirtualAllocatorCallback *allocator, PxsMaterialManager *materialManager, IG::SimpleIslandManager *islandManager, PxU64 contextID, const bool enableStabilization, const bool useEnhancedDeterminism, const PxReal lengthScale)
Constructor for DynamicsContext.
Definition DyTGSDynamics.cpp:327
void computeUnconstrainedVelocity(PxsRigidBody *atom) const
Computes the unconstrained velocity for a given PxsRigidBody.
virtual void updateBodyCore(PxBaseTask *continuation)
This method copy gpu solver body data to cpu body core.
Definition DyTGSDynamics.cpp:3394
PxArray< PxsBodyCore * > mBodyCoreArray
Array of body core pointers for all bodies in the scene.
Definition DyTGSDynamics.h:428
void destroy()
Destroys this DynamicsContext.
Definition DyTGSDynamics.cpp:169
PxI32 mThresholdStreamOut
Atomic counter for the number of threshold stream elements.
Definition DyTGSDynamics.h:465
PxArray< FeatherstoneArticulation * > mArticulationArray
Array of articulationpointers for all articulations in the scene.
Definition DyTGSDynamics.h:438
PxArray< Cm::SpatialVector > mMotionVelocityArray
Array of motion velocities for all bodies in the scene.
Definition DyTGSDynamics.h:423
PxArray< PxsRigidBody * > mRigidBodyArray
Array of rigid body pointers for all bodies in the scene.
Definition DyTGSDynamics.h:433
SolverStepConstraintDescPool mSolverConstraintDescPool
Solver constraint desc array.
Definition DyTGSDynamics.h:412
PX_FORCE_INLINE ThreadContext * getThreadContext()
Allocates and returns a thread context object.
Definition DyTGSDynamics.h:249
void resetThreadContexts()
Resets the thread contexts.
Definition DyTGSDynamics.cpp:175
PxcThreadCoherentCache< ThreadContext, PxcNpMemBlockPool > mThreadContextPool
A thread context pool.
Definition DyTGSDynamics.h:407
PxU32 mKinematicCount
The total number of kinematic bodies in the scene.
Definition DyTGSDynamics.h:460
PX_FORCE_INLINE PxcScratchAllocator & getScratchAllocator()
Returns the scratch memory allocator.
Definition DyTGSDynamics.h:396
PX_FORCE_INLINE Cm::FlushPool & getTaskPool()
Returns the static world solver body.
Definition DyTGSDynamics.h:197
virtual PX_CATCH_UNDEFINED_ENABLE_SIM_STATS void update(IG::SimpleIslandManager &simpleIslandManager, PxBaseTask *continuation, PxBaseTask *lostTouchTask, PxvNphaseImplementationContext *nphase, const PxU32 maxPatchesPerCM, const PxU32 maxArticulationLinks, const PxReal dt, const PxVec3 &gravity, PxBitMapPinned &changedHandleMap)
The entry point for the constraint solver.
Definition DyTGSDynamics.cpp:615
Definition DyTGSDynamics.cpp:2667
Definition DyFeatherstoneArticulation.h:590
Definition DyTGSDynamics.cpp:2689
Definition DyTGSDynamics.cpp:2456
Definition DyTGSDynamics.cpp:1917
Definition DyTGSDynamics.cpp:1961
Definition DyTGSDynamics.cpp:2106
Definition DyTGSDynamics.cpp:2074
Definition DyTGSDynamics.cpp:1887
Definition DyTGSDynamics.cpp:2131
Definition DyTGSDynamics.cpp:2244
Definition DyTGSDynamics.cpp:2487
Definition DyTGSDynamics.h:145
Definition DyTGSDynamics.h:138
Definition DyTGSDynamics.h:131
Definition DyTGSDynamics.h:152
Definition DyThreadContext.h:65
Definition DyThresholdTable.h:81
Definition DyTGSDynamics.cpp:3257
Definition PxsIslandSim.h:412
Definition PxsSimpleIslandManager.h:87
Base class of all task types.
Definition PxTask.h:45
The PxTaskManager interface.
Definition PxTaskManager.h:81
3 Element vector class.
Definition PxVec3.h:50
Definition PxAllocator.h:140
Definition PxcNpMemBlockPool.h:52
Definition PxcScratchAllocator.h:42
Definition PxcThreadCoherentCache.h:52
Definition PxsIslandManagerTypes.h:78
Definition PxsMaterialManager.h:126
Definition PxsRigidBody.h:43
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition DyTGSDynamics.h:109
Definition DySolverContext.h:42
Definition DyTGSDynamics.h:81
Constraint descriptor used inside the solver.
Definition PxSolverDefs.h:108
Enum
Definition PxSceneDesc.h:89
@ eTGS
Default Temporal Gauss-Seidel solver.
Definition PxSceneDesc.h:91
Definition PxSolverDefs.h:446
Definition PxSolverDefs.h:440
Definition PxSolverDefs.h:419
Definition PxvDynamics.h:74
Each contact manager or constraint references two separate bodies, where a body can be a dynamic rigi...
Definition PxsIslandManagerTypes.h:101
Definition PxvSimStats.h:52