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> 27 DEAL_II_NAMESPACE_OPEN
34 polynomial_space (create_polynomials (k)),
35 n_pols(compute_n_pols(k))
41 std::vector<std::vector< Polynomials::Polynomial< double > > >
44 std::vector<std::vector< Polynomials::Polynomial< double > > > pols(dim);
47 for (
unsigned int d=1; d<dim; ++d)
50 for (
unsigned int d=1; d<dim; ++d)
66 Assert(values.size()==n_pols || values.size()==0,
68 Assert(grads.size()==n_pols|| grads.size()==0,
70 Assert(grad_grads.size()==n_pols|| grad_grads.size()==0,
72 Assert(third_derivatives.size()==n_pols|| third_derivatives.size()==0,
74 Assert(fourth_derivatives.size()==n_pols|| fourth_derivatives.size()==0,
93 static std::vector<double> p_values;
94 static std::vector<Tensor<1,dim> > p_grads;
95 static std::vector<Tensor<2,dim> > p_grad_grads;
96 static std::vector<Tensor<3,dim> > p_third_derivatives;
97 static std::vector<Tensor<4,dim> > p_fourth_derivatives;
99 const unsigned int n_sub = polynomial_space.n();
100 p_values.resize((values.size() == 0) ? 0 : n_sub);
101 p_grads.resize((grads.size() == 0) ? 0 : n_sub);
102 p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub);
103 p_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_sub);
104 p_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_sub);
106 for (
unsigned int d=0; d<dim; ++d)
120 for (
unsigned int c=0; c<dim; ++c)
121 p(c) = unit_point((c+d)%dim);
123 polynomial_space.compute (p, p_values, p_grads, p_grad_grads, p_third_derivatives, p_fourth_derivatives);
125 for (
unsigned int i=0; i<p_values.size(); ++i)
126 values[i+d*n_sub][d] = p_values[i];
128 for (
unsigned int i=0; i<p_grads.size(); ++i)
129 for (
unsigned int d1=0; d1<dim; ++d1)
130 grads[i+d*n_sub][d][(d1+d)%dim] = p_grads[i][d1];
132 for (
unsigned int i=0; i<p_grad_grads.size(); ++i)
133 for (
unsigned int d1=0; d1<dim; ++d1)
134 for (
unsigned int d2=0; d2<dim; ++d2)
135 grad_grads[i+d*n_sub][d][(d1+d)%dim][(d2+d)%dim]
136 = p_grad_grads[i][d1][d2];
138 for (
unsigned int i=0; i<p_third_derivatives.size(); ++i)
139 for (
unsigned int d1=0; d1<dim; ++d1)
140 for (
unsigned int d2=0; d2<dim; ++d2)
141 for (
unsigned int d3=0; d3<dim; ++d3)
142 third_derivatives[i+d*n_sub][d][(d1+d)%dim][(d2+d)%dim][(d3+d)%dim]
143 = p_third_derivatives[i][d1][d2][d3];
145 for (
unsigned int i=0; i<p_fourth_derivatives.size(); ++i)
146 for (
unsigned int d1=0; d1<dim; ++d1)
147 for (
unsigned int d2=0; d2<dim; ++d2)
148 for (
unsigned int d3=0; d3<dim; ++d3)
149 for (
unsigned int d4=0; d4<dim; ++d4)
150 fourth_derivatives[i+d*n_sub][d][(d1+d)%dim][(d2+d)%dim][(d3+d)%dim][(d4+d)%dim]
151 = p_fourth_derivatives[i][d1][d2][d3][d4];
160 if (dim == 1)
return k+1;
161 if (dim == 2)
return 2*(k+1)*(k+2);
162 if (dim == 3)
return 3*(k+1)*(k+1)*(k+2);
174 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()