Materials in VTK files

Materials divide a single dataset at the cell level into different logical regions. They are useful in VisIt because you can use the Subset window to isolate various materials so you can restrict your visualization and analysis operations to certain materials. VTK does not support materials but VisIt's VTK reader supports materials in VTK files via a convention. If you have an integer cell data array called material in your file then VisIt will use the data in that array to create a material. Note that this mechanism only supports "clean cells", or 1 material per cell.

The material array should contain values that begin at 0 and go to N-1. VisIt will scan the material data array and discern that there are N materials. The materials that VisIt creates will be labeled using the number used to represent a given material.

Example file

Here is an example file with an unstructured grid that has a material defined on it. Note how the material is encoded in the cell data section of the file. Cell data arrays are indexed using the cell index so the first entry in the material array corresponds to cell 0, the next to cell 1, and so on.

# vtk DataFile Version 3.0
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 39 float
0 2 0 2 0 0 1.5 1.5 0 
2.5 1.5 0 4 2 0 2 1.5 0 
1.5 2 0 2 2 0 2.5 2 0 
1.5 2.5 0 2 2.5 0 2.5 2.5 0 
2 4 0 1.5 1.5 0 1 1 0 
3 1 0 2.5 1.5 0 1.5 2.5 0 
1 3 0 0 2 0 0 2 0 
1 3 0 1.5 2.5 0 3 3 0 
2.5 2.5 0 1.5 2 0 1.5 1.5 0 
1.5 2.5 0 2.5 1.5 0 1.5 2.5 0 
2.5 2.5 0 2 2 0 2 2 0 
2 2 0 2 2 0 2 2 0 
2 2 0 2 2 0 2.25 2.25 0 

CELLS 44 198
4 1 2 13 14 
3 0 14 13 
4 3 1 15 16 
3 4 16 15 
3 19 20 0 
4 21 22 9 18 
4 20 19 22 21 
3 17 18 9 
3 12 18 17 
4 11 4 23 24 
3 12 24 23 
4 25 19 0 6 
3 26 13 2 
4 6 0 13 26 
3 22 27 9 
4 19 25 27 22 
4 2 1 3 5 
3 16 28 3 
4 4 8 28 16 
3 11 8 4 
3 29 17 9 
4 10 12 17 29 
3 24 30 11 
4 12 10 30 24 
4 31 26 2 7 
3 7 2 5 
3 6 26 31 
4 28 32 7 3 
3 3 7 5 
3 8 32 28 
4 34 35 7 33 
4 29 9 35 34 
4 37 31 7 35 
4 25 6 31 37 
4 35 9 27 37 
3 25 37 27 
3 36 34 33 
4 10 29 34 36 
3 32 33 7 
4 38 36 33 8 
3 8 33 32 
3 10 36 38 
4 8 11 30 38 
3 10 38 30 

CELL_TYPES 44
9
5
9
5
5
9
9
5
5
9
5
9
5
9
5
9
9
5
9
5
5
9
5
9
9
5
5
9
5
5
9
9
9
9
9
5
5
9
5
9
5
5
9
5

CELL_DATA 44
FIELD FieldData 1
material 1 44 int
0 3 0 1 3 2 3 2 2 
1 2 3 3 3 3 3 0 1 
1 1 2 2 2 2 0 0 3 
0 0 1 2 2 2 3 2 3 
2 2 1 1 1 2 1 2 
POINT_DATA 39