chrono::gpu::ChGpuVisualization Class Reference

Description

Run-time visualization support for Chrono::Gpu systems.

Requires the Chrono::OpenGL module; if not available, most ChGpuVisualization functions are no-op.

Visualization is based on a separate Chrono system which carries proxies for all particles in the Chrono::Gpu system. This separate system can be provided by the user or else created automatically. Note that using run-time visualization for a Chrono::Gpu system incurs the penalty of collecting positions of all particles every time the Render() function is invoked.

#include <ChGpuVisualization.h>

Public Member Functions

 ChGpuVisualization (ChSystemGpu *sysGPU)
 Create a run-time visualization object associated with a given Chrono::Gpu system. More...
 
void SetTitle (const std::string &title)
 Set title of the visualization window (default: "").
 
void SetSize (int width, int height)
 Set window dimensions (default: 1280x720).
 
void SetCameraPosition (const ChVector<> &pos, const ChVector<> &target)
 Set camera position and target (look at) point.
 
void SetCameraUpVector (const ChVector<> &up)
 Set camera up vector (default: Z).
 
void SetCameraMoveScale (float scale)
 Set scale for camera movement increments (default: 0.1). More...
 
void AttachSystem (ChSystem *system)
 Attach a user-provided Chrono system for rendering. More...
 
void AddProxyBody (std::shared_ptr< ChBody > body)
 Add additional proxy body to supplemental system. More...
 
void Initialize ()
 Initialize the run-time visualization system. More...
 
bool Render ()
 Render the current state of the Chrono::Gpu system. More...
 

Constructor & Destructor Documentation

◆ ChGpuVisualization()

chrono::gpu::ChGpuVisualization::ChGpuVisualization ( ChSystemGpu sysGPU)

Create a run-time visualization object associated with a given Chrono::Gpu system.

If a supplemental Chrono system is not provided (default), one will be created internally.

Parameters
sysGPUAssociated Chrono::Gpu system

Member Function Documentation

◆ AddProxyBody()

void chrono::gpu::ChGpuVisualization::AddProxyBody ( std::shared_ptr< ChBody body)

Add additional proxy body to supplemental system.

Must be called before Initialize(). The provided body is set fixed to ground and it is the caller's responsibility to update the position of this body before a call to Render().

◆ AttachSystem()

void chrono::gpu::ChGpuVisualization::AttachSystem ( ChSystem system)
inline

Attach a user-provided Chrono system for rendering.

By default, the GPU run-time visualization renders granular particles. This function can be used to also render the mechanical system interacting with the granular system.

◆ Initialize()

void chrono::gpu::ChGpuVisualization::Initialize ( )

Initialize the run-time visualization system.

If the Chrono::OpenGL module is not available, this function is no-op.

◆ Render()

bool chrono::gpu::ChGpuVisualization::Render ( )

Render the current state of the Chrono::Gpu system.

This function, typically invoked from within the main simulation loop, can only be called after construction of the Gpu system was completed (i.e., the system was initialized). This funtion querries the positions of all particles in the Gpu system in order to update the positions of the proxy bodies. Returns false if the visualization window was closed. If the Chrono::OpenGL module is not available, this function is no-op.

◆ SetCameraMoveScale()

void chrono::gpu::ChGpuVisualization::SetCameraMoveScale ( float  scale)

Set scale for camera movement increments (default: 0.1).

Must be called before Initialize().


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_gpu/utils/ChGpuVisualization.h
  • /builds/uwsbel/chrono/src/chrono_gpu/utils/ChGpuVisualization.cpp