Skip to content

Commit eafae82

Browse files
committed
Fix for mesh size bug with scalar field initialisation
1 parent cc2fb74 commit eafae82

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fidimag/common/helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ def init_scalar(value, mesh):
7171
mesh_v[i] = value(mesh.coordinates[i])
7272

7373
elif isinstance(value, np.ndarray):
74-
7574
if value.shape == mesh_v.shape:
7675
mesh_v[:] = value[:]
76+
else:
77+
raise ValueError("Array size must match the mesh size")
7778

7879
return mesh_v
7980

0 commit comments

Comments
 (0)