Skip to content

Commit

Permalink
api: fix symbolic coefficient conservation at rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Aug 22, 2023
1 parent a38ea46 commit 174dc8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion devito/types/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np
import sympy

from sympy.core.assumptions import _assume_rules
from cached_property import cached_property

Expand Down Expand Up @@ -855,11 +856,14 @@ def __str__(self):

__repr__ = __str__

def _sympystr(self, printer):
def _sympystr(self, printer, **kwargs):
return str(self)

_latex = _sympystr

def _pretty(self, printer, **kwargs):
return printer._print_Function(self, func_name=self.name)

def __eq__(self, other):
try:
return (self.function is other.function and
Expand Down
3 changes: 2 additions & 1 deletion devito/types/dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def __init_finalize__(self, *args, function=None, **kwargs):
super(DiscreteFunction, self).__init_finalize__(*args, **kwargs)

# Symbolic (finite difference) coefficients
self._coefficients = kwargs.get('coefficients', 'standard')
self._coefficients = kwargs.get('coefficients',
getattr(function, 'coefficients', 'standard'))
if self._coefficients not in ('standard', 'symbolic'):
raise ValueError("coefficients must be `standard` or `symbolic`")

Expand Down

0 comments on commit 174dc8b

Please sign in to comment.