[petsc-users] Comprehensive example for KSPRegister()

Barry Smith bsmith at mcs.anl.gov
Fri Jul 29 10:39:02 CDT 2016


> On Jul 28, 2016, at 12:22 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Thu, Jul 28, 2016 at 9:07 AM, JC <loiseau.jc at gmail.com> wrote:
> Hey everyone,
> 
> I was wondering if any of you had a comprehensive example of KSPRegister() to create our own KSP solver in fortran?
> I have tried to look online but have not been able to find it.
> 
> We do not currently have one in Fortran, although we do in C.

   Basically you would copy the file src/ksp/ksp/impls/cg/cg.c and replace the bodies of each of the methods (KSPSolve_CG etc) with calls to your Fortran routines that implement each method.    Given the large number of KSP methods we already have implemented if what you want to implement is a variation of what we already have it would likely require much less new code if you worked in C and simple derived off a subclass of an already implemented class where you made the the changes.



   Barry

> 
>   Thanks,
> 
>      Matt
>  
> Thanks a lot,
> JC
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener



More information about the petsc-users mailing list