Skip to content

Commit b09d48a

Browse files
committed
Change where custom SparseDQJac gets tied to AuxData
1 parent 37476fa commit b09d48a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/sksundae/_cy_cvode.pyx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,6 @@ cdef class _cvLSSparseDQJac:
382382
self.groups = groups
383383
self.sparsity = aux.sparsity
384384

385-
# store the instance in AuxData for access in wrappers
386-
aux.jacfn = self
387-
388385
def __call__(
389386
self,
390387
sunrealtype t,
@@ -697,6 +694,8 @@ cdef class CVODE:
697694
if self.aux.jacfn is None and self.aux.sparsity is not None:
698695
spjac = _cvLSSparseDQJac(self.aux) # setup/store jacfn in AuxData
699696
spjac._setup_memory(self.mem) # pass mem to access time step info
697+
698+
self.aux.jacfn = spjac # assign spjac as jacfn for use in wrapper
700699

701700
if self.aux.jacfn:
702701
flag = CVodeSetJacFn(self.mem, _jacfn_wrapper)

src/sksundae/_cy_ida.pyx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,6 @@ cdef class _idaLSSparseDQJac:
388388
self.groups = groups
389389
self.sparsity = aux.sparsity
390390

391-
# store the instance in AuxData for access in wrappers
392-
aux.jacfn = self
393-
394391
def __call__(
395392
self,
396393
sunrealtype t,
@@ -724,6 +721,8 @@ cdef class IDA:
724721
if self.aux.jacfn is None and self.aux.sparsity is not None:
725722
spjac = _idaLSSparseDQJac(self.aux) # setup/store jacfn in AuxData
726723
spjac._setup_memory(self.mem) # pass mem to access time step info
724+
725+
self.aux.jacfn = spjac # assign spjac as jacfn for use in wrapper
727726

728727
if self.aux.jacfn:
729728
flag = IDASetJacFn(self.mem, _jacfn_wrapper)

0 commit comments

Comments
 (0)