v0.14.0
Tensor1_constructor.hpp
Go to the documentation of this file.
1 /* A helper class that allows simple initialization of the Tensor1,
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 Tensor1_constructor;
9 
10  template <class T> class Tensor1_constructor<T, 1>
11  {
12  public:
13  Tensor1_constructor(T data[], T d0) { data[0] = d0; }
14  };
15 
16  template <class T> class Tensor1_constructor<T, 2>
17  {
18  public:
19  Tensor1_constructor(T data[], T d0, T d1)
20  {
21  data[0] = d0;
22  data[1] = d1;
23  }
24  };
25 
26  template <class T> class Tensor1_constructor<T, 3>
27  {
28  public:
29  Tensor1_constructor(T data[], T d0, T d1, T d2)
30  {
31  data[0] = d0;
32  data[1] = d1;
33  data[2] = d2;
34  }
35  };
36 
37  template <class T> class Tensor1_constructor<T, 4>
38  {
39  public:
40  Tensor1_constructor(T data[], T d0, T d1, T d2, T d3)
41  {
42  data[0] = d0;
43  data[1] = d1;
44  data[2] = d2;
45  data[3] = d3;
46  }
47  };
48  template <class T> class Tensor1_constructor<T, 6>
49  {
50  public:
51  Tensor1_constructor(T data[], T d0, T d1, T d2, T d3, T d4, T d5)
52  {
53  data[0] = d0;
54  data[1] = d1;
55  data[2] = d2;
56  data[3] = d3;
57  data[4] = d4;
58  data[5] = d5;
59  }
60  };
61 
62  template <class T> class Tensor1_constructor<T, 8> {
63  public:
64  Tensor1_constructor(T data[], T d0, T d1, T d2, T d3, T d4, T d5, T d6,
65  T d7) {
66  data[0] = d0;
67  data[1] = d1;
68  data[2] = d2;
69  data[3] = d3;
70  data[4] = d4;
71  data[5] = d5;
72  data[6] = d6;
73  data[7] = d7;
74  }
75  };
76 
77  template <class T> class Tensor1_constructor<T, 9> {
78  public:
79  Tensor1_constructor(T data[], T d0, T d1, T d2, T d3, T d4, T d5, T d6,
80  T d7, T d8) {
81  data[0] = d0;
82  data[1] = d1;
83  data[2] = d2;
84  data[3] = d3;
85  data[4] = d4;
86  data[5] = d5;
87  data[6] = d6;
88  data[7] = d7;
89  data[8] = d8;
90  }
91  };
92 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
d3
static constexpr std::array< double, 3 > d3
Definition: prism_elements_from_surface.cpp:20
FTensor::Tensor1_constructor< T, 1 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0)
Definition: Tensor1_constructor.hpp:13
FTensor::Tensor1_constructor< T, 6 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0, T d1, T d2, T d3, T d4, T d5)
Definition: Tensor1_constructor.hpp:51
FTensor::Tensor1_constructor
Definition: Tensor1_constructor.hpp:8
FTensor::Tensor1_constructor< T, 3 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0, T d1, T d2)
Definition: Tensor1_constructor.hpp:29
FTensor::Tensor1_constructor< T, 4 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0, T d1, T d2, T d3)
Definition: Tensor1_constructor.hpp:40
FTensor::Tensor1_constructor< T, 2 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0, T d1)
Definition: Tensor1_constructor.hpp:19
FTensor::Tensor1_constructor< T, 9 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0, T d1, T d2, T d3, T d4, T d5, T d6, T d7, T d8)
Definition: Tensor1_constructor.hpp:79
FTensor::Tensor1_constructor< T, 8 >::Tensor1_constructor
Tensor1_constructor(T data[], T d0, T d1, T d2, T d3, T d4, T d5, T d6, T d7)
Definition: Tensor1_constructor.hpp:64
d4
static constexpr std::array< double, 3 > d4
Definition: prism_elements_from_surface.cpp:21