Skip to content

DM signatures: stencil keywords, add_coarsen_hook! order, distribute - #317

Merged
filoferra merged 3 commits into
JuliaParallel:mainfrom
filoferra:dm-signatures
Oct 22, 2026
Merged

filoferra merged 3 commits into
JuliaParallel:mainfrom
filoferra:dm-signatures

Conversation

@filoferra

Copy link
Copy Markdown
Collaborator

Three signature changes to the DM constructors and helpers. The old forms still work and warn.

  • DMDA and DMStag take stencil_width = 1 and stencil_type = :box as keywords. All DM constructors use set_from_options, setup and an AbstractString prefix; DMStag(dm, dof) takes prefix too. This fixes a 2D/3D DMDA without a stencil type throwing a MethodError, and dmsetfromoptions, which went to PETSc as an option and did nothing.
  • add_coarsen_hook!(dm, coarsenhook, restricthook) takes the DM first. The hooks are @cfunction pointers, which do can't supply, so putting them first bought nothing; naming.md §8.1 now says so.
  • distribute! is distribute: it returns a new DM and leaves its argument unchanged.

Tests and examples use the new forms; the full suite runs with no deprecation warnings.

DMDA and DMStag now take the stencil width and type as keywords (stencil_width = 1, stencil_type = :box), and all DM constructors use set_from_options, setup and an AbstractString prefix, which DMStag(dm, dof) now also accepts. This fixes 2D and 3D DMDA throwing a MethodError when no stencil type was given, and the dmsetfromoptions keyword, which was documented but went into the options database and did nothing. The positional stencil forms and the old keyword names still work and warn.
add_coarsen_hook!(dm, coarsenhook, restricthook) takes the DM first, as set_residual! does. The hooks are C function pointers from @cfunction, which do syntax can't supply, so putting them first bought nothing. The hook-first order still works and warns, and dm_coarsen_hook_add! forwards unchanged.
distribute(dm; overlap) returns the distributed mesh as a new DM and leaves dm unchanged, so the name drops the !. distribute! and plexdistribute! still work and warn. The docstring now says that on one rank the result is a DM with a null pointer, not nothing.
@filoferra
filoferra merged commit 3b72274 into JuliaParallel:main Oct 22, 2026
5 checks passed
@filoferra
filoferra deleted the dm-signatures branch October 22, 2026 10:20
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