16 #ifndef dealii_adaptation_strategies_h
17 #define dealii_adaptation_strategies_h
67 template <
int dim,
int spacedim,
typename value_type>
68 std::vector<value_type>
69 preserve(
const typename ::Triangulation<dim, spacedim>::cell_iterator
71 const value_type parent_value);
86 template <
int dim,
int spacedim,
typename value_type>
87 std::vector<value_type>
88 split(
const typename ::Triangulation<dim, spacedim>::cell_iterator
90 const value_type parent_value);
105 template <
int dim,
int spacedim,
typename value_type>
106 std::vector<value_type>
107 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
109 const value_type parent_value);
131 template <
int dim,
int spacedim,
typename value_type>
134 const typename ::Triangulation<dim, spacedim>::cell_iterator
136 const std::vector<value_type> &children_values);
150 template <
int dim,
int spacedim,
typename value_type>
152 sum(
const typename ::Triangulation<dim, spacedim>::cell_iterator
154 const std::vector<value_type> &children_values);
168 template <
int dim,
int spacedim,
typename value_type>
170 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
172 const std::vector<value_type> &children_values);
183 template <
int dim,
int spacedim,
typename value_type>
185 mean(
const typename ::Triangulation<dim, spacedim>::cell_iterator
187 const std::vector<value_type> &children_values);
198 template <
int dim,
int spacedim,
typename value_type>
200 max(
const typename ::Triangulation<dim, spacedim>::cell_iterator
202 const std::vector<value_type> &children_values);
216 template <
int dim,
int spacedim,
typename value_type>
217 std::vector<value_type>
218 preserve(
const typename ::Triangulation<dim, spacedim>::cell_iterator
223 return std::vector<value_type>(parent->n_children(), parent_value);
228 template <
int dim,
int spacedim,
typename value_type>
229 std::vector<value_type>
230 split(
const typename ::Triangulation<dim, spacedim>::cell_iterator
236 "The provided value_type may not meet the requirements "
237 "of this function.");
240 return std::vector<value_type>(parent->n_children(),
241 parent_value / parent->n_children());
246 template <
int dim,
int spacedim,
typename value_type>
247 std::vector<value_type>
248 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
254 "The provided value_type may not meet the requirements "
255 "of this function.");
258 return std::vector<value_type>(parent->n_children(),
260 std::sqrt(parent->n_children()));
268 template <
int dim,
int spacedim,
typename value_type>
271 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
272 const std::vector<value_type> &children_values)
276 const auto first_child = children_values.cbegin();
277 for (
auto other_child = first_child + 1;
278 other_child != children_values.cend();
280 Assert(*first_child == *other_child,
282 "Values on cells that will be coarsened are not equal!"));
289 template <
int dim,
int spacedim,
typename value_type>
291 sum(
const typename ::Triangulation<dim, spacedim>::cell_iterator &,
292 const std::vector<value_type> &children_values)
296 "The provided value_type may not meet the requirements "
297 "of this function.");
300 return std::accumulate(children_values.cbegin(),
301 children_values.cend(),
307 template <
int dim,
int spacedim,
typename value_type>
310 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
311 const std::vector<value_type> &children_values)
315 "The provided value_type may not meet the requirements "
316 "of this function.");
319 return std::sqrt(std::inner_product(children_values.cbegin(),
320 children_values.cend(),
321 children_values.cbegin(),
327 template <
int dim,
int spacedim,
typename value_type>
329 mean(
const typename ::Triangulation<dim, spacedim>::cell_iterator
331 const std::vector<value_type> &children_values)
333 return sum<dim, spacedim, value_type>(parent, children_values) /
334 children_values.size();
339 template <
int dim,
int spacedim,
typename value_type>
341 max(
const typename ::Triangulation<dim, spacedim>::cell_iterator &,
342 const std::vector<value_type> &children_values)
345 return *std::max_element(children_values.cbegin(),
346 children_values.cend());