From 946f9bc0ec98c5e6f1149781ab76137dea29072d Mon Sep 17 00:00:00 2001 From: Addison Alvey-Blanco Date: Fri, 11 Oct 2024 12:58:56 -0500 Subject: [PATCH] clean ups; check that nodes match --- meshmode/discretization/poly_element.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meshmode/discretization/poly_element.py b/meshmode/discretization/poly_element.py index 145e57b9..f6524306 100644 --- a/meshmode/discretization/poly_element.py +++ b/meshmode/discretization/poly_element.py @@ -525,19 +525,19 @@ def basis_obj(self): @memoize_method def quadrature_rule(self): - from modepy.tools import reshape_array_for_tensor_product_space as fold + from modepy.tools import reshape_array_for_tensor_product_space quads = [] if self.dim != 1: - nodes_tp = fold(self.space, self._nodes) + nodes_tp = reshape_array_for_tensor_product_space(self.space, + self._nodes) else: nodes_tp = self._nodes for idim, (nodes, basis) in enumerate(zip(nodes_tp, self._basis.bases)): # get current dimension's nodes from fastest varying axis - if self.dim != 1: - nodes = np.swapaxes(nodes, 0, idim)[:, *(0,)*(self.dim-1)] + nodes = nodes[*(0,)*idim, :, *(0,)*(self.dim-idim-1)] nodes_1d = nodes.reshape(1, -1) mass_matrix = mp.mass_matrix(basis, nodes_1d) @@ -545,7 +545,10 @@ def quadrature_rule(self): quads.append(mp.Quadrature(nodes_1d, weights, exact_to=self.order)) - return mp.TensorProductQuadrature(quads) + tp_quad = mp.TensorProductQuadrature(quads) + assert np.allclose(tp_quad.nodes, self._nodes) + + return tp_quad @property @memoize_method