[Dune-devel] [Dune] List of surrounding points for any given vertex in 2D triangular meshes

Andreas Dedner a.s.dedner at warwick.ac.uk
Fri Jan 17 22:06:52 CET 2014


Hi.
You will not need an intersection iterator. Just setup something like
std::vector<std::map<int>> v
v[i] then contains all the vertex index connected to p_i.

You iterate once over the grid and for each element with vertex
index i_0,i_1,i_2 you write something like
v[i_0].insert(i_1)   v[i_0].insert(i_2)
and so on.

I can't think of anything quicker in the DUNE context (and that is exactly
the stencil of the P_1 FE as Olvier already mentioned.
I hope that works, best
Andreas

On 17.01.2014 16:31, Oliver Sander wrote:
> Am 17.01.2014 17:22, schrieb Sacconi, Andrea:
>> Hi DUNErs,
>>
>> I would like to ask you a quick question.
>> Suppose that you are working with 2D, triangular meshes; to be more precise, conforming meshes. For any given vertex, there is a certain number of surrounding vertices around, topologically connected with it. In other words, all the vertices which are second extreme of a segment, whose first extreme is the given point.
>> What is the quickest way, within DUNE framework, to extract the global index of those vertices, given the index of the one in the middle?
>>
>> I was thinking of iterating over the elements, playing around with intersections and subIndices but it seems inefficient.
>> Any clever suggestions?
>>
> If you want to do the least amount of coding: assemble a P1 mass matrix and look
> at the matrix occupation pattern.  The neighbors of vertex i correspond to the
> non-zero entries of the i-th row of that matrix.
>
> If you want fast code: strip away everything from the assembler that is not needed,
> and consider using a smarter data structure than a crs matrix.  The result will not
> be extremely fast, but that's pretty much as good as it gets with the Dune interface.
>
> Cheers,
> Oliver
>
>> Thank you very much!
>> 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
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>>
>
>
>
>
>
>
>
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20140117/8d832525/attachment.htm>


More information about the Dune-devel mailing list