Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip node resampling in discretization #135

Merged
merged 2 commits into from
Mar 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
skip discr node resampling if unit nodes are the same as the mesh
  • Loading branch information
alexfikl committed Mar 19, 2021
commit 6e51d26d9874f1537be04a07568e6b8e59d233c9
28 changes: 19 additions & 9 deletions meshmode/discretization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,26 @@ def prg():
""",
name="nodes")

def resample_mesh_nodes(grp, iaxis, tol=1.0e-15):
inducer marked this conversation as resolved.
Show resolved Hide resolved
# TODO: would be nice to have the mesh use an array context already
nodes = actx.from_numpy(grp.mesh_el_group.nodes[iaxis])

grp_unit_nodes = grp.unit_nodes
meg_unit_nodes = grp.mesh_el_group.unit_nodes
if (grp_unit_nodes.shape == meg_unit_nodes.shape
and np.linalg.norm(grp_unit_nodes - meg_unit_nodes) < tol):
inducer marked this conversation as resolved.
Show resolved Hide resolved
return nodes

return actx.call_loopy(
prg(),
resampling_mat=actx.from_numpy(grp.from_mesh_interp_matrix()),
nodes=nodes,
)["result"]

return make_obj_array([
_DOFArray(None, tuple(
actx.freeze(
actx.call_loopy(
prg(),
resampling_mat=actx.from_numpy(
grp.from_mesh_interp_matrix()),
nodes=actx.from_numpy(grp.mesh_el_group.nodes[iaxis])
)["result"])
for grp in self.groups))
_DOFArray(None, tuple([
actx.freeze(resample_mesh_nodes(grp, iaxis)) for grp in self.groups
]))
for iaxis in range(self.ambient_dim)])

# vim: fdm=marker