You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem: mesh.GetVertexArray() returns a tuple of 1D numpy arrays instead of a 2D numpy array. Thats why slicing [:, 0] does not work.
The example runs when replacing verts = mesh.GetVertexArray() with verts = np.array(mesh.GetVertexArray()). However, I think this should be considered only a hotfix, because the documentation states that it should return a 2D numpy array.
@jherkenhoff Thank you for reminding this. I think the reason behind this is that the vertices data
is not simple contiguous array data in MFEM, and it is nice to return an numpy array as a view to
the original data (thus you can modify it if you need.). I will update the doc and example.
Activity
jherkenhoff commentedon Oct 23, 2025
The problem:
mesh.GetVertexArray()returns a tuple of 1D numpy arrays instead of a 2D numpy array. Thats why slicing[:, 0]does not work.The example runs when replacing
verts = mesh.GetVertexArray()withverts = np.array(mesh.GetVertexArray()). However, I think this should be considered only a hotfix, because the documentation states that it should return a 2D numpy array.jherkenhoff commentedon Oct 23, 2025
Duplicate of #178
sshiraiwa commentedon Oct 28, 2025
@jherkenhoff Thank you for reminding this. I think the reason behind this is that the vertices data
is not simple contiguous array data in MFEM, and it is nice to return an numpy array as a view to
the original data (thus you can modify it if you need.). I will update the doc and example.