← Back to team overview

dolfin team mailing list archive

Re: VTK export for Cell Fields

 



Bartosz Sawicki wrote:
Hi there,

I've found that VTK export in Dolfin has one serious limitation. It ignores type of finite element of DiscreteFunction and always interpolates function into vertex values. That is very general solution, which always produce something which can be visualized, but in some cases (eg. Lagrange element - 0 order) such procedure induces errors.

VTK file format specification allows two types of functions PointData and CellData. Paraview also visualize correctly both types. So why do we alway transform everything to PointData ?

I've already write some code that enable this feature in Dolfin. Unfortunatelly it was not easy, some special hacks was needed. Of course I can send path or bundle, but I this can be done better after some redesign.

The main problem is that, when I have object of DiscreteFunction I can't check what kind of finite element is used inside, or maybe I omit something? So I can't write code which will automatically detect when to use PointData, or CellData. At this moment I solve this problem by introducing new File::Type (vtkc). When new File object is created user has possibility to choose whether it is normal VTK with PointData, or VTK with CellData.
What do you think about such solution?


I don't think that this is the best solution. Ideally, a Function will know what's appropriate. We previously supported cell data (Kristian implemented it) but we removed it because we couldn't determine robustly for a general Function (possibly a mixed element) whether cell or point data was appropriate. This may now be easier now as a lot of changes have been made since we removed support for cell data.

Once a Function can determine the appropriate format, formatting the output is pretty straightforward. For now, just project solutions onto a continuous P1 basis.

Garth



regrd.
BArtosz
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev




References