Skip to content

Commit

Permalink
Use slice notation
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgibson committed Apr 6, 2017
1 parent 59ccfd3 commit e061ec0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions FIAT/hdiv_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ def tabulate(self, order, points, entity=None):
element = self.dg_elements[facet_sd]
nf = element.space_dimension()
nonzerovals, = itervalues(element.tabulate(order, new_points))
sindex = nf * unique_facet
eindex = nf * (unique_facet + 1)
indices = slice(nf * unique_facet, nf * (unique_facet + 1))

else:
entity_dim, _ = entity
Expand Down Expand Up @@ -246,8 +245,7 @@ def tabulate(self, order, points, entity=None):
# Found it! Grab insertion indices
if (facet_dim, i) == entity:
nonzerovals, = itervalues(element.tabulate(0, points))
sindex = offset
eindex = offset + nf
indices = slice(offset, offset + nf)

offset += nf

Expand All @@ -260,7 +258,7 @@ def tabulate(self, order, points, entity=None):
phivals[key] = TraceError(msg)

# Insert non-zero values in appropriate place
phivals[evalkey][sindex:eindex, :] = nonzerovals
phivals[evalkey][indices, :] = nonzerovals

return phivals

Expand Down

0 comments on commit e061ec0

Please sign in to comment.