Reference documentation for deal.II version Git 953c9590e9 2020-10-28 17:25:14 -0400
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
refinement.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 - 2020 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 
24 
27 
28 #include <deal.II/hp/dof_handler.h>
29 #include <deal.II/hp/refinement.h>
30 
31 #include <deal.II/lac/vector.h>
32 
34 
35 namespace hp
36 {
37  namespace Refinement
38  {
42  template <int dim, int spacedim>
43  void
44  full_p_adaptivity(const ::DoFHandler<dim, spacedim> &dof_handler)
45  {
46  std::vector<bool> p_flags(
47  dof_handler.get_triangulation().n_active_cells(), true);
48 
49  p_adaptivity_from_flags(dof_handler, p_flags);
50  }
51 
52 
53 
54  template <int dim, int spacedim>
55  void
57  const ::DoFHandler<dim, spacedim> &dof_handler,
58  const std::vector<bool> & p_flags)
59  {
60  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
61  p_flags.size());
62 
63  for (const auto &cell : dof_handler.active_cell_iterators())
64  if (cell->is_locally_owned() && p_flags[cell->active_cell_index()])
65  {
66  if (cell->refine_flag_set())
67  {
68  const unsigned int super_fe_index =
69  dof_handler.get_fe_collection().next_in_hierarchy(
70  cell->active_fe_index());
71 
72  // Reject update if already most superordinate element.
73  if (super_fe_index != cell->active_fe_index())
74  cell->set_future_fe_index(super_fe_index);
75  }
76  else if (cell->coarsen_flag_set())
77  {
78  const unsigned int sub_fe_index =
79  dof_handler.get_fe_collection().previous_in_hierarchy(
80  cell->active_fe_index());
81 
82  // Reject update if already least subordinate element.
83  if (sub_fe_index != cell->active_fe_index())
84  cell->set_future_fe_index(sub_fe_index);
85  }
86  }
87  }
88 
89 
90 
91  template <int dim, typename Number, int spacedim>
92  void
94  const ::DoFHandler<dim, spacedim> &dof_handler,
95  const Vector<Number> & criteria,
96  const Number p_refine_threshold,
97  const Number p_coarsen_threshold,
98  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
100  &compare_coarsen)
101  {
102  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
103  criteria.size());
104 
105  std::vector<bool> p_flags(
106  dof_handler.get_triangulation().n_active_cells(), false);
107 
108  for (const auto &cell : dof_handler.active_cell_iterators())
109  if (cell->is_locally_owned() &&
110  ((cell->refine_flag_set() &&
111  compare_refine(criteria[cell->active_cell_index()],
112  p_refine_threshold)) ||
113  (cell->coarsen_flag_set() &&
114  compare_coarsen(criteria[cell->active_cell_index()],
115  p_coarsen_threshold))))
116  p_flags[cell->active_cell_index()] = true;
117 
118  p_adaptivity_from_flags(dof_handler, p_flags);
119  }
120 
121 
122 
123  template <int dim, typename Number, int spacedim>
124  void
126  const ::DoFHandler<dim, spacedim> &dof_handler,
127  const Vector<Number> & criteria,
128  const double p_refine_fraction,
129  const double p_coarsen_fraction,
130  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
132  &compare_coarsen)
133  {
134  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
135  criteria.size());
136  Assert((p_refine_fraction >= 0) && (p_refine_fraction <= 1),
138  Assert((p_coarsen_fraction >= 0) && (p_coarsen_fraction <= 1),
140 
141  // We first have to determine the maximal and minimal values of the
142  // criteria of all flagged cells.
143  Number max_criterion_refine = std::numeric_limits<Number>::lowest(),
144  min_criterion_refine = std::numeric_limits<Number>::max();
145  Number max_criterion_coarsen = max_criterion_refine,
146  min_criterion_coarsen = min_criterion_refine;
147 
148  for (const auto &cell : dof_handler.active_cell_iterators())
149  if (cell->is_locally_owned())
150  {
151  if (cell->refine_flag_set())
152  {
153  max_criterion_refine =
154  std::max(max_criterion_refine,
155  criteria(cell->active_cell_index()));
156  min_criterion_refine =
157  std::min(min_criterion_refine,
158  criteria(cell->active_cell_index()));
159  }
160  else if (cell->coarsen_flag_set())
161  {
162  max_criterion_coarsen =
163  std::max(max_criterion_coarsen,
164  criteria(cell->active_cell_index()));
165  min_criterion_coarsen =
166  std::min(min_criterion_coarsen,
167  criteria(cell->active_cell_index()));
168  }
169  }
170 
171  const parallel::TriangulationBase<dim, spacedim> *parallel_tria =
172  dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
173  &dof_handler.get_triangulation());
174  if (parallel_tria != nullptr &&
176  &dof_handler.get_triangulation()) == nullptr)
177  {
178  max_criterion_refine =
179  Utilities::MPI::max(max_criterion_refine,
180  parallel_tria->get_communicator());
181  min_criterion_refine =
182  Utilities::MPI::min(min_criterion_refine,
183  parallel_tria->get_communicator());
184  max_criterion_coarsen =
185  Utilities::MPI::max(max_criterion_coarsen,
186  parallel_tria->get_communicator());
187  min_criterion_coarsen =
188  Utilities::MPI::min(min_criterion_coarsen,
189  parallel_tria->get_communicator());
190  }
191 
192  // Absent any better strategies, we will set the threshold by linear
193  // interpolation for both classes of cells individually.
194  const Number threshold_refine =
195  min_criterion_refine +
196  p_refine_fraction *
197  (max_criterion_refine - min_criterion_refine),
198  threshold_coarsen =
199  min_criterion_coarsen +
200  p_coarsen_fraction *
201  (max_criterion_coarsen - min_criterion_coarsen);
202 
204  criteria,
205  threshold_refine,
206  threshold_coarsen,
207  compare_refine,
208  compare_coarsen);
209  }
210 
211 
212 
213  template <int dim, typename Number, int spacedim>
214  void
216  const ::DoFHandler<dim, spacedim> &dof_handler,
217  const Vector<Number> & criteria,
218  const double p_refine_fraction,
219  const double p_coarsen_fraction,
220  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
222  &compare_coarsen)
223  {
224  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
225  criteria.size());
226  Assert((p_refine_fraction >= 0) && (p_refine_fraction <= 1),
228  Assert((p_coarsen_fraction >= 0) && (p_coarsen_fraction <= 1),
230 
231  // ComparisonFunction returning 'true' or 'false' for any set of
232  // parameters. These will be used to overwrite user-provided comparison
233  // functions whenever no actual comparison is required in the decision
234  // process, i.e. when no or all cells will be refined or coarsened.
235  const ComparisonFunction<Number> compare_false =
236  [](const Number &, const Number &) { return false; };
237  const ComparisonFunction<Number> compare_true =
238  [](const Number &, const Number &) { return true; };
239 
240  // 1.) First extract from the vector of indicators the ones that
241  // correspond to cells that we locally own.
242  unsigned int n_flags_refinement = 0;
243  unsigned int n_flags_coarsening = 0;
244  Vector<Number> indicators_refinement(
245  dof_handler.get_triangulation().n_active_cells());
246  Vector<Number> indicators_coarsening(
247  dof_handler.get_triangulation().n_active_cells());
248  for (const auto &cell :
249  dof_handler.get_triangulation().active_cell_iterators())
250  if (!cell->is_artificial() && cell->is_locally_owned())
251  {
252  if (cell->refine_flag_set())
253  indicators_refinement(n_flags_refinement++) =
254  criteria(cell->active_cell_index());
255  else if (cell->coarsen_flag_set())
256  indicators_coarsening(n_flags_coarsening++) =
257  criteria(cell->active_cell_index());
258  }
259  indicators_refinement.grow_or_shrink(n_flags_refinement);
260  indicators_coarsening.grow_or_shrink(n_flags_coarsening);
261 
262  // 2.) Determine the number of cells for p-refinement and p-coarsening on
263  // basis of the flagged cells.
264  //
265  // 3.) Find thresholds for p-refinment and p-coarsening on only those
266  // cells flagged for adaptation.
267  //
268  // For cases in which no or all cells flagged for refinement and/or
269  // coarsening are subject to p-adaptation, we usually pick thresholds
270  // that apply to all or none of the cells at once. However here, we
271  // do not know which threshold would suffice for this task because the
272  // user could provide any comparison function. Thus if necessary, we
273  // overwrite the user's choice with suitable functions simplying
274  // returning 'true' and 'false' for any cell with reference wrappers.
275  // Thus, no function object copies are stored.
276  //
277  // 4.) Perform p-adaptation with absolute thresholds.
278  Number threshold_refinement = 0.;
279  Number threshold_coarsening = 0.;
280  auto reference_compare_refine = std::cref(compare_refine);
281  auto reference_compare_coarsen = std::cref(compare_coarsen);
282 
283  const parallel::TriangulationBase<dim, spacedim> *parallel_tria =
284  dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
285  &dof_handler.get_triangulation());
286  if (parallel_tria != nullptr &&
288  &dof_handler.get_triangulation()) == nullptr)
289  {
290 #ifndef DEAL_II_WITH_P4EST
291  Assert(false, ExcInternalError());
292 #else
293  //
294  // parallel implementation with distributed memory
295  //
296 
297  MPI_Comm mpi_communicator = parallel_tria->get_communicator();
298 
299  // 2.) Communicate the number of cells scheduled for p-adaptation
300  // globally.
301  const unsigned int n_global_flags_refinement =
302  Utilities::MPI::sum(n_flags_refinement, mpi_communicator);
303  const unsigned int n_global_flags_coarsening =
304  Utilities::MPI::sum(n_flags_coarsening, mpi_communicator);
305 
306  const unsigned int target_index_refinement =
307  static_cast<unsigned int>(
308  std::floor(p_refine_fraction * n_global_flags_refinement));
309  const unsigned int target_index_coarsening =
310  static_cast<unsigned int>(
311  std::ceil((1 - p_coarsen_fraction) * n_global_flags_coarsening));
312 
313  // 3.) Figure out the global max and min of the criteria. We don't
314  // need it here, but it's a collective communication call.
315  const std::pair<Number, Number> global_min_max_refinement =
317  compute_global_min_and_max_at_root(indicators_refinement,
318  mpi_communicator);
319 
320  const std::pair<Number, Number> global_min_max_coarsening =
322  compute_global_min_and_max_at_root(indicators_coarsening,
323  mpi_communicator);
324 
325  // 3.) Compute thresholds if necessary.
326  if (target_index_refinement == 0)
327  reference_compare_refine = std::cref(compare_false);
328  else if (target_index_refinement == n_global_flags_refinement)
329  reference_compare_refine = std::cref(compare_true);
330  else
331  threshold_refinement = ::internal::parallel::distributed::
333  indicators_refinement,
334  global_min_max_refinement,
335  target_index_refinement,
336  mpi_communicator);
337 
338  if (target_index_coarsening == n_global_flags_coarsening)
339  reference_compare_coarsen = std::cref(compare_false);
340  else if (target_index_coarsening == 0)
341  reference_compare_coarsen = std::cref(compare_true);
342  else
343  threshold_coarsening = ::internal::parallel::distributed::
345  indicators_coarsening,
346  global_min_max_coarsening,
347  target_index_coarsening,
348  mpi_communicator);
349 #endif
350  }
351  else
352  {
353  //
354  // serial implementation (and parallel::shared implementation)
355  //
356 
357  // 2.) Determine the number of cells scheduled for p-adaptation.
358  const unsigned int n_p_refine_cells = static_cast<unsigned int>(
359  std::floor(p_refine_fraction * n_flags_refinement));
360  const unsigned int n_p_coarsen_cells = static_cast<unsigned int>(
361  std::floor(p_coarsen_fraction * n_flags_coarsening));
362 
363  // 3.) Compute thresholds if necessary.
364  if (n_p_refine_cells == 0)
365  reference_compare_refine = std::cref(compare_false);
366  else if (n_p_refine_cells == n_flags_refinement)
367  reference_compare_refine = std::cref(compare_true);
368  else
369  {
370  std::nth_element(indicators_refinement.begin(),
371  indicators_refinement.begin() +
372  n_p_refine_cells - 1,
373  indicators_refinement.end(),
374  std::greater<Number>());
375  threshold_refinement =
376  *(indicators_refinement.begin() + n_p_refine_cells - 1);
377  }
378 
379  if (n_p_coarsen_cells == 0)
380  reference_compare_coarsen = std::cref(compare_false);
381  else if (n_p_coarsen_cells == n_flags_coarsening)
382  reference_compare_coarsen = std::cref(compare_true);
383  else
384  {
385  std::nth_element(indicators_coarsening.begin(),
386  indicators_coarsening.begin() +
387  n_p_coarsen_cells - 1,
388  indicators_coarsening.end(),
389  std::less<Number>());
390  threshold_coarsening =
391  *(indicators_coarsening.begin() + n_p_coarsen_cells - 1);
392  }
393  }
394 
395  // 4.) Finally perform adaptation.
397  criteria,
398  threshold_refinement,
399  threshold_coarsening,
400  std::cref(reference_compare_refine),
401  std::cref(
402  reference_compare_coarsen));
403  }
404 
405 
406 
407  template <int dim, typename Number, int spacedim>
408  void
410  const ::DoFHandler<dim, spacedim> &dof_handler,
411  const Vector<Number> & sobolev_indices)
412  {
413  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
414  sobolev_indices.size());
415 
416  for (const auto &cell : dof_handler.active_cell_iterators())
417  if (cell->is_locally_owned())
418  {
419  if (cell->refine_flag_set())
420  {
421  const unsigned int super_fe_index =
422  dof_handler.get_fe_collection().next_in_hierarchy(
423  cell->active_fe_index());
424 
425  // Reject update if already most superordinate element.
426  if (super_fe_index != cell->active_fe_index())
427  {
428  const unsigned int super_fe_degree =
429  dof_handler.get_fe_collection()[super_fe_index].degree;
430 
431  if (sobolev_indices[cell->active_cell_index()] >
432  super_fe_degree)
433  cell->set_future_fe_index(super_fe_index);
434  }
435  }
436  else if (cell->coarsen_flag_set())
437  {
438  const unsigned int sub_fe_index =
439  dof_handler.get_fe_collection().previous_in_hierarchy(
440  cell->active_fe_index());
441 
442  // Reject update if already least subordinate element.
443  if (sub_fe_index != cell->active_fe_index())
444  {
445  const unsigned int sub_fe_degree =
446  dof_handler.get_fe_collection()[sub_fe_index].degree;
447 
448  if (sobolev_indices[cell->active_cell_index()] <
449  sub_fe_degree)
450  cell->set_future_fe_index(sub_fe_index);
451  }
452  }
453  }
454  }
455 
456 
457 
458  template <int dim, typename Number, int spacedim>
459  void
461  const ::DoFHandler<dim, spacedim> & dof_handler,
462  const Vector<Number> & criteria,
463  const Vector<Number> & references,
464  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
466  &compare_coarsen)
467  {
468  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
469  criteria.size());
470  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
471  references.size());
472 
473  std::vector<bool> p_flags(
474  dof_handler.get_triangulation().n_active_cells(), false);
475 
476  for (const auto &cell : dof_handler.active_cell_iterators())
477  if (cell->is_locally_owned() &&
478  ((cell->refine_flag_set() &&
479  compare_refine(criteria[cell->active_cell_index()],
480  references[cell->active_cell_index()])) ||
481  (cell->coarsen_flag_set() &&
482  compare_coarsen(criteria[cell->active_cell_index()],
483  references[cell->active_cell_index()]))))
484  p_flags[cell->active_cell_index()] = true;
485 
486  p_adaptivity_from_flags(dof_handler, p_flags);
487  }
488 
489 
490 
494  template <int dim, typename Number, int spacedim>
495  void
496  predict_error(const ::DoFHandler<dim, spacedim> &dof_handler,
497  const Vector<Number> & error_indicators,
498  Vector<Number> & predicted_errors,
499  const double gamma_p,
500  const double gamma_h,
501  const double gamma_n)
502  {
503  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
504  error_indicators.size());
505  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
506  predicted_errors.size());
507  Assert(0 < gamma_p && gamma_p < 1,
511 
512  // auxiliary variables
513  unsigned int future_fe_degree = numbers::invalid_unsigned_int;
514  unsigned int parent_future_fe_index = numbers::invalid_unsigned_int;
515  // store all determined future finite element indices on parent cells for
516  // coarsening
517  std::map<typename hp::DoFHandler<dim, spacedim>::cell_iterator,
518  unsigned int>
519  future_fe_indices_on_coarsened_cells;
520 
521  // deep copy error indicators
522  predicted_errors = error_indicators;
523 
524  for (const auto &cell : dof_handler.active_cell_iterators())
525  if (cell->is_locally_owned())
526  {
527  // current cell will not be adapted
528  if (!(cell->future_fe_index_set()) && !(cell->refine_flag_set()) &&
529  !(cell->coarsen_flag_set()))
530  {
531  predicted_errors[cell->active_cell_index()] *= gamma_n;
532  continue;
533  }
534 
535  // current cell will be adapted
536  // determine degree of its future finite element
537  if (cell->coarsen_flag_set())
538  {
539  // cell will be coarsened, thus determine future finite element
540  // on parent cell
541  const auto &parent = cell->parent();
542  if (future_fe_indices_on_coarsened_cells.find(parent) ==
543  future_fe_indices_on_coarsened_cells.end())
544  {
545 #ifdef DEBUG
546  for (const auto &child : parent->child_iterators())
547  Assert(child->is_active() && child->coarsen_flag_set(),
549  dim>::ExcInconsistentCoarseningFlags());
550 #endif
551 
552  parent_future_fe_index =
553  parent->dominated_future_fe_on_children();
554 
555  future_fe_indices_on_coarsened_cells.insert(
556  {parent, parent_future_fe_index});
557  }
558  else
559  {
560  parent_future_fe_index =
561  future_fe_indices_on_coarsened_cells[parent];
562  }
563 
564  future_fe_degree =
565  dof_handler.get_fe_collection()[parent_future_fe_index]
566  .degree;
567  }
568  else
569  {
570  // future finite element on current cell is already set
571  future_fe_degree =
572  dof_handler.get_fe_collection()[cell->future_fe_index()]
573  .degree;
574  }
575 
576  // step 1: exponential decay with p-adaptation
577  if (cell->future_fe_index_set())
578  {
579  predicted_errors[cell->active_cell_index()] *=
580  std::pow(gamma_p, future_fe_degree - cell->get_fe().degree);
581  }
582 
583  // step 2: algebraic decay with h-adaptation
584  if (cell->refine_flag_set())
585  {
586  predicted_errors[cell->active_cell_index()] *=
587  (gamma_h * std::pow(.5, future_fe_degree));
588 
589  // predicted error will be split on children cells
590  // after adaptation via CellDataTransfer
591  }
592  else if (cell->coarsen_flag_set())
593  {
594  predicted_errors[cell->active_cell_index()] /=
595  (gamma_h * std::pow(.5, future_fe_degree));
596 
597  // predicted error will be summed up on parent cell
598  // after adaptation via CellDataTransfer
599  }
600  }
601  }
602 
603 
604 
608  template <int dim, int spacedim>
609  void
610  force_p_over_h(const ::DoFHandler<dim, spacedim> &dof_handler)
611  {
612  for (const auto &cell : dof_handler.active_cell_iterators())
613  if (cell->is_locally_owned() && cell->future_fe_index_set())
614  {
615  cell->clear_refine_flag();
616  cell->clear_coarsen_flag();
617  }
618  }
619 
620 
621 
622  template <int dim, int spacedim>
623  void
624  choose_p_over_h(const ::DoFHandler<dim, spacedim> &dof_handler)
625  {
626  // Siblings of cells to be coarsened may not be owned by the same
627  // processor. We will exchange coarsening flags on ghost cells and
628  // temporarily store them.
629  std::map<CellId, std::pair<bool, bool>> ghost_buffer;
630 
631  if (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
632  &dof_handler.get_triangulation()))
633  {
634  auto pack = [](
635  const typename ::hp::DoFHandler<dim, spacedim>::
636  active_cell_iterator &cell) -> std::pair<bool, bool> {
637  return {cell->coarsen_flag_set(), cell->future_fe_index_set()};
638  };
639 
640  auto unpack = [&ghost_buffer](
641  const typename ::hp::DoFHandler<dim, spacedim>::
642  active_cell_iterator & cell,
643  const std::pair<bool, bool> pair) -> void {
644  ghost_buffer.emplace(cell->id(), pair);
645  };
646 
648  std::pair<bool, bool>,
649  ::DoFHandler<dim, spacedim>>(dof_handler, pack, unpack);
650  }
651 
652 
653  for (const auto &cell : dof_handler.active_cell_iterators())
654  if (cell->is_locally_owned() && cell->future_fe_index_set())
655  {
656  cell->clear_refine_flag();
657 
658  // A cell will only be coarsened into its parent if all of its
659  // siblings are flagged for h coarsening as well. We must take this
660  // into account for our decision whether we would like to impose h
661  // or p adaptivity.
662  if (cell->coarsen_flag_set())
663  {
664  const auto & parent = cell->parent();
665  const unsigned int n_children = parent->n_children();
666 
667  unsigned int h_flagged_children = 0, p_flagged_children = 0;
668  for (const auto &child : parent->child_iterators())
669  {
670  if (child->is_active())
671  {
672  if (child->is_locally_owned())
673  {
674  if (child->coarsen_flag_set())
675  ++h_flagged_children;
676  if (child->future_fe_index_set())
677  ++p_flagged_children;
678  }
679  else if (child->is_ghost())
680  {
681  const std::pair<bool, bool> &flags =
682  ghost_buffer[child->id()];
683 
684  if (flags.first)
685  ++h_flagged_children;
686  if (flags.second)
687  ++p_flagged_children;
688  }
689  else
690  {
691  // Siblings of locally owned cells are all
692  // either also locally owned or ghost cells.
693  Assert(false, ExcInternalError());
694  }
695  }
696  }
697 
698  if (h_flagged_children == n_children &&
699  p_flagged_children != n_children)
700  {
701  // Perform pure h coarsening and
702  // drop all p adaptation flags.
703  for (const auto &child : parent->child_iterators())
704  {
705  // h_flagged_children == n_children implies
706  // that all children are active
707  Assert(child->is_active(), ExcInternalError());
708  if (child->is_locally_owned())
709  child->clear_future_fe_index();
710  }
711  }
712  else
713  {
714  // Perform p adaptation on all children and
715  // drop all h coarsening flags.
716  for (const auto &child : parent->child_iterators())
717  {
718  if (child->is_active() && child->is_locally_owned())
719  child->clear_coarsen_flag();
720  }
721  }
722  }
723  }
724  }
725  } // namespace Refinement
726 } // namespace hp
727 
728 
729 // explicit instantiations
730 #include "refinement.inst"
731 
static const unsigned int invalid_unsigned_int
Definition: types.h:196
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1580
void p_adaptivity_from_regularity(const ::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &sobolev_indices)
Definition: refinement.cc:409
void p_adaptivity_from_flags(const ::DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &p_flags)
Definition: refinement.cc:56
void choose_p_over_h(const ::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:624
void p_adaptivity_from_reference(const ::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:460
std::pair< number, number > compute_global_min_and_max_at_root(const ::Vector< number > &criteria, MPI_Comm mpi_communicator)
void full_p_adaptivity(const ::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:44
Expression ceil(const Expression &x)
T sum(const T &t, const MPI_Comm &mpi_communicator)
#define Assert(cond, exc)
Definition: exceptions.h:1423
void force_p_over_h(const ::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:610
void predict_error(const ::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &error_indicators, Vector< Number > &predicted_errors, const double gamma_p=std::sqrt(0.4), const double gamma_h=2., const double gamma_n=1.)
Definition: refinement.cc:496
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:369
TriangulationBase< dim, spacedim > Triangulation
Definition: tria_base.h:302
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
Definition: utilities.h:1182
Definition: hp.h:117
virtual const MPI_Comm & get_communicator() const
Definition: tria_base.cc:138
void exchange_cell_data_to_ghosts(const MeshType &mesh, const std::function< std_cxx17::optional< DataType >(const typename MeshType::active_cell_iterator &)> &pack, const std::function< void(const typename MeshType::active_cell_iterator &, const DataType &)> &unpack, const std::function< bool(const typename MeshType::active_cell_iterator &)> &cell_filter=[](const typename MeshType::active_cell_iterator &) { return true;})
number compute_threshold(const ::Vector< number > &criteria, const std::pair< double, double > &global_min_and_max, const types::global_cell_index n_target_cells, MPI_Comm mpi_communicator)
void p_adaptivity_from_relative_threshold(const ::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:125
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:368
void p_adaptivity_from_absolute_threshold(const ::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:93
T min(const T &t, const MPI_Comm &mpi_communicator)
std::function< bool(const Number &, const Number &)> ComparisonFunction
Definition: refinement.h:139
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
Definition: utilities.h:1326
static ::ExceptionBase & ExcInvalidParameterValue()
void p_adaptivity_fixed_number(const ::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:215
T max(const T &t, const MPI_Comm &mpi_communicator)
static ::ExceptionBase & ExcInternalError()
Expression floor(const Expression &x)