forked from snytav/atom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tensor.h
91 lines (66 loc) · 1.17 KB
/
tensor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* tensor.h
*
* Created on: Jul 10, 2018
* Author: snytav
*/
#ifndef TENSOR_H_
#define TENSOR_H_
#ifndef __CUDACC__
#define __host__
#define __device__
#define __forceinline__
#endif
class CurrentTensorComponent {
public:
char i11, i12, i13,
i21, i22, i23,
i31, i32, i33,
i41, i42, i43;
double t[4];
__host__ __device__ CurrentTensorComponent & operator=(CurrentTensorComponent b)
{
CurrentTensorComponent a;
a.i11 = b.i11;
a.i12 = b.i12;
a.i13 = b.i13;
a.i21 = b.i21;
a.i22 = b.i22;
a.i23 = b.i23;
a.i31 = b.i31;
a.i32 = b.i32;
a.i33 = b.i33;
a.i41 = b.i41;
a.i42 = b.i42;
a.i43 = b.i43;
a.t[0] = b.t[0];
a.t[1] = b.t[1];
a.t[2] = b.t[2];
a.t[3] = b.t[3];
return a;
}
};
class CurrentTensor {
public:
CurrentTensorComponent Jx,Jy,Jz;
__host__ __device__ CurrentTensor & operator=(CurrentTensor b)
{
CurrentTensor a;
a.Jx = b.Jx;
a.Jy = b.Jy;
a.Jz = b.Jz;
return a;
}
};
class DoubleCurrentTensor {
public:
CurrentTensor t1,t2;
__host__ __device__ DoubleCurrentTensor & operator=(DoubleCurrentTensor b)
{
DoubleCurrentTensor a;
a.t1 = b.t1;
a.t2 = b.t2;
return a;
}
};
#endif /* TENSOR_H_ */