v0.14.0
test_T2s_41.cpp
Go to the documentation of this file.
1 #include "../../../src/FTensor.hpp"
2 #include "../test_for_zero.hpp"
3 #include <iostream>
4 using namespace FTensor;
5 using namespace std;
6 
9  const Tensor2_symmetric<double, 3> &t2s_2)
10 {
14 
15  Number<0> N0;
16  Number<1> N1;
17  Number<2> N2;
18 
19  /* Tensor2_symmetric tests */
20 
21  t2_1(0, 0) = t2s_2(0, 0);
22  t2_1(0, 1) = t2s_2(0, 1);
23  t2_1(0, 2) = t2s_2(0, 2);
24  t2_1(1, 0) = t2s_2(1, 0);
25  t2_1(1, 1) = t2s_2(1, 1);
26  t2_1(1, 2) = t2s_2(1, 2);
27  t2_1(2, 0) = t2s_2(2, 0);
28  t2_1(2, 1) = t2s_2(2, 1);
29  t2_1(2, 2) = t2s_2(2, 2);
30 
31  t2s_1(i, j) = t2s_2(i, k) ^ t2_1(k, j);
32  test_for_zero(t2s_1(0, 0)
33  - (t2s_2(0, 0) * t2_1(0, 0) + t2s_2(0, 1) * t2_1(1, 0)
34  + t2s_2(0, 2) * t2_1(2, 0)),
35  "T2s(i,k)^T2(k,j)(0,0)");
36  test_for_zero(t2s_1(0, 1)
37  - (t2s_2(0, 0) * t2_1(0, 1) + t2s_2(0, 1) * t2_1(1, 1)
38  + t2s_2(0, 2) * t2_1(2, 1)),
39  "T2s(i,k)^T2(k,j)(0,1)");
40  test_for_zero(t2s_1(0, 2)
41  - (t2s_2(0, 0) * t2_1(0, 2) + t2s_2(0, 1) * t2_1(1, 2)
42  + t2s_2(0, 2) * t2_1(2, 2)),
43  "T2s(i,k)^T2(k,j)(0,2)");
44  test_for_zero(t2s_1(1, 0)
45  - (t2s_2(1, 0) * t2_1(0, 0) + t2s_2(1, 1) * t2_1(1, 0)
46  + t2s_2(1, 2) * t2_1(2, 0)),
47  "T2s(i,k)^T2(k,j)(1,0)");
48  test_for_zero(t2s_1(1, 1)
49  - (t2s_2(1, 0) * t2_1(0, 1) + t2s_2(1, 1) * t2_1(1, 1)
50  + t2s_2(1, 2) * t2_1(2, 1)),
51  "T2s(i,k)^T2(k,j)(1,1)");
52  test_for_zero(t2s_1(1, 2)
53  - (t2s_2(1, 0) * t2_1(0, 2) + t2s_2(1, 1) * t2_1(1, 2)
54  + t2s_2(1, 2) * t2_1(2, 2)),
55  "T2s(i,k)^T2(k,j)(1,2)");
56  test_for_zero(t2s_1(2, 0)
57  - (t2s_2(2, 0) * t2_1(0, 0) + t2s_2(2, 1) * t2_1(1, 0)
58  + t2s_2(2, 2) * t2_1(2, 0)),
59  "T2s(i,k)^T2(k,j)(2,0)");
60  test_for_zero(t2s_1(2, 1)
61  - (t2s_2(2, 0) * t2_1(0, 1) + t2s_2(2, 1) * t2_1(1, 1)
62  + t2s_2(2, 2) * t2_1(2, 1)),
63  "T2s(i,k)^T2(k,j)(2,1)");
64  test_for_zero(t2s_1(2, 2)
65  - (t2s_2(2, 0) * t2_1(0, 2) + t2s_2(2, 1) * t2_1(1, 2)
66  + t2s_2(2, 2) * t2_1(2, 2)),
67  "T2s(i,k)^T2(k,j)(2,2)");
68  t2s_1(i, j) = t2_1(k, j) ^ t2s_2(i, k);
69  test_for_zero(t2s_1(0, 0)
70  - (t2s_2(0, 0) * t2_1(0, 0) + t2s_2(0, 1) * t2_1(1, 0)
71  + t2s_2(0, 2) * t2_1(2, 0)),
72  "T2(k,j)^T2s(i,k)(0,0)");
73  test_for_zero(t2s_1(0, 1)
74  - (t2s_2(0, 0) * t2_1(0, 1) + t2s_2(0, 1) * t2_1(1, 1)
75  + t2s_2(0, 2) * t2_1(2, 1)),
76  "T2(k,j)^T2s(i,k)(0,1)");
77  test_for_zero(t2s_1(0, 2)
78  - (t2s_2(0, 0) * t2_1(0, 2) + t2s_2(0, 1) * t2_1(1, 2)
79  + t2s_2(0, 2) * t2_1(2, 2)),
80  "T2(k,j)^T2s(i,k)(0,2)");
81  test_for_zero(t2s_1(1, 0)
82  - (t2s_2(1, 0) * t2_1(0, 0) + t2s_2(1, 1) * t2_1(1, 0)
83  + t2s_2(1, 2) * t2_1(2, 0)),
84  "T2(k,j)^T2s(i,k)(1,0)");
85  test_for_zero(t2s_1(1, 1)
86  - (t2s_2(1, 0) * t2_1(0, 1) + t2s_2(1, 1) * t2_1(1, 1)
87  + t2s_2(1, 2) * t2_1(2, 1)),
88  "T2(k,j)^T2s(i,k)(1,1)");
89  test_for_zero(t2s_1(1, 2)
90  - (t2s_2(1, 0) * t2_1(0, 2) + t2s_2(1, 1) * t2_1(1, 2)
91  + t2s_2(1, 2) * t2_1(2, 2)),
92  "T2(k,j)^T2s(i,k)(1,2)");
93  test_for_zero(t2s_1(2, 0)
94  - (t2s_2(2, 0) * t2_1(0, 0) + t2s_2(2, 1) * t2_1(1, 0)
95  + t2s_2(2, 2) * t2_1(2, 0)),
96  "T2(k,j)^T2s(i,k)(2,0)");
97  test_for_zero(t2s_1(2, 1)
98  - (t2s_2(2, 0) * t2_1(0, 1) + t2s_2(2, 1) * t2_1(1, 1)
99  + t2s_2(2, 2) * t2_1(2, 1)),
100  "T2(k,j)^T2s(i,k)(2,1)");
101  test_for_zero(t2s_1(2, 2)
102  - (t2s_2(2, 0) * t2_1(0, 2) + t2s_2(2, 1) * t2_1(1, 2)
103  + t2s_2(2, 2) * t2_1(2, 2)),
104  "T2(k,j)^T2s(i,k)(2,2)");
105 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
FTensor::Tensor2< double, 3, 3 >
FTensor::Number< 0 >
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 >
test_T2s_41
void test_T2s_41(Tensor2< double, 3, 3 > &t2_1, Tensor2_symmetric< double, 3 > &t2s_1, const Tensor2_symmetric< double, 3 > &t2s_2)
Definition: test_T2s_41.cpp:7
std
Definition: enable_if.hpp:5
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20