<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
#pfptBanner5zkm6xc { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important;
background-color: #D0D8DC !important;
max-width: none !important; max-height: none !important }
.pfptPrimaryButton5zkm6xc:hover, .pfptPrimaryButton5zkm6xc:focus {
background-color: #b4c1c7 !important; }
.pfptPrimaryButton5zkm6xc:active {
background-color: #90a4ae !important; }
</style>
<!-- BaNnErBlUrFlE-HeAdEr-end -->
</head><!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">
On Tue, May 28, 2024 at 11: 04 AM Jose E. Roman via petsc-users <petsc-users@ mcs. anl. gov> wrote: It should be: smoother=pc. getMGSmoother(0) The general rule is to drop the class name and move "Get" or "Set" to the
</div>
<!-- Preheader Text : END -->
<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>
<!--[if ((ie)|(mso))]>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 16px 0px 16px 0px; direction: ltr" ><tr><td>
<table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 10px 5px 6px; width: 100%; border-radius:4px; border-top:4px solid #90a4ae;background-color:#D0D8DC;"><tr><td valign="top">
<table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 4px 8px 4px 8px">
<tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; direction: ltr">
This Message Is From an External Sender
</td></tr>
<tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
This message came from outside your organization.
</td></tr>
</table>
</td></tr></table>
</td></tr></table>
<![endif]-->
<![if !((ie)|(mso))]>
<div dir="ltr" id="pfptBanner5zkm6xc" style="all: revert !important; display:block !important; text-align: left !important; margin:16px 0px 16px 0px !important; padding:8px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #D0D8DC !important; background-color: #D0D8DC; border-top: 4px solid #90a4ae !important; border-top: 4px solid #90a4ae;">
<div id="pfptBanner5zkm6xc" style="all: unset !important; float:left !important; display:block !important; margin: 0px 0px 1px 0px !important; max-width: 600px !important;">
<div id="pfptBanner5zkm6xc" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:18px !important; line-height:18px">
This Message Is From an External Sender
</div>
<div id="pfptBanner5zkm6xc" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:18px !important; line-height:18px; margin-top:2px !important;">
This message came from outside your organization.
</div>
</div>
<div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
</div>
<![endif]>
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->
<!-- BaNnErBlUrFlE-BoDy-end -->
<div dir="ltr"><div dir="ltr">On Tue, May 28, 2024 at 11:04 AM Jose E. Roman via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg6834265493776961528"><u></u>
<div style="font-size:1px;color:rgb(255,255,255);line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;display:none">
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
</div>
<div style="font-size:1px;color:rgb(255,255,255);line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;display:none">ZjQcmQRYFpfptBannerStart</div>
<u></u>
<div dir="ltr" id="m_6834265493776961528pfptBanner28u38q2" style="display:block;text-align:left;margin:16px 0px;padding:8px 16px;border-radius:4px;min-width:200px;background-color:rgb(208,216,220);border-top:4px solid rgb(144,164,174)">
<div id="m_6834265493776961528pfptBanner28u38q2" style="float:left;display:block;margin:0px 0px 1px;max-width:600px">
<div id="m_6834265493776961528pfptBanner28u38q2" style="display:block;background-color:rgb(208,216,220);color:rgb(0,0,0);font-family:Arial,sans-serif;font-weight:bold;font-size:14px;line-height:18px">
This Message Is From an External Sender
</div>
<div id="m_6834265493776961528pfptBanner28u38q2" style="font-weight:normal;display:block;background-color:rgb(208,216,220);color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:12px;line-height:18px;margin-top:2px">
This message came from outside your organization.
</div>
</div>
<div style="height:0px;clear:both;display:block;line-height:0;font-size:0.01px"> </div>
</div>
<u></u>
<div style="font-size:1px;color:rgb(255,255,255);line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;display:none">ZjQcmQRYFpfptBannerEnd</div>
<div><pre style="font-family:sans-serif;font-size:100%;white-space:pre-wrap">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.</pre></div></div></blockquote><div>And we now also have documentation:</div><div><br></div><div> <a href="https://urldefense.us/v3/__https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.PC.html__;!!G_uCfscf7eWS!c3p1NNyTOWrr2Svr5gbJxnbWYQ_UjM4v52aqXrRsVOsL0rBd5lggGW0QXDAzJEo_DuEtmLvXLsrXk1mFzxO5$">https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.PC.html</a></div><div><br></div><div> Thanks,</div><div><br></div><div> Matt <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg6834265493776961528"><div><pre style="font-family:sans-serif;font-size:100%;white-space:pre-wrap">Jose
> El 28 may 2024, a las 16:38, Klaij, Christiaan <<a href="mailto:C.Klaij@marin.nl" target="_blank">C.Klaij@marin.nl</a>> 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 | <a href="mailto:C.Klaij@marin.nl" target="_blank">C.Klaij@marin.nl</a> | <a href="https://urldefense.us/v3/__http://www.marin.nl__;!!G_uCfscf7eWS!ZTfC2k6ASlYOqzjxlaly2X8L-9NS8fzzLfjyqZtXWmY8PjiE5RBTDhE92LAZnY0I2cIn-iUK5vuRYHqeVTaOpoyb$" target="_blank">https://urldefense.us/v3/__http://www.marin.nl__;!!G_uCfscf7eWS!ZTfC2k6ASlYOqzjxlaly2X8L-9NS8fzzLfjyqZtXWmY8PjiE5RBTDhE92LAZnY0I2cIn-iUK5vuRYHqeVTaOpoyb$</a><image279842.png><image807462.png><image039071.png>
</pre></div>
</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!c3p1NNyTOWrr2Svr5gbJxnbWYQ_UjM4v52aqXrRsVOsL0rBd5lggGW0QXDAzJEo_DuEtmLvXLsrXk-Ul6hWC$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>