[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
adding support for custom call to inner linear solve in SNES
- To: petsc-dev@xxxxxxxxxxx
- Subject: adding support for custom call to inner linear solve in SNES
- From: "Lisandro Dalcin" <dalcinl@xxxxxxxxx>
- Date: Tue, 7 Aug 2007 20:12:58 -0300
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=na4YgXzBpU5WwfUg5efHybu6X5GuAxSNGCsCn+NzQXy7WEvHrU/oKjXgRee2PfvCg8IGAiXNhk/iYKQgvK0MVNjdwFU8VSgEvl/bGkwsnH6S8G4p0TaGmLM0RWqInZNNfSE/3IS2gX63MRjTRQAooPAkXgPIbVkX7F/YhsrQe1M=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=gY2+cp5Shgi+5PRE+3A1yu27OxGJFABP/XKwEFpm+Nm5JZkW5ZOMiLDH7GcC8R9lyWorniquPkAYITYGlutqODDfzGf1IH4j/J59x9d8eKKKQIhHSgomBWPmxfh9Oppp/qUk0oA+CdDPTru+x41aP7MAPHvBPsYaH/tqoa2z8kU=
- Reply-to: petsc-dev@xxxxxxxxxxx
- Sender: owner-petsc-dev@xxxxxxxxxxx
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