Conversation
| from petsc4py import PETSc | ||
|
|
||
|
|
||
| class AbstractKSPMonitorFunction(abc.ABC): |
There was a problem hiding this comment.
I think this is a good idea, but there's nothing that makes python monitors in particular special. If we're doing ABCs we should do as much of the suite of possible python types as possible, e.g. KSP, PC, SNES, Monitor, Linesearch etc. (see for example the KSP and PC examples in the petsc4py docs)
There was a problem hiding this comment.
Except I know how to do this for monitors but not anything else! I agree we should look to add more things. Have you implemented any of these before?
There was a problem hiding this comment.
Some of the protocols are here: https://petsc.org/main/petsc4py/petsc_python_types.html
I think there's some discussion about what should be an abstract method (i.e. throw an error if a child class doesn't implement it), and what are just blank methods to show what you can customise.
The main one missing from that link is SNES, but I know some of the methods and we can find the others from the petsc4py sauce.
There was a problem hiding this comment.
What I really want to have in petsctools are implementations of useful monitor functions and such. I'm less bothered about abstract classes and since petsc4py advertise most of the interfaces anyway it might be unnecessary here.
This is something @JDBetteridge had in his own code at one point. It would be good to include in petsctools.
@JHopeCollins this is likely of interest to you. I would be interested in hearing your thoughts.