Skip to content

Commit

Permalink
Fix PETSc options checking in SLATE (#3568)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjward authored Jun 21, 2024
1 parent 71ec9dd commit 14c6885
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions firedrake/slate/static_condensation/la_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,15 @@ def _split_mixed_operator(self):
K1 = Tensor(split_trace_op_transpose[(id1, 0)])
self.list_split_trace_ops_transpose = [K0, K1]

def _check_options(self, valid):
default = object()
def _check_options(self, valid_options):
opts = PETSc.Options(self.prefix)
for key, supported in valid:
value = opts.getString(key, default=default)
if value is not default and value not in supported:
for key, supported in valid_options:
try:
value = opts.getString(key)
except KeyError:
continue

if value not in supported:
raise ValueError(f"Unsupported value ({value}) for '{self.prefix + key}'. "
f"Should be one of {supported}")

Expand Down

0 comments on commit 14c6885

Please sign in to comment.