Hi, I'm computing a quantity that is piecewise constant in each cell, and its definition is basically a maximum over the lines of a quantity in each cell. To be clear, what I mean by
line is a pair of nodes (equivalently, a pair of DoFs since I'm using 1st-order Langrangian FE). So, in 1-D this is a cell, in 2-D a face, and in 3-D an edge of a face. To perform this computation, I loop over lines by doing this:
// reset line flags
triangulation->clear_user_flags_line();
for (cell = dof_handler->begin_active(); cell != endc; ++cell, ++i_cell)
{
// loop over lines of cell
for (unsigned int line = 0; line < GeometryInfo<dim>::lines_per_cell; ++line)
{
// skip line if it has already been traversed
if (!cell->line(line)->user_flag_set())
{
// mark line to signal it has been traversed
cell->line(line)->set_user_flag();
// get dof indices on line
cell->line(line)->get_dof_indices(local_dof_indices);
// compute quantity on line: quantity_line
// update quantity on current cell since we know it is adjacent to this line
quantity[cell] = max(quantity[cell], quantity_line);
// update quantity on all other adjacent cells, if any
for (all other adjacent cells: cell_other)
quantity[cell_other] = max(quantity[cell_other], quantity_line);
}
}
}
Is there any way to get a list of cells adjacent to the line, like in the last loop here? Or will I need to repeat these computations on the line from all other cells; i.e., remove all of the user flag stuff and thus possibly traverse a line multiple times?
Thanks!