Skip to content

Commit

Permalink
Drop index from mesh element group constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Mar 4, 2024
1 parent 052d11e commit 3fae668
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ jobs:
run: |
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
if [[ "$DOWNSTREAM_PROJECT" == "grudge" && "$GITHUB_HEAD_REF" == "group-constr-drop-index" ]]; then
DOWNSTREAM_PROJECT=https://github.com/inducer/grudge.git@grad-test-overint
fi
test_downstream "$DOWNSTREAM_PROJECT"
# vim: sw=4
8 changes: 1 addition & 7 deletions meshmode/discretization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,7 @@ def __init__(self,
raise TypeError("'actx' must be an ArrayContext")

self.mesh = mesh
groups = []
for igrp, mg in enumerate(mesh.groups):
# TODO: setting index is deprecated
ng = group_factory(mg, index=igrp)
groups.append(ng)

self.groups = groups
self.groups = [group_factory(mg) for mg in mesh.groups]

self.real_dtype = np.dtype(real_dtype)
self.complex_dtype = np.dtype({
Expand Down
17 changes: 14 additions & 3 deletions test/test_meshmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
PytestPyOpenCLArrayContextFactory,
])

from meshmode.mesh import SimplexElementGroup, TensorProductElementGroup
from meshmode.mesh import (
MeshElementGroup, SimplexElementGroup, TensorProductElementGroup)
from meshmode.discretization.poly_element import (
InterpolatoryQuadratureSimplexGroupFactory,
default_simplex_group_factory,
Expand Down Expand Up @@ -914,6 +915,7 @@ def test_mesh_multiple_groups(actx_factory, ambient_dim, visualize=False):
mesh.vertices[0, mesh.groups[0].vertex_indices] < 0.0,
axis=1).astype(np.int64)
mesh = split_mesh_groups(mesh, element_flags)
assert isinstance(mesh, Mesh)

assert len(mesh.groups) == 2 # pylint: disable=no-member
assert mesh.facial_adjacency_groups
Expand All @@ -932,10 +934,19 @@ def test_mesh_multiple_groups(actx_factory, ambient_dim, visualize=False):

from meshmode.discretization import Discretization

def grp_factory(mesh_el_group, index):
def grp_factory(mesh_el_group: MeshElementGroup):
index = None

for i, meg in enumerate(mesh.groups): # pylint: disable=no-member
if meg is mesh_el_group:
index = i

if mesh_el_group.dim == mesh.ambient_dim:
assert index is not None

return default_simplex_group_factory(
base_dim=ambient_dim, order=order + 2 if index == 0 else order
)(mesh_el_group, index)
)(mesh_el_group)

discr = Discretization(actx, mesh, grp_factory)

Expand Down

0 comments on commit 3fae668

Please sign in to comment.