[vtkusers] How to write discontinuous field data
Serge Lalonde
serge at infolytica.com
Tue Jun 17 11:37:42 EDT 2008
Hello,
I'm using ParaView in order to evalutate the visualization capabilities
of VTK. In order to do a fair evaluation, I am exporting the
discontinuous scalar field data from our current application (a magnetic
FE field solver) to a .vtk file (using the ASCII simple legacy format
according to http://www.vtk.org/pdf/file-formats.pdf).
The problem is that I can't seem to figure out how to write out the
discontinuous scalar field. I searched the help and the archives and
this isn't covered anywhere. There are references to "pulling your hair
out", and that it is supported, but it's not explained. Help!
Here is my setup:
- Tetrahedral elements (hence the data set is an unstructured grid)
- The scalar field is discontinuous at the cell boundaries. This means
that my field stores a (possibly different) value for each point, based
on which cell is accessed.
I tried generating the following file (abbreviated):
# vtk DataFile Version 3.0
Export of the mesh and field data for the field.
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 3196 double
<x y z values for all 3196 points here>
...
CELLS 16528 82640
4 <four 0-based indices into the points above to describe all the 16528
tetrahedra>
...
CELL_TYPES 16528
10 <repeated 16528 times because all elements are tetrahedra>
...
CELL_DATA 16528
FIELD ScalarField 1
FieldNameHere 4 16528 double
<four field values to specify the field values at each point of the
tetrahedra for all 16528 tetrahedra>
...
When I open this file, it almost looks right except that ParaView
calculates the magnitude of the four values for each cell when I select
"FieldNameHere" and displays that. So I never see any field variation in
a cell. I suspect that I have to use POINT_DATA, but I am unclear on how
to specify multiple scalar values (one for each cell sharing that point).
How can this be specified? Would I be better off using the XML file
format? Do I have to lose the connectivity of my mesh to get what I want
(i.e. repeat the same point N-times, where N is the number of times the
point is shared by a cell)?
Thanks.
More information about the vtkusers
mailing list