[Dune] uggrid<2> global vertex id order incorrect?

Carsten Gräser graeser at math.fu-berlin.de
Tue Apr 10 17:08:16 CEST 2012


Hi,

Am 10.04.2012 15:34, schrieb Lars Lubkoll:
> Hi,
> 
> I have some questions concerning the ordering and access of vertices in
> a UGGrid<2>. What I would like to do is the following:
> When "sitting" on a codim-1 entity (an edge) I want to get the edge's
> corners global vertex ids and their coordinates.
> 
> To access the global vertex id, I did the following:
> I first used the GenericReferenceElement's subEntity function to map the
> local corner id in the edge onto its local id in the triangle. Then I
> used the IndexSet's subIndex function to get the global vertex id.
then you ran into a common pitfall: The subEntity method of the
GenericReferenceElement does not give you the index of the vertex
within the element. It does only allow you to iterate over all the
vertices.
(See, e.g. http://www.dune-project.org/flyspray/index.php?do=details&task_id=818)

> 
> Now I had 2 choices to access the corresponding coordinates:
> a: using Intersection::geometry()::corner(localCornerIdInEdge)
> b: using a Codim<dim>::Iterator
> 
> - (b) seems to work correctly, but is nor elegant or efficient as the
> iterator does not support random access and consequently I have to use
> the increment-operator:(.
> - (a) does invert the order of the corners of edge 1 (local index wrt to
> the triangle containing this edge)

(a) will really give you the coordinate of a corner of an Intersection.
Since the subEntity method does not behave as you expected this will
not be the global coordinate you expect.

It seems that you want to know the global coordinate of the vertex of
an edge (as entity). You can get this directly from the edge-subentity
using subentity.geometry().corner(i) where i is the local vertex number
wrt. the subentity. The edge subentity itself can be accessed by the
subEntity method of the inside element.

Keep in mind that edge subentites and intersections are different
objects. (See e.g. http://www.dune-project.org/faq.html#ToC19)

If you want to now the global vertex index of an edge subentity you
can directly use the subIndex method with the subentity (see fs#818).
Unfortunately this is nor true for dune-2.0.

If you want to get the element-local vertex index from an edge-local
vertex index you can currently only get this by comparing the global
indices of all element vertices on this edge. You can iterate over
the latter using the subEntity method of the GenericReferenceElement.

Best,
Carsten
 


> 
> This behaviour is illustrated in "grid_id_test.cpp", which may be easier
> to understand than my explanation, in the appendix and leads me to the
> following questions:
> 
> 1. Am I just doing something wrong?
> 2. If not is the above behaviour intended?
> 3. Is there a way to directly access a vertex via its global id?
> 
> Kind regards,
> 
> 
> Lars Lubkoll
> 
> P.S.: I am using Dune2.0, gcc4.3.2 and UGGrid<2>.
> 
> 
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune


-- 
----------------------------------------------------------------------
Dr. Carsten Gräser       | phone: +49-30 / 838-75349
Freie Universität Berlin | fax  : +49-30 / 838-54977
Institut für Mathematik  | email: graeser at math.fu-berlin.de
Arnimallee 6             |
14195 Berlin, Germany    | URL  : http://page.mi.fu-berlin.de/graeser
----------------------------------------------------------------------




More information about the Dune mailing list