* Propagate manifold indicators associated to the cells of the Triangulation
* @p tria to their co-dimension one and two objects.
*
- * This function sets the @p manifold_id of shared faces and edges to the value
- * returnd by the @p disambiguation_function method, called with the set of
+ * This function sets the @p manifold_id of faces and edges (both on the
+ * interior and on the boundary) to the value returnd by the
+ * @p disambiguation_function method, called with the set of
* manifold indicators of the cells that share the same face or edge.
*
* By default, the @p disambiguation_function returns
* dimension one (i.e., when all adjacent cells and faces have the same
* manifold indicator).
*
+ * The parameter @p overwrite_only_flat_manifold_ids allows you to specify
+ * what to do when a face or an edge already has a manifold indicator
+ * different from numbers::flat_manifold_id. If the flag is @p true, the edge
+ * or face will maintain its original manifold indicator.
+ * If it is @p false, then also the manifold indicator of these faces and edges
+ * is set according to the return value of the @p disambiguation_function.
+ *
* @author Luca Heltai, 2019.
*/
template <int dim, int spacedim>
if (manifold_ids.size() == 1)
return *manifold_ids.begin();
else
- return numbers::invalid_manifold_id;
- });
+ return numbers::flat_manifold_id;
+ },
+ bool overwrite_only_flat_manifold_ids = true);
/*@}*/
/**
assign_co_dimensional_manifold_indicators(
Triangulation<dim, spacedim> & tria,
const std::function<types::manifold_id(
- const std::set<types::manifold_id> &)> &disambiguation_function)
+ const std::set<types::manifold_id> &)> &disambiguation_function,
+ bool overwrite_only_flat_manifold_ids)
{
// Easy case first:
if (dim == 1)
{
const auto id = cell->line(l)->user_index();
Assert(id != 0, ExcInternalError());
- cell->line(l)->set_manifold_id(
- disambiguation_function(manifold_ids[id]));
+ if (cell->line(l)->manifold_id() == numbers::flat_manifold_id ||
+ overwrite_only_flat_manifold_ids == false)
+ cell->line(l)->set_manifold_id(
+ disambiguation_function(manifold_ids[id]));
}
if (dim > 2)
for (unsigned int l = 0; l < GeometryInfo<dim>::quads_per_cell; ++l)
{
const auto id = cell->quad(l)->user_index();
Assert(id != 0, ExcInternalError());
- cell->quad(l)->set_manifold_id(
- disambiguation_function(manifold_ids[id]));
+ if (cell->quad(l)->manifold_id() == numbers::flat_manifold_id ||
+ overwrite_only_flat_manifold_ids == false)
+ cell->quad(l)->set_manifold_id(
+ disambiguation_function(manifold_ids[id]));
}
}
tria.load_user_indices(backup);
assign_co_dimensional_manifold_indicators(
Triangulation<deal_II_dimension, deal_II_space_dimension> &,
const std::function<
- types::manifold_id(const std::set<types::manifold_id> &)> &);
+ types::manifold_id(const std::set<types::manifold_id> &)> &,
+ bool);
template void
regularize_corner_cells(