Repository navigation
DM signatures: stencil keywords, add_coarsen_hook! order, distribute - #317
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three signature changes to the DM constructors and helpers. The old forms still work and warn.
DMDAandDMStagtakestencil_width = 1andstencil_type = :boxas keywords. All DM constructors useset_from_options,setupand anAbstractStringprefix;DMStag(dm, dof)takesprefixtoo. This fixes a 2D/3DDMDAwithout a stencil type throwing aMethodError, anddmsetfromoptions, which went to PETSc as an option and did nothing.add_coarsen_hook!(dm, coarsenhook, restricthook)takes the DM first. The hooks are@cfunctionpointers, whichdocan't supply, so putting them first bought nothing; naming.md §8.1 now says so.distribute!isdistribute: 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.