Skip to content

Check PETSc options prefix is not empty - #3796

Merged
schnellerhase merged 2 commits into
mainfrom
schnellerhase/linearproblem-options-database
Jul 11, 2025
Merged

Check PETSc options prefix is not empty#3796
schnellerhase merged 2 commits into
mainfrom
schnellerhase/linearproblem-options-database

Conversation

@schnellerhase

Copy link
Copy Markdown
Contributor

Follow up to #3785.

Passing an empty petsc_options_prefix string breaks. This is composed of PETSc's optional type handling of getOptionsPrefix and input of setOptionsPrefix not aligning, and the internal empty c-string being encoded as "\0" instead of "".

As an empty prefix is not desirable, we just raise to avoid this.

Debugged with @jhale.

@schnellerhase
schnellerhase requested a review from jhale July 11, 2025 12:40
@schnellerhase
schnellerhase marked this pull request as ready for review July 11, 2025 12:40
@schnellerhase schnellerhase changed the title Check options prefix is not empty Check PETSc options prefix is not empty Jul 11, 2025
@francesco-ballarin

Copy link
Copy Markdown
Member

Every meaningful options prefix will also end with _, shouldn't it? Hopefully PETSc does this check on its own, and if it doesn't it's not our own responsibility to do so.

Comment thread python/dolfinx/fem/petsc.py Outdated
Comment thread python/dolfinx/fem/petsc.py Outdated
Co-authored-by: Chris Richardson <chris@bpi.cam.ac.uk>
@chrisrichardson
chrisrichardson self-requested a review July 11, 2025 13:39
@schnellerhase
schnellerhase added this pull request to the merge queue Jul 11, 2025
Merged via the queue into main with commit 68edad2 Jul 11, 2025
28 checks passed
@schnellerhase
schnellerhase deleted the schnellerhase/linearproblem-options-database branch July 11, 2025 14:31
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.

3 participants