[vtkusers] How to write discontinuous field data

John Platt jcplatt at dsl.pipex.com
Wed Jun 18 04:16:18 EDT 2008


Hi,

VTK does not support point data on a cell by cell basis. A hack I have
used is to shrink the mesh using a shrink factor of 1 and then set the
point data. Unfortunately, this requires some significant programming
effort and is inefficient because it duplicates nodal positions. You
must give each cell unique point IDs and turn off merging of points.

Given that many real problems have scalar gradients that are
discontinuous across interfaces, personally, I think this is a serious
shortcoming.

John.

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
Behalf Of Serge Lalonde
Sent: 17 June 2008 16:38
To: vtkusers at vtk.org
Subject: [vtkusers] How to write discontinuous field data

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.
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list