MeshVisualization
The MeshVisualization provides the class definition for the mesh visualization of a Gmsh model. It is based on the pyvista and vtk libraries und implements additional features for the mesh visualization.
Class Definition
- class gmshModel.Visualization.MeshVisualization.MeshVisualization(model=None)[source]
Bases:
objectClass for Gmsh model mesh visualization
This class visualizes the mesh of a given GmshModel using the pyvista and vtk libraries. It provides a simple method to visualize the model geometry by storing the mesh into a temporary “.vtu” file which is read by pyvista. With additional slider widgets for a threshold algorithm based on physical groups of the Gmsh model and a box widget to facilitate an extraction of areas within the mesh, the visualization tool allows to get an impression of the generated mesh.
Attributes:
- model: GmshModel object instance
model instance for which the geometry has to be displayed
- defaultSettings: dict
dictionary holding the default widget visualization options to allow restoring those options
- currentSettings: dict
dictionary holding the current widget visualization options
- plotterObj: pyvista plotter object instance
current plotter/renderer object
- mesh: mesh object instance
object holding the current mesh information
- thresholdAlgorithm: vtk Threshold Algorithm instance
object instance with information for the applied vtkThreshold algorithm
- thresholdAlgorithm: vtk Extraction Algorithm instance
object instance with information for the applied vtkExtractGeometry algorithm
- extractionBox: vtkBox object instance
object instance storing information of the extraction box
- extractionBoxBounds: pyvista PolyData object instance
object instance storing information about the extraction box boundaries
- active widgets: list
list of active widgets within the rendering object
- filterPipeline()[source]
Filter pipeline method for mesh visualization
For every confirmed change of the widget settings, the mesh has to be updated. To this end, the filter pipeline consisting of the implemented threshold and extraction algorithms has to be executed. It is done within this method.
- setupExtractionAlgorithm()[source]
Extraction algorithm method for mesh visualization
This method implements the extraction algorithm used within the filter pipeline. Based on the settings of the box widget, the mesh elements within the extraction box bounds are extracted.
- setupThresholdAlgorithm()[source]
Threshold algorithm method for mesh visualization
This method implements the threshold algorithm used within the filter pipeline. Based on the settings of the slider widgets, the visibility of physical groups is enabled oder disabled.