Description

Attach this visual asset to a ChPhysicsItem (ex.a ChDomain) in order to provide an automatic visualization of Gauss material points and finite element nodes, as 3D glyps (arrows, dots, etc.).

If the visualization system supports glyphs, these will be rendered (ex. in Irrlicht 3d view, but also in Blender postprocessing etc. The system is modular and expandable, so that you can visualize properties such as stress, strain, speed, acceleration, temperature etc., by adding ChVisualDataExtractor objects to this visual asset.

#include <ChDrawer.h>

Inheritance diagram for chrono::fea::ChVisualDomainGlyphs:
Collaboration diagram for chrono::fea::ChVisualDomainGlyphs:

Public Member Functions

 ChVisualDomainGlyphs (std::shared_ptr< ChDomain > adomain)
 
void AddPropertyExtractor (const ChVisualDataExtractorScalarBase &mextractor, double min=0, double max=1, std::string mname="Scalar")
 Attach scalar property extractor. More...
 
void AddPropertyExtractor (const ChVisualDataExtractorVectorBase &mextractor, double min=0, double max=1, std::string mname="Vect")
 Attach vector property extractor. More...
 
void AddPropertyExtractor (const ChVisualDataExtractorMatrix33Base &mextractor, double min=0, double max=1, std::string mname="Matr")
 Attach 3x3 matrix property extractor. More...
 
void AddPositionExtractor (const ChVisualDataExtractorVectorBase &mextractor)
 
void SetColormap (const ChColormap &mcmap)
 Set the colormap for rendering the property via falsecolor.

 
void SetColormap (const ChColor &col)
 Set the color for rendering the glyphs as constant uniform color. More...
 
- Public Member Functions inherited from chrono::ChGlyphs
eCh_GlyphType GetDrawMode () const
 Get the way that glyphs must be rendered.
 
void SetDrawMode (eCh_GlyphType mmode)
 Set the way that glyphs must be rendered. More...
 
void Reserve (unsigned int n_glyphs)
 Resize the vectors of data so that memory management is faster than calling SetGlyphPoint() etc. More...
 
size_t GetNumberOfGlyphs () const
 Get the number of glyphs.
 
double GetGlyphsSize () const
 Get the 'size' (thickness of symbol, depending on the rendering system) of the glyph symbols.
 
void SetGlyphsSize (double msize)
 Set the 'size' (thickness of symbol, depending on the rendering system) of the glyph symbols.
 
void SetZbufferHide (bool mhide)
 
bool GetZbufferHide () const
 
void SetGlyphPoint (unsigned int id, ChVector3d mpoint, ChColor mcolor=ChColor(1, 0, 0))
 Fast method to set a glyph for GLYPH_POINT draw mode. More...
 
void SetGlyphVector (unsigned int id, ChVector3d mpoint, ChVector3d mvector, ChColor mcolor=ChColor(1, 0, 0))
 Fast method to set a glyph for GLYPH_VECTOR draw mode. More...
 
void SetGlyphVectorLocal (unsigned int id, ChVector3d mpoint, ChVector3d mvector, ChQuaternion<> mrot, ChColor mcolor=ChColor(1, 0, 0))
 Fast method to set a glyph for GLYPH_VECTOR draw mode, with each vectors set in its own local (rotated) basis If the id is more than the reserved amount of glyphs (see Reserve() ) the vectors are inflated.
 
void SetGlyphCoordsys (unsigned int id, ChCoordsys<> mcoord)
 Fast method to set a glyph for GLYPH_COORDSYS draw mode. More...
 
void SetGlyphTensor (unsigned int id, ChVector3d mpoint, ChQuaternion<> mbasis, ChVector3d eigenvalues)
 Fast method to set a glyph for GLYPH_TENSOR draw mode. More...
 
std::vector< ChProperty * > getProperties ()
 Gets the current array of per-point properties, if any.
 
void AddProperty (ChProperty &mprop)
 Add a property as an array of data per-point. More...
 
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 de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChVisualShape
void SetVisible (bool mv)
 Set this visualization asset as visible.
 
bool IsVisible () const
 Return true if the asset is set as visible.
 
void SetColor (const ChColor &col)
 Set the diffuse color for this shape. More...
 
ChColor GetColor () const
 Return the diffuse color of the first material in the list of materials for this shape. More...
 
void SetOpacity (float val)
 Set opacity for this shape (0: fully transparent; 1: fully opaque). More...
 
float GetOpacity () const
 Get opacity of the first material in the list of materials for this shape. More...
 
void SetTexture (const std::string &filename, float scale_x=1, float scale_y=1)
 Set the diffuse texture map for this shape. More...
 
std::string GetTexture () const
 Return the diffuse texture map of the first material in the list of materials for this shape. More...
 
void SetMutable (bool val)
 Set this visualization shape as modifiable (default: false). More...
 
bool IsMutable () const
 Return true if the visualization shape is marked as modifiable.
 
void SetDoubleFaced (bool val)
 Set shape rendering as double-faced (default: false).
 
bool IsDoubleFaced () const
 Return true if the visualization shape must be rendered double-faced.
 
int AddMaterial (std::shared_ptr< ChVisualMaterial > material)
 Add a visualization material and return its index in the list of materials.
 
void SetMaterial (int i, std::shared_ptr< ChVisualMaterial > material)
 Replace the material with specified index. More...
 
std::vector< std::shared_ptr< ChVisualMaterial > > & GetMaterials ()
 Get the list of visualization materials.
 
std::shared_ptr< ChVisualMaterialGetMaterial (int i) const
 Get the specified material in the list.
 
unsigned int GetNumMaterials () const
 Get the number of visualization materials.
 
virtual ChAABB GetBoundingBox () const
 Get the shape bounding box. More...
 

Protected Member Functions

virtual void Update (ChObj *updater, const ChFrame<> &frame) override
 This Update() is called automatically by the parent ChPhysicsItem all time that the system needs to update the visual assets. More...
 

Protected Attributes

std::shared_ptr< ChVisualDataExtractorVectorBaseextractor_position
 
std::vector< std::pair< std::shared_ptr< ChVisualDataExtractorScalarBase >, ChPropertyScalar * > > extractors_scalar_properties
 
std::vector< std::pair< std::shared_ptr< ChVisualDataExtractorVectorBase >, ChPropertyVector * > > extractors_vector_properties
 
std::vector< std::pair< std::shared_ptr< ChVisualDataExtractorMatrix33Base >, std::pair< ChPropertyQuaternion *, ChPropertyVector * > > > extractors_tensor_properties
 
std::shared_ptr< ChDomainmdomain
 
ChColormap colormap
 
bool use_colormap
 
int i_scalar_prop_colorized
 
int i_vector_prop_colorized
 
bool draw_materialpoints
 
bool draw_nodes
 
- Protected Attributes inherited from chrono::ChVisualShape
bool is_visible
 shape visibility flag
 
bool is_mutable
 flag indicating whether the shape is rigid or deformable
 
bool is_double_faced
 flag indicating that the shape should be rendered double-faced
 
std::vector< std::shared_ptr< ChVisualMaterial > > material_list
 list of visualization materials
 

Additional Inherited Members

- Public Types inherited from chrono::ChGlyphs
enum  eCh_GlyphType { GLYPH_POINT = 0, GLYPH_VECTOR, GLYPH_COORDSYS, GLYPH_TENSOR }
 
enum  eCh_GlyphLength { CONSTANT = 0, PROPERTY }
 Modes vector length, if GLYPH_VECTOR.
 
enum  eCh_GlyphWidth { CONSTANT = 0, PROPERTY }
 Modes for glyph width or size.
 
enum  eCh_GlyphBasis { CONSTANT = 0, PROPERTY }
 Modes for type of glyph rotation (for GLYPH_COORDSYS mode)
 
enum  eCh_GlyphEigenvalues { CONSTANT = 0, PROPERTY }
 Modes for type of glyph eigenvalues (for GLYPH_TENSOR mode)
 
enum  eCh_GlyphColor { CONSTANT = 0, PROPERTY }
 Modes for colorizing glyph.
 
- Public Attributes inherited from chrono::ChGlyphs
std::vector< ChVector3dpoints
 
eCh_GlyphLength glyph_length_type
 
std::string glyph_length_prop
 
double glyph_scalelenght
 
eCh_GlyphWidth glyph_width_type
 
std::string glyph_width_prop
 
double glyph_scalewidth
 
eCh_GlyphBasis glyph_basis_type
 
std::string glyph_basis_prop
 
ChQuaternion glyph_basis_constant
 
eCh_GlyphEigenvalues glyph_eigenvalues_type
 
std::string glyph_eigenvalues_prop
 
ChVector3d glyph_eigenvalue_constant
 
eCh_GlyphColor glyph_color_type
 
std::string glyph_color_prop
 
ChColor glyph_color_constant
 
double glyph_colormap_startscale
 
double glyph_colormap_endscale
 
bool vector_tip
 
std::vector< ChProperty * > m_properties
 
std::vector< ChColor > * colors
 
std::vector< ChVector3d > * vectors
 
std::vector< ChQuaternion< double > > * rotations
 
std::vector< ChVector3d > * eigenvalues
 

Member Function Documentation

◆ AddPropertyExtractor() [1/3]

void chrono::fea::ChVisualDomainGlyphs::AddPropertyExtractor ( const ChVisualDataExtractorMatrix33Base mextractor,
double  min = 0,
double  max = 1,
std::string  mname = "Matr" 
)
inline

Attach 3x3 matrix property extractor.

Also turns the glyph rendering into ChGlyph::GLYPH_TENSOR mode. If you added more than one property via AddPropertyExtractor(), by default the last one will be used for the falsecolor rendering.

◆ AddPropertyExtractor() [2/3]

void chrono::fea::ChVisualDomainGlyphs::AddPropertyExtractor ( const ChVisualDataExtractorScalarBase mextractor,
double  min = 0,
double  max = 1,
std::string  mname = "Scalar" 
)
inline

Attach scalar property extractor.

Also turns the glyph rendering into ChGlyph::GLYPH_POINT mode. If you added more than one property via AddPropertyExtractor(), by default the last one will be used for the falsecolor rendering.

◆ AddPropertyExtractor() [3/3]

void chrono::fea::ChVisualDomainGlyphs::AddPropertyExtractor ( const ChVisualDataExtractorVectorBase mextractor,
double  min = 0,
double  max = 1,
std::string  mname = "Vect" 
)
inline

Attach vector property extractor.

Also turns the glyph rendering into ChGlyph::GLYPH_POINT mode. If you added more than one property via AddPropertyExtractor(), by default the last one will be used for the falsecolor rendering.

◆ SetColormap()

void chrono::fea::ChVisualDomainGlyphs::SetColormap ( const ChColor col)
inline

Set the color for rendering the glyphs as constant uniform color.

This disables the colormap falsecolor rendering.

◆ Update()

virtual void chrono::fea::ChVisualDomainGlyphs::Update ( ChObj updater,
const ChFrame<> &  frame 
)
inlineoverrideprotectedvirtual

This Update() is called automatically by the parent ChPhysicsItem all time that the system needs to update the visual assets.

The main task of this Update is to generate/update the lists of glyps (vectors, poionts, etc.) that represents the visualization of the nodes and material points of the domain.

Reimplemented from chrono::ChVisualShape.


The documentation for this class was generated from the following file:
  • /builds/uwsbel/chrono/src/chrono/fea/ChDrawer.h