Skip to content

Commit

Permalink
port inverse_mass_matrix to take a Basis
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Jul 16, 2024
1 parent c588f00 commit 65fc71c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions examples/simple-dg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
14 changes: 7 additions & 7 deletions meshmode/discretization/poly_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 65fc71c

Please sign in to comment.