Project Chrono: chrono::fsi::ChFsiVisualization Class Reference

Public Types | Public Member Functions | Protected Attributes | List of all members
chrono::fsi::ChFsiVisualization Class Referenceabstract
FSI module » Modeling utilities

## Description

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

Note that using run-time visualization for a Chrono::FSI system incurs the penalty of collecting positions of all particles every time the Render() function is invoked.

`#include <ChFsiVisualization.h>`

Inheritance diagram for chrono::fsi::ChFsiVisualization:
[legend]
Collaboration diagram for chrono::fsi::ChFsiVisualization:
[legend]

## Public Types
enum class | RenderMode { POINTS , WIREFRAME , SOLID }
| Rendering mode for particles and mesh objects.

## Public Member Functions
| ChFsiVisualization (ChSystemFsi *sysFSI)
| Create a run-time FSI visualization object associated with a given Chrono::Fsi system.
virtual void | SetTitle (const std::string &title)
| Set title of the visualization window (default: "").
virtual void | SetSize (int width, int height)
| Set window dimensions (default: 1280x720).
virtual void | AddCamera (const ChVector3d &pos, const ChVector3d &target)
| Add a camera initially at the specified position and target (look at) point.
virtual void | UpdateCamera (const ChVector3d &pos, const ChVector3d &target)
| Set camera position and target (look at) point.
virtual void | SetCameraVertical (CameraVerticalDir up)
| Set camera up vector (default: Z).
virtual void | SetCameraMoveScale (float scale)
| Set scale for camera movement increments (default: 0.1).
virtual void | SetParticleRenderMode (RenderMode mode)
| Set rendering mode for SPH particles.
virtual void | SetRenderMode (RenderMode mode)
| Set rendering mode for mesh objects (default: WIREFRAME).
void | SetColorFluidMarkers (const ChColor &col)
| Set default color for fluid SPH particles (default: [0.10, 0.40, 0.65]).
void | SetColorBoundaryMarkers (const ChColor &col)
| Set default color for boundary BCE markers (default: [0.65, 0.30, 0.03]).
void | SetColorRigidBodyMarkers (const ChColor &col)
| Set default color for rigid body BCE markers (default: [0.10, 0.60, 0.30]).
void | SetColorFlexBodyMarkers (const ChColor &col)
| Set default color for flex body BCE markers (default: [0.40, 0.10, 0.65]).
void | SetSPHColorCallback (std::shared_ptr< ChParticleCloud::ColorCallback > functor)
| Set a callback for dynamic coloring of SPH particles.
void | SetImageOutputDirectory (const std::string &dir)
| Set output directory for saving frame snapshots (default: ".").
void | SetImageOutput (bool val)
| Enable/disable writing of frame snapshots to file.
virtual void | EnableInfoOverlay (bool val)
| Enable/disable information overlay (default: true).
void | EnableFluidMarkers (bool val)
| Enable/disable rendering of fluid SPH particles (default: true).
void | EnableRigidBodyMarkers (bool val)
| Enable/disable rendering of rigid-body BCE markers (default: true).
void | EnableFlexBodyMarkers (bool val)
| Enable/disable rendering of flex-body BCE markers (default: true).
void | EnableBoundaryMarkers (bool val)
| Enable/disable rendering of boundary BCE markers (default: false).
void | AttachSystem (ChSystem *system)
| Attach a user-provided Chrono system for rendering.
void | AddProxyBody (std::shared_ptr< ChBody > body)
| Add additional proxy body to supplemental system.
virtual void | Initialize ()
| Initialize the run-time visualization system.
virtual bool | Render ()=0
| Render the current state of the Chrono::Fsi system.
ChSystem * | GetSystem () const
| Return the internal Chrono system that holds visualization shapes.

## Protected Attributes
ChSystemFsi * | m_systemFSI
| associated Chrono::FSI system
ChSystem * | m_system
| internal Chrono system (holds proxies)
ChSystem * | m_user_system
| optional user-provided system
bool | m_sph_markers
| render fluid SPH particles?
bool | m_bndry_bce_markers
| render boundary BCE markers?
bool | m_rigid_bce_markers
| render rigid-body BCE markers?
bool | m_flex_bce_markers
| render flex-body markers?
std::shared_ptr< ChParticleCloud > | m_sph_cloud
| particle cloud proxy for SPH particles
std::shared_ptr< ChParticleCloud > | m_bndry_bce_cloud
| particle cloud proxy for boundary BCE markers
std::shared_ptr< ChParticleCloud > | m_rigid_bce_cloud
| particle cloud proxy for BCE markers on rigid bodies
std::shared_ptr< ChParticleCloud > | m_flex_bce_cloud
| particle cloud proxy for BCE markers on flex bodies
ChColor | m_sph_color
| color for SPH particles
ChColor | m_bndry_bce_color
| color for boundary BCE markers
ChColor | m_rigid_bce_color
| color for BCE markers on rigid bodies
ChColor | m_flex_bce_color
| color for BCE markers on flex bodies
std::shared_ptr< ChParticleCloud::ColorCallback > | m_color_fun
| dynamic color functor for SPH particles
bool | m_write_images
| if true, save snapshots
std::string | m_image_dir
| directory for image files

## Member Function Documentation

## ◆ AddCamera()

void chrono::fsi::ChFsiVisualization::AddCamera | ( | const ChVector3d & | pos,
|  | const ChVector3d & | target )
| virtual

Add a camera initially at the specified position and target (look at) point.

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ AddProxyBody()

void chrono::fsi::ChFsiVisualization::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::fsi::ChFsiVisualization::AttachSystem | ( | ChSystem * | system | ) |
| inline

Attach a user-provided Chrono system for rendering.

By default, the FSI run-time visualization renders SPH particles and BCE markers. This function can be used to also render the mechanical system interacting with the SPH system.

## ◆ EnableInfoOverlay()

void chrono::fsi::ChFsiVisualization::EnableInfoOverlay | ( | bool | val | ) |
| virtual

Enable/disable information overlay (default: true).

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ Initialize()

void chrono::fsi::ChFsiVisualization::Initialize | ( |  | ) |
| virtual

Initialize the run-time visualization system.

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ Render()

virtual bool chrono::fsi::ChFsiVisualization::Render | ( |  | ) |
| pure virtual

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

This function, typically invoked from within the main simulation loop, can only be called after construction of the FSI system was completed (i.e., the system was initialized). This function querries the positions of all particles in the FSI system in order to update the positions of the proxy bodies. Returns false if the visualization window was closed.

Implemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ SetCameraMoveScale()

void chrono::fsi::ChFsiVisualization::SetCameraMoveScale | ( | float | scale | ) |
| virtual

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

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ SetCameraVertical()

void chrono::fsi::ChFsiVisualization::SetCameraVertical | ( | CameraVerticalDir | up | ) |
| virtual

Set camera up vector (default: Z).

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ SetParticleRenderMode()

void chrono::fsi::ChFsiVisualization::SetParticleRenderMode | ( | RenderMode | mode | ) |
| virtual

Set rendering mode for SPH particles.

Must be called before Initialize().

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ SetRenderMode()

void chrono::fsi::ChFsiVisualization::SetRenderMode | ( | RenderMode | mode | ) |
| virtual

Set rendering mode for mesh objects (default: WIREFRAME).

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ SetSize()

void chrono::fsi::ChFsiVisualization::SetSize | ( | int | width,
|  | int | height )
| virtual

Set window dimensions (default: 1280x720).

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ SetSPHColorCallback()

void chrono::fsi::ChFsiVisualization::SetSPHColorCallback | ( | std::shared_ptr< ChParticleCloud::ColorCallback > | functor | ) |
| inline

Set a callback for dynamic coloring of SPH particles.

If none provided, SPH particles are rendered with a default color.

## ◆ SetTitle()

void chrono::fsi::ChFsiVisualization::SetTitle | ( | const std::string & | title | ) |
| virtual

Set title of the visualization window (default: "").

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

## ◆ UpdateCamera()

void chrono::fsi::ChFsiVisualization::UpdateCamera | ( | const ChVector3d & | pos,
|  | const ChVector3d & | target )
| virtual

Set camera position and target (look at) point.

Reimplemented in chrono::fsi::ChFsiVisualizationGL, and chrono::fsi::ChFsiVisualizationVSG.

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

- D:/W/B/src/chrono-9.0.1/src/chrono_fsi/visualization/ChFsiVisualization.h
- D:/W/B/src/chrono-9.0.1/src/chrono_fsi/visualization/ChFsiVisualization.cpp