Skip to content

Commit

Permalink
better error message for adding sphere basis with different raddi (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayceslesar committed Feb 6, 2023
1 parent 2648fcc commit 5b52e29
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dedalus/core/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,8 @@ def __add__(self, other):
if self.radius == other.radius:
shape = tuple(np.maximum(self.shape, other.shape))
return SphereBasis(self.coordsystem, shape, radius=self.radius, dealias=self.dealias, dtype=self.dtype)
else:
raise NotImplementedError(f"Cannot add two sphere bases with different radii {self.radius} and {other.radius}.")
return NotImplemented

def __mul__(self, other):
Expand All @@ -2772,6 +2774,8 @@ def __mul__(self, other):
if self.radius == other.radius:
shape = tuple(np.maximum(self.shape, other.shape))
return SphereBasis(self.coordsystem, shape, radius=self.radius, dealias=self.dealias, dtype=self.dtype)
else:
raise NotImplementedError(f"Cannot multiply two sphere bases with different radii {self.radius} and {other.radius}.")
return NotImplemented

def __matmul__(self, other):
Expand Down

0 comments on commit 5b52e29

Please sign in to comment.