Skip to content

Commit

Permalink
ruff: fix zip strict argument
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Nov 3, 2024
1 parent e5cc6bd commit 8d6d41f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
12 changes: 7 additions & 5 deletions grudge/dt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def _compute_characteristic_lengthscales():
cng * geo_facts
for cng, geo_facts in zip(
dt_non_geometric_factors(dcoll, dd),
actx.thaw(dt_geometric_factors(dcoll, dd)))))))
actx.thaw(dt_geometric_factors(dcoll, dd)),
strict=True)))))

return actx.thaw(_compute_characteristic_lengthscales())

Expand Down Expand Up @@ -141,7 +142,7 @@ def dt_non_geometric_factors(
discr = dcoll.discr_from_dd(dd)
min_delta_rs = []
for grp in discr.groups:
nodes = np.asarray(list(zip(*grp.unit_nodes)))
nodes = np.asarray(list(zip(*grp.unit_nodes, strict=True)))
nnodes = grp.nunit_dofs

# NOTE: order 0 elements have 1 node located at the centroid of
Expand Down Expand Up @@ -314,7 +315,7 @@ def dt_geometric_factors(
face_ae_i.shape[-1])),
tagged=(FirstAxisIsElementsTag(),))

for vgrp, face_ae_i in zip(volm_discr.groups, face_areas)))
for vgrp, face_ae_i in zip(volm_discr.groups, face_areas, strict=True)))
else:
surface_areas = DOFArray(
actx,
Expand All @@ -336,7 +337,7 @@ def dt_geometric_factors(

for vgrp, afgrp, face_ae_i in zip(volm_discr.groups,
face_discr.groups,
face_areas)
face_areas, strict=True)
)
)

Expand All @@ -349,7 +350,8 @@ def dt_geometric_factors(
1/sae_i,
actx.tag_axis(1, DiscretizationDOFAxisTag(), cv_i),
tagged=(FirstAxisIsElementsTag(),)) * dcoll.dim
for cv_i, sae_i in zip(cell_vols, surface_areas)))))
for cv_i, sae_i in zip(cell_vols, surface_areas,
strict=True)))))

# }}}

Expand Down
23 changes: 15 additions & 8 deletions grudge/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ def _single_axis_derivative_kernel(
tagged=(FirstAxisIsElementsTag(),))

for out_grp, in_grp, vec_i, ijm_i in zip(
out_discr.groups, in_discr.groups, vec,
inv_jac_mat)))
out_discr.groups,
in_discr.groups,
vec,
inv_jac_mat, strict=True)))


def _gradient_kernel(actx, out_discr, in_discr, get_diff_mat, inv_jac_mat, vec,
Expand All @@ -214,7 +216,7 @@ def _gradient_kernel(actx, out_discr, in_discr, get_diff_mat, inv_jac_mat, vec,
tagged=(FirstAxisIsElementsTag(),))
for out_grp, in_grp, vec_i, ijm_i in zip(
out_discr.groups, in_discr.groups, vec,
inv_jac_mat)]
inv_jac_mat, strict=True)]

return make_obj_array([
DOFArray(actx, data=tuple([ # noqa: C409
Expand All @@ -241,8 +243,10 @@ def _divergence_kernel(actx, out_discr, in_discr, get_diff_mat, inv_jac_mat, vec
arg_names=("inv_jac_t", "ref_stiffT_mat", "vec"),
tagged=(FirstAxisIsElementsTag(),))
for out_grp, in_grp, vec_i, ijm_i in zip(
out_discr.groups, in_discr.groups, vec,
inv_jac_mat)]
out_discr.groups,
in_discr.groups,
vec,
inv_jac_mat, strict=True)]

return DOFArray(actx, data=tuple(per_group_divs))

Expand Down Expand Up @@ -721,7 +725,8 @@ def _apply_mass_operator(
tagged=(FirstAxisIsElementsTag(),))

for in_grp, out_grp, ae_i, vec_i in zip(
in_discr.groups, out_discr.groups, area_elements, vec)
in_discr.groups, out_discr.groups, area_elements, vec,
strict=True)
)
)

Expand Down Expand Up @@ -815,7 +820,8 @@ def _apply_inverse_mass_operator(
reference_inverse_mass_matrix(actx, element_group=grp),
vec_i,
tagged=(FirstAxisIsElementsTag(),))
for grp, jac_inv, vec_i in zip(discr.groups, inv_area_elements, vec)]
for grp, jac_inv, vec_i in zip(
discr.groups, inv_area_elements, vec, strict=True)]

return DOFArray(actx, data=tuple(group_data))

Expand Down Expand Up @@ -1010,7 +1016,8 @@ def _apply_face_mass_operator(dcoll: DiscretizationCollection, dd_in, vec):
for vgrp, afgrp, vec_i, surf_ae_i in zip(volm_discr.groups,
face_discr.groups,
vec,
surf_area_elements)))
surf_area_elements,
strict=True)))


def face_mass(dcoll: DiscretizationCollection, *args) -> ArrayOrContainer:
Expand Down

0 comments on commit 8d6d41f

Please sign in to comment.