vtkwrite
vtkwrite copied to clipboard
Enabled writing VTK Cell types for unstructured meshes.
Users can now use VTK Cell Types to represent the unstructured mesh or grid geometry of their data, while also including data at vertex points for visualization. Currently supports unstructured 2D Triangles and Quads, as well as unstructured 3D Tetrahedron and Hexahedron. Requires having the connectivity list of the unstructured mesh/grid your data lives on.
This functionality is invoked by passing in the keyword argument 'celltype', followed by the a string of the mesh's cell type, followed by the connectivity matrix (connectivity is the same format as the "tri" and "tetra" matrix for the polydata examples, but for the respective Cell Type). Usage example for data corresponding to fluid flow computed on a 3D unstructured tetrahedral mesh:
vtkwrite(filename, 'unstructured_grid', x, y, z, 'celltype', 'tet', connectivity, 'vectors', 'velocities', u, v, w, 'scalars', 'pressure', p);
Mesh visualization without associated verttex data can be performed by excluding the 'vector' and 'scalar' fields and their associated arguements.
Keyword argument: 'celltype' Currently supported cell type strings are: 'tri', 'quad', 'tet', 'hex'. Connectivity matrix must be n_cells x n_vertices_per_cell. Ex: 20 Cell Hex mesh would be 20 x 8.
Supports ASCII and Binary write formats.
The following figure is an example of data visualization in Paraview from the VTK file produced using the newly implemented Cell Types functionality. Shown is a flow field solution on an arbitrarily selected partition from a parallelized semi-unstructured Hex mesh of a channel flow.