Reference documentation for deal.II version GIT 35969cdc9b 2023-12-09 01:10:02+00:00
mg_transfer_global_coarsening.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2020 - 2021 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 #include <deal.II/multigrid/mg_transfer_global_coarsening.templates.h>
17
19
21 {
22  unsigned int
24  const unsigned int previous_fe_degree,
25  const PolynomialCoarseningSequenceType &p_sequence)
26  {
27  switch (p_sequence)
28  {
30  return std::max(previous_fe_degree / 2, 1u);
32  return std::max(previous_fe_degree - 1, 1u);
34  return 1u;
35  default:
37  return 1u;
38  }
39  }
40
41
42
43  std::vector<unsigned int>
45  const unsigned int max_degree,
46  const PolynomialCoarseningSequenceType &p_sequence)
47  {
48  std::vector<unsigned int> degrees{max_degree};
49
50  while (degrees.back() > 1)
51  degrees.push_back(
52  create_next_polynomial_coarsening_degree(degrees.back(), p_sequence));
53
54  std::reverse(degrees.begin(), degrees.end());
55
56  return degrees;
57  }
58 } // namespace MGTransferGlobalCoarseningTools
59
60 #include "mg_transfer_global_coarsening.inst"
61
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
#define Assert(cond, exc)
Definition: exceptions.h:1631
static ::ExceptionBase & ExcNotImplemented()
unsigned int create_next_polynomial_coarsening_degree(const unsigned int degree, const PolynomialCoarseningSequenceType &p_sequence)
std::vector< unsigned int > create_polynomial_coarsening_sequence(const unsigned int max_degree, const PolynomialCoarseningSequenceType &p_sequence)