<div dir="ltr"><div><div><div><div>Hi Steffen<br><br></div>Thank you. Yes, that works but with that I was able to visit only the boundary domain and not the interface between the partitions. A small change<br><br>isIt->boundary()) || ( isIt->neighbor() && isIt->inside().partitionType() == Dune::InteriorEntity && isIt->outside().partitionType() == Dune::GhostEntity // this visits and not skips<br><br></div>now visits all the vertices sitting on the partition boundary which could either be part of partition interface or the domain boundary.<br><br></div>Regards<br></div>Ganesh<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 16, 2015 at 8:18 PM, Steffen Müthing <span dir="ltr"><<a href="mailto:steffen.muething@iwr.uni-heidelberg.de" target="_blank">steffen.muething@iwr.uni-heidelberg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ganesh,<br>
<span class=""><br>
<br>
> Am 16.09.2015 um 19:14 schrieb Ganesh Diwan <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>>:<br>
><br>
> Sorry to bother you again,<br>
><br>
> If I set the iterator for vertices same as above, I am able to extract the border vertices but this obviously misses the domain boundary.<br>
> I.e. it->partitionType()==Dune::BorderEntity gives me the shared vertices between the partition boundaries but not those on the domain boundary.<br>
<br>
</span>if you want to find the set of all vertices that are situated on the surface of the interiorBorder partition, the easiest way is probably to go through the<br>
cells and their intersections:<br>
<br>
for (const auto& cell : cells(gv,Partitions::interiorBorder))<br>
{<br>
auto& ref_el = Dune::ReferenceElements<double,dim>::general(cell.geometry().type());<br>
for (const auto& is : intersections(gv,cell))<br>
{<br>
// this skips all intersections that are not either on the domain boundary or have a neighbor<br>
// that is not in the interior partition<br>
if ((!is.boundary()) || (is.neighbor() && is.outside().partitionType() == Dune::InteriorEntity))<br>
continue;<br>
for (int i = 0; i < ref_el.size(is.indexInInside(),1,dim); ++i)<br>
{<br>
auto local_vertex_index = ref_el.index(is.indexInInside(),1,i,dim);<br>
// here, you get every vertex that lies on the surface of the interiorBorder partition<br>
auto vertex = cell.template subEntity<dim>(local_vertex_index);<br>
// if you only need the index of that vertex, it is faster to do the following:<br>
auto vertex_index = gv.indexSet().subIndex(cell,local_vertex_index,dim);<br>
}<br>
}<br>
}<br>
<br>
That code isn’t tested, but it should be broadly correct. Note, however, that it can (and probably) will visit vertices multiple times!<br>
<br>
Cheers,<br>
Steffen<br>
<div><div class="h5"><br>
><br>
> Thank you<br>
> Ganesh<br>
><br>
> On Wed, Sep 16, 2015 at 5:30 PM, Ganesh Diwan <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>> wrote:<br>
> Hi<br>
> Thank you for your replies.<br>
><br>
> 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.<br>
> 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 this?<br>
><br>
> 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).<br>
><br>
> As of now, I am able to extract only the domain boundary edges in the partition this way.<br>
><br>
> const Dune::PartitionIteratorType pit_all=Dune::All_Partition ;<br>
> typedef typename GridType::template Codim<0>::template Partition<pit_all>::LeafIterator AllElementIterator;<br>
> typedef typename GridView::IntersectionIterator IntersectionIterator;<br>
><br>
> int all_ElmCount = 0;<br>
> for (AllElementIterator it = grid.template leafbegin<0,pit_all>(); it!=grid.template leafend<0,pit_all>(); ++it) {<br>
> if (it->partitionType() == Dune::GhostEntity)<br>
> continue;<br>
> IntersectionIterator isIt = gv.ibegin(*it);<br>
> const IntersectionIterator &isEndIt = gv.iend(*it);<br>
> int numedges_on_domain_boundary = 0;<br>
> std::cout << "coe: " << it->geometry().center() << std::endl;<br>
> for (; isIt != isEndIt; ++isIt) {<br>
> if(isIt->boundary()) ++ numedges_on_domain_boundary;<br>
> }<br>
> std::cout << "edges on domain boundary = " << numedges_on_domain_boundary << std::endl;<br>
> ++all_ElmCount;<br>
> }<br>
><br>
><br>
> One way to probe the border entities, I thought was to follow test-parallel-ug.cc code:<br>
><br>
> typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, LayoutWrapper<0>::template Layout><br>
> MapperType;<br>
> MapperType mapper(gv);<br>
><br>
><br>
> and then probe the entity as:<br>
><br>
> for (AllElementIterator it = grid.template leafbegin<0,pit_all>(); it!=grid.template leafend<0,pit_all>(); ++it) { // element loop 2001<br>
> int numberOfSubEntities = it->template count<1>();<br>
> std::cout << "no of subentities = " << numberOfSubEntities << std::endl;<br>
> for (int k = 0; k < numberOfSubEntities; k++)<br>
> {<br>
> typedef typename GridView::template Codim<0>::Entity Element;<br>
> typedef typename Element::template Codim<0>::EntityPointer EntityPointer;<br>
> const EntityPointer entityPointer(it->template subEntity<1>(k)); // <<========= compilation error occurs here<br>
> entityIndex[mapper.map(*entityPointer)] = mapper.map(*entityPointer);<br>
> }<br>
> }<br>
><br>
> But I have problem compiling this where I define the EntityPointer, the error is:<br>
><br>
> 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>, Dune::UGGridEntity>::subentity_return_info<1>::type)’<br>
> const EntityPointer entityPointer(it->template subEntity<1>(k));<br>
><br>
><br>
> Thank you,<br>
> Ganesh<br>
><br>
> On Tue, Sep 15, 2015 at 5:38 PM, Markus Blatt <<a href="mailto:markus@dr-blatt.de">markus@dr-blatt.de</a>> wrote:<br>
> On Tue, Sep 15, 2015 at 02:42:47PM +0200, Jö Fahlke wrote:<br>
> ><br>
> > To unify things, and to make using the vertices() and elements() functions<br>
> > easier, recently a new scheme for naming partitions was introduced[4]. The<br>
> > new scheme makes it possible to name name all possible combinations, even<br>
> > though not all combinations are supported or are even meaningful in the<br>
> > context of entity iterators or communication.<br>
><br>
> Isn't that against the principles DUNE ("one algorithm to use them<br>
> (grids) all"?)?<br>
><br>
> Can one query what combinations are supported by a grid?<br>
><br>
> Markus<br>
> --<br>
> Join us at the DUNE User Meeting Sept. 28-29, 2015, Heidelberg, Germany<br>
> <a href="http://users.dune-project.org/projects/dune-user-meeting-2015/wiki" rel="noreferrer" target="_blank">http://users.dune-project.org/projects/dune-user-meeting-2015/wiki</a><br>
><br>
> Dr. Markus Blatt - HPC-Simulation-Software & Services <a href="http://www.dr-blatt.de" rel="noreferrer" target="_blank">http://www.dr-blatt.de</a><br>
> Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany<br>
> Tel.: <a href="tel:%2B49%20%280%29%20160%2097590858" value="+4916097590858">+49 (0) 160 97590858</a><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Dune mailing list<br>
> <a href="mailto:Dune@dune-project.org">Dune@dune-project.org</a><br>
> <a href="http://lists.dune-project.org/mailman/listinfo/dune" rel="noreferrer" target="_blank">http://lists.dune-project.org/mailman/listinfo/dune</a><br>
<br>
</blockquote></div><br></div>