Skip to content

Commit 80c26ac

Browse files
author
davidcorteso
committed
Updated last deprecated ndarray calls in Cython pyx files
1 parent 5f0e70d commit 80c26ac

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

fidimag/micro/lib/micro_clib.pyx

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import numpy
2-
cimport numpy as np
3-
np.import_array()
42

53
cdef extern from "micro_clib.h":
64
void compute_exch_field_micro(double *m, double *field,
@@ -22,47 +20,48 @@ cdef extern from "micro_clib.h":
2220
int nx, int ny, int nz, int *ngbs)
2321

2422

25-
def compute_exchange_field_micro(np.ndarray[double, ndim=1, mode="c"] m,
26-
np.ndarray[double, ndim=1, mode="c"] field,
27-
np.ndarray[double, ndim=1, mode="c"] energy,
28-
np.ndarray[double, ndim=1, mode="c"] Ms_inv,
23+
def compute_exchange_field_micro(double [:] m,
24+
double [:] field,
25+
double [:] energy,
26+
double [:] Ms_inv,
2927
A, dx, dy, dz, n,
30-
np.ndarray[int, ndim=2, mode="c"] ngbs):
28+
int [:, :] ngbs):
3129

3230
compute_exch_field_micro(&m[0], &field[0], &energy[0], &Ms_inv[0], A,
3331
dx, dy, dz, n, &ngbs[0, 0])
3432

3533

36-
def compute_dmi_field(np.ndarray[double, ndim=1, mode="c"] m,
37-
np.ndarray[double, ndim=1, mode="c"] field,
38-
np.ndarray[double, ndim=1, mode="c"] energy,
39-
np.ndarray[double, ndim=1, mode="c"] Ms_inv,
40-
np.ndarray[double, ndim=1, mode="c"] D,
41-
np.ndarray[double, ndim=1, mode="c"] dmi_vector,
34+
def compute_dmi_field(double [:] m,
35+
double [:] field,
36+
double [:] energy,
37+
double [:] Ms_inv,
38+
double [:] D,
39+
double [:] dmi_vector,
4240
n_dmi_ngbs,
4341
dx, dy, dz,
44-
n, np.ndarray[int, ndim=2, mode="c"] ngbs
42+
n,
43+
int [:, :] ngbs
4544
):
4645

4746
dmi_field(&m[0], &field[0], &energy[0], &Ms_inv[0],
4847
&D[0], &dmi_vector[0], n_dmi_ngbs,
4948
dx, dy, dz, n, &ngbs[0, 0])
5049

5150

52-
def compute_anisotropy_micro(np.ndarray[double, ndim=1, mode="c"] m,
53-
np.ndarray[double, ndim=1, mode="c"] field,
54-
np.ndarray[double, ndim=1, mode="c"] energy,
55-
np.ndarray[double, ndim=1, mode="c"] Ms_inv,
56-
np.ndarray[double, ndim=1, mode="c"] Ku,
57-
np.ndarray[double, ndim=1, mode="c"] axis,
58-
nx, ny, nz):
51+
def compute_anisotropy_micro(double [:] m,
52+
double [:] field,
53+
double [:] energy,
54+
double [:] Ms_inv,
55+
double [:] Ku,
56+
double [:] axis,
57+
nx, ny, nz):
5958

6059
compute_uniaxial_anis(&m[0], &field[0], &energy[0], &Ms_inv[0],
6160
&Ku[0], &axis[0], nx, ny, nz)
6261

63-
def compute_skyrmion_number(np.ndarray[double, ndim=1, mode="c"] m,
64-
np.ndarray[double, ndim=1, mode="c"] charge,
62+
def compute_skyrmion_number(double [:] m,
63+
double [:] charge,
6564
nx, ny, nz,
66-
np.ndarray[int, ndim=2, mode="c"] ngbs):
65+
int [:, :] ngbs):
6766

6867
return skyrmion_number(&m[0], &charge[0], nx, ny, nz, &ngbs[0, 0])

0 commit comments

Comments
 (0)