From 0bc492ff0aa08d7c44383a66d6c799f993b163da Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 19 Apr 2026 14:56:59 -0500 Subject: [PATCH 1/4] Git ignore venv --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d3f9c656..2157ef5e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,6 @@ a.out .pytest_cache .pylintrc.yml .run-pylint.py +.venv test/nodal-dg From fd96b0ad00e25fca1ffb66db8f991a8788ce5f5b Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 19 Apr 2026 14:57:07 -0500 Subject: [PATCH 2/4] Bpr ignore .venv --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 78afbcce..fd8872ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -176,6 +176,7 @@ reportImportCycles = "none" ignore = [ "doc/conf.py", + ".venv", ] [[tool.basedpyright.executionEnvironments]] From 70673bfb623eeb69144d743fff1a01c1c39e6fa3 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 19 Apr 2026 15:11:41 -0500 Subject: [PATCH 3/4] Firedrake: some things are apparently properties now --- meshmode/interop/firedrake/connection.py | 4 ++-- meshmode/interop/firedrake/mesh.py | 14 +++++++------- test/test_firedrake_interop.py | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py index a870d6db..1761ba11 100644 --- a/meshmode/interop/firedrake/connection.py +++ b/meshmode/interop/firedrake/connection.py @@ -215,7 +215,7 @@ def __init__(self, discr, fdrake_fspace, mm2fd_node_mapping, group_nr=None): # Get meshmode unit nodes mm_unit_nodes = element_grp.unit_nodes # get firedrake unit nodes and map onto meshmode reference element - tdim = fdrake_fspace.mesh().topological_dimension() + tdim = fdrake_fspace.mesh().topological_dimension fd_ref_cell_to_mm = get_affine_reference_simplex_mapping(tdim, True) fd_unit_nodes = get_finat_element_unit_nodes(fdrake_fspace.finat_element) fd_unit_nodes = fd_ref_cell_to_mm(fd_unit_nodes) @@ -783,7 +783,7 @@ def build_connection_to_firedrake(discr, group_nr=None, comm=None): export_mesh_to_firedrake(discr.mesh, group_nr, comm) fspace = FunctionSpace(fd_mesh, "DG", el_group.order) # get firedrake unit nodes and map onto meshmode reference element - dim = fspace.mesh().topological_dimension() + dim = fspace.mesh().topological_dimension fd_ref_cell_to_mm = get_affine_reference_simplex_mapping(dim, True) fd_unit_nodes = get_finat_element_unit_nodes(fspace.finat_element) fd_unit_nodes = fd_ref_cell_to_mm(fd_unit_nodes) diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 91a414fa..7e36025e 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -111,7 +111,7 @@ def _get_firedrake_nodal_info(fdrake_mesh_topology, cells_to_use=None): else: num_cells = np.size(cells_to_use) from pyop2.datatypes import IntType - vertex_indices = -np.ones((num_cells, top.ufl_cell().num_vertices()), + vertex_indices = -np.ones((num_cells, top.ufl_cell().num_vertices), dtype=IntType) # This will map fd cell ndx (or its new index as dictated by # *cells_to_use* if *cells_to_use* @@ -269,7 +269,7 @@ def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, fd_loc_fac_nr_to_mm = {} # Figure out which vertex is excluded to get the corresponding # firedrake local index - all_local_facet_nrs = set(range(top.ufl_cell().num_vertices())) + all_local_facet_nrs = set(range(top.ufl_cell().num_vertices)) for mm_local_facet_nr, face in enumerate(mm_face_vertex_indices): fd_local_facet_nr = all_local_facet_nrs - set(face) assert len(fd_local_facet_nr) == 1 @@ -439,8 +439,8 @@ def _get_firedrake_orientations(fdrake_mesh, unflipped_group, vertices, *cells_to_use[i]*\ th element. """ # compute orientations - tdim = fdrake_mesh.topological_dimension() - gdim = fdrake_mesh.geometric_dimension() + tdim = fdrake_mesh.topological_dimension + gdim = fdrake_mesh.geometric_dimension orient = None if gdim == tdim: @@ -600,9 +600,9 @@ def import_firedrake_mesh(fdrake_mesh, cells_to_use=None, assert np.all(np.logical_and(cells_to_use >= 0, cells_to_use < fdrake_mesh.num_cells())) - assert fdrake_mesh.ufl_cell().is_simplex(), "Mesh must use simplex cells" - gdim = fdrake_mesh.geometric_dimension() - tdim = fdrake_mesh.topological_dimension() + assert fdrake_mesh.ufl_cell().is_simplex, "Mesh must use simplex cells" + gdim = fdrake_mesh.geometric_dimension + tdim = fdrake_mesh.topological_dimension assert gdim in [1, 2, 3], "Mesh must be in space of ambient dim 1, 2, or 3" assert gdim - tdim in [0, 1], "Mesh co-dimension must be 0 or 1" diff --git a/test/test_firedrake_interop.py b/test/test_firedrake_interop.py index 83b0d9e8..26031e4a 100644 --- a/test/test_firedrake_interop.py +++ b/test/test_firedrake_interop.py @@ -141,7 +141,7 @@ def check_consistency(fdrake_fspace, discr, group_nr=0): fdrake_vert_indices = cfspace.cell_node_list[:, fdrake_unit_vert_indices] fdrake_vert_indices = np.unique(fdrake_vert_indices) fdrake_verts = fdrake_mesh.coordinates.dat.data[fdrake_vert_indices, ...] - if fdrake_mesh.geometric_dimension() == 1: + if fdrake_mesh.geometric_dimension == 1: fdrake_verts = fdrake_verts[:, np.newaxis] meshmode_verts = discr.mesh.vertices @@ -151,7 +151,7 @@ def check_consistency(fdrake_fspace, discr, group_nr=0): assert len(discr.mesh.groups) == 1 fdrake_mesh_fspace = fdrake_mesh.coordinates.function_space() fdrake_mesh_order = fdrake_mesh_fspace.finat_element.degree - assert discr.mesh.groups[group_nr].dim == fdrake_mesh.topological_dimension() + assert discr.mesh.groups[group_nr].dim == fdrake_mesh.topological_dimension assert discr.mesh.groups[group_nr].order == fdrake_mesh_order assert discr.mesh.groups[group_nr].nelements == fdrake_mesh.num_cells() assert discr.mesh.nvertices == fdrake_mesh.num_vertices() @@ -246,7 +246,7 @@ def test_from_boundary_consistency(actx_factory: ArrayContextFactory, assert len(discr.mesh.groups) == 1 fdrake_mesh_fspace = fdrake_mesh.coordinates.function_space() fdrake_mesh_order = fdrake_mesh_fspace.finat_element.degree - assert discr.mesh.groups[0].dim == fdrake_mesh.topological_dimension() + assert discr.mesh.groups[0].dim == fdrake_mesh.topological_dimension assert discr.mesh.groups[0].order == fdrake_mesh_order # Get the unit vertex indices (in each cell) @@ -269,7 +269,7 @@ def test_from_boundary_consistency(actx_factory: ArrayContextFactory, fdrake_unit_vert_indices[:, np.newaxis]] fdrake_vert_indices = np.unique(fdrake_vert_indices) fdrake_verts = fdrake_mesh.coordinates.dat.data[fdrake_vert_indices, ...] - if fdrake_mesh.geometric_dimension() == 1: + if fdrake_mesh.geometric_dimension == 1: fdrake_verts = fdrake_verts[:, np.newaxis] # Get meshmode vertices (shaped like (dim, nverts)) meshmode_verts = discr.mesh.vertices @@ -642,7 +642,7 @@ def test_from_fd_idempotency(actx_factory: ArrayContextFactory, fdrake_fspace = TensorFunctionSpace(fdrake_mesh, "DG", fspace_degree) # use the coordinates, duplicated into the right tensor shape xx = SpatialCoordinate(fdrake_fspace.mesh()) - dim = fdrake_fspace.mesh().geometric_dimension() + dim = fdrake_fspace.mesh().geometric_dimension unique_expr = as_tensor([xx for _ in range(dim)]) fdrake_unique = Function(fdrake_fspace).interpolate(unique_expr) From c548c5d5df8368410714555eeb19a62c0ca6937b Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 19 Apr 2026 14:56:42 -0500 Subject: [PATCH 4/4] Update baseline --- .basedpyright/baseline.json | 180 +++++++++++++++++++++++++++++------- 1 file changed, 146 insertions(+), 34 deletions(-) diff --git a/.basedpyright/baseline.json b/.basedpyright/baseline.json index 8ca2d7d2..43da8681 100644 --- a/.basedpyright/baseline.json +++ b/.basedpyright/baseline.json @@ -1891,14 +1891,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownVariableType", - "range": { - "startColumn": 4, - "endColumn": 22, - "lineCount": 1 - } - }, { "code": "reportUnknownArgumentType", "range": { @@ -8261,6 +8253,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, { "code": "reportUnknownParameterType", "range": { @@ -8309,6 +8309,30 @@ "lineCount": 1 } }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 39, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 79, + "lineCount": 1 + } + }, { "code": "reportUnknownMemberType", "range": { @@ -8333,6 +8357,22 @@ "lineCount": 1 } }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 31, + "endColumn": 76, + "lineCount": 1 + } + }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 32, + "endColumn": 47, + "lineCount": 1 + } + }, { "code": "reportUnknownVariableType", "range": { @@ -9707,14 +9747,6 @@ "lineCount": 1 } }, - { - "code": "reportArgumentType", - "range": { - "startColumn": 67, - "endColumn": 78, - "lineCount": 1 - } - }, { "code": "reportMissingTypeStubs", "range": { @@ -13129,6 +13161,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13161,6 +13201,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13193,6 +13241,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13225,6 +13281,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 51, + "endColumn": 62, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13257,6 +13321,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13289,6 +13361,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13321,6 +13401,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -13353,6 +13441,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 46, + "endColumn": 52, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { @@ -17515,7 +17611,7 @@ "code": "reportUnknownArgumentType", "range": { "startColumn": 30, - "endColumn": 72, + "endColumn": 70, "lineCount": 1 } }, @@ -18179,7 +18275,7 @@ "code": "reportUnknownArgumentType", "range": { "startColumn": 36, - "endColumn": 65, + "endColumn": 63, "lineCount": 1 } }, @@ -20623,22 +20719,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownMemberType", - "range": { - "startColumn": 51, - "endColumn": 67, - "lineCount": 1 - } - }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 51, - "endColumn": 67, - "lineCount": 1 - } - }, { "code": "reportUnknownVariableType", "range": { @@ -23523,6 +23603,30 @@ "lineCount": 1 } }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 25, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 25, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 11, + "endColumn": 50, + "lineCount": 1 + } + }, { "code": "reportUnknownVariableType", "range": { @@ -26037,6 +26141,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 36, + "endColumn": 38, + "lineCount": 1 + } + }, { "code": "reportUnknownVariableType", "range": {