15#ifndef dealii_adaptation_strategies_h
16#define dealii_adaptation_strategies_h
64 template <
int dim,
int spacedim,
typename value_type>
65 std::vector<value_type>
66 preserve(
const typename ::Triangulation<dim, spacedim>::cell_iterator
68 const value_type parent_value);
83 template <
int dim,
int spacedim,
typename value_type>
84 std::vector<value_type>
85 split(
const typename ::Triangulation<dim, spacedim>::cell_iterator
87 const value_type parent_value);
102 template <
int dim,
int spacedim,
typename value_type>
103 std::vector<value_type>
104 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
106 const value_type parent_value);
128 template <
int dim,
int spacedim,
typename value_type>
131 const typename ::Triangulation<dim, spacedim>::cell_iterator
133 const std::vector<value_type> &children_values);
147 template <
int dim,
int spacedim,
typename value_type>
149 sum(
const typename ::Triangulation<dim, spacedim>::cell_iterator
151 const std::vector<value_type> &children_values);
165 template <
int dim,
int spacedim,
typename value_type>
167 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
169 const std::vector<value_type> &children_values);
180 template <
int dim,
int spacedim,
typename value_type>
182 mean(
const typename ::Triangulation<dim, spacedim>::cell_iterator
184 const std::vector<value_type> &children_values);
195 template <
int dim,
int spacedim,
typename value_type>
197 max(
const typename ::Triangulation<dim, spacedim>::cell_iterator
199 const std::vector<value_type> &children_values);
213 template <
int dim,
int spacedim,
typename value_type>
214 std::vector<value_type>
215 preserve(
const typename ::Triangulation<dim, spacedim>::cell_iterator
217 const value_type parent_value)
220 return std::vector<value_type>(parent->n_children(), parent_value);
225 template <
int dim,
int spacedim,
typename value_type>
226 std::vector<value_type>
227 split(
const typename ::Triangulation<dim, spacedim>::cell_iterator
229 const value_type parent_value)
231 static_assert(std::is_arithmetic_v<value_type> &&
232 !std::is_same_v<value_type, bool>,
233 "The provided value_type may not meet the requirements "
234 "of this function.");
237 return std::vector<value_type>(parent->n_children(),
238 parent_value / parent->n_children());
243 template <
int dim,
int spacedim,
typename value_type>
244 std::vector<value_type>
245 l2_norm(
const typename ::Triangulation<dim, spacedim>::cell_iterator
247 const value_type parent_value)
249 static_assert(std::is_arithmetic_v<value_type> &&
250 !std::is_same_v<value_type, bool>,
251 "The provided value_type may not meet the requirements "
252 "of this function.");
255 return std::vector<value_type>(parent->n_children(),
265 template <
int dim,
int spacedim,
typename value_type>
268 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
269 const std::vector<value_type> &children_values)
273 const auto first_child = children_values.cbegin();
274 for (
auto other_child = first_child + 1;
275 other_child != children_values.cend();
277 Assert(*first_child == *other_child,
279 "Values on cells that will be coarsened are not equal!"));
286 template <
int dim,
int spacedim,
typename value_type>
288 sum(
const typename ::Triangulation<dim, spacedim>::cell_iterator &,
289 const std::vector<value_type> &children_values)
291 static_assert(std::is_arithmetic_v<value_type> &&
292 !std::is_same_v<value_type, bool>,
293 "The provided value_type may not meet the requirements "
294 "of this function.");
297 return std::accumulate(children_values.cbegin(),
298 children_values.cend(),
299 static_cast<value_type
>(0));
304 template <
int dim,
int spacedim,
typename value_type>
307 const typename ::Triangulation<dim, spacedim>::cell_iterator &,
308 const std::vector<value_type> &children_values)
310 static_assert(std::is_arithmetic_v<value_type> &&
311 !std::is_same_v<value_type, bool>,
312 "The provided value_type may not meet the requirements "
313 "of this function.");
316 return std::sqrt(std::inner_product(children_values.cbegin(),
317 children_values.cend(),
318 children_values.cbegin(),
319 static_cast<value_type
>(0)));
324 template <
int dim,
int spacedim,
typename value_type>
326 mean(
const typename ::Triangulation<dim, spacedim>::cell_iterator
328 const std::vector<value_type> &children_values)
331 children_values.size();
336 template <
int dim,
int spacedim,
typename value_type>
338 max(
const typename ::Triangulation<dim, spacedim>::cell_iterator &,
339 const std::vector<value_type> &children_values)
342 return *std::max_element(children_values.cbegin(),
343 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 max(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 > &)