Export

WriteVTK.vtk_gridFunction
vtk_grid(vtm::MultiblockFile, [filename], griddata...; kwargs...)

Create new dataset file that is added to an existent multiblock file. The VTK grid is specified by the elements of griddata.

If the filename is not given, it is determined automatically from the filename of the vtm file and the number of existent blocks.

vtk_grid(filename, x::AbstractRange{T}, y::AbstractRange{T}, [z::AbstractRange{T}];
         kwargs...)

Create image data (.vti) file.

Along each direction, the grid is specified in terms of an AbstractRange object.

Examples

# 3D dataset
julia> vtk = vtk_grid("abc", 1:0.2:5, 2:1.:3, 4:1.:5)
VTK file 'abc.vti' (ImageData file, open)

# 2D dataset
julia> vtk = vtk_grid("abc", 1:0.2:5, 2:1.:3)
VTK file 'abc.vti' (ImageData file, open)

julia> vtk = vtk_grid("def",
                      LinRange(0., 5., 10),
                      LinRange(0., 2π, 16),
                      LinRange(1., 10., 12))
VTK file 'def.vti' (ImageData file, open)
vtk_grid(filename::AbstractString,
         x::AbstractVector{T}, y::AbstractVector{T}, [z::AbstractVector{T}];
         kwargs...)

Create 2D or 3D rectilinear grid (.vtr) file.

Coordinates are specified by separate vectors x, y, z.

Examples

julia> vtk = vtk_grid("abc", [0., 0.2, 0.5], collect(-2.:0.2:3), [1., 2.1, 2.3])
VTK file 'abc.vtr' (RectilinearGrid file, open)
vtk_grid(f::Function, args...; kwargs...)

Create VTK file and apply f to it. The file is automatically closed by the end of the call.

This allows to use the do-block syntax for creating VTK files:

saved_files = vtk_grid(args...; kwargs...) do vtk
    # do stuff with the `vtk` file handler
end
vtk_grid(filename::AbstractString, grid::Grid)

Create a unstructured VTK grid from a Grid. Return a DatasetFile which data can be appended to, see vtk_point_data and vtk_cell_data.

source