//---------------------------- anisotropic_1.cc ---------------------------
// $Id$
-// Version: $Name$
+// Version: $Name$
//
-// Copyright (C) 2003, 2004, 2005, 2008 by the deal.II authors
+// Copyright (C) 2003, 2004, 2005, 2008, 2012 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
const POLY2 &q)
{
const unsigned int n = p.n();
-
+
std::vector<double> values1 (n), values2 (n);
std::vector<Tensor<1,dim> > gradients1(n), gradients2(n);
std::vector<Tensor<2,dim> > second1(n), second2(n);
-
+
p.compute (x, values1, gradients1, second1);
q.compute (x, values2, gradients2, second2);
-
+
for (unsigned int k=0; k<n; ++k)
{
// Check if compute_value is ok
if (grad2 != grad1)
deallog << "PQ" << k << ": gradients differ " << grad1 << " != "
<< grad2 << std::endl;
-
- // Check if compute_grad_grad is ok
- Tensor<2,dim> grad_grad1 = p.compute_grad_grad(k,x);
- if (grad_grad1 != second1[k])
- deallog << 'P' << k << ": second derivatives differ " << grad_grad1 << " != "
+
+ // Check if compute_hessian is ok
+ Tensor<2,dim> hessian1 = p.compute_hessian(k,x);
+ if (hessian1 != second1[k])
+ deallog << 'P' << k << ": second derivatives differ " << hessian1 << " != "
<< second1[k] << std::endl;
- Tensor<2,dim> grad_grad2 = q.compute_grad_grad(k,x);
- if (grad_grad2 != second2[k])
- deallog << 'Q' << k << ": second derivatives differ " << grad_grad2 << " != "
+ Tensor<2,dim> hessian2 = q.compute_hessian(k,x);
+ if (hessian2 != second2[k])
+ deallog << 'Q' << k << ": second derivatives differ " << hessian2 << " != "
<< second2[k] << std::endl;
- if (grad_grad2 != grad_grad1)
- deallog << "PQ" << k << ": second derivatives differ " << grad_grad1 << " != "
- << grad_grad2 << std::endl;
+ if (hessian2 != hessian1)
+ deallog << "PQ" << k << ": second derivatives differ " << hessian1 << " != "
+ << hessian2 << std::endl;
// finally output values,
// two-post-dot-digits limit
values1[k] *= std::pow(10., dim);
gradients1[k] *= std::pow(10., dim);
-
+
deallog << 'P' << k << "\t= " << values1[k]
<< "\tgradient\t";
for (unsigned int d=0;d<dim;++d)
std::vector<std::vector<Polynomial<double> > > pols (dim, v);
AnisotropicPolynomials<dim> q(pols);
-
+
check_poly (x, p, q);
}
deallog.pop();
deallog.push("Legendre");
-
+
p.clear ();
for (unsigned int i=0;i<3;++i)
p.push_back (Legendre(i));
//---------------------------- polynomial_test.cc ---------------------------
// $Id$
-// Version: $Name$
+// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2012 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
std::vector<double> values (n);
std::vector<Tensor<1,dim> > gradients(n);
std::vector<Tensor<2,dim> > second(n);
-
+
p.compute (x, values, gradients, second);
-
+
for (unsigned int k=0;k<n;++k)
{
// first make sure the
// individual functions work in
// a consistent way
-
+
// Check if compute_value is ok
double val = p.compute_value(k,x);
if (std::fabs(val - values[k]) > 5.0E-15)
if ((grad-gradients[k]) * (grad-gradients[k]) > 5e-15*5e-15)
deallog << 'P' << k << ": gradients differ " << grad << " != "
<< gradients[k] << std::endl;
-
- // Check if compute_grad_grad is ok
- Tensor<2,dim> grad2 = p.compute_grad_grad(k,x);
+
+ // Check if compute_hessian is ok
+ Tensor<2,dim> grad2 = p.compute_hessian(k,x);
Tensor<2,dim> diff = grad2-second[k];
double s = 0;
for (unsigned int i=0; i<dim; ++i)
// two-post-dot-digits limit
values[k] *= std::pow(10., dim);
gradients[k] *= std::pow(10., dim);
-
+
deallog << 'P' << k << "\t= " << values[k]
<< "\tgradient\t";
for (unsigned int d=0;d<dim;++d)
deallog.pop();
deallog.push("Legendre");
-
+
p.clear ();
for (unsigned int i=0;i<3;++i)
p.push_back (Legendre(i));