[petsc-users] passing variables into (*func)(KSP, Vec, void*) in the interface of KSPSetComputeRHS

Roc Wang pengxwang at hotmail.com
Sun Aug 4 11:12:18 CDT 2013


Hello, I am developing a poisson solver based on the example code petsc-3.4.0/src/ksp/ksp/examples/tutorials/ex45.c.

I have a question on utilizing functions
 KSPSetComputeRHS (KSP ksp,PetscErrorCode (*func)(KSP,Vec,void*),void *ctx) and ComputeRHS(KSP,Vec,void*) which is the (*func)(KSP,Vec,void*) in the interface.  

Since I have source term generated on the right hand side of Poisson equation and they are computed outside KSPSetComputeRHS() and ComputeRHS(), an array of source term variables must be passed into ComuteRHS() function. From the manual online, it seems the interface of ComputeRHS is only for passing variables from inside of ComputeRHS to KSPSetComputeRHS. There is not a dummy for passing into ComputeRHS. Can anybody give me suggestions on it? Thanks in advance.


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130804/7a93a3e3/attachment.html>


More information about the petsc-users mailing list