diff --git a/examples/simple-dg.py b/examples/simple-dg.py index 84bea31a4..94adbb3ce 100644 --- a/examples/simple-dg.py +++ b/examples/simple-dg.py @@ -275,15 +275,19 @@ def get_local_face_mass_matrix(self, afgrp, volgrp, dtype): import modepy as mp shape = mp.Simplex(volgrp.dim) - unit_vertices = mp.unit_vertices_for_shape(shape).T for face in mp.faces_for_shape(shape): - face_vertices = unit_vertices[np.array(face.volume_vertex_indices)].T - matrix[:, face.face_index, :] = mp.nodal_face_mass_matrix( + from modepy import basis_for_space, quadrature_for_space, PN, Simplex + face_space = PN(volgrp.dim - 1, volgrp.order) + face_shape = Simplex(volgrp.dim-1) + face_quad = quadrature_for_space(face_space, face_shape) + face_basis = basis_for_space(face_space, face_shape) + + matrix[:, face.face_index, :] = mp.nodal_mass_matrix_for_face( + face, face_quad, + face_basis.functions, volgrp.basis_obj().functions, - volgrp.unit_nodes, afgrp.unit_nodes, - volgrp.order, - face_vertices) + volgrp.unit_nodes, afgrp.unit_nodes) actx = self._setup_actx return actx.freeze(actx.from_numpy(matrix)) diff --git a/meshmode/array_context.py b/meshmode/array_context.py index 3a5d53056..6a421ce6c 100644 --- a/meshmode/array_context.py +++ b/meshmode/array_context.py @@ -53,7 +53,7 @@ DiscretizationEntityAxisTag) from dataclasses import dataclass -from pyrsistent import pmap +from immutabledict import immutabledict logger = logging.getLogger(__name__) @@ -781,7 +781,6 @@ class NotAnFEMEinsumError(ValueError): @memoize_on_first_arg def _get_redn_iname_to_insns(kernel): - from immutables import Map redn_iname_to_insns = {iname: set() for iname in kernel.all_inames()} @@ -789,7 +788,7 @@ def _get_redn_iname_to_insns(kernel): for redn_iname in insn.reduction_inames(): redn_iname_to_insns[redn_iname].add(insn.id) - return Map({k: frozenset(v) + return immutabledict({k: frozenset(v) for k, v in redn_iname_to_insns.items()}) @@ -1072,7 +1071,7 @@ def _get_iel_to_idofs(kernel): raise NotImplementedError(f"Cannot fit loop nest '{insn.within_inames}'" " into known set of loop-nest patterns.") - return pmap({iel: frozenset(idofs) + return immutabledict({iel: frozenset(idofs) for iel, idofs in iel_to_idofs.items()})