Subversion Repositories slepc-dev

Rev

Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2611 Rev 2616
Line 36... Line 36...
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
  PetscBool      flg,op;
  PetscBool      flg,op;
  PetscInt       opi,opi0;
  PetscInt       opi,opi0;
  PetscReal      opf;
  PetscReal      opf;
 
  KSP            ksp;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  ierr = PetscOptionsHead("EPS Jacobi-Davidson (JD) Options");CHKERRQ(ierr);
  ierr = PetscOptionsHead("EPS Jacobi-Davidson (JD) Options");CHKERRQ(ierr);
 
 
  ierr = EPSJDGetKrylovStart(eps,&op);CHKERRQ(ierr);
  ierr = EPSJDGetKrylovStart(eps,&op);CHKERRQ(ierr);
Line 75... Line 76...
 
 
  ierr = PetscOptionsInt("-eps_jd_qwindow","Set the number of converged vectors in the projected problem","EPSJDSetWindowSizes",opi0,&opi0,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_jd_qwindow","Set the number of converged vectors in the projected problem","EPSJDSetWindowSizes",opi0,&opi0,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSJDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); }
  if(flg) { ierr = EPSJDSetWindowSizes(eps,opi,opi0);CHKERRQ(ierr); }
 
 
  ierr = PetscOptionsTail();CHKERRQ(ierr);
  ierr = PetscOptionsTail();CHKERRQ(ierr);
 
 
 
  /* Set STPrecond as the default ST */
 
  if (!((PetscObject)eps->OP)->type_name) {
 
    ierr = STSetType(eps->OP,STPRECOND);CHKERRQ(ierr);
 
  }
 
  ierr = STPrecondSetKSPHasMat(eps->OP,PETSC_FALSE);CHKERRQ(ierr);
 
 
 
  /* Set the default options of the KSP */
 
  ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
 
  if (!((PetscObject)ksp)->type_name) {
 
    ierr = KSPSetType(ksp,KSPGMRES);CHKERRQ(ierr);
 
    ierr = KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);CHKERRQ(ierr);
 
  }
 
 
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}  
}  
EXTERN_C_END
EXTERN_C_END
 
 
#undef __FUNCT__  
#undef __FUNCT__  
Line 88... Line 103...
  PetscErrorCode ierr;
  PetscErrorCode ierr;
  PetscBool      t;
  PetscBool      t;
  KSP            ksp;
  KSP            ksp;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
 
 
  /* Setup common for all davidson solvers */
  /* Setup common for all davidson solvers */
  ierr = EPSSetUp_Davidson(eps);CHKERRQ(ierr);
  ierr = EPSSetUp_Davidson(eps);CHKERRQ(ierr);
 
 
  /* Check some constraints */
  /* Set the default options of the KSP */
  ierr = STSetUp(eps->OP);CHKERRQ(ierr);
 
  ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
  ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
 
  if (!((PetscObject)ksp)->type_name) {
 
    ierr = KSPSetType(ksp,KSPGMRES);CHKERRQ(ierr);
 
    ierr = KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);CHKERRQ(ierr);
 
  }
 
 
 
  /* Check some constraints */
  ierr = PetscTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr);
  ierr = PetscTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr);
  if (t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"EPSJD does not work with KSPPREONLY");
  if (t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"EPSJD does not work with KSPPREONLY");
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
Line 105... Line 126...
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSCreate_JD"
#define __FUNCT__ "EPSCreate_JD"
PetscErrorCode EPSCreate_JD(EPS eps)
PetscErrorCode EPSCreate_JD(EPS eps)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
  KSP            ksp;
 
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  /* Load the Davidson solver */
  /* Load the Davidson solver */
  ierr = EPSCreate_Davidson(eps);CHKERRQ(ierr);
  ierr = EPSCreate_Davidson(eps);CHKERRQ(ierr);
 
 
  /* Set the default ksp of the st to gmres */
 
  ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
 
  ierr = KSPSetType(ksp,KSPGMRES);CHKERRQ(ierr);
 
  ierr = KSPSetTolerances(ksp,1e-4,PETSC_DEFAULT,PETSC_DEFAULT,90);CHKERRQ(ierr);
 
 
 
  /* Overload the JD properties */
  /* Overload the JD properties */
  eps->ops->setfromoptions       = EPSSetFromOptions_JD;
  eps->ops->setfromoptions       = EPSSetFromOptions_JD;
  eps->ops->setup                = EPSSetUp_JD;
  eps->ops->setup                = EPSSetUp_JD;
  eps->ops->destroy              = EPSDestroy_JD;
  eps->ops->destroy              = EPSDestroy_JD;