Skip to content

Conversation

@alexfikl
Copy link
Collaborator

@alexfikl alexfikl commented Jan 3, 2026

This adds more type annotations to models.em inspired by #398.

Hopefully this makes the local / CI errors match at least in this module: it was previously complaining about a few Unknown types that are now known.

Comment on lines +181 to +185
def __call__(self,
x: Vector,
y: Vector,
three_mult: Callable[
[int, ArrayOrArithContainerOrScalar, ArrayOrArithContainerOrScalar],
ArrayOrArithContainerOrScalar] | None = None) -> Vector:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct from my reading of some of the code below (e.g. this function also takes an ObjectArray[_Dx]), but it's not too bad.

Comment on lines +252 to +253
:arg epsilon: can be a number, for a fixed material throughout the
computation domain or a :class:`~meshmode.dof_array.DOFArray` for
spatially variable material coefficients.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spatially varying case doesn't seem to be tested anywhere, right? I assumed that this would be DOFArray in that case, since TimeConstantGivenFunction doesn't exist anymore.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. I'm not sure it was tested ever. It should probably be removed and bumped to a PR.

return float(lc) * (x * y)

def e_curl(field: Vector) -> Vector:
return self.space_cross_e(nabla, field, three_mult=three_mult) # pyright: ignore[reportArgumentType]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is complaining because that nabla is an ObjectArray[_Dx].

. ./ci-support-v0
build_py_project_in_conda_env
cipip install pytest modepy
cipip install pytest modepy optype
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be why we couldn't match the CI? pymbolic uses it in MultiVector and the errors were all somehow connected to MultiVector.as_vector, from what I recall.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch! That makes sense. I wish the error message had been more explicit...

@alexfikl alexfikl marked this pull request as ready for review January 3, 2026 18:35
. ./ci-support-v0
build_py_project_in_conda_env
cipip install pytest modepy
cipip install pytest modepy optype
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch! That makes sense. I wish the error message had been more explicit...

Comment on lines +252 to +253
:arg epsilon: can be a number, for a fixed material throughout the
computation domain or a :class:`~meshmode.dof_array.DOFArray` for
spatially variable material coefficients.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. I'm not sure it was tested ever. It should probably be removed and bumped to a PR.

@inducer
Copy link
Owner

inducer commented Jan 4, 2026

Thx!

@inducer inducer merged commit 40f638a into inducer:main Jan 4, 2026
7 checks passed
@alexfikl alexfikl deleted the type-maxwell branch January 4, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants