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

DofsView doesn't call __array__ when used as the index of an ndarray #780

Closed
gatling-nrl opened this issue Nov 14, 2021 · 2 comments · Fixed by #787
Closed

DofsView doesn't call __array__ when used as the index of an ndarray #780

gatling-nrl opened this issue Nov 14, 2021 · 2 comments · Fixed by #787

Comments

@gatling-nrl
Copy link
Contributor

gatling-nrl commented Nov 14, 2021

I can't figure out why, but because DofsView inherits from NamedTuple it never calls __array__ and so u[dv] fails. The workaround is u[dv.flatten()] or to call it yourself as in u[dv.__array__()] (obviously, since all __array__ does right now is call flatten()).

@kinnala
Copy link
Owner

kinnala commented Nov 14, 2021

Thanks, I can look into it.

@kinnala
Copy link
Owner

kinnala commented Nov 14, 2021

Changing DofsView to dataclass seems to fix the issue. I'll do a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants