diff --git a/meshmode/mesh/processing.py b/meshmode/mesh/processing.py index d420c08d0fc88867e3a67488abd959486946eca3..664355e0f043089af35efbd1ed79b0fdec7e71d8 100644 --- a/meshmode/mesh/processing.py +++ b/meshmode/mesh/processing.py @@ -447,6 +447,8 @@ def map_mesh(mesh, f): # noqa shape ``(ambient_dim, npoints)``.""" vertices = f(mesh.vertices) + if not vertices.flags.c_contiguous: + vertices = np.copy(vertices, order="C") # {{{ assemble new groups list @@ -454,6 +456,9 @@ def map_mesh(mesh, f): # noqa for group in mesh.groups: mapped_nodes = f(group.nodes.reshape(mesh.ambient_dim, -1)) + if not mapped_nodes.flags.c_contiguous: + mapped_nodes = np.copy(mapped_nodes, order="C") + new_groups.append(group.copy( nodes=mapped_nodes.reshape(*group.nodes.shape))) @@ -479,7 +484,7 @@ def affine_map(mesh, A=None, b=None): # noqa b = np.zeros(A.shape[0]) def f(x): - return np.einsum("ij,jv->iv", A, x) + b[:, np.newaxis] + return np.dot(A, x) + b.reshape(-1, 1) return map_mesh(mesh, f)