16#ifndef dealii_adaptation_strategies_h
17#define dealii_adaptation_strategies_h
65 template <
int dim,
int spacedim,
typename value_type>
66 std::vector<value_type>
67 preserve(
const typename ::Triangulation<dim, spacedim>::cell_iterator
69 const value_type parent_value);
84 template <
int dim,
int spacedim,
typename value_type>
85 std::vector<value_type>
86 split(
const typename ::Triangulation<dim, spacedim>::cell_iterator
88 const value_type parent_value);
103 template <
int dim,
int spacedim,
typename value_type>
104 std::vector<value_type>
105 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
107 const value_type parent_value);
129 template <
int dim,
int spacedim,
typename value_type>
132 const typename ::Triangulation<dim, spacedim>::cell_iterator
134 const std::vector<value_type> &children_values);
148 template <
int dim,
int spacedim,
typename value_type>
150 sum(
const typename ::Triangulation<dim, spacedim>::cell_iterator
152 const std::vector<value_type> &children_values);
166 template <
int dim,
int spacedim,
typename value_type>
168 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
170 const std::vector<value_type> &children_values);
181 template <
int dim,
int spacedim,
typename value_type>
183 mean(
const typename ::Triangulation<dim, spacedim>::cell_iterator
185 const std::vector<value_type> &children_values);
196 template <
int dim,
int spacedim,
typename value_type>
198 max(
const typename ::Triangulation<dim, spacedim>::cell_iterator
200 const std::vector<value_type> &children_values);
214 template <
int dim,
int spacedim,
typename value_type>
215 std::vector<value_type>
216 preserve(
const typename ::Triangulation<dim, spacedim>::cell_iterator
218 const value_type parent_value)
221 return std::vector<value_type>(parent->n_children(), parent_value);
226 template <
int dim,
int spacedim,
typename value_type>
227 std::vector<value_type>
228 split(
const typename ::Triangulation<dim, spacedim>::cell_iterator
230 const value_type parent_value)
232 static_assert(std::is_arithmetic<value_type>::value &&
233 !std::is_same<value_type, bool>::value,
234 "The provided value_type may not meet the requirements "
235 "of this function.");
238 return std::vector<value_type>(parent->n_children(),
239 parent_value / parent->n_children());
244 template <
int dim,
int spacedim,
typename value_type>
245 std::vector<value_type>
246 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
248 const value_type parent_value)
250 static_assert(std::is_arithmetic<value_type>::value &&
251 !std::is_same<value_type, bool>::value,
252 "The provided value_type may not meet the requirements "
253 "of this function.");
256 return std::vector<value_type>(parent->n_children(),
266 template <
int dim,
int spacedim,
typename value_type>
269 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
270 const std::vector<value_type> &children_values)
274 const auto first_child = children_values.cbegin();
275 for (
auto other_child = first_child + 1;
276 other_child != children_values.cend();
278 Assert(*first_child == *other_child,
280 "Values on cells that will be coarsened are not equal!"));
287 template <
int dim,
int spacedim,
typename value_type>
289 sum(
const typename ::Triangulation<dim, spacedim>::cell_iterator &,
290 const std::vector<value_type> &children_values)
292 static_assert(std::is_arithmetic<value_type>::value &&
293 !std::is_same<value_type, bool>::value,
294 "The provided value_type may not meet the requirements "
295 "of this function.");
298 return std::accumulate(children_values.cbegin(),
299 children_values.cend(),
300 static_cast<value_type
>(0));
305 template <
int dim,
int spacedim,
typename value_type>
308 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
309 const std::vector<value_type> &children_values)
311 static_assert(std::is_arithmetic<value_type>::value &&
312 !std::is_same<value_type, bool>::value,
313 "The provided value_type may not meet the requirements "
314 "of this function.");
317 return std::sqrt(std::inner_product(children_values.cbegin(),
318 children_values.cend(),
319 children_values.cbegin(),
320 static_cast<value_type
>(0)));
325 template <
int dim,
int spacedim,
typename value_type>
327 mean(
const typename ::Triangulation<dim, spacedim>::cell_iterator
329 const std::vector<value_type> &children_values)
331 return sum<dim, spacedim, value_type>(parent, children_values) /
332 children_values.size();
337 template <
int dim,
int spacedim,
typename value_type>
339 max(
const typename ::Triangulation<dim, spacedim>::cell_iterator &,
340 const std::vector<value_type> &children_values)
343 return *std::max_element(children_values.cbegin(),
344 children_values.cend());
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
value_type check_equality(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_values)
value_type sum(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_values)
value_type l2_norm(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_values)
value_type mean(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const std::vector< value_type > &children_values)
std::vector< value_type > l2_norm(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)
std::vector< value_type > preserve(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)
std::vector< value_type > split(const typename ::Triangulation< dim, spacedim >::cell_iterator &parent, const value_type parent_value)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)