Repository navigation
More DMStag: local_to_local!, with_product_coordinates, set_matrix_preallocate_only! - #296
Merged
Merged
Conversation
Collaborator
Author
|
Added a third piece to this PR: It checks out DMStag local vectors and gives the block one view per field ( Without
Tests: |
local_to_local!(dst, dm, src) and the in-place local_to_local!(v, dm) refresh ghost points. with_product_coordinates(f, dm) hands out a DMStag's per-axis coordinates read-only. set_matrix_preallocate_only! lets the first assembly define a DM matrix's pattern. The Read restore of the product coordinates called the writable restore. The KSP and SNES docstrings say when constructor options are applied.
with_field_views!(f, dm, vecs...; fields, read, write) checks out local vectors and hands f one view per location => dof pair, indexed like stencil, ghosts included, or the whole [I..., slot] array without fields. The views are concretely typed; a checkout costs 9 allocations per vector (independent of the grid size)
filoferra
force-pushed
the
dmstag-halos
branch
from
September 25, 2026 18:12
39c6bed to
f7f6c51
Compare
filoferra
marked this pull request as ready for review
September 28, 2026 08:04
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.
Stacked on #295 : review that one first. Until it merges, this diff includes its commit.
The rest of what DMStag usersstill might do through LibPETSc:
local_to_local!(dst, dm, src)and the in-placelocal_to_local!(v, dm)refresh the ghost points of a local vector from its neighbours. Tested on 4 ranks.with_product_coordinates(f, dm)gives a block read-only access to a DMStag's per-axis coordinates (x[i, 1]is the lower face of elementi,x[i, 2]its centre) and hands them back when the block returns or throws.set_matrix_preallocate_only!(dm, true)makes a matrix fromdmget its nonzero pattern from the first assembly, instead of storing every coupling the stencil allows as a zero. It's a setter rather than aPetscMatkeyword because the flag stays on the DM.Fixes:
LibPETSc.DMStagRestoreProductCoordinateArraysReadcalled the writable restore, which doesn't match the read-only get.KSPandSNESdocstrings now say when the constructor's options are applied: once at construction forKSP, at everysolve!forSNES(andTS, whose docstring already said so).