1

I have this .vtk file that I have created for a single quadratic hexahedron element (cube):

# vtk DataFile Version 3.0
File generated from DClib
ASCII

DATASET UNSTRUCTURED_GRID
POINTS 20 float
0 0 0 
1 0 0 
1 1 0 
0 1 0 
0 0 1 
1 0 1 
1 1 1 
0 1 1 
0.5 0 0 
1 0.5 0 
0.5 1 0 
0 0.5 0 
0 0 0.5 
1 0 0.5 
1 1 0.5 
0 1 0.5 
0.5 0 1 
1 0.5 1 
0.5 1 1 
0 0.5 1 
CELLS 1 20
20 0 1 2 3 4 5 6 7 8 9 10 11 16 17 18 19 12 13 14 15 
CELL_TYPES 1
25

When I read it with Paraview I get the following cube:

enter image description here

As can be seen the cube is incorrect. What is wrong with this file?

This is the non-linear cell type found in VTK that I'm using:

enter image description here

Stratus
  • 159
  • 8

1 Answers1

1

In the first line of the cell data, which comes after the definition of the point data, the entry CELLS 1 20 should be replaced with

CELLS 1 21

The second number in this line indicates the total amount of numbers that must be read for the cell data, which in this case is 21: There are 20 PointIds for one cell, plus one value stating that this cell contains 20 points.

enter image description here

RHertel
  • 23,412
  • 5
  • 38
  • 64