export_vtk_legacy Subroutine
- Seyed Ali Ghasemi
- BSD 3-Clause
- 231 statements
public impure subroutine export_vtk_legacy(filename, points, elemConn, vtkCellType, point_data, field_names, encoding, cell_data, cell_field_names)
Write points, connectivity, and optional scalar fields in legacy VTK format.
Connectivity is one-based on input and converted to VTK's zero-based
indices; every index must lie in 1:size(points,1), but this is not
checked. Two-dimensional points are emitted with a zero z coordinate.
vtkCellType=4 selects POLYDATA/LINES and permits any common row width.
Other cell types require 2, 4, or 8 nodes per row and use ForCAD's
line/quad/hex tensor-node reordering. The caller must pair the row width
with the semantically correct VTK cell identifier.
Point fields are emitted only when both point_data and field_names
are present. Cell fields follow the same rule for cell_data and
cell_field_names. Corresponding names are written verbatim after
trimming and must already be valid VTK scalar identifiers. Supplying
only one member of either data-name pair omits that association.
Binary output converts coordinates and fields to IEEE real64 and
explicitly serializes big-endian 64-bit reals and 32-bit integers as
required by the legacy format. Headers and binary blocks share one
unformatted stream; explicit ASCII line feeds make the byte layout
independent of the operating system's formatted-record convention. It
requires 8-bit file storage units and the corresponding intrinsic
integer and IEEE real kinds. Recognized encodings are exactly the lower-,
title-, and upper-case forms of ascii and binary; binary is the
default.
The procedure has no status result. Rejected metadata returns before writing, and file-system I/O failures are not converted to a ForCAD diagnostic.
Format reference: VTK Legacy File Format.
Arguments
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
Destination path. |
||
| real(kind=rk), | intent(in), | contiguous | :: | points(:,:) |
Coordinates, shape |
|
| integer, | intent(in), | contiguous | :: | elemConn(:,:) |
One-based cell connectivity, one cell per row. |
|
| integer, | intent(in) | :: | vtkCellType |
Numeric VTK legacy cell identifier. |
||
| real(kind=rk), | intent(in), | optional, | contiguous | :: | point_data(:,:) |
Optional scalar fields, shape |
| character(len=*), | intent(in), | optional, | contiguous | :: | field_names(:) |
Optional names corresponding to |
| character(len=*), | intent(in), | optional | :: | encoding |
Optional |
|
| real(kind=rk), | intent(in), | optional, | contiguous | :: | cell_data(:,:) |
Optional scalar cell fields, shape |
| character(len=*), | intent(in), | optional, | contiguous | :: | cell_field_names(:) |
Optional names corresponding to |