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