Skip to content

Commit

Permalink
make solve string more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
dham committed Dec 17, 2024
1 parent 85a8267 commit 6768c9f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions firedrake/adjoint_utils/blocks/solving.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ def _init_solver_parameters(self, args, kwargs):
self.assemble_kwargs = {}

def __str__(self):
return "solve({} = {})".format(ufl2unicode(self.lhs),
ufl2unicode(self.rhs))
try:
lhs_string = ufl2unicode(self.lhs)
except AttributeError:
lhs_string = str(self.lhs)
try:
rhs_string = ufl2unicode(self.rhs)
except AttributeError:
rhs_string = str(self.rhs)
return "solve({} = {})".format(lhs_string, rhs_string)

def _create_F_form(self):
# Process the equation forms, replacing values with checkpoints,
Expand Down

0 comments on commit 6768c9f

Please sign in to comment.