v0.14.0
Tensor2_symmetric_constructor.hpp
Go to the documentation of this file.
1 /* A helper class that allows simple initialization of the Tensor2_symmetric,
2  but only if it has the correct number of elements. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  template <class T, int Tensor_Dim> class Tensor2_symmetric_constructor;
9 
10  template <class T> class Tensor2_symmetric_constructor<T, 1>
11  {
12  public:
13  Tensor2_symmetric_constructor(T data[1], T d00) { data[0] = d00; }
14  };
15 
16  template <class T> class Tensor2_symmetric_constructor<T, 2>
17  {
18  public:
19  Tensor2_symmetric_constructor(T data[(2 * 3) / 2], T d00, T d01, T d11)
20  {
21  data[0] = d00;
22  data[1] = d01;
23  data[2] = d11;
24  }
25  };
26 
27  template <class T> class Tensor2_symmetric_constructor<T, 3>
28  {
29  public:
30  Tensor2_symmetric_constructor(T data[(3 * 4) / 2], T d00, T d01, T d02,
31  T d11, T d12, T d22)
32  {
33  data[0] = d00;
34  data[1] = d01;
35  data[2] = d02;
36  data[3] = d11;
37  data[4] = d12;
38  data[5] = d22;
39  }
40  };
41 
42  template <class T> class Tensor2_symmetric_constructor<T, 4>
43  {
44  public:
45  Tensor2_symmetric_constructor(T data[(4 * 5) / 2], T d00, T d01, T d02,
46  T d03, T d11, T d12, T d13, T d22, T d23,
47  T d33)
48  {
49  data[0] = d00;
50  data[1] = d01;
51  data[2] = d02;
52  data[3] = d03;
53  data[4] = d11;
54  data[5] = d12;
55  data[6] = d13;
56  data[7] = d22;
57  data[8] = d23;
58  data[9] = d33;
59  }
60  };
61 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor2_symmetric_constructor
Definition: Tensor2_symmetric_constructor.hpp:8
FTensor::Tensor2_symmetric_constructor< T, 1 >::Tensor2_symmetric_constructor
Tensor2_symmetric_constructor(T data[1], T d00)
Definition: Tensor2_symmetric_constructor.hpp:13
FTensor::Tensor2_symmetric_constructor< T, 3 >::Tensor2_symmetric_constructor
Tensor2_symmetric_constructor(T data[(3 *4)/2], T d00, T d01, T d02, T d11, T d12, T d22)
Definition: Tensor2_symmetric_constructor.hpp:30
FTensor::Tensor2_symmetric_constructor< T, 4 >::Tensor2_symmetric_constructor
Tensor2_symmetric_constructor(T data[(4 *5)/2], T d00, T d01, T d02, T d03, T d11, T d12, T d13, T d22, T d23, T d33)
Definition: Tensor2_symmetric_constructor.hpp:45
FTensor::Tensor2_symmetric_constructor< T, 2 >::Tensor2_symmetric_constructor
Tensor2_symmetric_constructor(T data[(2 *3)/2], T d00, T d01, T d11)
Definition: Tensor2_symmetric_constructor.hpp:19