-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpyCinterface.py
89 lines (64 loc) · 1.77 KB
/
pyCinterface.py
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
# -*- coding:utf-8 -*-
from ctypes import CDLL, c_double
paraboloids = CDLL("./paraboloids.so")
# Control points
xe1A = paraboloids.xe1A
xe2A = paraboloids.xe2A
xe1B = paraboloids.xe1B
xe2B = paraboloids.xe2B
xe1C = paraboloids.xe1C
xe2C = paraboloids.xe2C
xe1A.restype = c_double
xe2A.restype = c_double
xe1B.restype = c_double
xe2B.restype = c_double
xe1C.restype = c_double
xe2C.restype = c_double
# Free energies
GA = paraboloids.GA
GA.argtypes = [c_double, c_double]
GA.restype = c_double
GB = paraboloids.GB
GB.argtypes = [c_double, c_double]
GB.restype = c_double
GC = paraboloids.GC
GC.argtypes = [c_double, c_double]
GC.restype = c_double
# First derivatives
dGAdx1 = paraboloids.dGAdx1
dGAdx1.argtypes = [c_double, c_double]
dGAdx1.restype = c_double
dGAdx2 = paraboloids.dGAdx2
dGAdx2.argtypes = [c_double, c_double]
dGAdx2.restype = c_double
dGBdx1 = paraboloids.dGBdx1
dGBdx1.argtypes = [c_double, c_double]
dGBdx1.restype = c_double
dGBdx2 = paraboloids.dGBdx2
dGBdx2.argtypes = [c_double, c_double]
dGBdx2.restype = c_double
dGCdx1 = paraboloids.dGCdx1
dGCdx1.argtypes = [c_double, c_double]
dGCdx1.restype = c_double
dGCdx2 = paraboloids.dGCdx2
dGCdx2.argtypes = [c_double, c_double]
dGCdx2.restype = c_double
# Second derivatives
d2GAdx11 = paraboloids.d2GAdx11
d2GAdx11.restype = c_double
d2GAdx12 = paraboloids.d2GAdx12
d2GAdx12.restype = c_double
d2GAdx22 = paraboloids.d2GAdx22
d2GAdx22.restype = c_double
d2GBdx11 = paraboloids.d2GBdx11
d2GBdx11.restype = c_double
d2GBdx12 = paraboloids.d2GBdx12
d2GBdx12.restype = c_double
d2GBdx22 = paraboloids.d2GBdx22
d2GBdx22.restype = c_double
d2GCdx11 = paraboloids.d2GCdx11
d2GCdx11.restype = c_double
d2GCdx12 = paraboloids.d2GCdx12
d2GCdx12.restype = c_double
d2GCdx22 = paraboloids.d2GCdx22
d2GCdx22.restype = c_double