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"
55 class SimpleIslandManager;
62class PxsIslandIndices;
63struct PxsIndexedInteraction;
64struct PxsIndexedContactManager;
65struct PxSolverConstraintDesc;
75 struct SolverIslandParams;
76 struct ArticulationSolverDesc;
78 class DynamicsContext;
83#define SOLVER_PARALLEL_METHOD_ARGS \
84 DynamicsContext& context, \
85 SolverIslandParams& params, \
86 IG::IslandSim& islandSim
91void solveParallel(SOLVER_PARALLEL_METHOD_ARGS);
92void solveParallelCouloumFriction(SOLVER_PARALLEL_METHOD_ARGS);
95struct SolverIslandObjects;
143 #pragma warning(push)
144 #pragma warning( disable : 4324 )
166 const bool enableStabilization,
167 const bool useEnhancedDeterminism,
168 const PxReal maxBiasCoefficient,
169 const bool frictionEveryIteration,
170 const PxReal lengthScale
186 PX_FORCE_INLINE ThresholdStream& getThresholdStream() {
return *mThresholdStream; }
190#if PX_ENABLE_SIM_STATS
191 void addThreadStats(
const ThreadContext::ThreadSimStats& stats);
193 PX_CATCH_UNDEFINED_ENABLE_SIM_STATS
210 virtual void update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask,
211 PxvNphaseImplementationContext* nPhase,
const PxU32 maxPatchesPerCM,
const PxU32 maxArticulationLinks,
const PxReal dt,
const PxVec3& gravity, PxBitMapPinned& changedHandleMap);
214 void updatePostKinematic(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask,
const PxU32 maxLinks);
216 virtual void processLostPatches(IG::SimpleIslandManager& , PxsContactManager** , PxU32 , PxsContactManagerOutputCounts* ){}
217 virtual void processFoundPatches(IG::SimpleIslandManager& , PxsContactManager** , PxU32 , PxsContactManagerOutputCounts* ) {}
221 virtual void setSimulationController(PxsSimulationController* simulationController ){ mSimulationController = simulationController; }
227 virtual void getDataStreamBase(
void*& ,
void*& ,
void*& ){}
258 DynamicsContext(PxcNpMemBlockPool* memBlockPool,
259 PxcScratchAllocator& scratchAllocator,
260 Cm::FlushPool& taskPool,
261 PxvSimStats& simStats,
262 PxTaskManager* taskManager,
263 PxVirtualAllocatorCallback* allocator,
264 PxsMaterialManager* materialManager,
265 IG::SimpleIslandManager* islandManager,
267 const bool enableStabilization,
268 const bool useEnhancedDeterminism,
269 const PxReal maxBiasCoefficient,
270 const bool frictionEveryIteration,
271 const PxReal lengthScale
316 PxU32
const* nodeIndexArray,
321 PxU32& maxSolverPositionIterations,
322 PxU32& maxSolverVelocityIterations,
462 friend class PxsSolverAticulationsTask;
463 friend class PxsSolverSetupConstraintsTask;
467 friend class PxsSolverIntegrateTask;
Definition CmFlushPool.h:49
Definition CmSpatialVector.h:46
Definition DyContext.h:76
Encapsules the data used by the constraint solver.
Definition DyDynamics.h:149
PX_FORCE_INLINE PxcScratchAllocator & getScratchAllocator()
Returns the scratch memory allocator.
Definition DyDynamics.h:350
void resetThreadContexts()
Resets the thread contexts.
Definition DyDynamics.cpp:146
SolverConstraintDescPool mSolverConstraintDescPool
Solver constraint desc array.
Definition DyDynamics.h:371
virtual void mergeResults()
This method combines the results of several islands, e.g. constructing scene-level simulation statist...
Definition DyDynamics.cpp:2384
SolverCore * mSolverCore[PxFrictionType::eFRICTION_COUNT]
Interface to the solver core.
Definition DyDynamics.h:426
PxArray< PxConstraintBatchHeader > mContactConstraintBatchHeaders
An array of contact constraint batch headers.
Definition DyDynamics.h:386
PxI32 mThresholdStreamOut
Atomic counter for the number of threshold stream elements.
Definition DyDynamics.h:442
void computeUnconstrainedVelocity(PxsRigidBody *atom) const
Computes the unconstrained velocity for a given PxsRigidBody.
PxArray< PxsBodyCore * > mBodyCoreArray
Array of body core pointers for all bodies in the scene.
Definition DyDynamics.h:396
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 DyDynamics.cpp:2107
virtual void updateBodyCore(PxBaseTask *continuation)
This method copy gpu solver body data to cpu body core.
Definition DyDynamics.cpp:2379
PX_ALIGN(16, PxSolverBody mWorldSolverBody)
Body to represent the world static body.
SolverConstraintDescPool mTempSolverConstraintDescPool
A temporary array of constraint descs used for partitioning.
Definition DyDynamics.h:381
PX_ALIGN(16, PxSolverBodyData mWorldSolverBodyData)
Body data to represent the world static body.
virtual ~DynamicsContext()
Destructor for DynamicsContext.
Definition DyDynamics.cpp:209
PxU32 mKinematicCount
The total number of kinematic bodies in the scene.
Definition DyDynamics.h:437
SolverBodyDataPool mSolverBodyDataPool
Global pool for solver body data. Kinematic bodies are at the start, and then dynamic bodies.
Definition DyDynamics.h:415
void setDescFromIndices(PxSolverConstraintDesc &desc, const IG::IslandSim &islandSim, const PxsIndexedInteraction &constraint, const PxU32 solverBodyOffset)
fills in a PxSolverConstraintDesc from an indexed interaction
Definition DyDynamics.cpp:234
void destroy()
Destroys this DynamicsContext.
Definition DyDynamics.cpp:140
void solveParallel(SolverIslandParams ¶ms, IG::IslandSim &islandSim, Cm::SpatialVectorF *Z, Cm::SpatialVectorF *deltaV)
Solves an island in parallel.
Definition DyDynamics.cpp:2538
PxArray< FeatherstoneArticulation * > mArticulationArray
Array of articulation pointers for all articulations in the scene.
Definition DyDynamics.h:406
void preIntegrationParallel(const PxF32 dt, PxsBodyCore *const *bodyArray, PxsRigidBody *const *originalBodyArray, PxU32 const *nodeIndexArray, PxU32 bodyCount, PxSolverBody *solverBodyPool, PxSolverBodyData *solverBodyDataPool, Cm::SpatialVector *motionVelocityArray, PxU32 &maxSolverPositionIterations, PxU32 &maxSolverVelocityIterations, PxBaseTask &integrateTask)
Compute the unconstrained velocity for set of bodies in parallel. This function may spawn additional ...
Definition DyDynamics.cpp:2476
PxArray< PxsRigidBody * > mRigidBodyArray
Array of rigid body pointers for all bodies in the scene.
Definition DyDynamics.h:401
PX_FORCE_INLINE PxSolverBody & getWorldSolverBody()
Returns the static world solver body.
Definition DyDynamics.h:182
PxArray< Cm::SpatialVector > mMotionVelocityArray
Array of motion velocities for all bodies in the scene.
Definition DyDynamics.h:391
SolverConstraintDescPool mOrderedSolverConstraintDescPool
Ordered sover constraint desc array (after partitioning)
Definition DyDynamics.h:376
PX_FORCE_INLINE ThreadContext * getThreadContext()
Allocates and returns a thread context object.
Definition DyDynamics.h:235
SolverBodyPool mSolverBodyPool
Global pool for solver bodies. Kinematic bodies are at the start, and then dynamic bodies.
Definition DyDynamics.h:411
static DynamicsContext * 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 maxBiasCoefficient, const bool frictionEveryIteration, const PxReal lengthScale)
Creates a DynamicsContext associated with a PxsContext.
Definition DyDynamics.cpp:114
void putThreadContext(ThreadContext *context)
Returns a thread context to the thread context pool.
Definition DyDynamics.h:244
PxcThreadCoherentCache< ThreadContext, PxcNpMemBlockPool > mThreadContextPool
A thread context pool.
Definition DyDynamics.h:366
Definition DyDynamics.cpp:611
Definition DyDynamics.cpp:1405
Definition DyDynamics.cpp:456
Definition DyDynamics.cpp:1966
Definition DyDynamics.cpp:1861
Definition DyDynamics.cpp:1488
Definition DyDynamics.cpp:830
Definition DyDynamics.cpp:740
Solver body data pool (array) that enforces 128-byte alignment for base address of array.
Definition DyDynamics.h:113
Solver body pool (array) that enforces 128-byte alignment for base address of array.
Definition DyDynamics.h:102
Definition DyDynamics.h:120
Definition DySolverCore.h:217
Definition DyThreadContext.h:65
Definition DyThresholdTable.h:81
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
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 CmSpatialVector.h:134
Encapsulates an island's context.
Definition DyDynamics.h:131
Definition DySolverCore.h:155
@ eFRICTION_COUNT
The total number of friction models supported by the SDK.
Definition PxSceneDesc.h:75
Struct that the solver uses to store the state and other properties of a body.
Definition PxSolverDefs.h:74
Struct that the solver uses to store velocity updates for a body.
Definition PxSolverDefs.h:55
Constraint descriptor used inside the solver.
Definition PxSolverDefs.h:108
Enum
Definition PxSceneDesc.h:89
@ ePGS
Projected Gauss-Seidel iterative solver.
Definition PxSceneDesc.h:90
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