Skip to content

Commit 895f985

Browse files
committed
Expose even more terms to Python from C Struct
1 parent 8d09ae0 commit 895f985

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

fidimag/common/dipolar/dipolar.pyx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ cdef extern from "dipolar.h":
1818
double *tensor_yy
1919
double *tensor_yz
2020
double *tensor_zz
21+
double *hx
22+
double *hy
23+
double *hz
2124
complex *Nxx
2225
complex *Nxy
2326
complex *Nxz
@@ -47,12 +50,12 @@ cdef class FFTDemag(object):
4750
cdef fft_demag_plan *_c_plan
4851
cdef int total_length
4952
cdef np.float64_t[:] tensor_xx_p, tensor_xy_p, tensor_xz_p, tensor_yy_p, \
50-
tensor_yz_p, tensor_zz_p
53+
tensor_yz_p, tensor_zz_p, hx_p, hy_p, hz_p
5154
cdef np.complex128_t[:] Nxx_p, Nxy_p, Nxz_p, Nyy_p, Nyz_p, Nzz_p, Hx_p, \
5255
Hy_p, Hz_p, Mx_p, My_p, Mz_p
5356
cdef public np.ndarray tensor_xx, tensor_xy, tensor_xz, tensor_yy, \
5457
tensor_yz, tensor_zz, Nxx, Nxy, Nxz, Nyy, Nyz, Nzz, \
55-
Mx, My, Mz, Hx, Hy, Hz
58+
Mx, My, Mz, Hx, Hy, Hz, hx, hy, hz
5659
#tensor_type could be 'dipolar', 'demag' or '2d_pbc'
5760
def __cinit__(self, dx, dy, dz, nx, ny, nz, tensor_type='dipolar'):
5861
self._c_plan = create_plan()
@@ -103,6 +106,13 @@ cdef class FFTDemag(object):
103106
self.Hz_p = <np.complex128_t[:self.total_length]> self._c_plan.Hz
104107
self.Hz = np.asarray(self.Hz_p)
105108

109+
self.hx_p = <np.float64_t[:self.total_length]> self._c_plan.hx
110+
self.hx = np.asarray(self.hx_p)
111+
self.hy_p = <np.float64_t[:self.total_length]> self._c_plan.hy
112+
self.hy = np.asarray(self.hy_p)
113+
self.hz_p = <np.float64_t[:self.total_length]> self._c_plan.hz
114+
self.hz = np.asarray(self.hz_p)
115+
106116

107117
self.tensor_xy_p = <np.float64_t[:self.total_length]> self._c_plan.tensor_xy
108118
self.tensor_xy = np.asarray(self.tensor_xy_p)

0 commit comments

Comments
 (0)