|
|
|
|
Exercise 2.a
Data file creation
Your first exercise is to create a valid legacy VTK or new XML based VTK (vti, vtp, etc.) formated data file with at least 20 data points. You can add as many data fields (vertex or cell) as you wish. Here are the samples shown in lecture:
| pyramid.vtk | or | box.vti |
|---|
# vtk DataFile Version 3.0
My Pyramid Example
ASCII
DATASET POLYDATA
POINTS 4 float
0.0 0.0 0.0
1.0 0.0 0.0
0.5 0.0 0.7
0.5 0.6 0.3
POLYGONS 4 16
3 0 2 1
3 0 1 3
3 0 3 2
3 1 2 3
CELL_DATA 4
SCALARS faceData int 1
LOOKUP_TABLE default
2
4
8
16
POINT_DATA 4
SCALARS vertexData float 1
LOOKUP_TABLE default
0.1
0.2
0.3
0.4
| <?xml version="1.0"?>
<VTKFile type="ImageData" version="0.1" byte_order="LittleEndian">
<ImageData WholeExtent="0 3 0 3 0 3"
Origin="0 0 0" Spacing="1 1 1">
<Piece Extent="0 3 0 3 0 3">
<PointData Scalars="vertexData">
<DataArray type="Float32" Name="scalarData" format="ascii">
0 1 2 3 1 2 3 4 2 3 4 8 3 6 9 11
2 3 4 5 5 6 7 8 3 4 5 6 4 5 6 7
3 4 5 6 3 4 5 6 4 5 6 7 6 7 8 9
2 3 4 5 2 3 4 5 3 4 5 6 4 5 6 7
</DataArray>
</PointData>
<CellData Scalars="cellData" Normals="cell_ normals">
<DataArray type="Int32" Name="cellData" format="ascii">
1 3 9 2 8 16 3 9 27
2 3 4 6 7 8 6 9 10
0 1 2 0 2 4 1 2 3
</DataArray>
</CellData>
</Piece>
</ImageData>
</VTKFile>
|
Remember you can refer to the VTK File Formats PDF guide, or you can always use one of the sample VTK files that come either with VTK, Paraview, or VisIt. (See Visualization page for links and references).
You may find it easier to either create a C/C++ program to help you dump the body of the data, or you may want to convert some data you already have in some ASCII format, by editing it manually, or using AWK or SED scripts. For any questions, be sure to refer to the classes blog.
To test that your files are working correctly you have two options: (easier) open the data in Paraview, or (harder) if you are feeling adventurous you can try installing vtk, and running a simple program like those shown in class.
Good luck!
|
Document Saved Successfully
|
|
|
|
|
|
|