Skip to content

Commit 55d391e

Browse files
authored
Initial bindings for jigsaw-0.9.12.xx
- Workaround for (alleged) ctypes bug in python >= 3.7: any (potentially) multi-dim arrays in jigsaw_msh_t are explicitly replaced with order="F" copies before being passed to libjigsaw. In some cases, this may modify the column-order of a users input arrays...
1 parent 92d4d04 commit 55d391e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

jigsawpy/libsaw.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,7 @@ def put_jig_t(jigt, jigl):
303303
def put_ptr_t(data, kind):
304304

305305
#--------------------------------- helper to assign ptrs
306-
return np.asfortranarray(
307-
data).ctypes.data_as(ct.POINTER(kind))
306+
return data.ctypes.data_as(ct.POINTER(kind))
308307

309308

310309
def put_msh_t(msht, mshl):
@@ -360,6 +359,9 @@ def put_msh_t(msht, mshl):
360359
if (msht.power is not None and
361360
msht.power.size != +0):
362361
#--------------------------------- assign ptrs for POWER
362+
msht.power = \
363+
np.asfortranarray(msht.power)
364+
363365
mshl.power.size = msht.power.size
364366
mshl.power.data = \
365367
put_ptr_t(msht.power, real_t)
@@ -444,13 +446,19 @@ def put_msh_t(msht, mshl):
444446
if (msht.value is not None and
445447
msht.value.size != +0):
446448
#--------------------------------- assign ptrs for VALUE
449+
msht.value = \
450+
np.asfortranarray(msht.value)
451+
447452
mshl.value.size = msht.value.size
448453
mshl.value.data = \
449454
put_ptr_t(msht.value, real_t)
450455

451456
if (msht.slope is not None and
452457
msht.slope.size != +0):
453458
#--------------------------------- assign ptrs for SLOPE
459+
msht.slope = \
460+
np.asfortranarray(msht.slope)
461+
454462
mshl.slope.size = msht.slope.size
455463
mshl.slope.data = \
456464
put_ptr_t(msht.slope, real_t)

0 commit comments

Comments
 (0)