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