Skip to content

Commit f0a843a

Browse files
committed
Fix: demo_lagrange
1 parent 622db03 commit f0a843a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

python/demo/demo_lagrange_variants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from mpi4py import MPI
2727

2828
import matplotlib.pylab as plt
29+
import numpy as np
2930

3031
import basix
3132
import basix.ufl
@@ -142,11 +143,11 @@ def saw_tooth(x):
142143
uh.interpolate(lambda x: saw_tooth(x[0]))
143144
if MPI.COMM_WORLD.size == 1: # Skip this plotting in parallel
144145
pts: list[list[float]] = []
145-
cells: list[int] = []
146+
cells = np.empty((0,), dtype=np.int32)
146147
for cell in range(N):
147148
for i in range(51):
148149
pts.append([cell / N + i / 50 / N, 0, 0])
149-
cells.append(cell)
150+
cells = np.append(cells, [cell])
150151
values = uh.eval(pts, cells)
151152
plt.plot(pts, [saw_tooth(i[0]) for i in pts], "k--")
152153
plt.plot(pts, values, "r-")

0 commit comments

Comments
 (0)