I've fixed KSPDestroy() to use user provided destroy routine for
convergence context. Please review.

BTW, from some time ago in petsc4py I hack things to use the default
convergence test as below. Does it make sense to use this on
KSPDefaultConverged? If not, I thing an error should be generated if
the norm type is KSP_NORM_NO. What do you think?

#undef __FUNCT__
#define __FUNCT__ "KSPDefaultConverged_Safe"
static PetscErrorCode
KSPDefaultConverged_Safe(KSP ksp,
                         PetscInt its, PetscReal rnorm,
                         KSPConvergedReason* reason, void* ctx)
{
  KSPNormType    normtype;
  PetscErrorCode ierr;
  PetscFunctionBegin;
  ierr = KSPGetNormType(ksp, &normtype); CHKERRQ(ierr);
  if (normtype == KSP_NORM_NO) {
    ierr = KSPSkipConverged(ksp,its,rnorm,reason,ctx);CHKERRQ(ierr);
  } else {
    ierr = KSPDefaultConverged(ksp,its,rnorm,reason,ctx);CHKERRQ(ierr);
  }
  PetscFunctionReturn(0);
}



-- 
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