3 #error "MoFEM need to be compiled with ADOL-C"
9 #define NUMBER_DIRECTIONS 6
12 #include <adolc/adtl.h>
18 int main(
int argc,
char *argv[])
31 for(
int ii = 0; ii != 2; ii++, dd0++)
33 a_t1(ii).setValue(t1(ii));
34 for(
int kk = 0; kk != 6; kk++)
38 a_t1(ii).setADValue(kk, 1);
42 a_t1(ii).setADValue(kk, 0);
46 for(
int ii = 0; ii != 2; ii++)
48 for(
int jj = 0; jj != 2; jj++, dd0++)
50 a_t2(ii, jj).setValue(t2(ii, jj));
51 for(
int kk = 0; kk != 6; kk++)
55 a_t2(ii, jj).setADValue(kk, 1);
59 a_t2(ii, jj).setADValue(kk, 0);
64 for(
int ii = 0; ii != 2; ii++)
66 std::cout <<
"a_t1 ( " << ii <<
" ) = " << a_t1(ii) << std::endl;
68 for(
int ii = 0; ii != 2; ii++)
70 for(
int jj = 0; jj != 2; jj++)
72 std::cout <<
"a_t1 ( " << ii <<
"," << jj <<
" ) = " << a_t2(ii, jj)
77 adtl::adouble a_t0 = a_t1(
I) * a_t2(
I,
J) * a_t1(
J);
81 std::cout <<
"Value: " << t0 <<
" ( " << a_t0 <<
" ) " << std::endl;
87 for(
int ii = 0; ii != 2; ii++,
dd++)
89 ad_t0_t1(ii) = a_t0.getADValue(
dd);
91 for(
int ii = 0; ii != 2; ii++)
93 for(
int jj = 0; jj != 2; jj++,
dd++)
95 ad_t0_t2(ii, jj) = a_t0.getADValue(
dd);
102 std::cout <<
"Derivatives t0_t1" << std::endl;
103 for(
int ii = 0; ii != 2; ii++,
dd++)
105 std::cout << ad_t0_t1(ii) << std::endl;
106 if(ad_t0_t1(ii) != 2)
108 std::cerr <<
"Wrong result, should be 2" << std::endl;
112 std::cout <<
"Derivatives t0_t2" << std::endl;
113 for(
int ii = 0; ii != 2; ii++)
115 for(
int jj = 0; jj != 2; jj++,
dd++)
117 std::cout << ad_t0_t2(ii, jj) <<
" ";
118 if(ad_t0_t2(ii, ii) != 1)
120 std::cerr <<
"Wrong result, should be 1" << std::endl;