Fix Jp + multigrid#5189
Draft
pbrubeck wants to merge 1 commit into
Draft
Conversation
15ec603 to
9098532
Compare
| dm = ksp.getDM() | ||
| ctx = dmhooks.get_appctx(dm) | ||
| A = ctx._jac.petscmat | ||
| P = A if ctx.Jp is None else ctx._pjac.petscmat |
Contributor
There was a problem hiding this comment.
I believe passing None is cleaner code
Suggested change
| P = A if ctx.Jp is None else ctx._pjac.petscmat | |
| P = None if ctx.Jp is None else ctx._pjac.petscmat |
Is this creating new matrices or just passing the ones stored inside?
Ideally, callbacks to create operators should create new ones, rather than passing references to stored matrices. Ideally, one can do
DMCreateMatrix(dm,&A1);
// ...populate A1
DMCreateMatrix(dm,&A2);
// ...populate A2
// use A1 and A2 independently
I believe it is conceptually wrong to pass matrices already stored in the context. One should duplicate the internal matrices instead
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.
Description
Depends on https://gitlab.com/petsc/petsc/-/merge_requests/9362