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

Use space_for_shape in tessellation #291

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion meshmode/discretization/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def connectivity_for_element_group(self, grp):

if isinstance(grp.mesh_el_group, _ModepyElementGroup):
shape = grp.mesh_el_group._modepy_shape
space = type(grp.mesh_el_group._modepy_space)(grp.dim, grp.order)
space = mp.space_for_shape(shape, grp.order)
assert type(space) == type(grp.mesh_el_group._modepy_space) # noqa: E721
inducer marked this conversation as resolved.
Show resolved Hide resolved

node_tuples = mp.node_tuples_for_space(space)

el_connectivity = np.array(
Expand Down
13 changes: 8 additions & 5 deletions meshmode/mesh/refinement/tessellate.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def _get_ref_midpoints(shape, ref_vertices):
# {{{ modepy.shape tessellation and resampling

@get_group_midpoints.register(_ModepyElementGroup)
def _(meg: _ModepyElementGroup, el_tess_info, elements):
def _get_group_midpoints_modepy(
meg: _ModepyElementGroup, el_tess_info, elements):
shape = meg._modepy_shape
space = meg._modepy_space

Expand All @@ -204,7 +205,8 @@ def _(meg: _ModepyElementGroup, el_tess_info, elements):


@get_group_tessellated_nodes.register(_ModepyElementGroup)
def _(meg: _ModepyElementGroup, el_tess_info, elements):
def _get_group_tessellated_nodes_modepy(
meg: _ModepyElementGroup, el_tess_info, elements):
shape = meg._modepy_shape
space = meg._modepy_space

Expand Down Expand Up @@ -233,15 +235,16 @@ def _(meg: _ModepyElementGroup, el_tess_info, elements):


@get_group_tessellation_info.register(_ModepyElementGroup)
def _(meg: _ModepyElementGroup):
def _get_group_tessellation_info_modepy(meg: _ModepyElementGroup):
shape = meg._modepy_shape
space = type(meg._modepy_space)(meg.dim, 2)
space = mp.space_for_shape(shape, 2)
assert type(space) == type(meg._modepy_space) # noqa: E721

ref_vertices = mp.node_tuples_for_space(space)
ref_vertices_to_index = {rv: i for i, rv in enumerate(ref_vertices)}

from pytools import add_tuples
space = type(meg._modepy_space)(meg.dim, 1)
space = mp.space_for_shape(shape, 1)
orig_vertices = tuple([
inducer marked this conversation as resolved.
Show resolved Hide resolved
add_tuples(vt, vt) for vt in mp.node_tuples_for_space(space)
])
Expand Down