Skip to content

Commit f592204

Browse files
committed
compiler: Suitably destroy the submats inside the jacobianstruct
1 parent b731340 commit f592204

2 files changed

Lines changed: 1 addition & 16 deletions

File tree

devito/petsc/iet/type_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _extend_build(self, base_dict):
119119

120120
base_dict['jacctx'] = JacobianStruct(
121121
name=sreg.make_name(prefix=objs['ljacctx'].name),
122-
fields=objs['ljacctx'].fields, no_of_submats=2
122+
fields=objs['ljacctx'].fields, no_of_submats=len(targets)*len(targets)
123123
)
124124

125125
for sm in submatrices:

devito/petsc/types/object.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -279,27 +279,12 @@ def __init__(self, name='jctx', pname='JacobianCtx', fields=None,
279279

280280
@property
281281
def _C_free(self):
282-
# from IPython import embed; embed()
283282
submats = [i for i in self.fields if isinstance(i, PointerMat)]
284283
submats = submats[0]
285-
# from IPython import embed; embed()
286284
from devito.symbolics import FieldFromComposite
287285
destroy_call = [petsc_call('MatDestroy', [Byref(FieldFromComposite(submats.indexed[i], self.function))]) for i in range(self._no_of_submats)]
288286
destroy_call.append(petsc_call('PetscFree', [Byref(FieldFromComposite(submats.base, self.function))]))
289287
return destroy_call
290-
# return petsc_call('PetscFree', [Byref(self.function)])
291-
292-
293-
# @property
294-
# def _C_free(self):
295-
296-
# submats = [i for i in self.fields if isinstance(i, PointerMat)]
297-
# destroy_calls = [
298-
# petsc_call('MatDestroy', [Byref(self.indexify().subs({self.dim: i}))])
299-
# for i in range(self._no_of_submats)
300-
# ]
301-
# destroy_calls.append(petsc_call('PetscFree', [self.function]))
302-
# return destroy_calls
303288

304289

305290
class SubMatrixStruct(PETScStruct):

0 commit comments

Comments
 (0)