Reference documentation for deal.II version 9.2.0
\(\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 
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 
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,
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,
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.
141  Number max_criterion_refine = std::numeric_limits<Number>::lowest(),
142  min_criterion_refine = std::numeric_limits<Number>::max();
143  Number max_criterion_coarsen = max_criterion_refine,
144  min_criterion_coarsen = min_criterion_refine;
145 
146  for (const auto &cell : dof_handler.active_cell_iterators())
147  if (cell->is_locally_owned())
148  {
149  if (cell->refine_flag_set())
150  {
151  max_criterion_refine =
152  std::max(max_criterion_refine,
153  criteria(cell->active_cell_index()));
154  min_criterion_refine =
155  std::min(min_criterion_refine,
156  criteria(cell->active_cell_index()));
157  }
158  else if (cell->coarsen_flag_set())
159  {
160  max_criterion_coarsen =
161  std::max(max_criterion_coarsen,
162  criteria(cell->active_cell_index()));
163  min_criterion_coarsen =
164  std::min(min_criterion_coarsen,
165  criteria(cell->active_cell_index()));
166  }
167  }
168 
169  const parallel::TriangulationBase<dim, spacedim> *parallel_tria =
170  dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
171  &dof_handler.get_triangulation());
172  if (parallel_tria != nullptr &&
174  &dof_handler.get_triangulation()) == nullptr)
175  {
176  max_criterion_refine =
177  Utilities::MPI::max(max_criterion_refine,
178  parallel_tria->get_communicator());
179  min_criterion_refine =
180  Utilities::MPI::min(min_criterion_refine,
181  parallel_tria->get_communicator());
182  max_criterion_coarsen =
183  Utilities::MPI::max(max_criterion_coarsen,
184  parallel_tria->get_communicator());
185  min_criterion_coarsen =
186  Utilities::MPI::min(min_criterion_coarsen,
187  parallel_tria->get_communicator());
188  }
189 
190  // Absent any better strategies, we will set the threshold by linear
191  // interpolation for both classes of cells individually.
192  const Number threshold_refine =
193  min_criterion_refine +
194  p_refine_fraction *
195  (max_criterion_refine - min_criterion_refine),
196  threshold_coarsen =
197  min_criterion_coarsen +
198  p_coarsen_fraction *
199  (max_criterion_coarsen - min_criterion_coarsen);
200 
202  criteria,
203  threshold_refine,
204  threshold_coarsen,
205  compare_refine,
206  compare_coarsen);
207  }
208 
209 
210 
211  template <int dim, typename Number, int spacedim>
212  void
214  const hp::DoFHandler<dim, spacedim> &dof_handler,
215  const Vector<Number> & criteria,
216  const double p_refine_fraction,
217  const double p_coarsen_fraction,
218  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
220  &compare_coarsen)
221  {
222  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
223  criteria.size());
224  Assert((p_refine_fraction >= 0) && (p_refine_fraction <= 1),
226  Assert((p_coarsen_fraction >= 0) && (p_coarsen_fraction <= 1),
228 
229  // ComparisonFunction returning 'true' or 'false' for any set of
230  // parameters. These will be used to overwrite user-provided comparison
231  // functions whenever no actual comparison is required in the decision
232  // process, i.e. when no or all cells will be refined or coarsened.
233  const ComparisonFunction<Number> compare_false =
234  [](const Number &, const Number &) { return false; };
235  const ComparisonFunction<Number> compare_true =
236  [](const Number &, const Number &) { return true; };
237 
238  // 1.) First extract from the vector of indicators the ones that
239  // correspond to cells that we locally own.
240  unsigned int n_flags_refinement = 0;
241  unsigned int n_flags_coarsening = 0;
242  Vector<Number> indicators_refinement(
243  dof_handler.get_triangulation().n_active_cells());
244  Vector<Number> indicators_coarsening(
245  dof_handler.get_triangulation().n_active_cells());
246  for (const auto &cell :
247  dof_handler.get_triangulation().active_cell_iterators())
248  if (!cell->is_artificial() && cell->is_locally_owned())
249  {
250  if (cell->refine_flag_set())
251  indicators_refinement(n_flags_refinement++) =
252  criteria(cell->active_cell_index());
253  else if (cell->coarsen_flag_set())
254  indicators_coarsening(n_flags_coarsening++) =
255  criteria(cell->active_cell_index());
256  }
257  indicators_refinement.grow_or_shrink(n_flags_refinement);
258  indicators_coarsening.grow_or_shrink(n_flags_coarsening);
259 
260  // 2.) Determine the number of cells for p-refinement and p-coarsening on
261  // basis of the flagged cells.
262  //
263  // 3.) Find thresholds for p-refinment and p-coarsening on only those
264  // cells flagged for adaptation.
265  //
266  // For cases in which no or all cells flagged for refinement and/or
267  // coarsening are subject to p-adaptation, we usually pick thresholds
268  // that apply to all or none of the cells at once. However here, we
269  // do not know which threshold would suffice for this task because the
270  // user could provide any comparison function. Thus if necessary, we
271  // overwrite the user's choice with suitable functions simplying
272  // returning 'true' and 'false' for any cell with reference wrappers.
273  // Thus, no function object copies are stored.
274  //
275  // 4.) Perform p-adaptation with absolute thresholds.
276  Number threshold_refinement = 0.;
277  Number threshold_coarsening = 0.;
278  auto reference_compare_refine = std::cref(compare_refine);
279  auto reference_compare_coarsen = std::cref(compare_coarsen);
280 
281  const parallel::TriangulationBase<dim, spacedim> *parallel_tria =
282  dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
283  &dof_handler.get_triangulation());
284  if (parallel_tria != nullptr &&
286  &dof_handler.get_triangulation()) == nullptr)
287  {
288 #ifndef DEAL_II_WITH_P4EST
289  Assert(false, ExcInternalError());
290 #else
291  //
292  // parallel implementation with distributed memory
293  //
294 
295  MPI_Comm mpi_communicator = parallel_tria->get_communicator();
296 
297  // 2.) Communicate the number of cells scheduled for p-adaptation
298  // globally.
299  const unsigned int n_global_flags_refinement =
300  Utilities::MPI::sum(n_flags_refinement, mpi_communicator);
301  const unsigned int n_global_flags_coarsening =
302  Utilities::MPI::sum(n_flags_coarsening, mpi_communicator);
303 
304  const unsigned int target_index_refinement =
305  static_cast<unsigned int>(
306  std::floor(p_refine_fraction * n_global_flags_refinement));
307  const unsigned int target_index_coarsening =
308  static_cast<unsigned int>(
309  std::ceil((1 - p_coarsen_fraction) * n_global_flags_coarsening));
310 
311  // 3.) Figure out the global max and min of the criteria. We don't
312  // need it here, but it's a collective communication call.
313  const std::pair<Number, Number> global_min_max_refinement =
315  compute_global_min_and_max_at_root(indicators_refinement,
316  mpi_communicator);
317 
318  const std::pair<Number, Number> global_min_max_coarsening =
320  compute_global_min_and_max_at_root(indicators_coarsening,
321  mpi_communicator);
322 
323  // 3.) Compute thresholds if necessary.
324  if (target_index_refinement == 0)
325  reference_compare_refine = std::cref(compare_false);
326  else if (target_index_refinement == n_global_flags_refinement)
327  reference_compare_refine = std::cref(compare_true);
328  else
329  threshold_refinement = ::internal::parallel::distributed::
331  indicators_refinement,
332  global_min_max_refinement,
333  target_index_refinement,
334  mpi_communicator);
335 
336  if (target_index_coarsening == n_global_flags_coarsening)
337  reference_compare_coarsen = std::cref(compare_false);
338  else if (target_index_coarsening == 0)
339  reference_compare_coarsen = std::cref(compare_true);
340  else
341  threshold_coarsening = ::internal::parallel::distributed::
343  indicators_coarsening,
344  global_min_max_coarsening,
345  target_index_coarsening,
346  mpi_communicator);
347 #endif
348  }
349  else
350  {
351  //
352  // serial implementation (and parallel::shared implementation)
353  //
354 
355  // 2.) Determine the number of cells scheduled for p-adaptation.
356  const unsigned int n_p_refine_cells = static_cast<unsigned int>(
357  std::floor(p_refine_fraction * n_flags_refinement));
358  const unsigned int n_p_coarsen_cells = static_cast<unsigned int>(
359  std::floor(p_coarsen_fraction * n_flags_coarsening));
360 
361  // 3.) Compute thresholds if necessary.
362  if (n_p_refine_cells == 0)
363  reference_compare_refine = std::cref(compare_false);
364  else if (n_p_refine_cells == n_flags_refinement)
365  reference_compare_refine = std::cref(compare_true);
366  else
367  {
368  std::nth_element(indicators_refinement.begin(),
369  indicators_refinement.begin() +
370  n_p_refine_cells - 1,
371  indicators_refinement.end(),
372  std::greater<Number>());
373  threshold_refinement =
374  *(indicators_refinement.begin() + n_p_refine_cells - 1);
375  }
376 
377  if (n_p_coarsen_cells == 0)
378  reference_compare_coarsen = std::cref(compare_false);
379  else if (n_p_coarsen_cells == n_flags_coarsening)
380  reference_compare_coarsen = std::cref(compare_true);
381  else
382  {
383  std::nth_element(indicators_coarsening.begin(),
384  indicators_coarsening.begin() +
385  n_p_coarsen_cells - 1,
386  indicators_coarsening.end(),
387  std::less<Number>());
388  threshold_coarsening =
389  *(indicators_coarsening.begin() + n_p_coarsen_cells - 1);
390  }
391  }
392 
393  // 4.) Finally perform adaptation.
395  criteria,
396  threshold_refinement,
397  threshold_coarsening,
398  std::cref(reference_compare_refine),
399  std::cref(
400  reference_compare_coarsen));
401  }
402 
403 
404 
405  template <int dim, typename Number, int spacedim>
406  void
408  const hp::DoFHandler<dim, spacedim> &dof_handler,
409  const Vector<Number> & sobolev_indices)
410  {
411  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
412  sobolev_indices.size());
413 
414  for (const auto &cell : dof_handler.active_cell_iterators())
415  if (cell->is_locally_owned())
416  {
417  if (cell->refine_flag_set())
418  {
419  const unsigned int super_fe_index =
420  dof_handler.get_fe_collection().next_in_hierarchy(
421  cell->active_fe_index());
422 
423  // Reject update if already most superordinate element.
424  if (super_fe_index != cell->active_fe_index())
425  {
426  const unsigned int super_fe_degree =
427  dof_handler.get_fe_collection()[super_fe_index].degree;
428 
429  if (sobolev_indices[cell->active_cell_index()] >
430  super_fe_degree)
431  cell->set_future_fe_index(super_fe_index);
432  }
433  }
434  else if (cell->coarsen_flag_set())
435  {
436  const unsigned int sub_fe_index =
437  dof_handler.get_fe_collection().previous_in_hierarchy(
438  cell->active_fe_index());
439 
440  // Reject update if already least subordinate element.
441  if (sub_fe_index != cell->active_fe_index())
442  {
443  const unsigned int sub_fe_degree =
444  dof_handler.get_fe_collection()[sub_fe_index].degree;
445 
446  if (sobolev_indices[cell->active_cell_index()] <
447  sub_fe_degree)
448  cell->set_future_fe_index(sub_fe_index);
449  }
450  }
451  }
452  }
453 
454 
455 
456  template <int dim, typename Number, int spacedim>
457  void
459  const hp::DoFHandler<dim, spacedim> & dof_handler,
460  const Vector<Number> & criteria,
461  const Vector<Number> & references,
462  const ComparisonFunction<typename identity<Number>::type> &compare_refine,
464  &compare_coarsen)
465  {
466  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
467  criteria.size());
468  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
469  references.size());
470 
471  std::vector<bool> p_flags(
472  dof_handler.get_triangulation().n_active_cells(), false);
473 
474  for (const auto &cell : dof_handler.active_cell_iterators())
475  if (cell->is_locally_owned() &&
476  ((cell->refine_flag_set() &&
477  compare_refine(criteria[cell->active_cell_index()],
478  references[cell->active_cell_index()])) ||
479  (cell->coarsen_flag_set() &&
480  compare_coarsen(criteria[cell->active_cell_index()],
481  references[cell->active_cell_index()]))))
482  p_flags[cell->active_cell_index()] = true;
483 
484  p_adaptivity_from_flags(dof_handler, p_flags);
485  }
486 
487 
488 
492  template <int dim, typename Number, int spacedim>
493  void
495  const Vector<Number> & error_indicators,
496  Vector<Number> & predicted_errors,
497  const double gamma_p,
498  const double gamma_h,
499  const double gamma_n)
500  {
501  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
502  error_indicators.size());
503  AssertDimension(dof_handler.get_triangulation().n_active_cells(),
504  predicted_errors.size());
505  Assert(0 < gamma_p && gamma_p < 1,
509 
510  // auxiliary variables
511  unsigned int future_fe_degree = numbers::invalid_unsigned_int;
512  unsigned int parent_future_fe_index = numbers::invalid_unsigned_int;
513  // store all determined future finite element indices on parent cells for
514  // coarsening
515  std::map<typename hp::DoFHandler<dim, spacedim>::cell_iterator,
516  unsigned int>
517  future_fe_indices_on_coarsened_cells;
518 
519  // deep copy error indicators
520  predicted_errors = error_indicators;
521 
522  for (const auto &cell : dof_handler.active_cell_iterators())
523  if (cell->is_locally_owned())
524  {
525  // current cell will not be adapted
526  if (!(cell->future_fe_index_set()) && !(cell->refine_flag_set()) &&
527  !(cell->coarsen_flag_set()))
528  {
529  predicted_errors[cell->active_cell_index()] *= gamma_n;
530  continue;
531  }
532 
533  // current cell will be adapted
534  // determine degree of its future finite element
535  if (cell->coarsen_flag_set())
536  {
537  // cell will be coarsened, thus determine future finite element
538  // on parent cell
539  const auto &parent = cell->parent();
540  if (future_fe_indices_on_coarsened_cells.find(parent) ==
541  future_fe_indices_on_coarsened_cells.end())
542  {
543  std::set<unsigned int> fe_indices_children;
544  for (unsigned int child_index = 0;
545  child_index < parent->n_children();
546  ++child_index)
547  {
548  const auto &child = parent->child(child_index);
549  Assert(child->is_active() && child->coarsen_flag_set(),
551  dim>::ExcInconsistentCoarseningFlags());
552 
553  fe_indices_children.insert(child->future_fe_index());
554  }
555  Assert(!fe_indices_children.empty(), ExcInternalError());
556 
557  parent_future_fe_index =
558  dof_handler.get_fe_collection()
559  .find_dominated_fe_extended(fe_indices_children,
560  /*codim=*/0);
561 
562  Assert(
563  parent_future_fe_index != numbers::invalid_unsigned_int,
564  typename ::hp::FECollection<
565  dim>::ExcNoDominatedFiniteElementAmongstChildren());
566 
567  future_fe_indices_on_coarsened_cells.insert(
568  {parent, parent_future_fe_index});
569  }
570  else
571  {
572  parent_future_fe_index =
573  future_fe_indices_on_coarsened_cells[parent];
574  }
575 
576  future_fe_degree =
577  dof_handler.get_fe_collection()[parent_future_fe_index]
578  .degree;
579  }
580  else
581  {
582  // future finite element on current cell is already set
583  future_fe_degree =
584  dof_handler.get_fe_collection()[cell->future_fe_index()]
585  .degree;
586  }
587 
588  // step 1: exponential decay with p-adaptation
589  if (cell->future_fe_index_set())
590  {
591  predicted_errors[cell->active_cell_index()] *=
592  std::pow(gamma_p, future_fe_degree - cell->get_fe().degree);
593  }
594 
595  // step 2: algebraic decay with h-adaptation
596  if (cell->refine_flag_set())
597  {
598  predicted_errors[cell->active_cell_index()] *=
599  (gamma_h * std::pow(.5, future_fe_degree));
600 
601  // predicted error will be split on children cells
602  // after adaptation via CellDataTransfer
603  }
604  else if (cell->coarsen_flag_set())
605  {
606  predicted_errors[cell->active_cell_index()] /=
607  (gamma_h * std::pow(.5, future_fe_degree));
608 
609  // predicted error will be summed up on parent cell
610  // after adaptation via CellDataTransfer
611  }
612  }
613  }
614 
615 
616 
620  template <int dim, int spacedim>
621  void
623  {
624  for (const auto &cell : dof_handler.active_cell_iterators())
625  if (cell->is_locally_owned() && cell->future_fe_index_set())
626  {
627  cell->clear_refine_flag();
628  cell->clear_coarsen_flag();
629  }
630  }
631 
632 
633 
634  template <int dim, int spacedim>
635  void
637  {
638  for (const auto &cell : dof_handler.active_cell_iterators())
639  if (cell->is_locally_owned() && cell->future_fe_index_set())
640  {
641  cell->clear_refine_flag();
642 
643  // A cell will only be coarsened into its parent if all of its
644  // siblings are flagged for h coarsening as well. We must take this
645  // into account for our decision whether we would like to impose h
646  // or p adaptivity.
647  if (cell->coarsen_flag_set())
648  {
649  const auto & parent = cell->parent();
650  const unsigned int n_children = parent->n_children();
651 
652  unsigned int h_flagged_children = 0, p_flagged_children = 0;
653  for (unsigned int child_index = 0; child_index < n_children;
654  ++child_index)
655  {
656  const auto &child = parent->child(child_index);
657  if (child->is_active())
658  {
659  if (child->coarsen_flag_set())
660  ++h_flagged_children;
661  if (child->future_fe_index_set())
662  ++p_flagged_children;
663  }
664  }
665 
666  if (h_flagged_children == n_children &&
667  p_flagged_children != n_children)
668  // Perform pure h coarsening and
669  // drop all p adaptation flags.
670  for (unsigned int child_index = 0; child_index < n_children;
671  ++child_index)
672  parent->child(child_index)->clear_future_fe_index();
673  else
674  // Perform p adaptation on all children and
675  // drop all h coarsening flags.
676  for (unsigned int child_index = 0; child_index < n_children;
677  ++child_index)
678  if (parent->child(child_index)->is_active())
679  parent->child(child_index)->clear_coarsen_flag();
680  }
681  }
682  }
683  } // namespace Refinement
684 } // namespace hp
685 
686 
687 // explicit instantiations
688 #include "refinement.inst"
689 
identity::type
T type
Definition: template_constraints.h:270
parallel::shared::Triangulation
Definition: shared_tria.h:103
Differentiation::SD::floor
Expression floor(const Expression &x)
Definition: symengine_math.cc:294
refinement.h
hp::DoFHandler::get_fe_collection
const hp::FECollection< dim, spacedim > & get_fe_collection() const
hp::Refinement::p_adaptivity_from_relative_threshold
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
hp::Refinement::p_adaptivity_from_regularity
void p_adaptivity_from_regularity(const hp::DoFHandler< dim, spacedim > &dof_handler, const Vector< Number > &sobolev_indices)
Definition: refinement.cc:407
hp::DoFHandler::get_triangulation
const Triangulation< dim, spacedim > & get_triangulation() const
MPI_Comm
internal::parallel::distributed::GridRefinement::compute_global_min_and_max_at_root
std::pair< number, number > compute_global_min_and_max_at_root(const ::Vector< number > &criteria, MPI_Comm mpi_communicator)
Definition: grid_refinement.cc:203
hp::DoFHandler
Definition: dof_handler.h:203
hp::Refinement::predict_error
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.4), const double gamma_h=2., const double gamma_n=1.)
Definition: refinement.cc:494
hp::DoFHandler::active_cell_iterators
IteratorRange< active_cell_iterator > active_cell_iterators() const
Definition: dof_handler.cc:1379
hp::Refinement::full_p_adaptivity
void full_p_adaptivity(const hp::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:43
hp::Refinement::ComparisonFunction
std::function< bool(const Number &, const Number &)> ComparisonFunction
Definition: refinement.h:143
mpi.h
hp::Refinement::p_adaptivity_from_flags
void p_adaptivity_from_flags(const hp::DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &p_flags)
Definition: refinement.cc:55
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
hp::Refinement::choose_p_over_h
void choose_p_over_h(const hp::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:636
internal::parallel::distributed::GridRefinement::RefineAndCoarsenFixedNumber::compute_threshold
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)
Definition: grid_refinement.cc:235
shared_tria.h
Utilities::MPI::sum
T sum(const T &t, const MPI_Comm &mpi_communicator)
grid_refinement.h
AssertDimension
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1579
grid_refinement.h
hp::Refinement::p_adaptivity_fixed_number
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:213
Differentiation::SD::ceil
Expression ceil(const Expression &x)
Definition: symengine_math.cc:301
parallel::Triangulation
TriangulationBase< dim, spacedim > Triangulation
Definition: tria_base.h:302
StandardExceptions::ExcInternalError
static ::ExceptionBase & ExcInternalError()
parallel::TriangulationBase::get_communicator
virtual const MPI_Comm & get_communicator() const
Definition: tria_base.cc:138
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
vector.h
hp
Definition: hp.h:117
numbers::invalid_unsigned_int
static const unsigned int invalid_unsigned_int
Definition: types.h:191
Utilities::MPI::min
T min(const T &t, const MPI_Comm &mpi_communicator)
hp::Refinement::p_adaptivity_from_absolute_threshold
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
hp::Refinement::p_adaptivity_from_reference
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:458
parallel::TriangulationBase
Definition: tria_base.h:78
hp::Refinement::force_p_over_h
void force_p_over_h(const hp::DoFHandler< dim, spacedim > &dof_handler)
Definition: refinement.cc:622
config.h
GridRefinement::ExcInvalidParameterValue
static ::ExceptionBase & ExcInvalidParameterValue()
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
tria_base.h
Utilities::MPI::max
T max(const T &t, const MPI_Comm &mpi_communicator)
dof_handler.h