Can I get the cell numbers of the cells neighbouring a face?

19 views
Skip to first unread message

Stephen

unread,
Jul 10, 2019, 3:56:02 PM7/10/19
to deal.II User Group
I have an error estimator which I need to calculate between edges and I'd like to loop over all edges in the triangulation. I know that I can do this the "traditional" way via looping over all cells and then looping over all faces in the cell but, if I do this, I end up calculating the same thing twice since I then run over non-boundary faces once from one cell and then again from it's neighbour; this is not acceptable since efficiency is really of paramount importance in the code I'm currently writing. Is it possible to instead loop over all active edges in the triangulation and then find the cell IDs of the cells which neighbour this face? This way I should be able to calculate the terms directly on the edge instead of trying to go via the cell first. Thanks!

Bruno Turcksin

unread,
Jul 10, 2019, 4:55:38 PM7/10/19
to deal.II User Group
Stephen


On Wednesday, July 10, 2019 at 3:56:02 PM UTC-4, Stephen wrote:
I have an error estimator which I need to calculate between edges and I'd like to loop over all edges in the triangulation. I know that I can do this the "traditional" way via looping over all cells and then looping over all faces in the cell but, if I do this, I end up calculating the same thing twice since I then run over non-boundary faces once from one cell and then again from it's neighbour; this is not acceptable since efficiency is really of paramount importance in the code I'm currently writing. Is it possible to instead loop over all active edges in the triangulation and then find the cell IDs of the cells which neighbour this face? This way I should be able to calculate the terms directly on the edge instead of trying to go via the cell first. Thanks!
What you can do is to check that the face is not on the boundary and in that case only compute your error on the left and the bottom edges (for example). I think you could also use this function to do all the heavy lifting for you.

Best,

Bruno
Reply all
Reply to author
Forward
0 new messages