[Dune] How to write vector fields using VTKWriter?

Andreas Lauser andreas.lauser at iws.uni-stuttgart.de
Mon Jun 20 16:14:16 CEST 2011


Hi Guys.

Am Sonntag, 19. Juni 2011, 20:51:26 schrieb Christian Engwer:
> On Sat, Jun 18, 2011 at 03:26:41PM +0200, Andreas Lauser wrote:
> > Hi Jö,
> > 
> > Thanks, now it compiles and runs, but all my nice vectors still get split
> > in the output, i.e. I get nComp scalar fields instead of one vector
> > field with nComp components. If my understanding of the VTK file format
> > is correct, it would be possible to write out vector fields using the 
> > DataArray tag's NumberOfComponents attribute. I have not found a way to
> > do this via VTKWriter, though. Is it possible?
> 
> I did this several times. You have to write your own VTKFuntion which
> outputs 3-comp data. This can then be attached via addCellData or
> addVertexData.

Thanks for the hint, this works. But I guess the documentation on this subject 
could be a bit improved. (Besides: I guess that the VTKFunctions's evaluate() 
method  should better return 'float', since VTK uses float32 as an internal 
representation. If you return values exhibiting an exponent too small or too 
large to be represented by a single precision float, some versions of paraview 
crash. Another option which would not involve an API change would be to check 
for this in VTKWriter...)

cheers
  Andreas

-- 
Andreas Lauser
Lehrstuhl für Hydromechanik und Hydrosystemmodellierung
Universität Stuttgart - Institut für Wasserbau
Pfaffenwaldring 61
D-70569 Stuttgart
Tel: (+49) 0711/ 685-64719
Fax: (+49) 0711/ 685-60430
e-mail: andreas.lauser at iws.uni-stuttgart.de




More information about the Dune mailing list