| Line 160... |
Line 160... |
ierr = EPSDefaultGetWork(eps,1);CHKERRQ(ierr);
|
ierr = EPSDefaultGetWork(eps,1);CHKERRQ(ierr);
|
|
|
blopex->tol.absolute = eps->tol;
|
blopex->tol.absolute = eps->tol;
|
blopex->tol.relative = 1e-50;
|
blopex->tol.relative = 1e-50;
|
|
|
LOBPCG_InitRandomContext();
|
|
SLEPCSetupInterpreter(&blopex->ii);
|
SLEPCSetupInterpreter(&blopex->ii);
|
blopex->eigenvectors = mv_MultiVectorCreateFromSampleVector(&blopex->ii,eps->ncv,eps->V);
|
blopex->eigenvectors = mv_MultiVectorCreateFromSampleVector(&blopex->ii,eps->ncv,eps->V);
|
mv_MultiVectorSetRandom(blopex->eigenvectors,1234);
|
mv_MultiVectorSetRandom(blopex->eigenvectors,1234);
|
|
|
if (eps->nds > 0) {
|
if (eps->nds > 0) {
|
| Line 220... |
Line 219... |
else eps->reason = EPS_CONVERGED_TOL;
|
else eps->reason = EPS_CONVERGED_TOL;
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "EPSDestroy_BLOPEX"
|
#define __FUNCT__ "EPSReset_BLOPEX"
|
PetscErrorCode EPSDestroy_BLOPEX(EPS eps)
|
PetscErrorCode EPSReset_BLOPEX(EPS eps)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
EPS_BLOPEX *blopex = (EPS_BLOPEX *)eps->data;
|
EPS_BLOPEX *blopex = (EPS_BLOPEX *)eps->data;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
LOBPCG_DestroyRandomContext();
|
|
SLEPCSetupInterpreterForDignifiedDeath(&blopex->ii);
|
|
mv_MultiVectorDestroy(blopex->eigenvectors);
|
mv_MultiVectorDestroy(blopex->eigenvectors);
|
mv_MultiVectorDestroy(blopex->Y);
|
mv_MultiVectorDestroy(blopex->Y);
|
|
ierr = EPSReset_Default(eps);CHKERRQ(ierr);
|
|
PetscFunctionReturn(0);
|
|
}
|
|
|
|
#undef __FUNCT__
|
|
#define __FUNCT__ "EPSDestroy_BLOPEX"
|
|
PetscErrorCode EPSDestroy_BLOPEX(EPS eps)
|
|
{
|
|
PetscErrorCode ierr;
|
|
|
|
PetscFunctionBegin;
|
|
LOBPCG_DestroyRandomContext();
|
ierr = PetscFree(eps->data);CHKERRQ(ierr);
|
ierr = PetscFree(eps->data);CHKERRQ(ierr);
|
ierr = EPSDestroy_Default(eps);CHKERRQ(ierr);
|
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
EXTERN_C_BEGIN
|
EXTERN_C_BEGIN
|
#undef __FUNCT__
|
#undef __FUNCT__
|
| Line 246... |
Line 254... |
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
EPS_BLOPEX *blopex;
|
EPS_BLOPEX *blopex;
|
const char* prefix;
|
const char* prefix;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
ierr = STSetType(eps->OP,STPRECOND);CHKERRQ(ierr);
|
|
ierr = STPrecondSetKSPHasMat(eps->OP,PETSC_TRUE);CHKERRQ(ierr);
|
|
|
|
ierr = PetscNewLog(eps,EPS_BLOPEX,&blopex);CHKERRQ(ierr);
|
ierr = PetscNewLog(eps,EPS_BLOPEX,&blopex);CHKERRQ(ierr);
|
ierr = KSPCreate(((PetscObject)eps)->comm,&blopex->ksp);CHKERRQ(ierr);
|
|
ierr = EPSGetOptionsPrefix(eps,&prefix);CHKERRQ(ierr);
|
|
ierr = KSPSetOptionsPrefix(blopex->ksp,prefix);CHKERRQ(ierr);
|
|
ierr = KSPAppendOptionsPrefix(blopex->ksp,"eps_blopex_");CHKERRQ(ierr);
|
|
eps->data = (void*)blopex;
|
eps->data = (void*)blopex;
|
eps->ops->setup = EPSSetUp_BLOPEX;
|
eps->ops->setup = EPSSetUp_BLOPEX;
|
eps->ops->setfromoptions = PETSC_NULL;
|
|
eps->ops->destroy = EPSDestroy_BLOPEX;
|
eps->ops->destroy = EPSDestroy_BLOPEX;
|
|
eps->ops->reset = EPSReset_BLOPEX;
|
eps->ops->backtransform = EPSBackTransform_Default;
|
eps->ops->backtransform = EPSBackTransform_Default;
|
eps->ops->computevectors = EPSComputeVectors_Default;
|
eps->ops->computevectors = EPSComputeVectors_Default;
|
|
ierr = KSPCreate(((PetscObject)eps)->comm,&blopex->ksp);CHKERRQ(ierr);
|
|
ierr = EPSGetOptionsPrefix(eps,&prefix);CHKERRQ(ierr);
|
|
ierr = KSPSetOptionsPrefix(blopex->ksp,prefix);CHKERRQ(ierr);
|
|
ierr = KSPAppendOptionsPrefix(blopex->ksp,"eps_blopex_");CHKERRQ(ierr);
|
|
ierr = STSetType(eps->OP,STPRECOND);CHKERRQ(ierr);
|
|
ierr = STPrecondSetKSPHasMat(eps->OP,PETSC_TRUE);CHKERRQ(ierr);
|
|
LOBPCG_InitRandomContext();
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
EXTERN_C_END
|
EXTERN_C_END
|
|
|
|
|