I would like to add some support in SNES to enable users to customize
the inner call to KSPSolve(). The approach amount to implement
something like this:

#undef __FUNCT__
#define __FUNCT__ "SNES_KSPSolve"
PetscErrorCode SNES_KSPSolve(SNES snes, KSP ksp, Vec b, Vec x)
{
  PetscErrorCode ierr;

  PetscFunctionBegin;
  if (snes->ksp_ewconv) { ierr =
SNESKSPEW_PreSolve(snes,ksp,b,x);CHKERRQ(ierr);  }
  if (snes->ops->linsolve) {
    ierr = (*snes->ops->linsolve)(snes, ksp, b, x);CHKERRQ(ierr);
  } else {
    ierr = KSPSolve(ksp,b,x);CHKERRQ(ierr);
  }
  if (snes->ksp_ewconv) { ierr =
SNESKSPEW_PostSolve(snes,ksp,b,x);CHKERRQ(ierr); }
  PetscFunctionReturn(0);
}

and, of course, add a routine to let users set their custom linear
solve routine.

Is this fine? Is it open-door for too-much user hackery? There could
be a better way to enable something like this?

I am also thinking (if there is no objection) in adding support for
setting a PreSolve and a PostSolve routine, but not sure what the
interface of the callback functions should be, and if the presolve
routine should be called after of before SNESSetUp().


-- 
Lisandro Dalc?n
---------------
Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC)
Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC)
Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET)
PTLC - G?emes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


Reply via email to