Description
VSG-based run-time visualization system for Chrono::DEM systems.
Used as a plugin to a Chrono::VSG visualization system. Note that using run-time visualization for a DEM system incurs the penalty of collecting positions of all particles every time the Render() function is invoked.
The plugin can also draw the contact force network (see vsg3d::ChForceNetworkVSG): a segment between the particle centers for each particle-particle contact, and a segment from the particle center to the contact point for each contact with a boundary condition (such as the walls of the domain box). The network is colored by the normal force, the Coulomb ratio (tangential force over its Coulomb limit), or the magnitude of the stored tangential displacement (MULTI_STEP friction mode). A force threshold and a region filter (slab and box) select the contacts that are drawn; a slab gives section cuts. The network requires a frictional simulation with contact recording enabled, and it includes the contacts with boundary conditions only with the material-based contact model (see ChSystemDem::GetContacts). Contacts with meshes are not included.
#include <ChDemVisualizationVSG.h>


Classes | |
| class | ParticleColorCallback |
| Class to be used as a callback interface for dynamic coloring of particles. More... | |
| class | ParticleVisibilityCallback |
| Class to be used as a callback interface for particle dynamic visibility. More... | |
Public Types | |
| enum | NetworkColoring { NetworkColoring::NORMAL_FORCE, NetworkColoring::COULOMB_RATIO, NetworkColoring::TANGENTIAL_DISPLACEMENT } |
| Quantity used to color the force network. More... | |
Public Member Functions | |
| ChDemVisualizationVSG (ChSystemDem *sysDEM) | |
| virtual void | OnAttach () override |
| Allow this plugin to perform any operations when it is attached to a VSG visual system. More... | |
| virtual void | OnInitialize () override |
| Allow this plugin to perform any pre-initialization operations. More... | |
| virtual void | OnBindAssets () override |
| Allow this plugin to perform any pre-binding operations. More... | |
| virtual void | OnRender () override |
| Allow this plugin to perform any pre-rendering operations. More... | |
| void | SetDefaultColor (const ChColor &col) |
| Set default color for granular material (default: [0.10, 0.40, 0.65]). | |
| ChColormap::Type | GetColormapType () const |
| Get the type of the colormap currently in use. | |
| const ChColormap & | GetColormap () const |
| Get the colormap object in current use. | |
| void | SetColorCallback (std::shared_ptr< ParticleColorCallback > functor, ChColormap::Type type=ChColormap::Type::JET) |
| Set a callback for dynamic coloring of particles. More... | |
| void | SetVisibilityCallback (std::shared_ptr< ParticleVisibilityCallback > functor) |
| Set a callback for dynamic visibility of particles. More... | |
| 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. | |
| void | EnableParticles (bool val) |
| Enable/disable rendering of particles (default: true). | |
| void | SetNetworkVisibility (bool visible) |
| Show or hide the force network (default: hidden). | |
| void | SetNetworkMode (vsg3d::ChForceNetworkVSG::Mode mode) |
| Set the rendering mode of the force network (default: CYLINDERS). | |
| void | SetNetworkColoring (NetworkColoring quantity) |
| Set the quantity used to color the force network (default: NORMAL_FORCE). | |
| void | SetNetworkColoring (NetworkColoring quantity, double vmin, double vmax) |
| Set the quantity used to color the force network and the range of values mapped to colors. More... | |
| void | SetNetworkColormap (ChColormap::Type type) |
| Map network values to colors with the specified colormap (default: JET). | |
| void | SetNetworkColorRamp (const ChColor &color_min, const ChColor &color_max) |
| Map network values to colors with a linear ramp between two colors. | |
| void | SetNetworkRadius (double radius) |
| Set a constant radius for network segments drawn as cylinders (default: 0.2 times the particle radius). | |
| void | SetNetworkRadius (double rmin, double rmax, double fmin, double fmax) |
| Scale the radius of network segments with the normal force, from rmin at fmin to rmax at fmax (clamped). | |
| void | SetNetworkForceThreshold (double threshold, bool relative=false) |
| Set the force threshold of the network (default: 0). More... | |
| void | SetNetworkCapacity (unsigned int num_segments) |
| Set the maximum number of network segments (default: 6 times the number of particles, at most 2e6). More... | |
| unsigned int | GetNumNetworkSegments () const |
| Get the number of network segments drawn at the current frame. | |
| unsigned int | GetNumNetworkSegmentsDropped () const |
| Get the number of network segments dropped at the current frame because they exceeded the capacity. | |
| void | SetRegionSlab (const ChVector3d &point, const ChVector3d &normal, double half_thickness) |
| Restrict drawing to a slab of the specified half-thickness, centered at a point and normal to a direction. More... | |
| void | SetRegionBox (const ChAABB &box) |
| Restrict drawing to an axis-aligned box. More... | |
| void | ClearRegion () |
| Remove the slab and box region filters. | |
| void | SetRegionParticleFiltering (bool val) |
| Apply the region filter to particles as well as to the force network (default: false). | |
| void | AddProxyBody (std::shared_ptr< ChBody > body) |
| Add additional proxy body to supplemental system. More... | |
| ChSystem * | GetSystem () const |
| Return the internal Chrono system that holds visualization shapes. | |
Public Member Functions inherited from chrono::vsg3d::ChVisualSystemVSGPlugin | |
| void | AddEventHandler (std::shared_ptr< ChEventHandlerVSG > eh) |
| TODO - remove AddEventHandler? A plugin can call the VSG system's AddEventHandler in its OnAttach() function. More... | |
| ChVisualSystemVSG & | GetVisualSystemVSG () const |
| Get a reference to the VSG visual system to which the plugin was attached. | |
Friends | |
| class | DEMStatsVSG |
| class | DEMParticleVisibility |
Additional Inherited Members | |
Protected Attributes inherited from chrono::vsg3d::ChVisualSystemVSGPlugin | |
| std::vector< std::shared_ptr< ChEventHandlerVSG > > | m_evhandler |
| list of all additional event handlers | |
| ChVisualSystemVSG * | m_vsys |
| associated VSG visual system | |
Member Enumeration Documentation
◆ NetworkColoring
Member Function Documentation
◆ AddProxyBody()
|
inline |
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().
◆ OnAttach()
|
overridevirtual |
Allow this plugin to perform any operations when it is attached to a VSG visual system.
The pointer m_vsys to the associated VSG visual system is set before calling OnAttach.
Reimplemented from chrono::vsg3d::ChVisualSystemVSGPlugin.
◆ OnBindAssets()
|
overridevirtual |
Allow this plugin to perform any pre-binding operations.
This function is called during initialization of the associated VSG visual system, after the scene was created and before binding assets for the associated VSG visual system. A plugin can create and populate its own children in the VSG scene.
Reimplemented from chrono::vsg3d::ChVisualSystemVSGPlugin.
◆ OnInitialize()
|
overridevirtual |
Allow this plugin to perform any pre-initialization operations.
This function is called before the initialization of the associated VSG visual system.
Reimplemented from chrono::vsg3d::ChVisualSystemVSGPlugin.
◆ OnRender()
|
overridevirtual |
Allow this plugin to perform any pre-rendering operations.
This function is called before updating and rendering the associated VSG visual system.
Reimplemented from chrono::vsg3d::ChVisualSystemVSGPlugin.
◆ SetColorCallback()
| void chrono::dem::ChDemVisualizationVSG::SetColorCallback | ( | std::shared_ptr< ParticleColorCallback > | functor, |
| ChColormap::Type | type = ChColormap::Type::JET |
||
| ) |
Set a callback for dynamic coloring of particles.
If none provided, particles are rendered with a default color.
◆ SetNetworkCapacity()
|
inline |
Set the maximum number of network segments (default: 6 times the number of particles, at most 2e6).
Segments beyond this capacity are dropped and counted. This function must be called before the visual system is initialized.
◆ SetNetworkColoring()
| void chrono::dem::ChDemVisualizationVSG::SetNetworkColoring | ( | NetworkColoring | quantity, |
| double | vmin, | ||
| double | vmax | ||
| ) |
Set the quantity used to color the force network and the range of values mapped to colors.
Without an explicit range, the range is [0, 1] for the Coulomb ratio and, for the other quantities, from 0 to the largest value at the current frame.
◆ SetNetworkForceThreshold()
| void chrono::dem::ChDemVisualizationVSG::SetNetworkForceThreshold | ( | double | threshold, |
| bool | relative = false |
||
| ) |
Set the force threshold of the network (default: 0).
Only contacts with a normal force larger than the threshold are drawn. If relative is true, the threshold is a multiple of the mean normal force over all contacts with a positive normal force.
◆ SetRegionBox()
| void chrono::dem::ChDemVisualizationVSG::SetRegionBox | ( | const ChAABB & | box | ) |
Restrict drawing to an axis-aligned box.
A contact is drawn if its contact point is in the box. With SetRegionParticleFiltering(true), a particle is drawn if its center is in the box. A box and a slab can be combined.
◆ SetRegionSlab()
| void chrono::dem::ChDemVisualizationVSG::SetRegionSlab | ( | const ChVector3d & | point, |
| const ChVector3d & | normal, | ||
| double | half_thickness | ||
| ) |
Restrict drawing to a slab of the specified half-thickness, centered at a point and normal to a direction.
A contact is drawn if its contact point is in the slab. With SetRegionParticleFiltering(true), a particle is drawn if its center is in the slab.
◆ SetVisibilityCallback()
|
inline |
Set a callback for dynamic visibility of particles.
If none provided, all particles are visible.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_dem/visualization/ChDemVisualizationVSG.h
- /builds/uwsbel/chrono/src/chrono_dem/visualization/ChDemVisualizationVSG.cpp
Public Member Functions inherited from