17 #include <deal.II/base/polynomials_raviart_thomas.h> 18 #include <deal.II/base/quadrature_lib.h> 19 #include <deal.II/base/thread_management.h> 33 DEAL_II_NAMESPACE_OPEN
39 , polynomial_space(create_polynomials(k))
40 , n_pols(compute_n_pols(k))
46 std::vector<std::vector<Polynomials::Polynomial<double>>>
49 std::vector<std::vector<Polynomials::Polynomial<double>>> pols(dim);
52 for (
unsigned int d = 1; d < dim; ++d)
55 for (
unsigned int d = 1; d < dim; ++d)
72 Assert(values.size() == n_pols || values.size() == 0,
74 Assert(grads.size() == n_pols || grads.size() == 0,
76 Assert(grad_grads.size() == n_pols || grad_grads.size() == 0,
78 Assert(third_derivatives.size() == n_pols || third_derivatives.size() == 0,
80 Assert(fourth_derivatives.size() == n_pols || fourth_derivatives.size() == 0,
97 std::lock_guard<std::mutex> lock(mutex);
99 static std::vector<double> p_values;
100 static std::vector<Tensor<1, dim>> p_grads;
101 static std::vector<Tensor<2, dim>> p_grad_grads;
102 static std::vector<Tensor<3, dim>> p_third_derivatives;
103 static std::vector<Tensor<4, dim>> p_fourth_derivatives;
105 const unsigned int n_sub = polynomial_space.n();
106 p_values.resize((values.size() == 0) ? 0 : n_sub);
107 p_grads.resize((grads.size() == 0) ? 0 : n_sub);
108 p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub);
109 p_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_sub);
110 p_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_sub);
112 for (
unsigned int d = 0; d < dim; ++d)
126 for (
unsigned int c = 0; c < dim; ++c)
127 p(c) = unit_point((c + d) % dim);
129 polynomial_space.compute(p,
134 p_fourth_derivatives);
136 for (
unsigned int i = 0; i < p_values.size(); ++i)
137 values[i + d * n_sub][d] = p_values[i];
139 for (
unsigned int i = 0; i < p_grads.size(); ++i)
140 for (
unsigned int d1 = 0; d1 < dim; ++d1)
141 grads[i + d * n_sub][d][(d1 + d) % dim] = p_grads[i][d1];
143 for (
unsigned int i = 0; i < p_grad_grads.size(); ++i)
144 for (
unsigned int d1 = 0; d1 < dim; ++d1)
145 for (
unsigned int d2 = 0; d2 < dim; ++d2)
146 grad_grads[i + d * n_sub][d][(d1 + d) % dim][(d2 + d) % dim] =
147 p_grad_grads[i][d1][d2];
149 for (
unsigned int i = 0; i < p_third_derivatives.size(); ++i)
150 for (
unsigned int d1 = 0; d1 < dim; ++d1)
151 for (
unsigned int d2 = 0; d2 < dim; ++d2)
152 for (
unsigned int d3 = 0; d3 < dim; ++d3)
153 third_derivatives[i + d * n_sub][d][(d1 + d) % dim]
154 [(d2 + d) % dim][(d3 + d) % dim] =
155 p_third_derivatives[i][d1][d2][d3];
157 for (
unsigned int i = 0; i < p_fourth_derivatives.size(); ++i)
158 for (
unsigned int d1 = 0; d1 < dim; ++d1)
159 for (
unsigned int d2 = 0; d2 < dim; ++d2)
160 for (
unsigned int d3 = 0; d3 < dim; ++d3)
161 for (
unsigned int d4 = 0; d4 < dim; ++d4)
162 fourth_derivatives[i + d * n_sub][d][(d1 + d) % dim]
163 [(d2 + d) % dim][(d3 + d) % dim]
165 p_fourth_derivatives[i][d1][d2][d3][d4];
177 return 2 * (k + 1) * (k + 2);
179 return 3 * (k + 1) * (k + 1) * (k + 2);
191 DEAL_II_NAMESPACE_CLOSE
PolynomialsRaviartThomas(const unsigned int k)
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int degree)
static unsigned int compute_n_pols(unsigned int degree)
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int degree)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void compute(const Point< dim > &unit_point, std::vector< Tensor< 1, dim >> &values, std::vector< Tensor< 2, dim >> &grads, std::vector< Tensor< 3, dim >> &grad_grads, std::vector< Tensor< 4, dim >> &third_derivatives, std::vector< Tensor< 5, dim >> &fourth_derivatives) const
static std::vector< std::vector< Polynomials::Polynomial< double > > > create_polynomials(const unsigned int k)
static ::ExceptionBase & ExcNotImplemented()