Skip to content

Commit 24270be

Browse files
committed
broken petsc tests
1 parent e97b87a commit 24270be

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

devito/petsc/config.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ def get_petsc_type_mappings():
7979
petsc_type_to_ctype = {v: k for k, v in printer_mapper.items()}
8080
# Add other PETSc types
8181
petsc_type_to_ctype.update({
82-
# KSPType is `const char*` into KSP-owned memory. Using c_char_p
83-
# would dereference that pointer when Python reads the struct, which
84-
# segfaults after SNESDestroy frees the KSP. An inline char array
85-
# (c_char * N) stores a copy, so it is safe to read at any time.
82+
# Store a copy so it doens't segfault after SNESDestroy
8683
'KSPType': ctypes.c_char * KSPTYPE_MAX_LEN,
8784
'KSPConvergedReason': petsc_type_to_ctype['PetscInt'],
8885
'KSPNormType': petsc_type_to_ctype['PetscInt'],

devito/petsc/iet/callbacks.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,7 @@ def _create_initial_guess_body(self, body):
648648
def _make_constrain_bc(self):
649649
"""
650650
Constructs the `CountBCs` and `SetPointBCs` efuncs. Works for both
651-
single- and multi-field: all fields' expressions are compiled together
652-
(clustering may fuse loops) and a single callback is emitted for each.
651+
single- and multi-field.
653652
"""
654653
constrain_bc = self.field_data.constrain_bc
655654
sobjs = self.solver_objs
@@ -863,10 +862,8 @@ def _create_set_point_bc_body(self, body, _constrain_bc_dict):
863862

864863
def _create_set_point_bc_body_coupled(self, body):
865864
"""
866-
Combined SetPointBCs body for all target fields. The body is compiled
867-
from all fields' point_bc_exprs together (loops may be fused by
868-
clustering). Per-field counter symbols are substituted with the
869-
corresponding bcPointsArr[k_iter] after assembly.
865+
# TODO : ADD DOCS - MAKE IT CLEARER
866+
Combined SetPointBCs body for all target fields.
870867
"""
871868
linsolve_expr = self.inject_solve.expr.rhs
872869
objs = self.objs
@@ -892,8 +889,6 @@ def _create_set_point_bc_body_coupled(self, body):
892889
bcPointsIS = sobjs['bcPointsIS']
893890
bcCompsIS = sobjs['bcCompsIS']
894891

895-
# Zero-initialise IS arrays (PetscCalloc1 sets pointers to NULL so
896-
# the automatic ISDestroy cleanup is safe even on early exit)
897892
is_array_mallocs = (
898893
petsc_call('PetscCalloc1', [nfields, Byref(bcPointsIS._C_symbol)]),
899894
petsc_call('PetscCalloc1', [nfields, Byref(bcCompsIS._C_symbol)]),
@@ -947,7 +942,6 @@ def _create_set_point_bc_body_coupled(self, body):
947942
stacks=(dm_get_local_info,) + derefs
948943
)
949944

950-
# Struct substitutions + per-field counter → bcArr[k_iter]
951945
subs = {i._C_symbol: FieldFromPointer(i._C_symbol, ctx) for
952946
i in fields if not isinstance(i.function, AbstractFunction)}
953947
for t in targets:

0 commit comments

Comments
 (0)