From 4ab4ebdb77fdf0344158c2593a9e88de411ff532 Mon Sep 17 00:00:00 2001 From: "Saullo G. P. Castro" Date: Fri, 17 Nov 2023 17:00:07 +0100 Subject: [PATCH] MAINT: removing dependency on NumPy C API --- .../bladestiff1d_clt_donnell_bardell.pyx | 17 ++++++----------- .../bladestiff2d_clt_donnell_bardell.pyx | 17 ++++++----------- .../models/tstiff2d_clt_donnell_bardell.pyx | 19 +++++++------------ 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/compmech/stiffener/models/bladestiff1d_clt_donnell_bardell.pyx b/compmech/stiffener/models/bladestiff1d_clt_donnell_bardell.pyx index e6eda9a2..55266ffd 100644 --- a/compmech/stiffener/models/bladestiff1d_clt_donnell_bardell.pyx +++ b/compmech/stiffener/models/bladestiff1d_clt_donnell_bardell.pyx @@ -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': @@ -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 @@ -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. @@ -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 @@ -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. diff --git a/compmech/stiffener/models/bladestiff2d_clt_donnell_bardell.pyx b/compmech/stiffener/models/bladestiff2d_clt_donnell_bardell.pyx index 5438b0e3..14a54aad 100644 --- a/compmech/stiffener/models/bladestiff2d_clt_donnell_bardell.pyx +++ b/compmech/stiffener/models/bladestiff2d_clt_donnell_bardell.pyx @@ -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': @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/compmech/stiffener/models/tstiff2d_clt_donnell_bardell.pyx b/compmech/stiffener/models/tstiff2d_clt_donnell_bardell.pyx index e2dc9d3b..3c9d87d9 100644 --- a/compmech/stiffener/models/tstiff2d_clt_donnell_bardell.pyx +++ b/compmech/stiffener/models/tstiff2d_clt_donnell_bardell.pyx @@ -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': @@ -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 @@ -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 @@ -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 @@ -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.