<div dir="ltr"><div><div><div><div>I am confused because of what I see as the output of gridleaflist and what the Intersectioniterator loop gives me. Please allow me to modify the meshfile above so that I have more than one element. My mesh is now, say:<br><br>$MeshFormat<br>2.0 0 8<br>$EndMeshFormat<br>$Nodes<br>9<br>1 0 0 0<br>2 0.5 0 0<br>5 1 0 0<br>6 1 0.5 0<br>8 1 1 0<br>7 0.5 1 0<br>9 0 1 0<br>3 0 0.5 0<br>4 0.5 0.5 0<br>$EndNodes<br>$Elements<br>4<br>1 3 0 1 2 4 3<br>2 3 0 2 5 6 4<br>3 3 0 4 6 8 7<br>4 3 0 3 4 7 9<br>$EndElements<br><br><br>The local node numbering provided at <a href="http://www.dune-project.org/doc/doxygen/dune-geometry-html/group___geometry_reference_elements.html">http://www.dune-project.org/doc/doxygen/dune-geometry-html/group___geometry_reference_elements.html</a> for a reference element matches with what I see as the outcome of Dune::gridleaflist(*grid, "Grid_leaf_info ") and this is given below-<br><br>Grid_leaf_info level=0 (cube, 2)[2] index=0 gid=0 leaf=1 partition=interior center=(0.25 0.25) first=(0 0)<br>Grid_leaf_info codim 2 subindex 0:0 1:1 2:2 3:3<br>Grid_leaf_info codim 1 subindex 0:0 1:1 2:2 3:3<br>Grid_leaf_info level=0 (cube, 2)[2] index=1 gid=1 leaf=1 partition=interior center=(0.75 0.25) first=(0.5 0)<br>Grid_leaf_info codim 2 subindex 0:1 1:4 2:3 3:5<br>Grid_leaf_info codim 1 subindex 0:1 1:4 2:5 3:6<br>Grid_leaf_info level=0 (cube, 2)[2] index=2 gid=2 leaf=1 partition=interior center=(0.75 0.75) first=(0.5 0.5)<br>Grid_leaf_info codim 2 subindex 0:3 1:5 2:6 3:7<br>Grid_leaf_info codim 1 subindex 0:7 1:8 2:6 3:9<br>Grid_leaf_info level=0 (cube, 2)[2] index=3 gid=3 leaf=1 partition=interior center=(0.25 0.75) first=(0 0.5)<br>Grid_leaf_info codim 2 subindex 0:2 1:3 2:8 3:6<br>Grid_leaf_info codim 1 subindex 0:10 1:7 2:3 3:11<br><br></div><div>This is perfectly fine.<br></div>However when doing the mesh traversal using the IntersectionIterator I see that the orientation of the faces is not the same as what I get from gridleaflist.<br><br></div>Consider only the first element for which the IntersectionIteror gives me:<br>node 1 for face 0 is 0.5 0<br>node 2 for face 0 is 0.5 0.5<br><br>visiting face 1(simplex, 1)<br>node 1 for face 1 is 0 0.5<br>node 2 for face 1 is 0.5 0.5<br><br>visiting face 2(simplex, 1)<br>node 1 for face 2 is 0 0<br>node 2 for face 2 is 0 0.5<br><br>visiting face 3(simplex, 1)<br>node 1 for face 3 is 0 0<br>node 2m for face 3 is 0.5 0<br><br></div>From gridleaflist and above output corresponding to the first element I understand the face orientation is:<br><br><br>gridleaflist face orientation <br></div> +-----------+<br> | 3 | <br> | | <br> | 0 1 |<br> | | <br> | 2 | <br> +-----------+<br><div><div><div><br><br> I would expect them to be the same. Or did I miss something?<br><br><br><div><br><br><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 13, 2015 at 2:20 PM, Jö Fahlke <span dir="ltr"><<a href="mailto:jorrit@jorrit.de" target="_blank">jorrit@jorrit.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am Mon, 13. Apr 2015, 10:33:49 +0100 schrieb Ganesh Diwan:<br>
> Date: Mon, 13 Apr 2015 10:33:49 +0100<br>
> From: Ganesh Diwan <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>><br>
> To: Ganesh Diwan <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>>, Oliver Sander<br>
<span class="">> <<a href="mailto:sander@igpm.rwth-aachen.de">sander@igpm.rwth-aachen.de</a>>, DUNE Liste <<a href="mailto:dune@dune-project.org">dune@dune-project.org</a>><br>
> Subject: Re: [Dune] Local node numbering in Dune<br>
<br>
</span>I'm not sure what the inconsistency is you are concerned about. These numbers<br>
look OK to me. Maybe these two observations will help to clear the confusion<br>
up:<br>
<br>
- You are printing the corners of intersections. Intersections are not<br>
subentities of the referenceelements of their neighboring elements, so their<br>
orientation is somewhat arbitrary, may depend on the grid manager used, and<br>
may even depend on how that particular grid was constructed. To transform<br>
from the local coornate system of an intersection to the local coordinate<br>
system of its inside (outside) element, use is->geometryInInside()<br>
(is->geometryInOutside()).<br>
<br>
- The intersection iterator can visit the intersections in arbitrary order.<br>
There is however a special number that you can request: is->indexInInside().<br>
Basically, this tells you the number of the codim-1-subentitiy of the<br>
inside-element that coincides with the intersection. For non-conforming<br>
grids, multiple intersections of the same inside element can have the same<br>
indexInInside():<br>
<br>
+-----------+-----+<br>
| 3 | |<br>
| 1| |<br>
|0 +-----+<br>
| 1| |<br>
| 2 | |<br>
+-----------+-----+<br>
<br>
There are five intersections in the larger element, two of which have<br>
indexInInside()==1.<br>
<br>
There is also a corresponding is->indexInOutside().<br>
<br>
If that does not clear things up, please point us to a particular a number<br>
from the output that you think is wrong, tell us what you think it should be<br>
instead, and why yoh think so.<br>
<br>
Regards,<br>
Jö.<br>
<div><div class="h5"><br>
> I'm sorry, you appear to have included the wrong version of MeshTraversal in<br>
> > your mail. At least I cannot see how it could have produced the output<br>
> > above,<br>
> > since it does not contain the string "my face".<br>
> ><br>
><br>
> My apologies for the confusion. I should have pasted the precise output<br>
> from my code, here it is:<br>
><br>
><br>
> //<br>
> -------------------------------------------------------------------------------------------------<br>
> dimension of the grid is: 2<br>
> visiting element 1(cube, 2)<br>
> visiting face 1(simplex, 1)<br>
> node 1 for face 1 is 1 0<br>
> node 2 for face 1 is 1 1<br>
> visiting face 2(simplex, 1)<br>
> node 1 for face 2 is 0 1<br>
> node 2 for face 2 is 1 1<br>
> visiting face 3(simplex, 1)<br>
> node 1 for face 3 is 0 0<br>
> node 2 for face 3 is 0 1<br>
> visiting face 4(simplex, 1)<br>
> node 1 for face 4 is 0 0<br>
> node 2 for face 4 is 1 0<br>
> //<br>
> -------------------------------------------------------------------------------------------------<br>
> // end of output from MeshTraversal<br>
><br>
> I hope it is clear now, please write if it is not. Also please see the mesh<br>
> data in gmsh format which I am using as input to the code above-<br>
><br>
> $MeshFormat<br>
> 2.2 0 8<br>
> $EndMeshFormat<br>
> $Nodes<br>
> 4<br>
> 1 0 0 0<br>
> 2 1 0 0<br>
> 3 1 1 0<br>
> 4 0 1 0<br>
> $EndNodes<br>
> $Elements<br>
> 9<br>
> 1 15 2 0 1 1<br>
> 2 15 2 0 2 2<br>
> 3 15 2 0 3 3<br>
> 4 15 2 0 4 4<br>
> 5 1 2 0 1 1 2<br>
> 6 1 2 0 1 2 3<br>
> 7 1 2 0 1 3 4<br>
> 8 1 2 0 1 4 1<br>
> 9 3 2 0 6 1 2 3 4<br>
> $EndElements<br>
><br>
><br>
> Many thanks for your help,<br>
> Ganesh<br>
><br>
><br>
><br>
><br>
> On Fri, Apr 10, 2015 at 9:27 PM, Jö Fahlke <<a href="mailto:jorrit@jorrit.de">jorrit@jorrit.de</a>> wrote:<br>
><br>
> > Am Fri, 10. Apr 2015, 14:09:09 +0100 schrieb Ganesh Diwan:<br>
> > > Date: Fri, 10 Apr 2015 14:09:09 +0100<br>
> > > From: Ganesh Diwan <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>><br>
> > > To: Oliver Sander <<a href="mailto:sander@igpm.rwth-aachen.de">sander@igpm.rwth-aachen.de</a>>, DUNE Liste<br>
> > > <<a href="mailto:dune@dune-project.org">dune@dune-project.org</a>><br>
> > > Subject: Re: [Dune] Local node numbering in Dune<br>
> > > X-No-Auth: unauthenticated sender<br>
> > > X-No-Relay: not in my network<br>
> > > X-Envelope-From: <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>><br>
> > ><br>
> > > Hi Oliver<br>
> > ><br>
> > > When I loop through the element(s), I see that Dune returns element faces<br>
> > > that are in conflict with what the link above says. To be specific I get<br>
> > > my face 2 as Dune reference element face 0,<br>
> > > my face 0 as Dune reference element face 1,<br>
> > > my face 3 as Dune reference element face 2, and<br>
> > > my face 1 as Dune reference element face 3,<br>
> > ><br>
> > > Clearly I am doing something wrong!<br>
> ><br>
> > I'm sorry, you appear to have included the wrong version of MeshTraversal<br>
> > in<br>
> > your mail. At least I cannot see how it could have produced the output<br>
> > above,<br>
> > since it does not contain the string "my face".<br>
> ><br>
> > (In case I misunderstood and MeshTraversal was not meant to produce that<br>
> > output, please clarify how you obtained the numbers after "my face" and<br>
> > "Dune<br>
> > reference element face".)<br>
> ><br>
> > Regards,<br>
> > Jö.<br>
> ><br>
> > > I have:<br>
> > ><br>
> > > typedef Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming> GridTypeALU;<br>
> > > std::auto_ptr<GridTypeALU> mygrid( GmshReader<GridTypeALU>::read(<br>
> > > "./grids/hhgex.msh", true, true ) );<br>
> > > MeshTraversal (*mygrid); //<br>
> > ><br>
> > > and then I have MeshTraversal as:<br>
> > ><br>
> > > template<class G><br>
> > > void MeshTraversal(G& grid) {<br>
> > > //first we extract the dimensions of the grid<br>
> > ><br>
> > > const int dim = G::dimension;<br>
> > > std::cout << "dimension of the grid is: " << dim << std::endl;<br>
> > > const int dimworld = G::dimensionworld;<br>
> > > typedef typename G::ctype ct;<br>
> > > typedef typename G::LeafGridView GridView;<br>
> > ><br>
> > > typedef typename GridView::template Codim<0>::Iterator LeafIterator;<br>
> > > typedef typename GridView::IntersectionIterator IntersectionIterator;<br>
> > ><br>
> > > GridView gridView = grid.leafView();<br>
> > > // get grid view on leaf part<br>
> > ><br>
> > > LeafIterator endit = gridView.template end<0>();<br>
> > ><br>
> > > int count = 0;<br>
> > > //<br>
> > > for (LeafIterator it = gridView.template begin<0>(); it != endit;<br>
> > ++it)<br>
> > > {<br>
> > ><br>
> > > count++;<br>
> > > Dune::GeometryType gt = it->type();<br>
> > > //<br>
> > > std::cout << "visiting element " << count << gt << std::endl;<br>
> > ><br>
> > > IntersectionIterator isend = gridView.iend(*it);<br>
> > ><br>
> > > int countface = 0;<br>
> > > for (IntersectionIterator is = gridView.ibegin(*it); is != isend;<br>
> > > ++is) {<br>
> > > countface++;<br>
> > > Dune::GeometryType gfacet = is->type();<br>
> > > std::cout << "visiting face " << countface << gfacet <<<br>
> > > std::endl;<br>
> > > std::cout << "node 1 for face" << countface << " is "<br>
> > > << is->geometry().corner(0) << std::endl;<br>
> > > std::cout << "node 2 for face" << countface << " is "<br>
> > > << is->geometry().corner(1) << std::endl;<br>
> > > //<br>
> > > }<br>
> > > }<br>
> > > std::cin.get();<br>
> > > }<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Wed, Apr 8, 2015 at 3:57 PM, Ganesh Diwan <<a href="mailto:gcdiwan83@gmail.com">gcdiwan83@gmail.com</a>><br>
> > wrote:<br>
> > ><br>
> > > > Thankyou!<br>
> > > ><br>
> > > > Ganesh<br>
> > > ><br>
> > > > On Wed, Apr 8, 2015 at 3:56 PM, Oliver Sander <<br>
> > <a href="mailto:sander@igpm.rwth-aachen.de">sander@igpm.rwth-aachen.de</a>><br>
> > > > wrote:<br>
> > > ><br>
> > > >> Am 08.04.2015 um 16:50 schrieb Ganesh Diwan:<br>
> > > >> > Dear List<br>
> > > >> ><br>
> > > >> > It appears that after reading the grid from a Gmsh format file<br>
> > inside<br>
> > > >> Dune,<br>
> > > >> > the local dofs 2 and 3 i.e. node number 3 and 4 are swapped. This is<br>
> > > >> inside<br>
> > > >> > dune-grid//dune/grid/io/file/gmshreader.hh<br>
> > > >> ><br>
> > > >> > Is there a specific reason this is done? Is there a way to tell<br>
> > Dune to<br>
> > > >> use<br>
> > > >> > the same node numbering as in Gmsh file and not to alter it?<br>
> > > >><br>
> > > >> Hi Ganesh,<br>
> > > >> Dune has one fixed numbering for the local node numbers of all<br>
> > reference<br>
> > > >> elements<br>
> > > >> (see<br>
> > > >><br>
> > <a href="http://www.dune-project.org/doc/doxygen/dune-geometry-html/group___geometry_reference_elements.html" target="_blank">http://www.dune-project.org/doc/doxygen/dune-geometry-html/group___geometry_reference_elements.html</a><br>
> > > >> )<br>
> > > >><br>
> > > >> These numberings differ from the ones used by gmsh, and hence the gmsh<br>
> > > >> reader<br>
> > > >> needs to do some node swapping.<br>
> > > >><br>
> > > >> Best,<br>
> > > >> Oliver<br>
> > > >><br>
> > > >> ><br>
> > > >> > Thankyou<br>
> > > >> > Ganesh<br>
> > > >> ><br>
> > > >> ><br>
> > > >> ><br>
> > > >> > _______________________________________________<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" target="_blank">http://lists.dune-project.org/mailman/listinfo/dune</a><br>
> > > >> ><br>
> > > >><br>
> > > >><br>
> > > >><br>
> > > >> _______________________________________________<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" target="_blank">http://lists.dune-project.org/mailman/listinfo/dune</a><br>
> > > >><br>
> > > >><br>
> > > ><br>
> ><br>
> > > _______________________________________________<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" target="_blank">http://lists.dune-project.org/mailman/listinfo/dune</a><br>
> ><br>
> ><br>
> > --<br>
> > Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,<br>
> > University of Münster, Orleans-Ring 10, D-48149 Münster<br>
> > Tel: <a href="tel:%2B49%20251%2083%2035146" value="+492518335146">+49 251 83 35146</a> Fax: <a href="tel:%2B49%20251%2083%2032729" value="+492518332729">+49 251 83 32729</a><br>
> ><br>
> > Interpunktion, Orthographie und Grammatik der Email ist frei erfunden.<br>
> > Eine Übereinstimmung mit aktuellen oder ehemaligen Regeln wäre rein<br>
> > zufällig und ist nicht beabsichtigt.<br>
> ><br>
<br>
> _______________________________________________<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" target="_blank">http://lists.dune-project.org/mailman/listinfo/dune</a><br>
<br>
<br>
--<br>
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,<br>
University of Münster, Orleans-Ring 10, D-48149 Münster<br>
Tel: <a href="tel:%2B49%20251%2083%2035146" value="+492518335146">+49 251 83 35146</a> Fax: <a href="tel:%2B49%20251%2083%2032729" value="+492518332729">+49 251 83 32729</a><br>
<br>
</div></div>If God had intended Man to Smoke, He would have set him on Fire.<br>
-- fortune<br>
</blockquote></div><br></div>