I think it is best to code the modified GMRES method in C; likely, much of the current GMRES code could be reused. We'd be happy to help incorporate it into PETSc.
Barry > On Jan 22, 2025, at 5:11 PM, Matthew Knepley <knep...@gmail.com> wrote: > > On Wed, Jan 22, 2025 at 3:18 PM Frank Bramkamp <bramk...@nsc.liu.se > <mailto:bramk...@nsc.liu.se>> wrote: >> Dear PETSc team, >> >> I was planning to program a custom KSP method, some modified GMRES. >> We mainly use PETSc from Fortran. Therefore I wonder it is possible >> to have an interface to a custom KSP solver that is written in fortran. >> >> I thought of using KSPRegister to register my own routine, but that seems >> only >> available in C. Or is it possible to have a fortran/C wrapper to do that ? > > We have wrappers for other functions that take callbacks, such as > SNESSetFunction(). What > we need to do is have a list of Fortran function pointers for this method. > They when you > register, we actually stick in a C wrapper that calls your Fortran function > pointer that we have > stored in our list. It should be straightforward looking at the > implementation for something like > SNESSetFunction(). We would help if you want to try :) > > Barry, is this impacted by your binding rewrite? > > Thanks, > > Matt > >> Thanks, Frank Bramkamp >> >> >> >> >> > > > > -- > 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 > > https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!fZ-M6nCWDDSrX42HCG2Hd_eMWEdTWiNP56U7piFnAZP-_DkwvSartT6C_Ioe5Aay6Q2Ts_7l_vkJQSAUzZxWHPo$ > > <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!eRXZvRoV2JfqzeOdQlhP6UA71kWfULNX_F1C0-Fer5IItdUKkmstwIO3N1VrmApHJYGGisuS6EyybdCUXUwi$>