[Dune] Extract host entity from GeometryGrid entity

Martin Nolte nolte at mathematik.uni-freiburg.de
Tue Dec 6 17:10:40 CET 2016


Hi Marco,

that's one of my favorite issues with DUNE: The entity you get is an instance of 
the facade class Dune::Entity which only forwards the interface methods to the 
actual implementation. If you want to access an implementation detail of a grid 
(like the hostEntity in a GeometryGrid), you need to call the method impl() on 
the entity to obtain the actual implementation. In your case, the correct 
statement is:

entity.impl().hostEntity()

Note: This method is only public, if you enable *experimental grid extensions*.

Best,

Martin


On 12/06/2016 04:25 PM, Agnese, Marco wrote:
> Hi,
>
> I need to obtain the host entity of an entity contained in a GeometryGrid.
>
> I was trying to do something like this
>
>
> for( const auto& entity : elements( geogrid.leafGridView() ) )
>
> {
>   const auto hostEntity = entity.hostEntity() ;
>   // ...
> }
>
> but I have the following error
>
> error: ‘const class Dune::Entity<0, 2, const
> Dune::GeometryGrid<Dune::YaspGrid<2>, Dune::IdenticalCoordFunction<double, 2u>
>>, Dune::GeoGrid::Entity>’ has no member named ‘hostEntity’
>
> But in dune/grid/geometrygrid/entity.hh the hostEntity() method is defined.
>
> Any idea of what am I doing wrong?
>
> Cheers,
> Marco
>
>
>
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list