adding support for custom call to inner linear solve in SNES
Barry Smith
bsmith at mcs.anl.gov
Tue Aug 7 22:35:52 CDT 2007
Lisandro,
What problem is this suppose to be solving? Can you give an
example of linsolve()?
Barry
On Tue, 7 Aug 2007, Lisandro Dalcin wrote:
> 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().
>
>
>
More information about the petsc-dev
mailing list