Skip to content

Commit

Permalink
chore: no more depend on pre-NumPy-1.7 C-API
Browse files Browse the repository at this point in the history
  • Loading branch information
nauaneed committed Sep 26, 2024
1 parent fc8046d commit e33482e
Show file tree
Hide file tree
Showing 39 changed files with 93 additions and 10 deletions.
2 changes: 2 additions & 0 deletions pysph/base/box_sort_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.map cimport map

from .nnps_base cimport *
Expand Down
5 changes: 4 additions & 1 deletion pysph/base/box_sort_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# cython: language_level=3, language=c++, embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# Library imports.
import numpy as np
cimport numpy as np
Expand Down
5 changes: 4 additions & 1 deletion pysph/base/cell_indexing_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# cython: language_level=3, language=c++, embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.map cimport map
from libcpp.pair cimport pair

Expand Down
1 change: 1 addition & 0 deletions pysph/base/cell_indexing_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/gpu_nnps_base.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# numpy
cimport numpy as np
cimport cython
Expand Down
1 change: 1 addition & 0 deletions pysph/base/gpu_nnps_base.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# Library imports.
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions pysph/base/linalg3.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

"""Routines for eigen decomposition of symmetric 3x3 matrices.
"""
Expand Down
1 change: 1 addition & 0 deletions pysph/base/linalg3.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#cython: boundscheck=False
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

#
# Eigen decomposition code for symmetric 3x3 matrices, some code taken
Expand Down
1 change: 1 addition & 0 deletions pysph/base/linked_list_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.map cimport map
from libcpp.vector cimport vector
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/linked_list_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# Library imports.
import numpy as np
cimport numpy as np
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/nnps_base.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# numpy
cimport numpy as np
cimport cython
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/nnps_base.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# Library imports.
import numpy as np
cimport numpy as np
Expand Down
4 changes: 4 additions & 0 deletions pysph/base/no_omp_threads.pxd
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

cpdef int get_number_of_threads()
cpdef set_number_of_threads(int)
4 changes: 4 additions & 0 deletions pysph/base/no_omp_threads.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

cpdef int get_number_of_threads():
return 1

Expand Down
2 changes: 2 additions & 0 deletions pysph/base/octree.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from .nnps_base cimport *
from libcpp.vector cimport vector
cimport cython
Expand Down
4 changes: 3 additions & 1 deletion pysph/base/octree.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from .nnps_base cimport *

Expand Down
2 changes: 2 additions & 0 deletions pysph/base/octree_gpu_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from pysph.base.gpu_nnps_base cimport *


Expand Down
5 changes: 4 additions & 1 deletion pysph/base/octree_gpu_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

import numpy as np
cimport numpy as np
from pysph.base.tree.point_tree import PointTree
Expand Down
1 change: 1 addition & 0 deletions pysph/base/octree_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from .nnps_base cimport *
from .octree cimport Octree, CompressedOctree, cOctreeNode
Expand Down
4 changes: 3 additions & 1 deletion pysph/base/octree_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from .nnps_base cimport *
from .octree cimport Octree, CompressedOctree, cOctreeNode
Expand Down
4 changes: 4 additions & 0 deletions pysph/base/omp_threads.pxd
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

cpdef int get_number_of_threads()
cpdef set_number_of_threads(int)
4 changes: 4 additions & 0 deletions pysph/base/omp_threads.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from cython.parallel import parallel, prange
cimport openmp

Expand Down
5 changes: 4 additions & 1 deletion pysph/base/particle_array.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# cython: language_level=3, language=c++, embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

cimport numpy as np

from cyarray.carray cimport BaseArray, UIntArray, IntArray, LongArray
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/particle_array.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

"""
A `ParticleArray` represents a collection of particles.
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/point.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

cimport numpy

cdef extern from "math.h":
Expand Down
4 changes: 3 additions & 1 deletion pysph/base/point.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

"""A handy set of classes/functions for 3D points.
"""
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/spatial_hash_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.vector cimport vector

from .nnps_base cimport *
Expand Down
1 change: 1 addition & 0 deletions pysph/base/spatial_hash_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/stratified_hash_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.vector cimport vector

from .nnps_base cimport *
Expand Down
4 changes: 3 additions & 1 deletion pysph/base/stratified_hash_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/stratified_sfc_gpu_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.vector cimport vector
from libcpp.map cimport map
from libcpp.pair cimport pair
Expand Down
1 change: 1 addition & 0 deletions pysph/base/stratified_sfc_gpu_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/stratified_sfc_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.vector cimport vector
from libcpp.map cimport map
from libcpp.pair cimport pair
Expand Down
4 changes: 3 additions & 1 deletion pysph/base/stratified_sfc_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/z_order_gpu_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.map cimport map
from libcpp.pair cimport pair

Expand Down
4 changes: 3 additions & 1 deletion pysph/base/z_order_gpu_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#cython: embedsignature=True
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
2 changes: 2 additions & 0 deletions pysph/base/z_order_nnps.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cython: language_level=3, embedsignature=True
# distutils: language=c++
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from libcpp.map cimport map
from libcpp.pair cimport pair

Expand Down
1 change: 1 addition & 0 deletions pysph/base/z_order_nnps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#cython: embedsignature=True
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

# malloc and friends
from libc.stdlib cimport malloc, free
Expand Down
4 changes: 4 additions & 0 deletions pysph/tools/mesh_tools.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# cython: language_level=3, embedsignature=True
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

from pysph.base.particle_array import ParticleArray

from pysph.base import nnps
from pysph.tools.geometry import remove_repeated_points
import numpy as np
Expand Down

0 comments on commit e33482e

Please sign in to comment.