-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapping PetscDS into petsc4py #9
Comments
In cython I could do something like that:
|
Without the DS being passed into the F0_Function wrapper we're incapable of building the memory blocks required to construct the wrapper. |
That sounds suspiciously like a void * context solution.
Prof Louis Moresi
[email protected]<mailto:[email protected]>
(w) +61 3 8344 1217
(m) +61 4 0333 1413
(us) +1 505 349 4425
www.moresi.info<http://www.moresi.info/>
www.facebook.com/underworldcode<http://www.facebook.com/underworldcode>
@LouisMoresi<https://twitter.com/LouisMoresi>
On 14 Jun 2019, 4:46 AM +0100, Julian Giordani <[email protected]>, wrote:
Without the DS being passed into the F0_Function wrapper we're incapable of building the memory blocks required to construct the wrapper.
2 possible solution come to mind. We modify petsc to pass either 1) the ds or 2) a void* that could be the ds.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#9?email_source=notifications&email_token=ADABPIYB5GS5TPMZZ7R247LP2MIAFA5CNFSM4HRQNNZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXVUEWA#issuecomment-501957208>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ADABPI4R6DBARVI5RDXUT6DP2MIAFANCNFSM4HRQNNZA>.
|
Might be good to have both 1 and 2...the DS and the void * which we could use to pass UW functions? |
OK I am copying the discussion we had with Matt Knepley a while ago as it is not available anymore on bitbucket |
If you look at a system like FIredrake, they compile down a |
This is still ongoing... I have not found a solution to this pb. |
I am trying to wrap the PetscDS functionalities into Petsc4py by completing the
cython class. The aim is to be be able to reproduce finite element pb such as
the Poisson example (petsc/src/snes/examples/tutorials/ex12.c) and ultimately
a Stokes problem such as in (petsc/src/snes/examples/tutorials/ex12.c).
The main hurdle I am facing is the wrapping of the PetscDSSetResidual (and
PetscDSSetJacobian) function which set the Residual integrand f0 and f1 as
callback functions.
see PETSc doc here
The signature of those callback functions is as follow:
Ideally I would like those functions to be written in python in a way similar to
what has been done for the SNESSetFunction, SNESSetJacobian etc.
It would be great if a pointer to the DS could be added to the list of arguments
passed to the above function.
Another possibility would be to add a void pointer to the argument passed to the
f* function that could be used to provide some context information...
This requires some changes in PETSc itself and I am not sure how we should
proceed. Maybe contact Matt Knepley directly?
I can't see any other way around it and I think this is also going to be a
problem for passing underworld function (whether they are C or python function).
For now julian uses the auxiliar fields on which he casts the required
information... but he still has to write the C function...
The text was updated successfully, but these errors were encountered: