From 07a58f96202e0ed688a7b9b3794ce0cb1d6f956b Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Sun, 18 Feb 2018 20:37:37 -0600 Subject: [PATCH 1/2] fix affine_map to not change array to F_CONTINUGOUS einsum changed arrays from C_CONTIGUOUS to F_CONTINGUOUS, which got sent to map_mesh above and reshaped into an array that wasn't C or F contiguous. --- meshmode/mesh/processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshmode/mesh/processing.py b/meshmode/mesh/processing.py index d420c08d..90dbd1f5 100644 --- a/meshmode/mesh/processing.py +++ b/meshmode/mesh/processing.py @@ -479,7 +479,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) -- GitLab From 1249add022961f34523c42b0b6f35ff5a84af1ed Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Wed, 21 Feb 2018 16:36:55 -0600 Subject: [PATCH 2/2] mesh:processing: make sure node arrays stay c contiguous --- meshmode/mesh/processing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meshmode/mesh/processing.py b/meshmode/mesh/processing.py index 90dbd1f5..664355e0 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))) -- GitLab