]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
In the automatic differentiation example: initialize values of independent variables...
authorleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 27 Mar 2008 15:31:30 +0000 (15:31 +0000)
committerleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 27 Mar 2008 15:31:30 +0000 (15:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@15936 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-33/doc/intro.dox

index 596c6de571a20b80b57c4d0b751abf8a017870ae..316b73c0ee751267a5feec08ad97941a1e1d035b 100644 (file)
@@ -124,6 +124,7 @@ used:
 
 @code
 #include <Sacado.hpp>
+#include <iostream>
 
 typedef Sacado::Fad::DFad<double> 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;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.