first commit
This commit is contained in:
commit
4a0ee77276
3 changed files with 148 additions and 0 deletions
24
plot.py
Normal file
24
plot.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import numpy as np
|
||||
import ctypes, subprocess
|
||||
|
||||
recompile = True
|
||||
|
||||
if recompile:
|
||||
p = subprocess.Popen('g++ -shared -o libmain.so -fPIC main.cpp -lgsl'.split())
|
||||
p.wait()
|
||||
if p.returncode != 0: raise RuntimeError(p.returncode)
|
||||
|
||||
libmain = ctypes.CDLL('./libmain.so')
|
||||
def integrate(y0, t_max):
|
||||
y0 = (ctypes.c_double*6)(*y0)
|
||||
y = (ctypes.c_double*6)()
|
||||
status = libmain.integrate(y0, ctypes.c_double(t_max), y)
|
||||
return np.array(y), status
|
||||
|
||||
gsl_success = libmain.gsl_success()
|
||||
|
||||
#t_array = linspace(plot_tmin, plot_tmax, plot_points)
|
||||
#r_array = empty_like(t_array)
|
||||
|
||||
res = integrate([10,0,0,0,200,0], 0.1)
|
||||
print(res, gsl_success)
|
||||
Loading…
Add table
Add a link
Reference in a new issue