Reference documentation for deal.II version GIT relicensing-1054-gedd46abbd6 2024-07-12 01:20:01+00:00
\(\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\}}\)
Loading...
Searching...
No Matches
polynomials_p.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2004 - 2018 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15
17
19
20
21template <int dim>
23 : PolynomialSpace<dim>(
24 Polynomials::Monomial<double>::generate_complete_basis(p))
25 , p(p)
26{
27 std::vector<unsigned int> index_map(this->n());
29 this->set_numbering(index_map);
30}
31
32
33template <>
34void
36 std::vector<unsigned int> &index_map) const
37{
38 Assert(index_map.size() == this->n(),
39 ExcDimensionMismatch(index_map.size(), this->n()));
40
41 // identity
42 for (unsigned int i = 0; i < this->n(); ++i)
43 index_map[i] = i;
44}
45
46
47namespace
48{
49 const unsigned int imap2[6][21] = {
50 {0},
51 {0, 1, 2},
52 {0, 1, 3, 4, 2, 5},
53 {0, 1, 4, 5, 2, 7, 6, 8, 3, 9},
54 {0, 1, 5, 6, 2, 9, 7, 10, 3, 12, 11, 8, 13, 4, 14},
55 {0, 1, 6, 7, 2, 11, 8, 12, 3, 15, 13, 9, 16, 4, 18, 14, 17, 10, 19, 5, 20}};
56}
57
58template <>
59void
61 std::vector<unsigned int> &index_map) const
62{
63 Assert(index_map.size() == this->n(),
64 ExcDimensionMismatch(index_map.size(), this->n()));
65 Assert(p <= 5, ExcNotImplemented());
66
67 // Given the number i of the
68 // polynomial in
69 // @f$1,x,y,xy,x2,y2,...@f$,
70 // index_map[i] gives the number of
71 // the polynomial in
72 // PolynomialSpace.
73 for (unsigned int i = 0; i < this->n(); ++i)
74 index_map[i] = imap2[p][i];
75}
76
77
78namespace
79{
80 const unsigned int imap3[4][20] = {{0},
81 {0, 1, 2, 3},
82 {0, 1, 3, 6, 4, 7, 8, 2, 5, 9},
83 {0, 1, 4, 10, 5, 11, 13, 2, 7, 16,
84 14, 6, 12, 8, 15, 17, 18, 3, 9, 19}};
85}
86
87template <>
88void
90 std::vector<unsigned int> &index_map) const
91{
92 Assert(index_map.size() == this->n(),
93 ExcDimensionMismatch(index_map.size(), this->n()));
94 Assert(p <= 3, ExcNotImplemented());
95
96 // Given the number i of the
97 // polynomial in
98 // @f$1,x,y,xy,x2,y2,...@f$,
99 // index_map[i] gives the number of
100 // the polynomial in
101 // PolynomialSpace.
102 for (unsigned int i = 0; i < this->n(); ++i)
103 index_map[i] = imap3[p][i];
104}
105
106
107
108template class PolynomialsP<1>;
109template class PolynomialsP<2>;
110template class PolynomialsP<3>;
111
void set_numbering(const std::vector< unsigned int > &renumber)
std::vector< unsigned int > index_map
void create_polynomial_ordering(std::vector< unsigned int > &index_map) const
PolynomialsP(const unsigned int p)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)