Reference documentation for deal.II version 9.4.0
polynomials_p.cc
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2004 - 2018 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
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
18
20
21
22template <int dim>
24 : PolynomialSpace<dim>(
25 Polynomials::Monomial<double>::generate_complete_basis(p))
26 , p(p)
27{
28 std::vector<unsigned int> index_map(this->n());
30 this->set_numbering(index_map);
31}
32
33
34template <>
35void
37 std::vector<unsigned int> &index_map) const
38{
39 Assert(index_map.size() == this->n(),
40 ExcDimensionMismatch(index_map.size(), this->n()));
41
42 // identity
43 for (unsigned int i = 0; i < this->n(); ++i)
44 index_map[i] = i;
45}
46
47
48namespace
49{
50 const unsigned int imap2[6][21] = {
51 {0},
52 {0, 1, 2},
53 {0, 1, 3, 4, 2, 5},
54 {0, 1, 4, 5, 2, 7, 6, 8, 3, 9},
55 {0, 1, 5, 6, 2, 9, 7, 10, 3, 12, 11, 8, 13, 4, 14},
56 {0, 1, 6, 7, 2, 11, 8, 12, 3, 15, 13, 9, 16, 4, 18, 14, 17, 10, 19, 5, 20}};
57}
58
59template <>
60void
62 std::vector<unsigned int> &index_map) const
63{
64 Assert(index_map.size() == this->n(),
65 ExcDimensionMismatch(index_map.size(), this->n()));
66 Assert(p <= 5, ExcNotImplemented());
67
68 // Given the number i of the
69 // polynomial in
70 // @f$1,x,y,xy,x2,y2,...@f$,
71 // index_map[i] gives the number of
72 // the polynomial in
73 // PolynomialSpace.
74 for (unsigned int i = 0; i < this->n(); ++i)
75 index_map[i] = imap2[p][i];
76}
77
78
79namespace
80{
81 const unsigned int imap3[4][20] = {{0},
82 {0, 1, 2, 3},
83 {0, 1, 3, 6, 4, 7, 8, 2, 5, 9},
84 {0, 1, 4, 10, 5, 11, 13, 2, 7, 16,
85 14, 6, 12, 8, 15, 17, 18, 3, 9, 19}};
86}
87
88template <>
89void
91 std::vector<unsigned int> &index_map) const
92{
93 Assert(index_map.size() == this->n(),
94 ExcDimensionMismatch(index_map.size(), this->n()));
95 Assert(p <= 3, ExcNotImplemented());
96
97 // Given the number i of the
98 // polynomial in
99 // @f$1,x,y,xy,x2,y2,...@f$,
100 // index_map[i] gives the number of
101 // the polynomial in
102 // PolynomialSpace.
103 for (unsigned int i = 0; i < this->n(); ++i)
104 index_map[i] = imap3[p][i];
105}
106
107
108
109template class PolynomialsP<1>;
110template class PolynomialsP<2>;
111template class PolynomialsP<3>;
112
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:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
Definition: exceptions.h:1473
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)