std::vector<Tensor<4,dim> > &fourth_derivatives) const;
};
-// template functions
-template <int dim>
-template <int order>
-Tensor<order,dim>
-PolynomialsRannacherTurek<dim>::compute_derivative (const unsigned int i,
- const Point<dim> &p) const
+
+namespace internal
{
- Assert(dim == 2, ExcNotImplemented());
- Tensor<order,dim> derivative;
- switch (order)
- {
- case 1:
+ namespace PolynomialsRannacherTurek
+ {
+ template <int order, int dim>
+ inline
+ Tensor<order,dim>
+ compute_derivative (const unsigned int,
+ const Point<dim> &)
{
- Tensor<1,dim> &grad = *reinterpret_cast<Tensor<1,dim>*>(&derivative);
- if (i == 0)
- {
- grad[0] = -2.5 + 3*p(0);
- grad[1] = 1.5 - 3*p(1);
- }
- else if (i == 1)
- {
- grad[0] = -0.5 + 3.0*p(0);
- grad[1] = 1.5 - 3.0*p(1);
- }
- else if (i == 2)
- {
- grad[0] = 1.5 - 3.0*p(0);
- grad[1] = -2.5 + 3.0*p(1);
- }
- else if (i == 3)
- {
- grad[0] = 1.5 - 3.0*p(0);
- grad[1] = -0.5 + 3.0*p(1);
- }
- else
- {
- Assert(false, ExcNotImplemented());
- }
- return derivative;
+ Assert (dim == 2, ExcNotImplemented());
+ return Tensor<order,dim>();
}
- case 2:
+
+
+ template <int order>
+ inline
+ Tensor<order,2>
+ compute_derivative (const unsigned int i,
+ const Point<2> &p)
{
- Tensor<2,dim> &grad_grad = *reinterpret_cast<Tensor<2,dim>*>(&derivative);
- if (i == 0)
+ const unsigned int dim = 2;
+
+ Tensor<order,dim> derivative;
+ switch (order)
{
- grad_grad[0][0] = 3;
- grad_grad[0][1] = 0;
- grad_grad[1][0] = 0;
- grad_grad[1][1] = -3;
- }
- else if (i == 1)
+ case 1:
{
- grad_grad[0][0] = 3;
- grad_grad[0][1] = 0;
- grad_grad[1][0] = 0;
- grad_grad[1][1] = -3;
+ Tensor<1,dim> &grad = *reinterpret_cast<Tensor<1,dim>*>(&derivative);
+ if (i == 0)
+ {
+ grad[0] = -2.5 + 3*p(0);
+ grad[1] = 1.5 - 3*p(1);
+ }
+ else if (i == 1)
+ {
+ grad[0] = -0.5 + 3.0*p(0);
+ grad[1] = 1.5 - 3.0*p(1);
+ }
+ else if (i == 2)
+ {
+ grad[0] = 1.5 - 3.0*p(0);
+ grad[1] = -2.5 + 3.0*p(1);
+ }
+ else if (i == 3)
+ {
+ grad[0] = 1.5 - 3.0*p(0);
+ grad[1] = -0.5 + 3.0*p(1);
+ }
+ else
+ {
+ Assert(false, ExcNotImplemented());
+ }
+ return derivative;
}
- else if (i == 2)
+ case 2:
{
- grad_grad[0][0] = -3;
- grad_grad[0][1] = 0;
- grad_grad[1][0] = 0;
- grad_grad[1][1] = 3;
+ Tensor<2,dim> &grad_grad = *reinterpret_cast<Tensor<2,dim>*>(&derivative);
+ if (i == 0)
+ {
+ grad_grad[0][0] = 3;
+ grad_grad[0][1] = 0;
+ grad_grad[1][0] = 0;
+ grad_grad[1][1] = -3;
+ }
+ else if (i == 1)
+ {
+ grad_grad[0][0] = 3;
+ grad_grad[0][1] = 0;
+ grad_grad[1][0] = 0;
+ grad_grad[1][1] = -3;
+ }
+ else if (i == 2)
+ {
+ grad_grad[0][0] = -3;
+ grad_grad[0][1] = 0;
+ grad_grad[1][0] = 0;
+ grad_grad[1][1] = 3;
+ }
+ else if (i == 3)
+ {
+ grad_grad[0][0] = -3;
+ grad_grad[0][1] = 0;
+ grad_grad[1][0] = 0;
+ grad_grad[1][1] = 3;
+ }
+ return derivative;
}
- else if (i == 3)
+ default:
{
- grad_grad[0][0] = -3;
- grad_grad[0][1] = 0;
- grad_grad[1][0] = 0;
- grad_grad[1][1] = 3;
+ // higher derivatives are all zero
+ return Tensor<order,dim>();
+ }
}
- return derivative;
- }
- default:
- {
- // higher derivatives are all zero
- return Tensor<order,dim>();
- }
}
+ }
+}
+
+
+
+// template functions
+template <int dim>
+template <int order>
+Tensor<order,dim>
+PolynomialsRannacherTurek<dim>::compute_derivative (const unsigned int i,
+ const Point<dim> &p) const
+{
+ return internal::PolynomialsRannacherTurek::compute_derivative<order> (i, p);
}