VTKBase.jl

The VTKBase.jl package contains common definitions used in the WriteVTK.jl and ReadVTK.jl packages.

VTK dataset types

VTKBase.VTKImageDataType
VTKImageData <: StructuredVTKDataset

Represents the VTK image data format (.vti extension).

This corresponds to rectangular grids with uniform spacing in all directions.

source
VTKBase.VTKRectilinearGridType
VTKRectilinearGrid <: StructuredVTKDataset

Represents the VTK rectilinear grid format (.vtr extension).

This corresponds to rectangular grids with non-uniform spacing.

source
VTKBase.VTKStructuredGridType
VTKStructuredGrid <: StructuredVTKDataset

Represents the VTK structured grid format (.vts extension).

This corresponds to curvilinear grids, the most general kind of structured grid.

source
VTKBase.VTKPolyDataType
VTKPolyData <: UnstructuredVTKDataset

Represents the VTK polydata format (.vtp extension).

These are unstructured datasets that accept a limited set of cells types, defined in the PolyData module.

source
VTKBase.VTKUnstructuredGridType
VTKUnstructuredGrid <: UnstructuredVTKDataset

Represents the VTK unstructured format (.vtu extension).

This is the most general kind of unstructured grid, which accepts all cell types defined in the VTKCellTypes module.

source

Field data types

In VTK, data can either be attached to the geometry (point and cell data), or not (field data).

VTKBase.VTKFieldDataType
VTKFieldData <: AbstractFieldData

Represents data that is not attached to the grid geometry.

This is typically used for lightweight metadata, such as timestep information or strings.

source

Cells in unstructured grids

General unstructured datasets

These are useful when working with general unstructured datasets (.vtu files).

VTKBase.VTKCellTypes.nodesFunction
nodes(c::VTKCellTypes)

Returns the number of nodes (or grid points) required by the cell type.

For instance, this returns 3 for VTK_TRIANGLE.

For cell types that can take any number of nodes, such as VTK_POLY_LINE, this returns -1.

source
VTKBase.MeshCellType
MeshCell <: AbstractMeshCell

Single cell element in unstructured or polygonal grid.

It is characterised by a cell type (for instance, VTKCellType.TRIANGLE or PolyData.Strips) and by a connectivity vector determining the points on the grid defining this cell.


MeshCell(cell_type, connectivity)

Define a single cell element of an unstructured grid.

The cell_type argument characterises the type of cell (e.g. vertex, triangle, hexaedron, ...):

  • cell types for unstructured datasets are defined in the VTKCellTypes

module;

  • cell types for polygonal datasets are defined in the PolyData module.

The connectivity argument is a vector or tuple containing the indices of the points passed to vtk_grid which define this cell.

Example

Define a triangular cell passing by points with indices [3, 5, 42].

julia> cell = MeshCell(VTKCellTypes.VTK_TRIANGLE, (3, 5, 42))
MeshCell{VTKCellType, Tuple{Int64, Int64, Int64}}(VTKCellType("VTK_TRIANGLE", 0x05, 3), (3, 5, 42))
source

Polygonal datasets

These are useful when working with polygonal datasets (.vtp files).

VTKBase.PolyDataModule
PolyData

Defines cell types for polygonal datasets.

The following singleton types are defined:

  • PolyData.Verts for vertices,
  • PolyData.Lines for lines,
  • PolyData.Strips for triangular strips,
  • PolyData.Polys for polygons.
source
VTKBase.VTKPolyhedronType
VTKPolyhedron <: AbstractMeshCell

Represents a polyhedron cell in an unstructured grid.

Using VTKPolyhedron should be preferred to using a MeshCell with a cell type VTKCellTypes.VTK_POLYHEDRON, since the latter cannot hold all the necessary information to describe a polyhedron cell.


VTKPolyhedron(connectivity, faces...)

Construct polyhedron cell from connectivity vector (see MeshCell for details) and from a list of polyhedron faces.

Example

Create a polyhedron with 8 points and 6 faces. This can represent a cube if the 8 points are properly positioned.

julia> cell = VTKPolyhedron(
           1:8,
           (1, 4, 3, 2),
           (1, 5, 8, 4),
           (5, 6, 7, 8),
           (6, 2, 3, 7),
           (1, 2, 6, 5),
           (3, 4, 8, 7),
       )
VTKPolyhedron{UnitRange{Int64}, NTuple{6, NTuple{4, Int64}}}(1:8, ((1, 4, 3, 2), (1, 5, 8, 4), (5, 6, 7, 8), (6, 2, 3, 7), (1, 2, 6, 5), (3, 4, 8, 7)))
source

Constants