recover pxd

fixes-turtlebasket
Mattia Montanari 2020-05-21 16:24:36 +01:00
parent f01cf17ea4
commit 1c447f6f6e
5 changed files with 21 additions and 32 deletions

View File

@ -1,14 +0,0 @@
from distutils.core import setup, Extension
from Cython.Build import cythonize
exts = Extension(
"openGJKpy",
sources = ["openGJK_cython.pyx", "openGJK.c"],
# extra_compile_args = ['-fopenmp'],
# extra_link_args = ['-fopenmp']
)
setup(ext_modules = cythonize( [exts] ))

1
openGJK_cython.c Normal file
View File

@ -0,0 +1 @@
#error Do not use this file, it is the result of a failed Cython compilation.

View File

@ -1,25 +1,13 @@
# distutils: sources = src/openGJK.c
# distutils: include_dirs = include/openGJK
# cython: language_level=3, boundscheck=False # cython: language_level=3, boundscheck=False
cimport openGJK_cython
import numpy as np import numpy as np
from libc.stdlib cimport free, malloc from libc.stdlib cimport free, malloc
from cpython.mem cimport PyMem_Malloc, PyMem_Free from cpython.mem cimport PyMem_Malloc, PyMem_Free
# Declare C function and data types
cdef extern from "openGJK.h":
struct bd:
int numpoints
double s[3]
double ** coord
struct simplex:
int nvrtx
double vrtx[4][3]
int wids[4]
double lambdas[4]
double gjk(bd bd1, bd bd2, simplex *s)
# Create Python function # Create Python function
def pygjk(bod1, bod2): def pygjk(bod1, bod2):

View File

@ -1,5 +1,5 @@
import numpy as np import numpy as np
import openGJKpy as opengjk import openGJK_cython as opengjk
a = np.array([[1.,1.,1.],[1.,1.,1.]]) a = np.array([[1.,1.,1.],[1.,1.,1.]])
b = np.array([[11.,1.,1.],[1.,1.,1.]]) b = np.array([[11.,1.,1.],[1.,1.,1.]])
d = opengjk.pygjk(a,b) d = opengjk.pygjk(a,b)

14
setup.py Normal file
View File

@ -0,0 +1,14 @@
from setuptools import Extension, setup
from Cython.Build import cythonize
exts = Extension(
"openGJK_cython",
sources = ["openGJK_cython.pyx"],
extra_compile_args=['-Iinclude/','-fopenmp'],
extra_link_args=['-fopenmp'],
)
setup(
name='openGJK-cython-version',
ext_modules = cythonize( [exts] )
)