[petsc-dev] How to pass user data to a registered PC (PCRegister) ?

Franck Houssen franck.houssen at inria.fr
Thu Dec 28 09:34:15 CST 2017


How to pass user data to a registered PC (PCRegister) ? 

At first, I expected the signature would be "PetscErrorCode PCRegister(const char sname[],PetscErrorCode (*function)(PC, void * ))" but it turns out to be "PetscErrorCode PCRegister(const char sname[],PetscErrorCode (*function)( PC ))" 

I try to integrate a PC that needs A but also other informations (dof multiplicities, domain intersections that the user must provide). I guess I can get A with PCGetOperators in the setup callback of the PC. But still not sure how to pass the other informations if I get to use PCRegister. I looked a few examples in the bitbucket (jacobi: src/ksp/ksp/examples/tutorials/ex12.c and src/ksp/pc/impls/jacobi/jacobi.c + SOR: src/ksp/pc/impls/sor/sor.c)... But didn't get any real relevant answer and feel a bit lost among the numerous pc !... 

The idea is: for now I use PCSetType(pc, PCSHELL) and PCShellSetContext with a context who knows the extra needed informations which is "not so handy" (that's OK as for now I am both the user and the PC provider). I'd like to package this in a more convenient way (a unique and "simple" call to PCRegister) to decouple the user from the PC machinery. 

Franck 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171228/404a8f50/attachment.html>


More information about the petsc-dev mailing list