40 const auto coarsening_strategy =
42 const typename ::Triangulation<dim, spacedim>::cell_iterator
54 fe_index = ::internal::hp::DoFHandlerImplementation::
55 dominated_future_fe_on_children<dim, spacedim>(
59 Assert(fe.n_dofs_per_cell() > 0,
61 "Cannot coarsen onto a FiniteElement with no DoFs."));
67 std::count_if(child_iterators.begin(),
68 child_iterators.end(),
70 return child_cell->get_fe().n_dofs_per_cell() ==
78 "Coarsening is only supported for parent cells where either all"
79 " or none of the child cells are FE_Nothing."));
89 const unsigned int dofs_per_cell = fe.n_dofs_per_cell();
96 for (
unsigned int child = 0;
102 fe.get_restriction_matrix(child,
107 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
108 if (fe.restriction_is_additive(i))
110 else if (tmp(i) !=
Number())
124 &::AdaptationStrategies::Refinement::
125 preserve<dim, spacedim, Vector<Number>>,
126 coarsening_strategy);
135 const VectorType & in,
138 const unsigned int dofs_per_cell =
139 dof_handler.get_fe_collection().max_dofs_per_cell();
146 val = std::numeric_limits<Number>::infinity();
149 in.update_ghost_values();
151 std::vector<types::global_dof_index> dof_indices(dofs_per_cell);
152 for (
const auto &cell : dof_handler.active_cell_iterators())
154 if ((cell->is_locally_owned()) &&
166 cell_data_transfer->prepare_for_coarsening_and_refinement(
179 const unsigned int dofs_per_cell =
180 dof_handler.get_fe_collection().max_dofs_per_cell();
182 dof_handler.get_triangulation().n_active_cells(),
188 data_to_transfer.clear();
190 for (
unsigned int i = 0; i < out.locally_owned_size(); ++i)
191 out.local_element(i) = std::numeric_limits<Number>::infinity();
194 for (
auto const &cell : dof_handler.active_cell_iterators())
196 if ((cell->is_locally_owned()) &&
198 std::numeric_limits<Number>::infinity()))
210 std::vector<types::global_dof_index> dof_indices;
211 std::vector<types::global_dof_index>
dofs_map;
212 std::vector<std::vector<std::pair<types::global_dof_index, Number>>>
214 std::vector<Number> constraint_values;
215 IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
222 bool add_line =
false;
223 for (
unsigned int i = 0; i <
line_size; ++i)
226 (*constraint)[i].first;
230 std::numeric_limits<Number>::infinity())
239 std::vector<std::pair<types::global_dof_index, Number>> line;
242 for (
unsigned int i = 0; i <
line_size; ++i)
245 (*constraint)[i].first;
248 std::numeric_limits<Number>::infinity())
267 constraint_values.push_back(val);
279 for (
unsigned int i = 0; i < n_rows; ++i)
281 for (
unsigned int j = 0;
j < n_cols; ++
j)
304 for (
unsigned int i = 0; i < n_cols; ++i)
311 std::for_each(out.begin(), out.end(), [&](
Number &val) {
312 if (val == std::numeric_limits<Number>::infinity())