From 65fc71c1d453ee78054411bef39db0b21fcb237a Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Sat, 13 Jul 2024 15:57:54 +0300 Subject: [PATCH] port inverse_mass_matrix to take a Basis --- examples/simple-dg.py | 4 +--- meshmode/discretization/poly_element.py | 14 +++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/examples/simple-dg.py b/examples/simple-dg.py index 138b7d65..f8752698 100644 --- a/examples/simple-dg.py +++ b/examples/simple-dg.py @@ -237,9 +237,7 @@ def face_jacobian(self, where): @memoize_method def get_inverse_mass_matrix(self, grp, dtype): import modepy as mp - matrix = mp.inverse_mass_matrix( - grp.basis_obj().functions, - grp.unit_nodes) + matrix = mp.inverse_mass_matrix(grp.basis_obj(), grp.unit_nodes) actx = self._setup_actx return actx.freeze(actx.from_numpy(matrix)) diff --git a/meshmode/discretization/poly_element.py b/meshmode/discretization/poly_element.py index da6ec2b8..6fcfae5f 100644 --- a/meshmode/discretization/poly_element.py +++ b/meshmode/discretization/poly_element.py @@ -126,7 +126,7 @@ def mass_matrix(grp: InterpolatoryElementGroupBase) -> np.ndarray: assert grp.is_orthonormal_basis() return mp.mass_matrix( - grp.basis_obj().functions, + grp.basis_obj(), grp.unit_nodes) @@ -288,11 +288,11 @@ def quadrature_rule(self): class _MassMatrixQuadratureElementGroup(PolynomialSimplexElementGroupBase): @memoize_method def quadrature_rule(self): - basis_fcts = self.basis_obj().functions + basis = self.basis_obj() nodes = self._interp_nodes - mass_matrix = mp.mass_matrix(basis_fcts, nodes) + mass_matrix = mp.mass_matrix(basis, nodes) weights = np.dot(mass_matrix, - np.ones(len(basis_fcts))) + np.ones(len(basis.functions))) return mp.Quadrature(nodes, weights, exact_to=self.order) @property @@ -571,11 +571,11 @@ def basis_obj(self): @memoize_method def quadrature_rule(self): - basis_fcts = self._basis.functions + basis = self._basis nodes = self._nodes - mass_matrix = mp.mass_matrix(basis_fcts, nodes) + mass_matrix = mp.mass_matrix(basis, nodes) weights = np.dot(mass_matrix, - np.ones(len(basis_fcts))) + np.ones(len(basis.functions))) return mp.Quadrature(nodes, weights, exact_to=self.order) @property