[vtkusers] Simple connectivity question
Paul Cochrane
cochrane at esscc.uq.edu.au
Wed Feb 16 03:17:38 EST 2005
Hi,
I'm trying to understand how vtk orders points when one comes to describing
the connectivity between them. This is so that I can automatically generate
vtk xml files from an application being developed at my centre. For
instance, if I want to describe an UnstructuredGrid of 4 points, and 1 cell,
with data defined on each point, and on the cell, one can come up with the
vtk xml file something like the following:
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1">
<UnstructuredGrid>
<Piece NumberOfPoints="4" NumberOfCells="1">
<PointData Scalars="scalars">
<DataArray Name="scalars" type="Float32" NumberOfComponents="1"
format="ascii">
0.1
0.2
0.3
0.4
</DataArray>
</PointData>
<Points>
<DataArray NumberOfComponents="2" type="Float32" format="ascii">
0 0
1 0
0 1
1 1
</DataArray>
</Points>
<CellData Scalars="cell_scalars">
<DataArray Name="cell_scalars" type="Float32" NumberOfComponents="1"
format="ascii">
10
</DataArray>
</CellData>
<Cells>
<DataArray Name="connectivity" type="Int32" format="ascii">
0
1
2
3
</DataArray>
<DataArray Name="offsets" type="Int32" format="ascii">
4
</DataArray>
<DataArray Name="types" type="UInt8" format="ascii">
9
</DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>
Unfortunately, this doesn't load into mayavi, and so leads me to believe
that I've stuffed something up. I believe I've narrowed my problem down to
how I've described the connectivity within the Cells element (hence my
post).
My understanding from the way a VTK_QUAD object for example has its points
ordered, then one would think that the cell and points would be something
like this:
3 _____ 2
| |
| |
0 ----- 1
Where I've tried my best with ascii art the labels I would expect on the
object.
My question is then: what's wrong with having the connectivity written as
0 -> 1 -> 2 -> 3, (as I understand I've written it in the xml file above)?
Any help clearing this up would be greatly appreciated.
Thanks in advance,
Paul
--
Paul Cochrane
Computational Scientist/Software Developer
Earth Systems Science Computational Centre
University of Queensland
Brisbane
Queensland 4072
Australia
cochrane at esscc dot uq dot edu dot au
More information about the vtkusers
mailing list