Newton Dynamics  4.00
ndWorldSceneCuda Class Reference
Inheritance diagram for ndWorldSceneCuda:
ndWorldScene ndCudaContext ndScene ndThreadPool ndSyncMutex ndThread ndClassAlloc ndThreadName ndSemaphore ndAtomic< bool >

Public Member Functions

 ndWorldSceneCuda (const ndWorldScene &src)
 
virtual void Begin ()
 
virtual void End ()
 
virtual bool IsGPU () const
 
virtual bool IsValid () const
 
virtual double GetGPUTime () const
 
virtual void ApplyExtForce ()
 
virtual void BalanceScene ()
 
virtual void InitBodyArray ()
 
virtual void UpdateBodyList ()
 
virtual void CalculateContacts ()
 
virtual void FindCollidingPairs ()
 
virtual void UpdateTransform ()
 
void LoadBodyData ()
 
void GetBodyTransforms ()
 
ndCudaContextGetContext ()
 
 ndWorldSceneCuda (const ndWorldScene &src)
 
virtual void Begin ()
 
virtual void End ()
 
virtual bool IsValid () const
 
virtual void InitBodyArray ()
 
virtual void UpdateBodyList ()
 
virtual void CalculateContacts ()
 
virtual void FindCollidingPairs ()
 
virtual void FindCollidingPairs (ndBodyKinematic *const body)
 
virtual void CalculateContacts (ndInt32 threadIndex, ndContact *const contact)
 
virtual void UpdateTransform ()
 
void LoadBodyData ()
 
void GetBodyTransforms ()
 
bool SanityCheckPrefix () const
 
bool SanityCheckSortCells () const
 
- Public Member Functions inherited from ndWorldScene
D_NEWTON_API ndWorldScene (ndWorld *const world)
 
D_NEWTON_API ndWorldScene (const ndWorldScene &src)
 
- Public Member Functions inherited from ndScene
virtual D_COLLISION_API bool AddBody (ndSharedPtr< ndBody > &body)
 
virtual D_COLLISION_API bool RemoveBody (ndBodyKinematic *const body)
 
virtual D_COLLISION_API void Sync ()
 
virtual D_COLLISION_API void Cleanup ()
 
D_COLLISION_API ndContactNotifyGetContactNotify () const
 
D_COLLISION_API void SetContactNotify (ndContactNotify *const notify)
 
virtual D_COLLISION_API void DebugScene (ndSceneTreeNotiFy *const notify)
 
virtual D_COLLISION_API void BodiesInAabb (ndBodiesInAabbNotify &callback, const ndVector &minBox, const ndVector &maxBox) const
 
virtual D_COLLISION_API bool RayCast (ndRayCastNotify &callback, const ndVector &globalOrigin, const ndVector &globalDest) const
 
virtual D_COLLISION_API bool ConvexCast (ndConvexCastNotify &callback, const ndShapeInstance &convexShape, const ndMatrix &globalOrigin, const ndVector &globalDest) const
 
D_COLLISION_API void SendBackgroundTask (ndBackgroundTask *const job)
 
ndInt32 GetThreadCount () const
 
const ndBodyListViewGetBodyList () const
 
ndArray< ndBodyKinematic * > & GetActiveBodyArray ()
 
const ndArray< ndBodyKinematic * > & GetActiveBodyArray () const
 
ndArray< ndConstraint * > & GetActiveContactArray ()
 
const ndArray< ndConstraint * > & GetActiveContactArray () const
 
ndArray< ndUnsigned8 > & GetScratchBuffer ()
 
ndFloat32 GetTimestep () const
 
void SetTimestep (ndFloat32 timestep)
 
ndBodyKinematicGetSentinelBody () const
 
- Public Member Functions inherited from ndThreadPool
D_CORE_API ndThreadPool (const char *const baseName)
 
ndInt32 GetThreadCount () const
 
D_CORE_API void SetThreadCount (ndInt32 count)
 
D_CORE_API void TickOne ()
 
D_CORE_API void Begin ()
 
D_CORE_API void End ()
 
template<typename Function >
void ParallelExecute (const Function &ndFunction)
 
- Public Member Functions inherited from ndSyncMutex
D_CORE_API ndSyncMutex ()
 Create and initialize counter to zero.
 
D_CORE_API ~ndSyncMutex ()
 Destroy mutex.
 
D_CORE_API void Sync ()
 Synchronize with another worker threads. More...
 
D_CORE_API void Tick ()
 Increment internal variable m_count by one.
 
D_CORE_API void Release ()
 Decrement internal variable m_count by one and signal the thread to wakeup.
 
- Public Member Functions inherited from ndThread
D_CORE_API ndThread ()
 Empty default constructor after creation all threads go to a wait state.
 
virtual D_CORE_API ~ndThread ()
 Empty, does not terminate the thread loop. More...
 
D_CORE_API void SetName (const char *const name)
 Set thread name. More...
 
D_CORE_API void Signal ()
 Set the thread, to execute one call to and go back to a wait state

 
D_CORE_API void Finish ()
 Force the thread loop to terminate. More...
 
- Public Member Functions inherited from ndClassAlloc
 ndClassAlloc ()
 Empty default constructor.
 
 ~ndClassAlloc ()
 Empty.
 
- Public Member Functions inherited from ndSemaphore
D_CORE_API ndSemaphore ()
 Create and initialize counter to zero.
 
D_CORE_API ~ndSemaphore ()
 Destroy semaphore.
 
D_CORE_API ndInt32 GetCount () const
 Returns counter counter value.
 
D_CORE_API bool Wait ()
 Synchronize with another threads. More...
 
D_CORE_API void Signal ()
 Notify a thread blocked by member function Wait to wake and test m_counter again. More...
 
D_CORE_API void Terminate ()
 Notify a waiting thread on member function Wait that is time to exit the thread loop.
 
- Public Member Functions inherited from ndAtomic< bool >
 ndAtomic (bool val)
 
 ndAtomic (const ndAtomic< bool > &copy)
 
bool operator= (bool value)
 
- Public Member Functions inherited from ndCudaContext
D_CUDA_API bool IsValid () const
 
D_CUDA_API const char * GetStringId () const
 
D_CUDA_API void Begin ()
 
D_CUDA_API void End ()
 
D_CUDA_API double GetGPUTime () const
 
D_CUDA_API void ResizeBuffers (int size)
 
D_CUDA_API void LoadBodyData (const ndCudaBodyProxy *const src, int size)
 
D_CUDA_API void InitBodyArray ()
 
D_CUDA_API void UpdateTransform ()
 
D_CUDA_API void ValidateContextBuffers ()
 
D_CUDA_API ndCudaSpatialVectorGetTransformBuffer ()
 
D_CUDA_API void IntegrateBodies (float timestep)
 
D_CUDA_API void IntegrateUnconstrainedBodies (float timestep)
 
void SwapBuffers ()
 

Public Attributes

ndArray< ndCudaBodyProxym_bodyBufferCpu
 
ndCudaContextm_context
 
- Public Attributes inherited from ndThreadName
char m_name [32]
 
- Public Attributes inherited from ndCudaContext
ndCudaDevicem_device
 
ndCudaContextImplementm_implement
 
cuSceneInfo * m_sceneInfoGpu
 
cuSceneInfo * m_sceneInfoCpu
 
cuDeviceBuffer< unsigned > m_histogram
 
ndArray< cuBodyProxym_bodyBufferCpu
 
cuDeviceBuffer< cuBodyProxym_bodyBufferGpu
 
cuDeviceBuffer< cuBodyAabbCellm_bodyAabbCell
 
cuDeviceBuffer< cuBodyAabbCellm_bodyAabbCellScrath
 
cuDeviceBuffer< cuBoundingBoxm_boundingBoxGpu
 
cuHostBuffer< cuSpatialVectorm_transformBufferCpu0
 
cuHostBuffer< cuSpatialVectorm_transformBufferCpu1
 
cuDeviceBuffer< cuSpatialVectorm_transformBufferGpu0
 
cuDeviceBuffer< cuSpatialVectorm_transformBufferGpu1
 
cudaStream_t m_solverMemCpyStream
 
cudaStream_t m_solverComputeStream
 
ndInt32 m_frameCounter
 

Friends

class ndDynamicsUpdateCuda
 

Additional Inherited Members

- Static Public Member Functions inherited from ndThreadPool
static D_CORE_API ndInt32 GetMaxThreads ()
 
- Static Public Member Functions inherited from ndClassAlloc
D_OPERATOR_NEW_AND_DELETE static D_CORE_API void * Malloc (size_t size)
 Generic allocation for any function subclass from ndClassAlloc.
 
static D_CORE_API void Free (void *const ptr)
 Generic destruction for any function subclass from ndClassAlloc.
 
- Static Public Member Functions inherited from ndCudaContext
static ndCudaContextCreateContext ()
 
- Protected Member Functions inherited from ndWorldScene
virtual void ThreadFunction ()
 Thread function to execute in a perpetual loop until the thread is terminated. More...
 
virtual ndWorldGetWorld () const
 
- Protected Member Functions inherited from ndScene
D_COLLISION_API ndScene (const ndScene &src)
 
bool ValidateContactCache (ndContact *const contact, const ndVector &timestep) const
 
const ndContactArrayGetContactArray () const
 
void FindCollidingPairs (ndBodyKinematic *const body, ndInt32 threadId)
 
void FindCollidingPairsForward (ndBodyKinematic *const body, ndInt32 threadId)
 
void FindCollidingPairsBackward (ndBodyKinematic *const body, ndInt32 threadId)
 
void AddPair (ndBodyKinematic *const body0, ndBodyKinematic *const body1, ndInt32 threadId)
 
void SubmitPairs (ndBvhLeafNode *const bodyNode, ndBvhNode *const node, bool forward, ndInt32 threadId)
 
void CalculateJointContacts (ndInt32 threadIndex, ndContact *const contact)
 
void ProcessContacts (ndInt32 threadIndex, ndInt32 contactCount, ndContactSolver *const contactSolver)
 
ndJointBilateralConstraintFindBilateralJoint (ndBodyKinematic *const body0, ndBodyKinematic *const body1) const
 
bool RayCast (ndRayCastNotify &callback, const ndBvhNode **stackPool, ndFloat32 *const distance, ndInt32 stack, const ndFastRay &ray) const
 
bool ConvexCast (ndConvexCastNotify &callback, const ndBvhNode **stackPool, ndFloat32 *const distance, ndInt32 stack, const ndFastRay &ray, const ndShapeInstance &convexShape, const ndMatrix &globalOrigin, const ndVector &globalDest) const
 
virtual D_COLLISION_API void UpdateSpecial ()
 
virtual D_COLLISION_API void CreateNewContacts ()
 
virtual D_COLLISION_API void DeleteDeadContacts ()
 
virtual D_COLLISION_API void UpdateTransformNotify (ndInt32 threadIndex, ndBodyKinematic *const body)
 
- Protected Attributes inherited from ndWorldScene
ndWorldm_world
 
- Protected Attributes inherited from ndScene
ndBodyListView m_bodyList
 
ndContactArray m_contactArray
 
ndBvhSceneManager m_bvhSceneManager
 
ndArray< ndUnsigned8 > m_scratchBuffer
 
ndArray< ndBodyKinematic * > m_sceneBodyArray
 
ndArray< ndConstraint * > m_activeConstraintArray
 
ndSpecialList< ndBodyKinematicm_specialUpdateList
 
ndThreadBackgroundWorker m_backgroundThread
 
ndArray< ndContactPairsm_newPairs
 
ndArray< ndContactPairsm_partialNewPairs [D_MAX_THREADS_COUNT]
 
ndPolygonMeshDesc::ndStaticMeshFaceQuery m_staticMeshQuery [D_MAX_THREADS_COUNT]
 
ndPolygonMeshDesc::ndProceduralStaticMeshFaceQuery m_proceduralStaticMeshQuery [D_MAX_THREADS_COUNT]
 
ndSpinLock m_lock
 
ndBvhNodem_rootNode
 
ndBodyKinematicm_sentinelBody
 
ndContactNotifym_contactNotifyCallback
 
ndFloat32 m_timestep
 
ndUnsigned32 m_lru
 
ndUnsigned32 m_frameNumber
 
ndUnsigned32 m_subStepNumber
 
ndUnsigned32 m_forceBalanceSceneCounter
 
- Static Protected Attributes inherited from ndScene
static ndVector m_velocTol
 
static ndVector m_linearContactError2
 
static ndVector m_angularContactError2