Skip to content

Commit

Permalink
MAINT: removing dependency on NumPy C API
Browse files Browse the repository at this point in the history
  • Loading branch information
saullocastro committed Nov 17, 2023
1 parent 4f540f4 commit 4ab4ebd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
17 changes: 6 additions & 11 deletions compmech/stiffener/models/bladestiff1d_clt_donnell_bardell.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
#cython: nonecheck=False
#cython: profile=False
#cython: infer_types=False
from __future__ import division

from scipy.sparse import coo_matrix
import numpy as np
cimport numpy as np


cdef extern from 'bardell.h':
Expand All @@ -31,9 +28,7 @@ cdef extern from 'bardell_functions.h':
double calc_fxi(int i, double xi, double xi1t, double xi1r,
double xi2t, double xi2r) nogil

ctypedef np.double_t cDOUBLE
DOUBLE = np.float64
ctypedef np.int64_t cINT
INT = np.int64

cdef int num = 3
Expand All @@ -54,8 +49,8 @@ def fk0f(double ys, double a, double b, double bf, double df, double E1, double
cdef double fAwxixifBwxixi
cdef double gAu, gBu, gAw, gBw, gAweta, gBweta

cdef np.ndarray[cINT, ndim=1] k0fr, k0fc
cdef np.ndarray[cDOUBLE, ndim=1] k0fv
cdef long [:] k0fr, k0fc
cdef double [:] k0fv

eta = 2*ys/b - 1.

Expand Down Expand Up @@ -127,8 +122,8 @@ def fkG0f(double ys, double Fx, double a, double b, double bf, int m, int n,
cdef int i, k, j, l, c, row, col
cdef double eta

cdef np.ndarray[cINT, ndim=1] kG0fr, kG0fc
cdef np.ndarray[cDOUBLE, ndim=1] kG0fv
cdef long [:] kG0fr, kG0fc
cdef double [:] kG0fv

cdef double fAwxifBwxi, gAw, gBw

Expand Down Expand Up @@ -187,8 +182,8 @@ def fkMf(double ys, double mu, double h, double hb, double hf, double a,
cdef int i, k, j, l, c, row, col
cdef double eta

cdef np.ndarray[cINT, ndim=1] kMfr, kMfc
cdef np.ndarray[cDOUBLE, ndim=1] kMfv
cdef long [:] kMfr, kMfc
cdef double [:] kMfv

eta = 2*ys/b - 1.

Expand Down
17 changes: 6 additions & 11 deletions compmech/stiffener/models/bladestiff2d_clt_donnell_bardell.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
#cython: nonecheck=False
#cython: profile=False
#cython: infer_types=False
from __future__ import division

from scipy.sparse import coo_matrix
import numpy as np
cimport numpy as np


cdef extern from 'bardell.h':
Expand All @@ -21,9 +18,7 @@ cdef extern from 'bardell_functions.h':
double calc_fxi(int i, double xi, double xi1t, double xi1r,
double xi2t, double xi2r) nogil

ctypedef np.double_t cDOUBLE
DOUBLE = np.float64
ctypedef np.int64_t cINT
INT = np.int64

cdef int num = 3
Expand All @@ -41,8 +36,8 @@ def fkCss(double kt, double kr, double ys, double a, double b, int m, int n,
cdef int i, k, j, l, c, row, col
cdef double eta

cdef np.ndarray[cINT, ndim=1] kCssr, kCssc
cdef np.ndarray[cDOUBLE, ndim=1] kCssv
cdef long [:] kCssr, kCssc
cdef double [:] kCssv

cdef double fAufBu, fAvfBv, fAwfBw
cdef double gAu, gBu, gAv, gBv, gAw, gBw, gAweta, gBweta
Expand Down Expand Up @@ -119,8 +114,8 @@ def fkCsf(double kt, double kr, double ys, double a, double b, double bf,
cdef int i, j, k1, l1, c, row, col
cdef double eta

cdef np.ndarray[cINT, ndim=1] kCsfr, kCsfc
cdef np.ndarray[cDOUBLE, ndim=1] kCsfv
cdef long [:] kCsfr, kCsfc
cdef double [:] kCsfv

cdef double fAurBu, fAvrBw, fAwrBv, fAwrBw
cdef double gAu, gAv, gAw, gAweta, sBu, sBv, sBw, sBweta
Expand Down Expand Up @@ -194,8 +189,8 @@ def fkCff(double kt, double kr, double a, double bf, int m1, int n1,
int size, int row0, int col0):
cdef int i1, k1, j1, l1, c, row, col

cdef np.ndarray[cINT, ndim=1] kCffr, kCffc
cdef np.ndarray[cDOUBLE, ndim=1] kCffv
cdef long [:] kCffr, kCffc
cdef double [:] kCffv

cdef double rAurBu, rAvrBv, rAwrBw
cdef double sAu, sBu, sAv, sBv, sAw, sBw, sAweta, sBweta
Expand Down
19 changes: 7 additions & 12 deletions compmech/stiffener/models/tstiff2d_clt_donnell_bardell.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
#cython: nonecheck=False
#cython: profile=False
#cython: infer_types=False
from __future__ import division

from scipy.sparse import coo_matrix
import numpy as np
cimport numpy as np


cdef extern from 'bardell.h':
Expand Down Expand Up @@ -41,9 +38,7 @@ cdef extern from 'bardell_c0c1.h':
double x1t, double x1r, double x2t, double x2r,
double y1t, double y1r, double y2t, double y2r) nogil

ctypedef np.double_t cDOUBLE
DOUBLE = np.float64
ctypedef np.int64_t cINT
INT = np.int64

cdef int num = 3
Expand All @@ -63,8 +58,8 @@ def fkCppy1y2(double y1, double y2,
cdef int i, k, j, l, c, row, col
cdef double eta1, eta2

cdef np.ndarray[cINT, ndim=1] kCppr, kCppc
cdef np.ndarray[cDOUBLE, ndim=1] kCppv
cdef long [:] kCppr, kCppc
cdef double [:] kCppv

cdef double fAufBu, fAufBwxi, fAvfBv, fAvfBw, fAwfBv, fAwfBw, fAwxifBu, fAwxifBwxi
cdef double gAugBu, gAugBw, gAvgBv, gAvgBweta, gAwgBu, gAwgBw, gAwetagBv, gAwetagBweta
Expand Down Expand Up @@ -163,8 +158,8 @@ def fkCpby1y2(double y1, double y2,
cdef int i, j, k1, l1, c, row, col
cdef double eta1, eta2, c0, c1

cdef np.ndarray[cINT, ndim=1] kCpbr, kCpbc
cdef np.ndarray[cDOUBLE, ndim=1] kCpbv
cdef long [:] kCpbr, kCpbc
cdef double [:] kCpbv

cdef double fAupBu, fAvpBv, fAwpBw, fAwxipBu, fAwpBv
cdef double gAuqBu, gAvqBv, gAwqBw, gAwetaqBv, gAwqBu
Expand Down Expand Up @@ -243,11 +238,11 @@ def fkCbbpby1y2(double y1, double y2,
cdef int i1, k1, j1, l1, c, row, col
cdef double eta1, eta2, c1

cdef np.ndarray[cINT, ndim=1] kCbbpbr, kCbbpbc
cdef np.ndarray[cDOUBLE, ndim=1] kCbbpbv
cdef long [:] kCbbpbr, kCbbpbc
cdef double [:] kCbbpbv

cdef double pAupBu, pAvpBv, pAwpBw
cdef double qAuqBu, qAvqBv, qAwqBw, qAwetaqBweta
cdef double qAuqBu, qAvqBv, qAwqBw

eta1 = 2*y1/b - 1.
eta2 = 2*y2/b - 1.
Expand Down

0 comments on commit 4ab4ebd

Please sign in to comment.