From 7e08b07c3e773ea4ef95a3642f242f31340b8965 Mon Sep 17 00:00:00 2001 From: leicht Date: Thu, 27 Mar 2008 15:31:30 +0000 Subject: [PATCH] In the automatic differentiation example: initialize values of independent variables before declaring them as such. git-svn-id: https://svn.dealii.org/trunk@15936 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-33/doc/intro.dox | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deal.II/examples/step-33/doc/intro.dox b/deal.II/examples/step-33/doc/intro.dox index 596c6de571..316b73c0ee 100644 --- a/deal.II/examples/step-33/doc/intro.dox +++ b/deal.II/examples/step-33/doc/intro.dox @@ -124,6 +124,7 @@ used: @code #include +#include typedef Sacado::Fad::DFad fad_double; @@ -131,15 +132,15 @@ main() { fad_double a,b,c; + a = 1; b = 2; + a.diff(0,2); // Set a to be dof 0, in a 2-dof system. b.diff(1,2); // Set b to be dof 1, in a 2-dof system. - a = 1; b = 2; - c = 2*a+cos(a*b); - double *derivs = c.fastAccessDx(0); // Access derivatives + double *derivs = &c.fastAccessDx(0); // Access derivatives std::cout << "dc/da = " << derivs[0] << ", dc/db=" << derivs[1] << std::endl; -- 2.39.5