v0.14.0
Functions
test_T4ddg_006.cpp File Reference
#include "../../../src/FTensor.hpp"
#include "../test_for_zero.hpp"
#include <iostream>

Go to the source code of this file.

Functions

void test_T4ddg_006 (const Tensor2_symmetric< double, 3 > &t2s_2, const Tensor2_symmetric< double, 3 > &t2s_3)
 

Function Documentation

◆ test_T4ddg_006()

void test_T4ddg_006 ( const Tensor2_symmetric< double, 3 > &  t2s_2,
const Tensor2_symmetric< double, 3 > &  t2s_3 
)

Definition at line 7 of file test_T4ddg_006.cpp.

8  {
13 
14  {
15  Ddg<double, 3, 3> t4ddg_3_1, t4ddg_3_2, t4ddg_3_3;
16  t4ddg_3_1(i, j, k, l) = t2s_2(i, j) * t2s_3(k, l);
17  t4ddg_3_2(i, j, k, l) = t2s_3(i, j) * t2s_2(k, l);
18  t4ddg_3_3(i, j, k, l) = t4ddg_3_1(i, j, k, l);
19  t4ddg_3_3(i, j, k, l) += t4ddg_3_2(i, j, k, l);
20 
21  for (int ii = 0; ii != 3; ++ii)
22  for (int jj = 0; jj != 3; ++jj)
23  for (int kk = 0; kk != 3; ++kk)
24  for (int ll = 0; ll != 3; ++ll) {
25  test_for_zero(t4ddg_3_3(ii, jj, kk, ll) -
26  t4ddg_3_1(ii, jj, kk, ll) -
27  t4ddg_3_2(ii, jj, kk, ll),
28  "T4ddg(i,j,k,l)+=T4ddg(i,j,k,l)(" + to_string(ii) +
29  "," + to_string(jj) + "," + to_string(kk) + "," +
30  to_string(ll) + ")");
31  }
32 
33  Ddg<double, 3, 3> t4ddg_3_4;
34  t4ddg_3_4(i, j, k, l) = t4ddg_3_3(i, j, k, l);
35  t4ddg_3_4(i, j, k, l) -= t4ddg_3_3(i, j, k, l);
36  for (int ii = 0; ii != 3; ++ii)
37  for (int jj = 0; jj != 3; ++jj)
38  for (int kk = 0; kk != 3; ++kk)
39  for (int ll = 0; ll != 3; ++ll) {
40  test_for_zero(t4ddg_3_4(ii, jj, kk, ll),
41  "T4ddg(i,j,k,l)-=T4ddg(i,j,k,l)(" + to_string(ii) +
42  "," + to_string(jj) + "," + to_string(kk) + "," +
43  to_string(ll) + ")");
44  }
45  }
46 
47  {
48  Ddg<double, 3, 3> t4ddg_3_1, t4ddg_3_2;
49  t4ddg_3_1(i, j, k, l) = t2s_2(i, j) * t2s_3(k, l);
50  t4ddg_3_2(i, j, k, l) = t4ddg_3_1(i, j, k, l);
51  t4ddg_3_1(i, j, k, l) *= 2.;
52  for (int ii = 0; ii != 3; ++ii)
53  for (int jj = 0; jj != 3; ++jj)
54  for (int kk = 0; kk != 3; ++kk)
55  for (int ll = 0; ll != 3; ++ll) {
57  t4ddg_3_1(ii, jj, kk, ll) - 2 * t4ddg_3_2(ii, jj, kk, ll),
58  "T4ddg(i,j,k,l)*=2(" + to_string(ii) + "," + to_string(jj) +
59  "," + to_string(kk) + "," + to_string(ll) + ")");
60  }
61  }
62 
63  {
64  Ddg<double, 3, 3> t4ddg_3_1;
65  t4ddg_3_1(i, j, k, l) = t2s_2(i, j) * t2s_3(k, l);
66 
68  for (int ii = 0; ii != 3; ++ii)
69  for (int jj = 0; jj != 3; ++jj)
70  t2(ii, jj) = 1 + ii + 10 * jj;
71 
72  Tensor2<double, 3, 3> t2_1, t2_2;
73  t2_1(i, k) = t4ddg_3_1(i, j, k, l) * t2(j, l);
74  t2_2(i, k) = t2s_2(i, j) * (t2s_3(k, l) * t2(j, l));
75 
76  for (int ii = 0; ii != 3; ++ii)
77  for (int jj = 0; jj != 3; ++jj) {
78  test_for_zero(t2_1(ii, jj) - t2_2(ii, jj), "T4ddg(i,j,k,l)*T2(j,l)(" +
79  to_string(ii) + "," +
80  to_string(jj) + ")");
81  }
82  }
83 
84  {
85  Ddg<double, 3, 3> t4ddg_3_1;
86  t4ddg_3_1(i, j, k, l) = t2s_2(i, j) * t2s_3(k, l);
87 
89  for (int ii = 0; ii != 3; ++ii)
90  for (int jj = 0; jj != 3; ++jj)
91  t2(ii, jj) = 1 + ii + 10 * jj;
92 
93  Tensor2_symmetric<double, 3> t2s_1, t2s_4;
94  t2s_1(k, l) = t4ddg_3_1(i, j, k, l) * t2(i, j);
95 
96  t2s_4(k, l) = 0;
97  for (int kk = 0; kk != 3; ++kk)
98  for (int ll = kk; ll != 3; ++ll)
99  for (int ii = 0; ii != 3; ++ii)
100  for (int jj = 0; jj != 3; ++jj)
101  t2s_4(kk, ll) += t2s_3(kk, ll) * (t2s_2(ii, jj) * t2(ii, jj));
102 
103  for (int ii = 0; ii != 3; ++ii)
104  for (int jj = 0; jj != 3; ++jj) {
105  test_for_zero(t2s_1(ii, jj) - t2s_4(ii, jj), "T4ddg(i,j,k,l)*T2(i,j)(" +
106  to_string(ii) + "," +
107  to_string(jj) + ")");
108  }
109  }
110 }
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
FTensor::Tensor2< double, 3, 3 >
test_for_zero
void test_for_zero(const T &t, const std::string &s)
Definition: test_for_zero.hpp:7
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg< double, 3, 3 >
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21