Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagiyam committed Nov 16, 2024
1 parent cad0cd2 commit 8417b41
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions firedrake/functionspaceimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,15 @@ def _components(self):

@PETSc.Log.EventDecorator()
def sub(self, i):
#bound = len(self._components)
#if i < 0 or i >= bound:
# raise IndexError("Invalid component %d, not in [0, %d)" % (i, bound))
if len(self) == 1:
bound = len(self._components)
if i < 0 or i >= bound:
raise IndexError("Invalid component %d, not in [0, %d)" % (i, bound))
return self._components[i]
else:
bound = len(self)
if i < 0 or i >= bound:
raise IndexError("Invalid index %d, not in [0, %d)" % (i, bound))
return self.subfunctions[i]

@utils.cached_property
Expand Down

0 comments on commit 8417b41

Please sign in to comment.