dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #04188
Re: MeshIterators
On Thu, Jan 18, 2007 at 09:31:40AM +0100, Johan Jansson wrote:
> On Thu, Jan 18, 2007 at 09:28:03AM +0100, Johan Hoffman wrote:
> > Do we have a simple way to get a pointer to a MeshEntity from the
> > corresponding index? Or is the idea that we should use iterators all the
> > time? It appears that sometimes you just want the pointer from the index.
> > But maybe this is available but I have missed it?
> >
> > /Johan
> >
>
> I think you want this:
>
> Cell cell(mesh, index);
> Vertex vertex(mesh, index);
>
> etc.
>
> i.e. use the constructors for the mesh entities. This was not clear to
> me either at first.
>
> Johan
Yes, this is how you should do it. Note that creating a mesh entity
(like a cell, vertex etc) from a mesh and an index is very
lightweight. Here's the constructor for MeshEntity:
MeshEntity(Mesh& mesh, uint dim, uint index) :
_mesh(mesh), _dim(dim), _index(index) {}
This should be in the manual.
/Anders
References