Bullet Collision Detection & Physics Library
|
btSequentialImpulseConstraintSolverMt More...
#include <btSequentialImpulseConstraintSolverMt.h>
Classes | |
struct | btContactManifoldCachedInfo |
struct | JointParams |
Static Public Attributes | |
static bool | s_allowNestedParallelForLoops = false |
static int | s_minimumContactManifoldsForBatching = 250 |
static btBatchedConstraints::BatchingMethod | s_contactBatchingMethod = btBatchedConstraints::BATCHING_METHOD_SPATIAL_GRID_2D |
static btBatchedConstraints::BatchingMethod | s_jointBatchingMethod = btBatchedConstraints::BATCHING_METHOD_SPATIAL_GRID_2D |
static int | s_minBatchSize = 50 |
static int | s_maxBatchSize = 100 |
Protected Member Functions | |
virtual void | randomizeConstraintOrdering (int iteration, int numIterations) |
virtual btScalar | resolveAllJointConstraints (int iteration) |
virtual btScalar | resolveAllContactConstraints () |
virtual btScalar | resolveAllContactFrictionConstraints () |
virtual btScalar | resolveAllContactConstraintsInterleaved () |
virtual btScalar | resolveAllRollingFrictionConstraints () |
virtual void | setupBatchedContactConstraints () |
virtual void | setupBatchedJointConstraints () |
virtual void | convertJoints (btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal) BT_OVERRIDE |
virtual void | convertContacts (btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal) BT_OVERRIDE |
virtual void | convertBodies (btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal) BT_OVERRIDE |
int | getOrInitSolverBodyThreadsafe (btCollisionObject &body, btScalar timeStep) |
void | allocAllContactConstraints (btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal) |
void | setupAllContactConstraints (const btContactSolverInfo &infoGlobal) |
void | randomizeBatchedConstraintOrdering (btBatchedConstraints *batchedConstraints) |
![]() | |
void | setupSolverFunctions (bool useSimd) |
void | setupFrictionConstraint (btSolverConstraint &solverConstraint, const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, const btContactSolverInfo &infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.) |
void | setupTorsionalFrictionConstraint (btSolverConstraint &solverConstraint, const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, btScalar combinedTorsionalFriction, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.) |
btSolverConstraint & | addFrictionConstraint (const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, int frictionIndex, btManifoldPoint &cp, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, const btContactSolverInfo &infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.) |
btSolverConstraint & | addTorsionalFrictionConstraint (const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, int frictionIndex, btManifoldPoint &cp, btScalar torsionalFriction, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, btScalar desiredVelocity=0, btScalar cfmSlip=0.f) |
void | setupContactConstraint (btSolverConstraint &solverConstraint, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal, btScalar &relaxation, const btVector3 &rel_pos1, const btVector3 &rel_pos2) |
void | setFrictionConstraintImpulse (btSolverConstraint &solverConstraint, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal) |
btScalar | restitutionCurve (btScalar rel_vel, btScalar restitution, btScalar velocityThreshold) |
virtual void | convertContacts (btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal) |
void | convertContact (btPersistentManifold *manifold, const btContactSolverInfo &infoGlobal) |
virtual void | convertJoints (btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal) |
void | convertJoint (btSolverConstraint *currentConstraintRow, btTypedConstraint *constraint, const btTypedConstraint::btConstraintInfo1 &info1, int solverBodyIdA, int solverBodyIdB, const btContactSolverInfo &infoGlobal) |
virtual void | convertBodies (btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal) |
btScalar | resolveSplitPenetrationSIMD (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
btScalar | resolveSplitPenetrationImpulseCacheFriendly (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
int | getOrInitSolverBody (btCollisionObject &body, btScalar timeStep) |
void | initSolverBody (btSolverBody *solverBody, btCollisionObject *collisionObject, btScalar timeStep) |
btScalar | resolveSingleConstraintRowGeneric (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
btScalar | resolveSingleConstraintRowGenericSIMD (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
btScalar | resolveSingleConstraintRowLowerLimit (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
btScalar | resolveSingleConstraintRowLowerLimitSIMD (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
btScalar | resolveSplitPenetrationImpulse (btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint) |
void | writeBackContacts (int iBegin, int iEnd, const btContactSolverInfo &infoGlobal) |
void | writeBackJoints (int iBegin, int iEnd, const btContactSolverInfo &infoGlobal) |
void | writeBackBodies (int iBegin, int iEnd, const btContactSolverInfo &infoGlobal) |
virtual void | solveGroupCacheFriendlySplitImpulseIterations (btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer) |
virtual btScalar | solveGroupCacheFriendlyFinish (btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal) |
virtual btScalar | solveSingleIteration (int iteration, btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer) |
virtual btScalar | solveGroupCacheFriendlySetup (btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer) |
virtual btScalar | solveGroupCacheFriendlyIterations (btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer) |
Static Protected Attributes | |
static const int | CACHE_LINE_SIZE = 64 |
Additional Inherited Members | |
![]() | |
btSolverAnalyticsData | m_analyticsData |
![]() | |
static void | applyAnisotropicFriction (btCollisionObject *colObj, btVector3 &frictionDirection, int frictionMode) |
btSequentialImpulseConstraintSolverMt
A multithreaded variant of the sequential impulse constraint solver. The constraints to be solved are grouped into batches and phases where each batch of constraints within a given phase can be solved in parallel with the rest. Ideally we want as few phases as possible, and each phase should have many batches, and all of the batches should have about the same number of constraints. This method works best on a large island of many constraints.
Supports all of the features of the normal sequential impulse solver such as:
When the SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS flag is enabled, unlike the normal SequentialImpulse solver, the rolling friction is interleaved as well. Interleaving the contact penetration constraints with friction reduces the number of parallel loops that need to be done, which reduces threading overhead so it can be a performance win, however, it does seem to produce a less stable simulation, at least on stacks of blocks.
When the SOLVER_RANDMIZE_ORDER flag is enabled, the ordering of phases, and the ordering of constraints within each batch is randomized, however it does not swap constraints between batches. This is to avoid regenerating the batches for each solver iteration which would be quite costly in performance.
Note that a non-zero leastSquaresResidualThreshold could possibly affect the determinism of the simulation if the task scheduler's parallelSum operation is non-deterministic. The parallelSum operation can be non-deterministic because floating point addition is not associative due to rounding errors. The task scheduler can and should ensure that the result of any parallelSum operation is deterministic.
Definition at line 56 of file btSequentialImpulseConstraintSolverMt.h.
btSequentialImpulseConstraintSolverMt::btSequentialImpulseConstraintSolverMt | ( | ) |
Definition at line 32 of file btSequentialImpulseConstraintSolverMt.cpp.
|
virtual |
Definition at line 39 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protected |
Definition at line 513 of file btSequentialImpulseConstraintSolverMt.cpp.
btSequentialImpulseConstraintSolverMt::BT_DECLARE_ALIGNED_ALLOCATOR | ( | ) |
|
protectedvirtual |
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 802 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 573 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
setup the btSolverConstraints
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 686 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protected |
Definition at line 297 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalAllocContactConstraints | ( | const btContactManifoldCachedInfo * | cachedInfoArray, |
int | numManifolds | ||
) |
Definition at line 450 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalCollectContactManifoldCachedInfo | ( | btContactManifoldCachedInfo * | cachedInfoArray, |
btPersistentManifold ** | manifoldPtr, | ||
int | numManifolds, | ||
const btContactSolverInfo & | infoGlobal | ||
) |
Definition at line 389 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalConvertBodies | ( | btCollisionObject ** | bodies, |
int | iBegin, | ||
int | iEnd, | ||
const btContactSolverInfo & | infoGlobal | ||
) |
Definition at line 747 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalConvertMultipleJoints | ( | const btAlignedObjectArray< JointParams > & | jointParamsArray, |
btTypedConstraint ** | constraints, | ||
int | iBegin, | ||
int | iEnd, | ||
const btContactSolverInfo & | infoGlobal | ||
) |
Definition at line 643 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalInitMultipleJoints | ( | btTypedConstraint ** | constraints, |
int | iBegin, | ||
int | iEnd | ||
) |
Definition at line 598 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalSetupContactConstraints | ( | int | iContactConstraint, |
const btContactSolverInfo & | infoGlobal | ||
) |
Bullet has several options to set the friction directions By default, each contact has only a single friction direction that is recomputed automatically very frame based on the relative linear velocity. If the relative velocity it zero, it will automatically compute a friction direction.
You can also enable two friction directions, using the SOLVER_USE_2_FRICTION_DIRECTIONS. In that case, the second friction direction will be orthogonal to both contact normal and first friction direction.
If you choose SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION, then the friction will be independent from the relative projected velocity.
The user can manually override the friction directions for certain contacts using a contact callback, and set the cp.m_lateralFrictionInitialized to true In that case, you can set the target relative motion in each friction direction (cp.m_contactMotion1 and cp.m_contactMotion2) this will give a conveyor belt effect
Definition at line 65 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalWriteBackBodies | ( | int | iBegin, |
int | iEnd, | ||
const btContactSolverInfo & | infoGlobal | ||
) |
Definition at line 1471 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalWriteBackContacts | ( | int | iBegin, |
int | iEnd, | ||
const btContactSolverInfo & | infoGlobal | ||
) |
Definition at line 1447 of file btSequentialImpulseConstraintSolverMt.cpp.
void btSequentialImpulseConstraintSolverMt::internalWriteBackJoints | ( | int | iBegin, |
int | iEnd, | ||
const btContactSolverInfo & | infoGlobal | ||
) |
Definition at line 1465 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protected |
Definition at line 1168 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 1192 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 1268 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 1346 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 1307 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 1229 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 1385 of file btSequentialImpulseConstraintSolverMt.cpp.
btScalar btSequentialImpulseConstraintSolverMt::resolveMultipleContactConstraints | ( | const btAlignedObjectArray< int > & | consIndices, |
int | batchBegin, | ||
int | batchEnd | ||
) |
Definition at line 1013 of file btSequentialImpulseConstraintSolverMt.cpp.
btScalar btSequentialImpulseConstraintSolverMt::resolveMultipleContactConstraintsInterleaved | ( | const btAlignedObjectArray< int > & | contactIndices, |
int | batchBegin, | ||
int | batchEnd | ||
) |
Definition at line 1099 of file btSequentialImpulseConstraintSolverMt.cpp.
btScalar btSequentialImpulseConstraintSolverMt::resolveMultipleContactFrictionConstraints | ( | const btAlignedObjectArray< int > & | consIndices, |
int | batchBegin, | ||
int | batchEnd | ||
) |
Definition at line 1028 of file btSequentialImpulseConstraintSolverMt.cpp.
btScalar btSequentialImpulseConstraintSolverMt::resolveMultipleContactRollingFrictionConstraints | ( | const btAlignedObjectArray< int > & | consIndices, |
int | batchBegin, | ||
int | batchEnd | ||
) |
Definition at line 1059 of file btSequentialImpulseConstraintSolverMt.cpp.
btScalar btSequentialImpulseConstraintSolverMt::resolveMultipleContactSplitPenetrationImpulseConstraints | ( | const btAlignedObjectArray< int > & | consIndices, |
int | batchBegin, | ||
int | batchEnd | ||
) |
Definition at line 858 of file btSequentialImpulseConstraintSolverMt.cpp.
btScalar btSequentialImpulseConstraintSolverMt::resolveMultipleJointConstraints | ( | const btAlignedObjectArray< int > & | consIndices, |
int | batchBegin, | ||
int | batchEnd, | ||
int | iteration | ||
) |
Definition at line 995 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protected |
Definition at line 273 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 43 of file btSequentialImpulseConstraintSolverMt.cpp.
|
protectedvirtual |
Definition at line 54 of file btSequentialImpulseConstraintSolverMt.cpp.
|
virtual |
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 1525 of file btSequentialImpulseConstraintSolverMt.cpp.
|
virtual |
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 828 of file btSequentialImpulseConstraintSolverMt.cpp.
|
virtual |
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 896 of file btSequentialImpulseConstraintSolverMt.cpp.
|
virtual |
solve all joint constraints
Reimplemented from btSequentialImpulseConstraintSolver.
Definition at line 933 of file btSequentialImpulseConstraintSolverMt.cpp.
|
staticprotected |
Definition at line 96 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 106 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 98 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 99 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 105 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 107 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 103 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 100 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 104 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 108 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 101 of file btSequentialImpulseConstraintSolverMt.h.
|
protected |
Definition at line 102 of file btSequentialImpulseConstraintSolverMt.h.
|
static |
Definition at line 88 of file btSequentialImpulseConstraintSolverMt.h.
|
static |
Definition at line 90 of file btSequentialImpulseConstraintSolverMt.h.
|
static |
Definition at line 91 of file btSequentialImpulseConstraintSolverMt.h.
|
static |
Definition at line 93 of file btSequentialImpulseConstraintSolverMt.h.
|
static |
Definition at line 92 of file btSequentialImpulseConstraintSolverMt.h.
|
static |
Definition at line 89 of file btSequentialImpulseConstraintSolverMt.h.