Project Chrono: chrono::ChCollisionSystemMulticore Class Reference

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
chrono::ChCollisionSystemMulticore Class Reference
Chrono::Engine » Collision detection » Multicore collision detection

## Description

Chrono multicore collision system.

Contains both the broadphase and the narrow phase methods.

`#include <ChCollisionSystemMulticore.h>`

Inheritance diagram for chrono::ChCollisionSystemMulticore:
[legend]
Collaboration diagram for chrono::ChCollisionSystemMulticore:
[legend]

## Public Member Functions
virtual void | Clear () override
| Clears all data instanced by this algorithm if any (like persistent contact manifolds).
virtual void | Add (std::shared_ptr< ChCollisionModel > model) override
| Add the specified collision model to the collision engine.
virtual void | Remove (std::shared_ptr< ChCollisionModel > model) override
| Remove the specified collision model from the collision engine.
void | SetEnvelope (double envelope)
| Set collision envelope for rigid shapes (default: ChCollisionModel::GetDefaultSuggestedEnvelope).
void | SetBroadphaseGridResolution (const ChVector3i &num_bins)
| Set a fixed number of grid bins (default 10x10x10).
void | SetBroadphaseGridSize (const ChVector3d &bin_size)
| Set a variable number of grids, such that each bin has roughly the specified size.
void | SetBroadphaseGridDensity (double density)
| Set a variable number of grid bins, such that there are roughly density collision shapes per bin.
void | SetNarrowphaseAlgorithm (ChNarrowphase::Algorithm algorithm)
| Set the narrowphase algorithm (default: ChNarrowphase::Algorithm::HYBRID).
void | EnableActiveBoundingBox (const ChVector3d &aabb_min, const ChVector3d &aabb_max)
| Enable monitoring of shapes outside active bounding box (default: false).
bool | GetActiveBoundingBox (ChVector3d &aabb_min, ChVector3d &aabb_max) const
| Get the dimensions of the "active" box.
virtual void | SetNumThreads (int nthreads) override
| Set the number of OpenMP threads for collision detection.
virtual void | PreProcess () override
| Synchronization operations, invoked before running the collision detection.
virtual void | Run () override
| Run the algorithm and finds all the contacts.
virtual void | PostProcess () override
| Synchronization operations, invoked after running the collision detection.
virtual ChAABB | GetBoundingBox () const override
| Return an AABB bounding all collision shapes in the system.
virtual void | ResetTimers () override
| Reset any timers associated with collision detection.
virtual double | GetTimerCollisionBroad () const override
| Return the time (in seconds) for broadphase collision detection.
virtual double | GetTimerCollisionNarrow () const override
| Return the time (in seconds) for narrowphase collision detection.
virtual void | ReportContacts (ChContactContainer *container) override
| Fill in the provided contact container with collision information after Run().
virtual void | ReportProximities (ChProximityContainer *mproximitycontainer) override
| Fill in the provided proximity container with near point information after Run().
virtual bool | RayHit (const ChVector3d &from, const ChVector3d &to, ChRayhitResult &result) const override
| Perform a ray-hit test with all collision models.
virtual bool | RayHit (const ChVector3d &from, const ChVector3d &to, ChCollisionModel *model, ChRayhitResult &result) const override
| Perform a ray-hit test with the specified collision model.
virtual void | Visualize (int flags) override
| Method to trigger debug visualization of collision shapes.
virtual std::vector< vec2 > | GetOverlappingPairs ()
| Return the pairs of IDs for overlapping contact shapes.
virtual void | ArchiveOut (ChArchiveOut &archive_out) override
| Method to allow serialization of transient data to archives.
virtual void | ArchiveIn (ChArchiveIn &archive_in) override
| Method to allow deserialization of transient data from archives.
Public Member Functions inherited from chrono::ChCollisionSystem
bool | IsInitialized () const
| Test if the collision system was initialized.
virtual void | Initialize ()
| Initialize the collision system.
virtual void | BindAll ()
| Process all collision models in the associated Chrono system.
virtual void | BindItem (std::shared_ptr< ChPhysicsItem > item)
| Process the collision models associated with the specified Chrono physics item.
void | UnbindItem (std::shared_ptr< ChPhysicsItem > item)
| Remove any collision models associated with the specified physics item from the collision engine.
void | RegisterBroadphaseCallback (std::shared_ptr< BroadphaseCallback > callback)
| Specify a callback object to be used each time a pair of 'near enough' collision shapes is found by the broad-phase collision step.
void | RegisterNarrowphaseCallback (std::shared_ptr< NarrowphaseCallback > callback)
| Specify a callback object to be used each time a collision pair is found during the narrow-phase collision detection step.
virtual void | RegisterVisualizationCallback (std::shared_ptr< VisualizationCallback > callback)
| Specify a callback object to be used for debug rendering of collision shapes.
void | SetSystem (ChSystem *sys)
| Set associated Chrono system.

## Protected Member Functions
virtual void | GetOverlappingAABB (std::vector< char > &active_id, real3 Amin, real3 Amax)
| Mark bodies whose AABB is contained within the specified box.
void | GenerateAABB ()
| Generate the current axis-aligned bounding boxes of collision shapes.
void | VisualizeShapes ()
| Visualize collision shapes (wireframe).
void | VisualizeAABB ()
| Visualize collision shape AABBs.
void | VisualizeContacts ()
| Visualize contact points and normals.

## Protected Attributes
std::vector< std::shared_ptr< ChCollisionModelMulticore > > | ct_models
std::shared_ptr< ChCollisionData > | cd_data
ChBroadphase | broadphase
| methods for broad-phase collision detection
ChNarrowphase | narrowphase
| methods for narrow-phase collision detection
std::vector< char > | body_active
bool | use_aabb_active
| enable freezing of objects outside the active bounding box
real3 | active_aabb_min
| lower corner of active bounding box
real3 | active_aabb_max
| upper corner of active bounding box
ChTimer | m_timer_broad
ChTimer | m_timer_narrow
Protected Attributes inherited from chrono::ChCollisionSystem
bool | m_initialized
ChSystem * | m_system
| associated Chrono system
std::shared_ptr< BroadphaseCallback > | broad_callback
| user callback for each near-enough pair of shapes
std::shared_ptr< NarrowphaseCallback > | narrow_callback
| user callback for each collision pair
std::shared_ptr< VisualizationCallback > | vis_callback
| user callback for debug visualization
int | m_vis_flags

## Additional Inherited Members
Public Types inherited from chrono::ChCollisionSystem
enum class | Type { BULLET , MULTICORE }
| Supported collision systems. More...
enum | VisualizationModes { VIS_None = 0 , VIS_Shapes = 1 << 0 , VIS_Aabb = 1 << 1 , VIS_Contacts = 1 << 2 , VIS_MAX_MODES }
| Enumeration of supported flags for collision debug visualization. More...

## Member Function Documentation

## ◆ Add()

void chrono::ChCollisionSystemMulticore::Add | ( | std::shared_ptr< ChCollisionModel > | model | ) |
| overridevirtual

Add the specified collision model to the collision engine.

Implements chrono::ChCollisionSystem.

## ◆ ArchiveIn()

void chrono::ChCollisionSystemMulticore::ArchiveIn | ( | ChArchiveIn & | archive_in | ) |
| overridevirtual

Method to allow deserialization of transient data from archives.

Reimplemented from chrono::ChCollisionSystem.

## ◆ ArchiveOut()

void chrono::ChCollisionSystemMulticore::ArchiveOut | ( | ChArchiveOut & | archive_out | ) |
| overridevirtual

Method to allow serialization of transient data to archives.

Reimplemented from chrono::ChCollisionSystem.

## ◆ Clear()

void chrono::ChCollisionSystemMulticore::Clear | ( |  | ) |
| overridevirtual

Clears all data instanced by this algorithm if any (like persistent contact manifolds).

Implements chrono::ChCollisionSystem.

## ◆ EnableActiveBoundingBox()

void chrono::ChCollisionSystemMulticore::EnableActiveBoundingBox | ( | const ChVector3d & | aabb_min,
|  | const ChVector3d & | aabb_max )

Enable monitoring of shapes outside active bounding box (default: false).

If enabled, objects whose collision shapes exit the active bounding box are deactivated (frozen). The size of the bounding box is specified by its min and max extents.

## ◆ GetActiveBoundingBox()

bool chrono::ChCollisionSystemMulticore::GetActiveBoundingBox | ( | ChVector3d & | aabb_min,
|  | ChVector3d & | aabb_max ) const

Get the dimensions of the "active" box.

The return value indicates whether or not the active box feature is enabled.

## ◆ GetBoundingBox()

ChAABB chrono::ChCollisionSystemMulticore::GetBoundingBox | ( |  | ) | const
| overridevirtual

Return an AABB bounding all collision shapes in the system.

Implements chrono::ChCollisionSystem.

## ◆ GetTimerCollisionBroad()

double chrono::ChCollisionSystemMulticore::GetTimerCollisionBroad | ( |  | ) | const
| overridevirtual

Return the time (in seconds) for broadphase collision detection.

Implements chrono::ChCollisionSystem.

## ◆ GetTimerCollisionNarrow()

double chrono::ChCollisionSystemMulticore::GetTimerCollisionNarrow | ( |  | ) | const
| overridevirtual

Return the time (in seconds) for narrowphase collision detection.

Implements chrono::ChCollisionSystem.

## ◆ PostProcess()

void chrono::ChCollisionSystemMulticore::PostProcess | ( |  | ) |
| overridevirtual

Synchronization operations, invoked after running the collision detection.

This function updates the list of active bodies (if active bounding box enabled).

Reimplemented from chrono::ChCollisionSystem.

Reimplemented in chrono::ChCollisionSystemChronoMulticore.

## ◆ PreProcess()

void chrono::ChCollisionSystemMulticore::PreProcess | ( |  | ) |
| overridevirtual

Synchronization operations, invoked before running the collision detection.

This function copies contactable state information in the collision system's data structures.

Reimplemented from chrono::ChCollisionSystem.

Reimplemented in chrono::ChCollisionSystemChronoMulticore.

## ◆ RayHit() [1/2]

bool chrono::ChCollisionSystemMulticore::RayHit | ( | const ChVector3d & | from,
|  | const ChVector3d & | to,
|  | ChCollisionModel * | model,
|  | ChRayhitResult & | result ) const
| overridevirtual

Perform a ray-hit test with the specified collision model.

Currently not implemented.

Implements chrono::ChCollisionSystem.

## ◆ RayHit() [2/2]

bool chrono::ChCollisionSystemMulticore::RayHit | ( | const ChVector3d & | from,
|  | const ChVector3d & | to,
|  | ChRayhitResult & | result ) const
| overridevirtual

Perform a ray-hit test with all collision models.

Currently not implemented.

Implements chrono::ChCollisionSystem.

## ◆ Remove()

void chrono::ChCollisionSystemMulticore::Remove | ( | std::shared_ptr< ChCollisionModel > | model | ) |
| overridevirtual

Remove the specified collision model from the collision engine.

Implements chrono::ChCollisionSystem.

## ◆ ReportContacts()

void chrono::ChCollisionSystemMulticore::ReportContacts | ( | ChContactContainer * | container | ) |
| overridevirtual

Fill in the provided contact container with collision information after Run().

Implements chrono::ChCollisionSystem.

Reimplemented in chrono::ChCollisionSystemChronoMulticore.

## ◆ ReportProximities()

virtual void chrono::ChCollisionSystemMulticore::ReportProximities | ( | ChProximityContainer * | mproximitycontainer | ) |
| inlineoverridevirtual

Fill in the provided proximity container with near point information after Run().

Not used.

Implements chrono::ChCollisionSystem.

Reimplemented in chrono::ChCollisionSystemChronoMulticore.

## ◆ ResetTimers()

void chrono::ChCollisionSystemMulticore::ResetTimers | ( |  | ) |
| overridevirtual

Reset any timers associated with collision detection.

Reimplemented from chrono::ChCollisionSystem.

## ◆ Run()

void chrono::ChCollisionSystemMulticore::Run | ( |  | ) |
| overridevirtual

Run the algorithm and finds all the contacts.

Implements chrono::ChCollisionSystem.

## ◆ SetBroadphaseGridDensity()

void chrono::ChCollisionSystemMulticore::SetBroadphaseGridDensity | ( | double | density | ) |

Set a variable number of grid bins, such that there are roughly density collision shapes per bin.

By default, a fixed number of bins is used (see SetBroadphaseGridResolution).

## ◆ SetBroadphaseGridResolution()

void chrono::ChCollisionSystemMulticore::SetBroadphaseGridResolution | ( | const ChVector3i & | num_bins | ) |

Set a fixed number of grid bins (default 10x10x10).

This is the default setting; to continuously adjust the number of bins, use SetBroadphaseGridSize or SetBroadphaseGridDensity.

## ◆ SetBroadphaseGridSize()

void chrono::ChCollisionSystemMulticore::SetBroadphaseGridSize | ( | const ChVector3d & | bin_size | ) |

Set a variable number of grids, such that each bin has roughly the specified size.

By default, a fixed grid resolution is used (see SetBroadphaseGridResolution).

## ◆ SetEnvelope()

void chrono::ChCollisionSystemMulticore::SetEnvelope | ( | double | envelope | ) |

Set collision envelope for rigid shapes (default: ChCollisionModel::GetDefaultSuggestedEnvelope).

For stability of NSC contact, the envelope should be set to 5-10% of the smallest collision shape size (too large a value will slow down the narrowphase collision detection). The envelope is the amount by which each collision shape is inflated prior to performing the collision detection, in order to create contact constraints before shapes actually come in contact. This collision detection system uses a global envelope, used for all rigid shapes in the system.

## ◆ SetNarrowphaseAlgorithm()

void chrono::ChCollisionSystemMulticore::SetNarrowphaseAlgorithm | ( | ChNarrowphase::Algorithm | algorithm | ) |

Set the narrowphase algorithm (default: ChNarrowphase::Algorithm::HYBRID).

The Chrono collision detection system provides several analytical collision detection algorithms, for particular pairs of shapes (see ChNarrowphasePRIMS). For general convex shapes, the collision system relies on the Minkovski Portal Refinement algorithm (see ChNarrowphaseMPR).

## ◆ SetNumThreads()

void chrono::ChCollisionSystemMulticore::SetNumThreads | ( | int | nthreads | ) |
| overridevirtual

Set the number of OpenMP threads for collision detection.

Reimplemented from chrono::ChCollisionSystem.

Reimplemented in chrono::ChCollisionSystemChronoMulticore.

## ◆ Visualize()

void chrono::ChCollisionSystemMulticore::Visualize | ( | int | flags | ) |
| overridevirtual

Method to trigger debug visualization of collision shapes.

The 'flags' argument can be any of the VisualizationModes enums, or a combination thereof (using bit-wise operators). The calling program must invoke this function from within the simulation loop. No-op if a visualization callback was not specified with RegisterVisualizationCallback().

Reimplemented from chrono::ChCollisionSystem.

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

- D:/W/B/src/chrono-9.0.1/src/chrono/collision/multicore/ChCollisionSystemMulticore.h
- D:/W/B/src/chrono-9.0.1/src/chrono/collision/multicore/ChCollisionSystemMulticore.cpp