[petsc-users] passing variables into (*func)(KSP, Vec, void*) in the interface of KSPSetComputeRHS
Dave May
dave.mayhem23 at gmail.com
Sun Aug 4 11:18:54 CDT 2013
The last argument you give to KSPSetComputeRHS() will be passed into your
user defined function ComputeRHS(). All data needed to evaluate the rhs
should be made available through that pointer (void *ctx)
On Sunday, 4 August 2013, Roc Wang wrote:
> 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/8fe217ab/attachment.html>
More information about the petsc-users
mailing list