17 #include <deal.II/base/polynomials_abf.h> 18 #include <deal.II/base/quadrature_lib.h> 24 DEAL_II_NAMESPACE_OPEN
31 std::vector<std::vector<Polynomials::Polynomial<double>>>
32 get_abf_polynomials(
const unsigned int k)
34 std::vector<std::vector<Polynomials::Polynomial<double>>> pols(dim);
38 for (
unsigned int d = 1;
d < dim; ++
d)
41 for (
unsigned int d = 1;
d < dim; ++
d)
51 , polynomial_space(get_abf_polynomials<dim>(k))
52 , n_pols(compute_n_pols(k))
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,
83 const unsigned int n_sub = polynomial_space.n();
89 std::lock_guard<std::mutex> lock(mutex);
91 p_values.resize((values.size() == 0) ? 0 : n_sub);
92 p_grads.resize((grads.size() == 0) ? 0 : n_sub);
93 p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub);
94 p_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_sub);
95 p_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_sub);
97 for (
unsigned int d = 0; d < dim; ++d)
111 for (
unsigned int c = 0; c < dim; ++c)
112 p(c) = unit_point((c + d) % dim);
114 polynomial_space.compute(p,
119 p_fourth_derivatives);
121 for (
unsigned int i = 0; i < p_values.size(); ++i)
122 values[i + d * n_sub][d] = p_values[i];
124 for (
unsigned int i = 0; i < p_grads.size(); ++i)
125 for (
unsigned int d1 = 0; d1 < dim; ++d1)
126 grads[i + d * n_sub][d][(d1 + d) % dim] = p_grads[i][d1];
128 for (
unsigned int i = 0; i < p_grad_grads.size(); ++i)
129 for (
unsigned int d1 = 0; d1 < dim; ++d1)
130 for (
unsigned int d2 = 0; d2 < dim; ++d2)
131 grad_grads[i + d * n_sub][d][(d1 + d) % dim][(d2 + d) % dim] =
132 p_grad_grads[i][d1][d2];
134 for (
unsigned int i = 0; i < p_third_derivatives.size(); ++i)
135 for (
unsigned int d1 = 0; d1 < dim; ++d1)
136 for (
unsigned int d2 = 0; d2 < dim; ++d2)
137 for (
unsigned int d3 = 0; d3 < dim; ++d3)
138 third_derivatives[i + d * n_sub][d][(d1 + d) % dim]
139 [(d2 + d) % dim][(d3 + d) % dim] =
140 p_third_derivatives[i][d1][d2][d3];
142 for (
unsigned int i = 0; i < p_fourth_derivatives.size(); ++i)
143 for (
unsigned int d1 = 0; d1 < dim; ++d1)
144 for (
unsigned int d2 = 0; d2 < dim; ++d2)
145 for (
unsigned int d3 = 0; d3 < dim; ++d3)
146 for (
unsigned int d4 = 0; d4 < dim; ++d4)
147 fourth_derivatives[i + d * n_sub][d][(d1 + d) % dim]
148 [(d2 + d) % dim][(d3 + d) % dim]
150 p_fourth_derivatives[i][d1][d2][d3][d4];
168 return 2 * (k + 3) * (k + 1);
173 return 3 * (k + 3) * (k + 1) * (k + 1);
188 DEAL_II_NAMESPACE_CLOSE
static std::vector< Polynomial< double > > generate_complete_basis(const 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)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
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 unsigned int compute_n_pols(unsigned int degree)
static ::ExceptionBase & ExcNotImplemented()
const AnisotropicPolynomials< dim > polynomial_space
PolynomialsABF(const unsigned int k)
static ::ExceptionBase & ExcInternalError()