Reference documentation for deal.II version Git f40be01994 2020-04-09 07:13:12 +0200
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
refinement.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/base/config.h>
18 
19 #include <deal.II/base/mpi.h>
20 
21 #include <deal.II/distributed/grid_refinement.h>
22 #include <deal.II/distributed/shared_tria.h>
23 #include <deal.II/distributed/tria_base.h>
24 
25 #include <deal.II/grid/grid_refinement.h>
26 
27 #include <deal.II/hp/dof_handler.h>
28 #include <deal.II/hp/refinement.h>
29 
30 #include <deal.II/lac/vector.h>
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 namespace hp
35 {
36  namespace Refinement
37  {
41  template <int dim, int spacedim>
42  void
44  {
45  std::vector<bool> p_flags(
46  dof_handler.get_triangulation().n_active_cells(), true);
47 
48  p_adaptivity_from_flags(dof_handler, p_flags);
49  }
50 
51 
52 
53  template <int dim, int spacedim>
54  void
56  const std::vector<bool> & p_flags)
57  {
58  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
59  p_flags.size());
60 
61  for (const auto &cell : dof_handler.active_cell_iterators())
62  if (cell->is_locally_owned() && p_flags[cell->active_cell_index()])
63  {
64  if (cell->refine_flag_set())
65  {
66  const unsigned int super_fe_index =
67  dof_handler.get_fe_collection().next_in_hierarchy(
68  cell->active_fe_index());
69 
70  // Reject update if already most superordinate element.
71  if (super_fe_index != cell->active_fe_index())
72  cell->set_future_fe_index(super_fe_index);
73  }
74  else if (cell->coarsen_flag_set())
75  {
76  const unsigned int sub_fe_index =
77  dof_handler.get_fe_collection().previous_in_hierarchy(
78  cell->active_fe_index());
79 
80  // Reject update if already least subordinate element.
81  if (sub_fe_index != cell->active_fe_index())
82  cell->set_future_fe_index(sub_fe_index);
83  }
84  }
85  }
86 
87 
88 
89  template <int dim, typename Number, int spacedim>
90  void
92  const hp::DoFHandler<dim, spacedim> &dof_handler,
93  const Vector<Number> & criteria,
94  const Number p_refine_threshold,
95  const Number p_coarsen_threshold,
96  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
97  const ComparisonFunction<typename identity<Number>::type>
98  &compare_coarsen)
99  {
100  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
101  criteria.size());
102 
103  std::vector<bool> p_flags(
104  dof_handler.get_triangulation().n_active_cells(), false);
105 
106  for (const auto &cell : dof_handler.active_cell_iterators())
107  if (cell->is_locally_owned() &&
108  ((cell->refine_flag_set() &&
109  compare_refine(criteria[cell->active_cell_index()],
110  p_refine_threshold)) ||
111  (cell->coarsen_flag_set() &&
112  compare_coarsen(criteria[cell->active_cell_index()],
113  p_coarsen_threshold))))
114  p_flags[cell->active_cell_index()] = true;
115 
116  p_adaptivity_from_flags(dof_handler, p_flags);
117  }
118 
119 
120 
121  template <int dim, typename Number, int spacedim>
122  void
124  const hp::DoFHandler<dim, spacedim> &dof_handler,
125  const Vector<Number> & criteria,
126  const double p_refine_fraction,
127  const double p_coarsen_fraction,
128  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
129  const ComparisonFunction<typename identity<Number>::type>
130  &compare_coarsen)
131  {
132  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
133  criteria.size());
134  Assert((p_refine_fraction >= 0) && (p_refine_fraction <= 1),
136  Assert((p_coarsen_fraction >= 0) && (p_coarsen_fraction <= 1),
138 
139  // We first have to determine the maximal and minimal values of the
140  // criteria of all flagged cells. We start with the minimal and maximal
141  // values of all cells, a range within which the minimal and maximal
142  // values on cells flagged for refinement must surely lie.
143  Number max_criterion_refine =
144  *std::min_element(criteria.begin(), criteria.end()),
145  min_criterion_refine =
146  *std::max_element(criteria.begin(), criteria.end());
147  Number max_criterion_coarsen = max_criterion_refine,
148  min_criterion_coarsen = min_criterion_refine;
149 
150  for (const auto &cell : dof_handler.active_cell_iterators())
151  if (cell->is_locally_owned())
152  {
153  if (cell->refine_flag_set())
154  {
155  max_criterion_refine =
156  std::max(max_criterion_refine,
157  criteria(cell->active_cell_index()));
158  min_criterion_refine =
159  std::min(min_criterion_refine,
160  criteria(cell->active_cell_index()));
161  }
162  else if (cell->coarsen_flag_set())
163  {
164  max_criterion_coarsen =
165  std::max(max_criterion_coarsen,
166  criteria(cell->active_cell_index()));
167  min_criterion_coarsen =
168  std::min(min_criterion_coarsen,
169  criteria(cell->active_cell_index()));
170  }
171  }
172 
173  const parallel::TriangulationBase<dim, spacedim> *parallel_tria =
174  dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
175  &dof_handler.get_triangulation());
176  if (parallel_tria != nullptr &&
178  &dof_handler.get_triangulation()) == nullptr)
179  {
180  max_criterion_refine =
181  Utilities::MPI::max(max_criterion_refine,
182  parallel_tria->get_communicator());
183  min_criterion_refine =
184  Utilities::MPI::min(min_criterion_refine,
185  parallel_tria->get_communicator());
186  max_criterion_coarsen =
187  Utilities::MPI::max(max_criterion_coarsen,
188  parallel_tria->get_communicator());
189  min_criterion_coarsen =
190  Utilities::MPI::min(min_criterion_coarsen,
191  parallel_tria->get_communicator());
192  }
193 
194  // Absent any better strategies, we will set the threshold by linear
195  // interpolation for both classes of cells individually.
196  const Number threshold_refine =
197  min_criterion_refine +
198  p_refine_fraction *
199  (max_criterion_refine - min_criterion_refine),
200  threshold_coarsen =
201  min_criterion_coarsen +
202  p_coarsen_fraction *
203  (max_criterion_coarsen - min_criterion_coarsen);
204 
206  criteria,
207  threshold_refine,
208  threshold_coarsen,
209  compare_refine,
210  compare_coarsen);
211  }
212 
213 
214 
215  template <int dim, typename Number, int spacedim>
216  void
218  const hp::DoFHandler<dim, spacedim> &dof_handler,
219  const Vector<Number> & criteria,
220  const double p_refine_fraction,
221  const double p_coarsen_fraction,
222  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
223  const ComparisonFunction<typename identity<Number>::type>
224  &compare_coarsen)
225  {
226  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
227  criteria.size());
228  Assert((p_refine_fraction >= 0) && (p_refine_fraction <= 1),
230  Assert((p_coarsen_fraction >= 0) && (p_coarsen_fraction <= 1),
232 
233  // ComparisonFunction returning 'true' or 'false' for any set of
234  // parameters. These will be used to overwrite user-provided comparison
235  // functions whenever no actual comparison is required in the decision
236  // process, i.e. when no or all cells will be refined or coarsened.
237  const ComparisonFunction<Number> compare_false =
238  [](const Number &, const Number &) { return false; };
239  const ComparisonFunction<Number> compare_true =
240  [](const Number &, const Number &) { return true; };
241 
242  // 1.) First extract from the vector of indicators the ones that
243  // correspond to cells that we locally own.
244  unsigned int n_flags_refinement = 0;
245  unsigned int n_flags_coarsening = 0;
246  Vector<Number> indicators_refinement(
247  dof_handler.get_triangulation().n_active_cells());
248  Vector<Number> indicators_coarsening(
249  dof_handler.get_triangulation().n_active_cells());
250  for (const auto &cell :
251  dof_handler.get_triangulation().active_cell_iterators())
252  if (!cell->is_artificial() && cell->is_locally_owned())
253  {
254  if (cell->refine_flag_set())
255  indicators_refinement(n_flags_refinement++) =
256  criteria(cell->active_cell_index());
257  else if (cell->coarsen_flag_set())
258  indicators_coarsening(n_flags_coarsening++) =
259  criteria(cell->active_cell_index());
260  }
261  indicators_refinement.grow_or_shrink(n_flags_refinement);
262  indicators_coarsening.grow_or_shrink(n_flags_coarsening);
263 
264  // 2.) Determine the number of cells for p-refinement and p-coarsening on
265  // basis of the flagged cells.
266  //
267  // 3.) Find thresholds for p-refinment and p-coarsening on only those
268  // cells flagged for adaptation.
269  //
270  // For cases in which no or all cells flagged for refinement and/or
271  // coarsening are subject to p-adaptation, we usually pick thresholds
272  // that apply to all or none of the cells at once. However here, we
273  // do not know which threshold would suffice for this task because the
274  // user could provide any comparison function. Thus if necessary, we
275  // overwrite the user's choice with suitable functions simplying
276  // returning 'true' and 'false' for any cell with reference wrappers.
277  // Thus, no function object copies are stored.
278  //
279  // 4.) Perform p-adaptation with absolute thresholds.
280  Number threshold_refinement = 0.;
281  Number threshold_coarsening = 0.;
282  auto reference_compare_refine = std::cref(compare_refine);
283  auto reference_compare_coarsen = std::cref(compare_coarsen);
284 
285  const parallel::TriangulationBase<dim, spacedim> *parallel_tria =
286  dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
287  &dof_handler.get_triangulation());
288  if (parallel_tria != nullptr &&
290  &dof_handler.get_triangulation()) == nullptr)
291  {
292 #ifndef DEAL_II_WITH_P4EST
293  Assert(false, ExcInternalError());
294 #else
295  //
296  // parallel implementation with distributed memory
297  //
298 
299  MPI_Comm mpi_communicator = parallel_tria->get_communicator();
300 
301  // 2.) Communicate the number of cells scheduled for p-adaptation
302  // globally.
303  const unsigned int n_global_flags_refinement =
304  Utilities::MPI::sum(n_flags_refinement, mpi_communicator);
305  const unsigned int n_global_flags_coarsening =
306  Utilities::MPI::sum(n_flags_coarsening, mpi_communicator);
307 
308  const unsigned int target_index_refinement =
309  static_cast<unsigned int>(
310  std::floor(p_refine_fraction * n_global_flags_refinement));
311  const unsigned int target_index_coarsening =
312  static_cast<unsigned int>(
313  std::ceil((1 - p_coarsen_fraction) * n_global_flags_coarsening));
314 
315  // 3.) Figure out the global max and min of the criteria. We don't
316  // need it here, but it's a collective communication call.
317  const std::pair<Number, Number> global_min_max_refinement =
318  ::internal::parallel::distributed::GridRefinement::
319  compute_global_min_and_max_at_root(indicators_refinement,
320  mpi_communicator);
321 
322  const std::pair<Number, Number> global_min_max_coarsening =
323  ::internal::parallel::distributed::GridRefinement::
324  compute_global_min_and_max_at_root(indicators_coarsening,
325  mpi_communicator);
326 
327  // 3.) Compute thresholds if necessary.
328  if (target_index_refinement == 0)
329  reference_compare_refine = std::cref(compare_false);
330  else if (target_index_refinement == n_global_flags_refinement)
331  reference_compare_refine = std::cref(compare_true);
332  else
333  threshold_refinement = ::internal::parallel::distributed::
334  GridRefinement::RefineAndCoarsenFixedNumber::compute_threshold(
335  indicators_refinement,
336  global_min_max_refinement,
337  target_index_refinement,
338  mpi_communicator);
339 
340  if (target_index_coarsening == n_global_flags_coarsening)
341  reference_compare_coarsen = std::cref(compare_false);
342  else if (target_index_coarsening == 0)
343  reference_compare_coarsen = std::cref(compare_true);
344  else
345  threshold_coarsening = ::internal::parallel::distributed::
346  GridRefinement::RefineAndCoarsenFixedNumber::compute_threshold(
347  indicators_coarsening,
348  global_min_max_coarsening,
349  target_index_coarsening,
350  mpi_communicator);
351 #endif
352  }
353  else
354  {
355  //
356  // serial implementation (and parallel::shared implementation)
357  //
358 
359  // 2.) Determine the number of cells scheduled for p-adaptation.
360  const unsigned int n_p_refine_cells = static_cast<unsigned int>(
361  std::floor(p_refine_fraction * n_flags_refinement));
362  const unsigned int n_p_coarsen_cells = static_cast<unsigned int>(
363  std::floor(p_coarsen_fraction * n_flags_coarsening));
364 
365  // 3.) Compute thresholds if necessary.
366  if (n_p_refine_cells == 0)
367  reference_compare_refine = std::cref(compare_false);
368  else if (n_p_refine_cells == n_flags_refinement)
369  reference_compare_refine = std::cref(compare_true);
370  else
371  {
372  std::nth_element(indicators_refinement.begin(),
373  indicators_refinement.begin() +
374  n_p_refine_cells - 1,
375  indicators_refinement.end(),
376  std::greater<Number>());
377  threshold_refinement =
378  *(indicators_refinement.begin() + n_p_refine_cells - 1);
379  }
380 
381  if (n_p_coarsen_cells == 0)
382  reference_compare_coarsen = std::cref(compare_false);
383  else if (n_p_coarsen_cells == n_flags_coarsening)
384  reference_compare_coarsen = std::cref(compare_true);
385  else
386  {
387  std::nth_element(indicators_coarsening.begin(),
388  indicators_coarsening.begin() +
389  n_p_coarsen_cells - 1,
390  indicators_coarsening.end(),
391  std::less<Number>());
392  threshold_coarsening =
393  *(indicators_coarsening.begin() + n_p_coarsen_cells - 1);
394  }
395  }
396 
397  // 4.) Finally perform adaptation.
399  criteria,
400  threshold_refinement,
401  threshold_coarsening,
402  std::cref(reference_compare_refine),
403  std::cref(
404  reference_compare_coarsen));
405  }
406 
407 
408 
409  template <int dim, typename Number, int spacedim>
410  void
412  const hp::DoFHandler<dim, spacedim> &dof_handler,
413  const Vector<Number> & sobolev_indices)
414  {
415  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
416  sobolev_indices.size());
417 
418  for (const auto &cell : dof_handler.active_cell_iterators())
419  if (cell->is_locally_owned())
420  {
421  if (cell->refine_flag_set())
422  {
423  const unsigned int super_fe_index =
424  dof_handler.get_fe_collection().next_in_hierarchy(
425  cell->active_fe_index());
426 
427  // Reject update if already most superordinate element.
428  if (super_fe_index != cell->active_fe_index())
429  {
430  const unsigned int super_fe_degree =
431  dof_handler.get_fe_collection()[super_fe_index].degree;
432 
433  if (sobolev_indices[cell->active_cell_index()] >
434  super_fe_degree)
435  cell->set_future_fe_index(super_fe_index);
436  }
437  }
438  else if (cell->coarsen_flag_set())
439  {
440  const unsigned int sub_fe_index =
441  dof_handler.get_fe_collection().previous_in_hierarchy(
442  cell->active_fe_index());
443 
444  // Reject update if already least subordinate element.
445  if (sub_fe_index != cell->active_fe_index())
446  {
447  const unsigned int sub_fe_degree =
448  dof_handler.get_fe_collection()[sub_fe_index].degree;
449 
450  if (sobolev_indices[cell->active_cell_index()] <
451  sub_fe_degree)
452  cell->set_future_fe_index(sub_fe_index);
453  }
454  }
455  }
456  }
457 
458 
459 
460  template <int dim, typename Number, int spacedim>
461  void
463  const hp::DoFHandler<dim, spacedim> & dof_handler,
464  const Vector<Number> & criteria,
465  const Vector<Number> & references,
466  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
467  const ComparisonFunction<typename identity<Number>::type>
468  &compare_coarsen)
469  {
470  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
471  criteria.size());
472  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
473  references.size());
474 
475  std::vector<bool> p_flags(
476  dof_handler.get_triangulation().n_active_cells(), false);
477 
478  for (const auto &cell : dof_handler.active_cell_iterators())
479  if (cell->is_locally_owned() &&
480  ((cell->refine_flag_set() &&
481  compare_refine(criteria[cell->active_cell_index()],
482  references[cell->active_cell_index()])) ||
483  (cell->coarsen_flag_set() &&
484  compare_coarsen(criteria[cell->active_cell_index()],
485  references[cell->active_cell_index()]))))
486  p_flags[cell->active_cell_index()] = true;
487 
488  p_adaptivity_from_flags(dof_handler, p_flags);
489  }
490 
491 
492 
496  template <int dim, typename Number, int spacedim>
497  void
499  const Vector<Number> & error_indicators,
500  Vector<Number> & predicted_errors,
501  const double gamma_p,
502  const double gamma_h,
503  const double gamma_n)
504  {
505  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
506  error_indicators.size());
507  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
508  predicted_errors.size());
509  Assert(0 < gamma_p && gamma_p < 1,
513 
514  for (const auto &cell : dof_handler.active_cell_iterators())
515  if (cell->is_locally_owned())
516  {
517  if (cell->future_fe_index_set()) // p adaptation
518  {
519  Assert(cell->future_fe_index_set() && !cell->refine_flag_set(),
520  ExcMessage(
521  "For error prediction, a cell marked for p-adaptation "
522  "should not also be flagged for h-refinement!"));
523  Assert(cell->future_fe_index_set() && !cell->coarsen_flag_set(),
524  ExcMessage(
525  "For error prediction, a cell marked for p-adaptation "
526  "should not also be flagged for h-coarsening!"));
527 
528  const int degree_difference =
529  dof_handler.get_fe_collection()[cell->future_fe_index()]
530  .degree -
531  cell->get_fe().degree;
532 
533  predicted_errors[cell->active_cell_index()] =
534  error_indicators[cell->active_cell_index()] *
535  std::pow(gamma_p, degree_difference);
536  }
537  else if (cell->refine_flag_set()) // h refinement
538  {
539  Assert(
540  cell->refine_flag_set() ==
542  ExcMessage(
543  "Error prediction is only valid for isotropic refinement!"));
544 
545  predicted_errors[cell->active_cell_index()] =
546  error_indicators[cell->active_cell_index()] *
547  (gamma_h * std::pow(.5, dim + cell->get_fe().degree));
548  }
549  else if (cell->coarsen_flag_set()) // h coarsening
550  {
551  predicted_errors[cell->active_cell_index()] =
552  error_indicators[cell->active_cell_index()] /
553  (gamma_h * std::pow(.5, cell->get_fe().degree));
554  }
555  else // no changes
556  {
557  predicted_errors[cell->active_cell_index()] =
558  error_indicators[cell->active_cell_index()] * gamma_n;
559  }
560  }
561  }
562 
563 
564 
568  template <int dim, int spacedim>
569  void
571  {
572  for (const auto &cell : dof_handler.active_cell_iterators())
573  if (cell->is_locally_owned() && cell->future_fe_index_set())
574  {
575  cell->clear_refine_flag();
576  cell->clear_coarsen_flag();
577  }
578  }
579 
580 
581 
582  template <int dim, int spacedim>
583  void
585  {
586  for (const auto &cell : dof_handler.active_cell_iterators())
587  if (cell->is_locally_owned() && cell->future_fe_index_set())
588  {
589  cell->clear_refine_flag();
590 
591  // A cell will only be coarsened into its parent if all of its
592  // siblings are flagged for h coarsening as well. We must take this
593  // into account for our decision whether we would like to impose h
594  // or p adaptivity.
595  if (cell->coarsen_flag_set())
596  {
597  const auto & parent = cell->parent();
598  const unsigned int n_children = parent->n_children();
599 
600  unsigned int h_flagged_children = 0, p_flagged_children = 0;
601  for (unsigned int child_index = 0; child_index < n_children;
602  ++child_index)
603  {
604  const auto &child = parent->child(child_index);
605  if (child->is_active())
606  {
607  if (child->coarsen_flag_set())
608  ++h_flagged_children;
609  if (child->future_fe_index_set())
610  ++p_flagged_children;
611  }
612  }
613 
614  if (h_flagged_children == n_children &&
615  p_flagged_children != n_children)
616  // Perform pure h coarsening and
617  // drop all p adaptation flags.
618  for (unsigned int child_index = 0; child_index < n_children;
619  ++child_index)
620  parent->child(child_index)->clear_future_fe_index();
621  else
622  // Perform p adaptation on all children and
623  // drop all h coarsening flags.
624  for (unsigned int child_index = 0; child_index < n_children;
625  ++child_index)
626  if (parent->child(child_index)->is_active())
627  parent->child(child_index)->clear_coarsen_flag();
628  }
629  }
630  }
631  } // namespace Refinement
632 } // namespace hp
633 
634 
635 // explicit instantiations
636 #include "refinement.inst"
637 
638 DEAL_II_NAMESPACE_CLOSE
void p_adaptivity_from_reference(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &criteria, const Vector< Number > &references, const ComparisonFunction< typename identity< Number >::type > &compare_refine, const ComparisonFunction< typename identity< Number >::type > &compare_coarsen)
Definition: refinement.cc:462
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1579
void p_adaptivity_from_relative_threshold(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &criteria, const double p_refine_fraction=0.5, const double p_coarsen_fraction=0.5, const ComparisonFunction< typename identity< Number >::type > &compare_refine=std::greater_equal< Number >(), const ComparisonFunction< typename identity< Number >::type > &compare_coarsen=std::less_equal< Number >())
Definition: refinement.cc:123
void p_adaptivity_from_absolute_threshold(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &criteria, const Number p_refine_threshold, const Number p_coarsen_threshold, const ComparisonFunction< typename identity< Number >::type > &compare_refine=std::greater_equal< Number >(), const ComparisonFunction< typename identity< Number >::type > &compare_coarsen=std::less_equal< Number >())
Definition: refinement.cc:91
static ::ExceptionBase & ExcMessage(std::string arg1)
void force_p_over_h(const hp::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:570
void full_p_adaptivity(const hp::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:43
T sum(const T &t, const MPI_Comm &mpi_communicator)
#define Assert(cond, exc)
Definition: exceptions.h:1419
IteratorRange< active_cell_iterator > active_cell_iterators() const
void p_adaptivity_from_flags(const hp::DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &p_flags)
Definition: refinement.cc:55
const hp::FECollection< dim, spacedim > & get_fe_collection() const
Definition: hp.h:117
virtual const MPI_Comm & get_communicator() const
Definition: tria_base.cc:167
void choose_p_over_h(const hp::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:584
void p_adaptivity_fixed_number(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &criteria, const double p_refine_fraction=0.5, const double p_coarsen_fraction=0.5, const ComparisonFunction< typename identity< Number >::type > &compare_refine=std::greater_equal< Number >(), const ComparisonFunction< typename identity< Number >::type > &compare_coarsen=std::less_equal< Number >())
Definition: refinement.cc:217
void predict_error(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &error_indicators, Vector< Number > &predicted_errors, const double gamma_p=std::sqrt(0.1), const double gamma_h=1., const double gamma_n=1.)
Definition: refinement.cc:498
T min(const T &t, const MPI_Comm &mpi_communicator)
const Triangulation< dim, spacedim > & get_triangulation() const
std::function< bool(const Number &, const Number &)> ComparisonFunction
Definition: refinement.h:143
void p_adaptivity_from_regularity(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &sobolev_indices)
Definition: refinement.cc:411
static ::ExceptionBase & ExcInvalidParameterValue()
T max(const T &t, const MPI_Comm &mpi_communicator)
static ::ExceptionBase & ExcInternalError()