number of cells sharing a line

14 views
Skip to first unread message

Nicola Giuliani

unread,
Jan 24, 2020, 2:39:30 AM1/24/20
to deal.II User Group
Dear all,

In my code I need to reconstruct the number of cells sharing an edge. 

Is there a way to reconstruct this number locally? In principle I would need something like to cell->line(1)->n_sharing_cells()?

Bests,
Nicola

luca.heltai

unread,
Jan 24, 2020, 5:03:55 AM1/24/20
to Deal.II Users
Nicola,

I would simply do this by

std::map<decltype(tria.begin_active()->line(0)), unsigned int> line_count;

for(const auto &cell: tria.active_cell_iterators()) {
for(unsigned int i=0; i< GeometryInfo<dim>::lines_per_cell; ++i) {
const it = line_count.find(cell->line(i));
if(it != line_count.end())
*it.second++;
else
line_count[cell->line(i)] = 1;
}

We don’t have access to that information within the iterator.

L.
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/8f2dca8c-b6e3-4a33-b203-cea32e5fb8a4%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages