Skip to content

Mark PETSC Vector restore_array function as const #4155

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

Open
dschwen opened this issue Apr 25, 2025 · 0 comments · May be fixed by #4156
Open

Mark PETSC Vector restore_array function as const #4155

dschwen opened this issue Apr 25, 2025 · 0 comments · May be fixed by #4156
Assignees

Comments

@dschwen
Copy link
Member

dschwen commented Apr 25, 2025

All that function does is update a mutable member and call another const function. This would resolve the conundrum of being able to call get_array_read on a const reference to a PetscVector, but being unable to call the mandatory restore_array after the read. Certain MOOSE apps circumvent this by casting const away, but the elegant solution here is to just mark restore_array as const.

@dschwen dschwen self-assigned this Apr 25, 2025
dschwen added a commit to dschwen/libmesh that referenced this issue Apr 25, 2025
@dschwen dschwen linked a pull request Apr 25, 2025 that will close this issue
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 a pull request may close this issue.

1 participant