#include <ostream>
#include <adolc/adtl.h>
#include <FTensor.hpp>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ ADOLC_TAPELESS
◆ FTENSOR_DEBUG
◆ NUMBER_DIRECTIONS
#define NUMBER_DIRECTIONS 6 |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 18 of file ftensor_and_adolc_tapeless.cpp.
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;
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)