It should be: smoother=pc. getMGSmoother(0) The general rule is to drop the class name and move "Get" or "Set" to the front (in small letters). But sometimes this does not hold. It is better that you check the source code, for instance do "git
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
It should be:    smoother=pc.getMGSmoother(0)
The general rule is to drop the class name and move "Get" or "Set" to the front (in small letters). But sometimes this does not hold. It is better that you check the source code, for instance do "git grep PCMGGetSmoother -- src/binding" to locate where the C function is called from within petsc4py.

Jose

> El 28 may 2024, a las 16:38, Klaij, Christiaan <c.kl...@marin.nl> escribió:
> 
> This Message Is From an External Sender
> This message came from outside your organization.
> I'm attempting some rapid prototyping with petsc4py. The idea is basically to read-in a matrix and rhs, setup GAMG as ksppreonly, get the smoother and overrule it with a python function of my own, similar to the demo where the Jacobi method is user-defined in python. So far I have something like this:
> 
> pc = PETSc.PC().create()
> pc.setOperators(A)
> pc.setType(PETSc.PC.Type.GAMG)
> pc.PCMGGetSmoother(l=0,ksp=smoother)
> 
> which triggers the following error:
> 
> AttributeError: 'petsc4py.PETSc.PC' object has no attribute 'PCMGGetSmoother'
> 
> 1) Am I doing something wrong, or is this function just not available through python? 
> 
> 2) How can I tell up front if a function is available, only if it is listed in libpetsc4py.pyx? 
> 
> 3) Given the function description in C from the manual pages, how can I deduce the python syntax?
> (perhaps it's supposed to be ksp = pc.PCMGGetSmoother(l=0), or something else entirely)
> 
> Thanks for your help,<image663216.png>
> dr. ir.​​​​ Christiaan  Klaij  |  Senior Researcher  |  Research & Development
> T +31 317 49 33 44  |   c.kl...@marin.nl | https://urldefense.us/v3/__http://www.marin.nl__;!!G_uCfscf7eWS!ZTfC2k6ASlYOqzjxlaly2X8L-9NS8fzzLfjyqZtXWmY8PjiE5RBTDhE92LAZnY0I2cIn-iUK5vuRYHqeVTaOpoyb$<image279842.png><image807462.png><image039071.png>


Reply via email to