Skip to content

Commit bcf403b

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

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/demo/demo_lagrange_variants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import basix
3131
import basix.ufl
32+
import numpy as np
3233
import ufl
3334
from dolfinx import default_real_type, fem, mesh
3435

@@ -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)