[Dune] How to write vector fields using VTKWriter?

Jö Fahlke jorrit at jorrit.de
Sat Jun 18 14:19:28 CEST 2011


Am Sat, 18. Jun 2011, 14:06:51 +0200 schrieb Andreas Lauser:
> Does DUNE provide a way to write vector fields to a VTK file? To me it seems 
> that the "nComps" argument in VTKWriter's addVertexData method is there for 
> this purpose, but unfortunately the attached example only compiles for 
> fieldDim == 1.

vtkWriter.addCellData(vector, "name", fieldDim) is meant for flat vectors, not
nested ones.  It probably works for fieldDim==1 because FieldVector<K,1> and K
are meant to be interoperable, while FieldVector<K,n> and K are not, for n!=1.

Either use a flat vector with fieldDim*cellRes[0] entries, or write an adapter
for your nested vector to present a flat vector view, or wrap the vector into
a VTKFunction yourself and add that to the vtkWriter.

Bye,
Jö.

-- 
Warum die Sonne verboten werden sollte: http://www.bastiat.de unter
"Petition".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110618/e15737d9/attachment.sig>


More information about the Dune mailing list