// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
{
unsigned int indices[dim];
compute_index (i, indices);
-
+
double value=1.;
for (unsigned int d=0; d<dim; ++d)
value *= polynomials[indices[d]].value(p(d));
-
+
return value;
}
-
+
+
+template <>
+double
+TensorProductPolynomials<0>::compute_value (const unsigned int ,
+ const Point<0> &) const
+{
+ return 1./0.;
+}
+
+
+
template <int dim>
Tensor<1,dim>
TensorProductPolynomials<dim>::compute_grad (const unsigned int i,
std::vector<std::vector<double> > v(dim, std::vector<double> (2));
for (unsigned int d=0; d<dim; ++d)
polynomials[indices[d]].value(p(d), v[d]);
-
+
Tensor<1,dim> grad;
for (unsigned int d=0; d<dim; ++d)
{
for (unsigned int x=0; x<dim; ++x)
grad[d] *= v[x][d==x];
}
-
+
return grad;
}
std::vector<std::vector<double> > v(dim, std::vector<double> (3));
for (unsigned int d=0; d<dim; ++d)
polynomials[indices[d]].value(p(d), v[d]);
-
+
Tensor<2,dim> grad_grad;
for (unsigned int d1=0; d1<dim; ++d1)
for (unsigned int d2=0; d2<dim; ++d2)
derivative=2;
else
derivative=1;
- }
+ }
grad_grad[d1][d2] *= v[x][derivative];
}
}
v(d,i).resize (n_values_and_derivatives, 0.);
polynomials[i].value(p(d), v(d,i));
};
-
+
for (unsigned int i=0; i<n_tensor_pols; ++i)
{
// first get the
// product polynomial
unsigned int indices[dim];
compute_index (i, indices);
-
+
if (update_values)
{
values[i] = 1;
for (unsigned int x=0; x<dim; ++x)
values[i] *= v(x,indices[x])[0];
}
-
+
if (update_grads)
for (unsigned int d=0; d<dim; ++d)
{
- grads[i][d] = 1.;
+ grads[i][d] = 1.;
for (unsigned int x=0; x<dim; ++x)
grads[i][d] *= v(x,indices[x])[d==x];
}
derivative=2;
else
derivative=1;
- }
+ }
grad_grads[i][d1][d2]
*= v(x,indices[x])[derivative];
}
-template<int dim>
+template <int dim>
unsigned int
TensorProductPolynomials<dim>::n() const
{
+template <>
+unsigned int
+TensorProductPolynomials<0>::n() const
+{
+ return numbers::invalid_unsigned_int;
+}
+
+
+
/* ------------------- AnisotropicPolynomials -------------- */
{
unsigned int indices[dim];
compute_index (i, indices);
-
+
double value=1.;
for (unsigned int d=0; d<dim; ++d)
value *= polynomials[d][indices[d]].value(p(d));
-
+
return value;
}
-
+
template <int dim>
Tensor<1,dim>
AnisotropicPolynomials<dim>::compute_grad (const unsigned int i,
std::vector<std::vector<double> > v(dim, std::vector<double> (2));
for (unsigned int d=0; d<dim; ++d)
polynomials[d][indices[d]].value(p(d), v[d]);
-
+
Tensor<1,dim> grad;
for (unsigned int d=0; d<dim; ++d)
{
for (unsigned int x=0; x<dim; ++x)
grad[d] *= v[x][d==x];
}
-
+
return grad;
}
std::vector<std::vector<double> > v(dim, std::vector<double> (3));
for (unsigned int d=0; d<dim; ++d)
polynomials[d][indices[d]].value(p(d), v[d]);
-
+
Tensor<2,dim> grad_grad;
for (unsigned int d1=0; d1<dim; ++d1)
for (unsigned int d2=0; d2<dim; ++d2)
derivative=2;
else
derivative=1;
- }
+ }
grad_grad[d1][d2] *= v[x][derivative];
}
}
polynomials[d][i].value(p(d), v[d][i]);
};
}
-
+
for (unsigned int i=0; i<n_tensor_pols; ++i)
{
// first get the
// product polynomial
unsigned int indices[dim];
compute_index (i, indices);
-
+
if (update_values)
{
values[i] = 1;
for (unsigned int x=0; x<dim; ++x)
values[i] *= v[x][indices[x]][0];
}
-
+
if (update_grads)
for (unsigned int d=0; d<dim; ++d)
{
- grads[i][d] = 1.;
+ grads[i][d] = 1.;
for (unsigned int x=0; x<dim; ++x)
grads[i][d] *= v[x][indices[x]][d==x ? 1 : 0];
}
derivative=2;
else
derivative=1;
- }
+ }
grad_grads[i][d1][d2]
*= v[x][indices[x]][derivative];
}