On Tue, May 28, 2024 at 11:04 AM Jose E. Roman via petsc-users < [email protected]> wrote:
> 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. > > And we now also have documentation: https://urldefense.us/v3/__https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.PC.html__;!!G_uCfscf7eWS!c3p1NNyTOWrr2Svr5gbJxnbWYQ_UjM4v52aqXrRsVOsL0rBd5lggGW0QXDAzJEo_DuEtmLvXLsrXk1mFzxO5$ Thanks, Matt > Jose > > > El 28 may 2024, a las 16:38, Klaij, Christiaan <[email protected]> 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 | [email protected] | > > https://urldefense.us/v3/__http://www.marin.nl__;!!G_uCfscf7eWS!ZTfC2k6ASlYOqzjxlaly2X8L-9NS8fzzLfjyqZtXWmY8PjiE5RBTDhE92LAZnY0I2cIn-iUK5vuRYHqeVTaOpoyb$<image279842.png><image807462.png><image039071.png> > > > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!c3p1NNyTOWrr2Svr5gbJxnbWYQ_UjM4v52aqXrRsVOsL0rBd5lggGW0QXDAzJEo_DuEtmLvXLsrXk9nFHPiP$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!c3p1NNyTOWrr2Svr5gbJxnbWYQ_UjM4v52aqXrRsVOsL0rBd5lggGW0QXDAzJEo_DuEtmLvXLsrXk-Ul6hWC$ >
