Skip to content

Public handle types and small API consistency fixes - #314

Merged
filoferra merged 2 commits into
JuliaParallel:mainfrom
filoferra:public-surface
Oct 21, 2026
Merged

filoferra merged 2 commits into
JuliaParallel:mainfrom
filoferra:public-surface

Conversation

@filoferra

Copy link
Copy Markdown
Collaborator
  • The handle types are public and documented: the abstract types to annotate with (AbstractPetscVec, AbstractKSP, ...) and PetscDM, PC, IS, AO, PF, Tao. PETSc.scalartype/inttype are the LibPETSc functions rather than copies, and realtype is public.
  • mul!, ldiv!, ksp \ b and solve!(x, ksp, b) take any vector handle, so a borrowed VecPtr works.
  • A LibPETSc call whose arguments match no generated method throws a MethodError naming the argument types. The change is in the generator (wrapping/generator/src/render.jl); src/autowrapped/ follows it.
  • library_info() prints as a plain NamedTuple; its custom show also caught any NamedTuple with the same field names.
  • One shared implementation behind every destroy!.

Two behaviour changes are listed in the CHANGELOG: the error type of a mismatched LibPETSc call, and how library_info() prints.

Full test suite passes locally.

The abstract handle types used in nearly every signature (AbstractPetscVec, AbstractKSP, ...) and the handles PetscDM, PC, IS, AO, PF and Tao were reachable but not declared public, and had no docstrings. IS, AO, PF and Tao weren't reachable as PETSc.X at all. They're now public, documented, and listed on the utilities page.

PETSc.scalartype and PETSc.inttype were separate copies of the LibPETSc functions, so a method added to one was missing from the other. PETSc now uses the LibPETSc functions, and realtype is public alongside them.
Products and solves (mul!, ldiv!, ksp \ b, solve!(x, ksp, b)) now take any vector handle, so a borrowed VecPtr works where it gave a MethodError.
A LibPETSc call whose arguments match no generated method throws a MethodError naming the argument types instead of a bare "no generated method" error.
library_info() prints as the NamedTuple it returns, without a show method that also changed how any NamedTuple with the same field names printed.
Every destroy! shares one implementation.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@filoferra
filoferra merged commit 5f3c8dd into JuliaParallel:main Oct 21, 2026
6 checks passed
@filoferra
filoferra deleted the public-surface branch October 21, 2026 12:52
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.

1 participant