[Dune] Problems using VTK cell data with Dune IndexSet

Sascha Zelzer s.zelzer at dkfz-heidelberg.de
Thu Dec 27 18:07:23 CET 2012

Hi Christian,

thanks for reply! I have seen the method in the docs but couldn't 
initially think of a way to use it.

Now, when iterating over codim=0 leaf entities of the created grid, the 
returned indices are ordered in the same way as the cell elements were 
added using the grid factory, which is great. But they have an offset. 
The offset in my case is neither the number of inserted vertices or 
anything I could think of. Do you know what it is? For now, I can just 
subtract the insertion index from the first leaf iterator.


P.S. I will try to get some time for cleaning up and sending a Dune VTK 
grid reader class.

On 12/27/2012 03:57 PM, Christian Engwer wrote:
> Hi Sascha,
>> I have VTK unstructured grid files as inputs for a FEM simulation.
>> Using the Dune GridFactory (templated with
>> Dune::ALUSimplexGrid<3,3>) I am able to translate the VTK grid into
>> a Dune grid. However, I need to be able to associate the grid
>> entities (tetrahedra) with their original VTK cell data and am
>> having hard times to achieve that. The indices returned by
>> duneGrid.leafView().indexSet(tetEntity)
>> are differently ordered compared to their insertion order with the
>> grid factory (maybe due to load balancing when creating the grid?)
>> and I cannot find a way to create a mapping of the index set values
>> into the original VTK cell ids (and their respective cell data).
> There is no guarantee on the indexes returned by the grid, compared to
> the grid file. You have to use the insertion index. You ask the grid
> factory for the insertionIndex of a given cell.
> Dune::GridFactory::insertionIndex (const typename Codim< 0 >::Entity &entity) const
>> Did I miss something? Does anybody have a nice solution for that? If
>> there is a solution and people are interested in such a conversion
>> class (VTK -> Dune Grid) I would be happy to share it.
> Adding such a reader would be nice :-)
> Christian
>> Many thanks,
>> Sascha
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune

More information about the Dune mailing list