[Dune] How to iterate over Process Boundary edges

Martin Nolte nolte at mathematik.uni-freiburg.de
Fri Apr 10 11:18:24 CEST 2015


Hi Aleksejs,

given your introduction, I hardly dare answering. So please excuse me, if I 
got your question wrong of give you just another inefficient of ineffective 
answer.

As far as I understand your question, you seek all edges with partition type 
"border", so the code could look like

for( const auto &edge : edges( gridView, Partitions::interiorBorder ) )
{
   if( edge.partitionType() != BorderEntity )
     continue;

   // do whatever you need to do on an edge on the process border
}

Best,

Martin

On 04/10/2015 10:56 AM, Aleksejs Fomins wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Dear Dune,
>
> I know I have asked this question about a hundred times now, but I would really like to get a consistent answer on it, and so far I was always sent off to read the Intersection documentation which I can probably recite with closed eyes by now.
>
> I want to iterate over all edges that are on the process boundary and do something with them. I have a certain diagnostics routine which does only that and nothing else.
>
> Currently employed method:
> 1.1) Iterate over all elements
> 1.2) Iterate over all intersections
> 1.3) Check if the outside element of the intersection is a Ghost
> 1.4) If yes, extract all edges associated with the intersection as subentities of the face.
> 1.5) Do sth with extracted edges
>
> The problem with this code, disregarding the fact that it is clumsy, is also that it is very inefficient.
> Even though in my special case I am only interested in process boundary edges, this algorithm effectively iterates
> * Once over all elements,
> * twice over all faces (because all internal intersections are visited twice)
> * and twice over all process boundary edges (because most PB edges are shared by two PB faces)
>
> So this code is approx 5 times slower than this hypothetical straightforward code
> 2.1) Iterate over all edges (entities of codim 2)
> 2.2) Find out if this edge is on a process boundary in constant time
> 2.3) If yes, do sth with this edge
>
> The question is if it is possible to do 2.2 and if yes then how?
>
> Regards,
> Aleksejs
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
>
> iQIcBAEBAgAGBQJVJ5BAAAoJEDkNM7UOEwMZ4ckP/jOx/tsNewQ12+Hq/ZvTaBeN
> D1Wj1pYuxgPEtVl/ZV7zxxez4RjRfwWdLgl0d35gWc/cw/KOf/7qClYqAn4aN1jk
> F3XDkKVEk//dW64l2n3A1AQy+p6v+nB/bkfymeDy+07E9E9PaAOiPm2afxQCbeqy
> bvvEoLe6UdXDap9etpX7vREH6/nL2FVcQ5QKJkbizpt20r9S/RqZ2Nii/qNlRU98
> SYLteSRtwyvQfNgbORMMo9CQmjqbH1Oy29FvseS1x2usQiXaLlf+mScsxvH9yH+x
> Rdy7MMLFM0ZOaLUQYFnIwgj8wX10OIzfmggbTwVREWDJKPDbKwB1ZPcoS2UVWrxg
> eOFkkoH6T5m6SwDlTBEWN9OyNjLw3F86BrqTY2JpLMOiRL7GPhWdlAdlUkXt2vwE
> bi0iLLvMfRxUp8zQMnMGsf+nKw7VzQpoF1+sP0yVnUQWhQTIftf0jELHIZymkbDC
> XEqXJOR2Ags8Xd6oiCsXCd6I/qix7mrt8sgCCUPuwlIBgXQmCrwAgTCH6VS6QEEb
> PNMkN1+ltlb1zrWYz/6yPVRh8yKuENPjP1LyfVutZ/eHIUe2as+qWBsU/aP6FAtm
> 6fAfS2plsl0ZeGskClGP6YiHMhb3L7oUjSAkHkairFCU3xMnUXGzxIYbsRz8uBLH
> FRCw44I6Elf8+TJPvFiY
> =IyX2
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list