-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtensor.h
100 lines (74 loc) · 1.26 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
92
93
94
95
96
97
98
99
100
/*
* 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 LiteCurrentTensorComponent {
public:
char i11, i12, i13,
i21, i22, i23,
i31, i32, i33,
i41, i42, i43;
};
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)
{
i11 = b.i11;
i12 = b.i12;
i13 = b.i13;
i21 = b.i21;
i22 = b.i22;
i23 = b.i23;
i31 = b.i31;
i32 = b.i32;
i33 = b.i33;
i41 = b.i41;
i42 = b.i42;
i43 = b.i43;
t[0] = b.t[0];
t[1] = b.t[1];
t[2] = b.t[2];
t[3] = b.t[3];
return *this;
}
};
class LiteCurrentTensor {
public:
LiteCurrentTensorComponent Jx,Jy,Jz;
};
class CurrentTensor {
public:
CurrentTensorComponent Jx,Jy,Jz;
__host__ __device__ CurrentTensor & operator=(CurrentTensor b)
{
Jx = b.Jx;
Jy = b.Jy;
Jz = b.Jz;
return *this;
}
};
class DoubleCurrentTensor {
public:
CurrentTensor t1,t2;
__host__ __device__ DoubleCurrentTensor & operator=(DoubleCurrentTensor b)
{
t1 = b.t1;
t2 = b.t2;
return *this;
}
};
#endif /* TENSOR_H_ */