Bullet Collision Detection & Physics Library
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
btConstraintSolverPoolMt Class Reference

btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of them. More...

#include <btDiscreteDynamicsWorldMt.h>

Inheritance diagram for btConstraintSolverPoolMt:
Inheritance graph
[legend]
Collaboration diagram for btConstraintSolverPoolMt:
Collaboration graph
[legend]

Classes

struct  ThreadSolver
 

Public Member Functions

 btConstraintSolverPoolMt (int numSolvers)
 
 btConstraintSolverPoolMt (btConstraintSolver **solvers, int numSolvers)
 
virtual ~btConstraintSolverPoolMt ()
 
virtual btScalar solveGroup (btCollisionObject **bodies, int numBodies, btPersistentManifold **manifolds, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &info, btIDebugDraw *debugDrawer, btDispatcher *dispatcher) BT_OVERRIDE
 solve a group of constraints More...
 
virtual void reset () BT_OVERRIDE
 clear internal cached data and reset random seed More...
 
virtual btConstraintSolverType getSolverType () const BT_OVERRIDE
 
- Public Member Functions inherited from btConstraintSolver
virtual ~btConstraintSolver ()
 
virtual void prepareSolve (int, int)
 
virtual void allSolved (const btContactSolverInfo &, class btIDebugDraw *)
 

Private Member Functions

ThreadSolvergetAndLockThreadSolver ()
 btConstraintSolverPoolMt More...
 
void init (btConstraintSolver **solvers, int numSolvers)
 

Private Attributes

btAlignedObjectArray< ThreadSolverm_solvers
 
btConstraintSolverType m_solverType
 

Static Private Attributes

static const size_t kCacheLineSize = 128
 

Detailed Description

btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of them.

Each solver in the pool is protected by a mutex. When solveGroup is called from a thread, the pool looks for a solver that isn't being used by another thread, locks it, and dispatches the call to the solver. So long as there are at least as many solvers as there are hardware threads, it should never need to spin wait.

Definition at line 34 of file btDiscreteDynamicsWorldMt.h.

Constructor & Destructor Documentation

btConstraintSolverPoolMt::btConstraintSolverPoolMt ( int  numSolvers)
explicit

Definition at line 92 of file btDiscreteDynamicsWorldMt.cpp.

btConstraintSolverPoolMt::btConstraintSolverPoolMt ( btConstraintSolver **  solvers,
int  numSolvers 
)

Definition at line 105 of file btDiscreteDynamicsWorldMt.cpp.

btConstraintSolverPoolMt::~btConstraintSolverPoolMt ( )
virtual

Definition at line 110 of file btDiscreteDynamicsWorldMt.cpp.

Member Function Documentation

btConstraintSolverPoolMt::ThreadSolver * btConstraintSolverPoolMt::getAndLockThreadSolver ( )
private
virtual btConstraintSolverType btConstraintSolverPoolMt::getSolverType ( ) const
inlinevirtual

Implements btConstraintSolver.

Definition at line 58 of file btDiscreteDynamicsWorldMt.h.

void btConstraintSolverPoolMt::init ( btConstraintSolver **  solvers,
int  numSolvers 
)
private

Definition at line 77 of file btDiscreteDynamicsWorldMt.cpp.

void btConstraintSolverPoolMt::reset ( )
virtual

clear internal cached data and reset random seed

Implements btConstraintSolver.

Definition at line 139 of file btDiscreteDynamicsWorldMt.cpp.

btScalar btConstraintSolverPoolMt::solveGroup ( btCollisionObject **  bodies,
int  numBodies,
btPersistentManifold **  manifolds,
int  numManifolds,
btTypedConstraint **  constraints,
int  numConstraints,
const btContactSolverInfo info,
btIDebugDraw debugDrawer,
btDispatcher dispatcher 
)
virtual

solve a group of constraints

Implements btConstraintSolver.

Definition at line 122 of file btDiscreteDynamicsWorldMt.cpp.

Member Data Documentation

const size_t btConstraintSolverPoolMt::kCacheLineSize = 128
staticprivate

Definition at line 61 of file btDiscreteDynamicsWorldMt.h.

btAlignedObjectArray<ThreadSolver> btConstraintSolverPoolMt::m_solvers
private

Definition at line 68 of file btDiscreteDynamicsWorldMt.h.

btConstraintSolverType btConstraintSolverPoolMt::m_solverType
private

Definition at line 69 of file btDiscreteDynamicsWorldMt.h.


The documentation for this class was generated from the following files: