[Dune] Use of partition iterators

Ganesh Diwan gcdiwan83 at gmail.com
Wed Sep 16 18:30:40 CEST 2015

Thank you for your replies.

It appears that I can iterate through only the Ghost and InteriorEntity for
codim 0 for a given partition. This is OK as I am concerned about the
elements that are truly interior to a partition.
I however need more information: how to extract all the vertices and edges
(marked as blue in grid-howto) only on the border of the partition using

The border of partition must include the domain boundary if any (If I
understand correctly, as per howto some of the edges/vertices can be of
partitiontype interior and be on the domain boundary- aptly therefore
marked red).

As of now, I am able to extract only the domain boundary edges in the
partition this way.

    const Dune::PartitionIteratorType pit_all=Dune::All_Partition  ;
    typedef typename GridType::template Codim<0>::template
Partition<pit_all>::LeafIterator AllElementIterator;
    typedef typename GridView::IntersectionIterator IntersectionIterator;

    int all_ElmCount = 0;
    for (AllElementIterator it = grid.template leafbegin<0,pit_all>();
it!=grid.template leafend<0,pit_all>(); ++it) {
        if (it->partitionType() == Dune::GhostEntity)
        IntersectionIterator isIt = gv.ibegin(*it);
        const IntersectionIterator &isEndIt = gv.iend(*it);
        int numedges_on_domain_boundary = 0;
        std::cout << "coe: " << it->geometry().center() << std::endl;
        for (; isIt != isEndIt; ++isIt) {
            if(isIt->boundary()) ++ numedges_on_domain_boundary;
        std::cout << "edges on domain boundary = " <<
numedges_on_domain_boundary << std::endl;

One way to probe the border entities, I thought was to follow
test-parallel-ug.cc code:

typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView,
LayoutWrapper<0>::template Layout>
    MapperType mapper(gv);

and then probe the entity as:

for (AllElementIterator it = grid.template leafbegin<0,pit_all>();
it!=grid.template leafend<0,pit_all>(); ++it) { // element loop 2001
        int numberOfSubEntities = it->template count<1>();
        std::cout << "no of subentities = " << numberOfSubEntities <<
        for (int k = 0; k < numberOfSubEntities; k++)
            typedef typename GridView::template Codim<0>::Entity Element;
            typedef typename Element::template Codim<0>::EntityPointer
            const EntityPointer entityPointer(it->template
subEntity<1>(k)); // <<========= compilation error occurs here
            entityIndex[mapper.map(*entityPointer)]   =

But I have problem compiling this where I define the EntityPointer, the
error is:

 error: no matching function for call to ‘Dune::EntityPointer<const
Dune::UGGrid<2>, Dune::UGGridEntityPointer<0, const Dune::UGGrid<2> >
>::EntityPointer(Dune::Entity<0, 2, const Dune::UGGrid<2>,
    const EntityPointer entityPointer(it->template subEntity<1>(k));

Thank you,

On Tue, Sep 15, 2015 at 5:38 PM, Markus Blatt <markus at dr-blatt.de> wrote:

> On Tue, Sep 15, 2015 at 02:42:47PM +0200, Jö Fahlke wrote:
> >
> > To unify things, and to make using the vertices() and elements()
> functions
> > easier, recently a new scheme for naming partitions was introduced[4].
> The
> > new scheme makes it possible to name name all possible combinations, even
> > though not all combinations are supported or are even meaningful in the
> > context of entity iterators or communication.
> Isn't that against the principles DUNE ("one algorithm to use them
> (grids) all"?)?
> Can one query what combinations are supported by a grid?
> Markus
> --
> Join us at the DUNE User Meeting Sept. 28-29, 2015, Heidelberg, Germany
> http://users.dune-project.org/projects/dune-user-meeting-2015/wiki
> Dr. Markus Blatt - HPC-Simulation-Software & Services
> http://www.dr-blatt.de
> Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
> Tel.: +49 (0) 160 97590858
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150916/f731f88a/attachment.html>

More information about the Dune mailing list