[dune-fem] Getting the list of neighbours for a given element of the grid

Sacconi, Andrea a.sacconi11 at imperial.ac.uk
Sat Oct 27 23:37:11 CEST 2012


Hi  Robert,

actually I'm implementing an algorithm that requires nested loops: outside, (a subset of) the elements of the grid (starting from the boundary), inside the neighbours of the given element, fixed on the outer loop.
I also need to store them somewhere (in an STL container), and move them from one container to another, so I need to be consistent.
I have re-written all the containers in terms of EntityPointer instead of IteratorType; I had already done it (before changing again); what went wrong was inserting those pointers in std::map < ..... > and std::set < ..... >. The compiler complains if you pass an IteratorType and not an EntityPointer; rough workaround: create an EntityPointer from an IteratorType and then pass it to the STL containers.

Your answer:
There is no way the create an iterator from and entity pointer.
was exactly what I needed to know.

Thanks again for your help!
Andrea

__________________________________________________________

Andrea Sacconi
PhD student, Applied Mathematics
AMMP Section, Department of Mathematics, Imperial College London,
London SW7 2AZ, UK
a.sacconi11 at imperial.ac.uk

________________________________________
From: dune-fem-bounces+a.sacconi11=imperial.ac.uk at dune-project.org [dune-fem-bounces+a.sacconi11=imperial.ac.uk at dune-project.org] on behalf of Robert Kloefkorn [robertk at ucar.edu]
Sent: 26 October 2012 18:23
To: dune-fem at dune-project.org
Subject: Re: [dune-fem] Getting the list of neighbours for a given element of the grid

On 10/26/2012 11:05 AM, Sacconi, Andrea wrote:
> Hi all,
>
> just one question about the neighbours for a given element.
>
> If you want to get all the neighbours, you enumerate all the intersections and check if the bool neighbor () is true or false.
> If it's true, calling the method outside (), you get an EntityPointer to the entity you need (i.e., the triangle that is the current neighbour under analysis).

Hi Andrea,

what exactly is the problem? You have an iterator (her the intersection
iterator) and the you iterate over all intersections and if a neighbor
is present you do the stuff that you want to do. Why do you need to
store these neighbors? And if you need to store them, use a std::vector
or something like this and then iterate over the vector.

Is that what you were asking?

Best,

Robert

PS: There is no way the create an iterator from and entity pointer.


--

Dr. Robert Kloefkorn           <robertk at ucar dot edu>

Institute for Mathematics Applied to Geosciences (IMAGe)
National Center for Atmospheric Research (NCAR)

1850 Table Mesa Drive, Boulder CO 80305, USA.

Phone: +1 303 497 2481

_______________________________________________
dune-fem mailing list
dune-fem at dune-project.org
http://lists.dune-project.org/mailman/listinfo/dune-fem




More information about the dune-fem mailing list