JuliaVTK / WriteVTK.jl

Julia package for writing VTK XML files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Support for Polyhedron Cells

taylormcd opened this issue · comments

This package doesn't appear to support VTKCellTypes.VTK_POLYHEDRON cells.

The following is an example VTK file for this cell type. As far as I can tell, there doesn't seem to be a way to add the faces and faceoffsets fields in WriteVTK.

<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <UnstructuredGrid>
    <Piece NumberOfPoints="8" NumberOfCells="1">
      <PointData>
      </PointData>
      <CellData>
      </CellData>
      <Points>
        <DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="1.7320508075688772" RangeMax="1.7320508075688772">
          -1 -1 -1 1 -1 -1
          1 1 -1 -1 1 -1
          -1 -1 1 1 -1 1
          1 1 1 -1 1 1
        </DataArray>
      </Points>
      <Cells>
        <DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="7">
          0 1 2 3 4 5
          6 7
        </DataArray>
        <DataArray type="Int64" Name="offsets" format="ascii" RangeMin="8" RangeMax="8">
          8
        </DataArray>
        <DataArray type="UInt8" Name="types" format="ascii" RangeMin="42" RangeMax="42">
          42
        </DataArray>
        <DataArray type="Int64" Name="faces" format="ascii" RangeMin="0" RangeMax="7">
          6 4 0 3 2 1
          4 0 4 7 3 4
          4 5 6 7 4 5
          1 2 6 4 0 1
          5 4 4 2 3 7
          6
        </DataArray>
        <DataArray type="Int64" Name="faceoffsets" format="ascii" RangeMin="31" RangeMax="31">
          31
        </DataArray>
      </Cells>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

That shouldn't be too difficult to add.

However, I'm not really familiar with the specification of polyhedron cells. Could you provide some information on the definition of the faces and faceoffsets fields?