| Line 9... |
Line 9... |
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "dvd_schm_basic_preconf"
|
#define __FUNCT__ "dvd_schm_basic_preconf"
|
PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d, dvdBlackboard *b,
|
PetscErrorCode dvd_schm_basic_preconf(dvdDashboard *d, dvdBlackboard *b,
|
PetscInt max_size_V, PetscInt min_size_V, PetscInt bs, PetscInt ini_size_V,
|
PetscInt max_size_V, PetscInt min_size_V, PetscInt bs, PetscInt ini_size_V,
|
Vec *initV, PetscInt size_initV, PetscInt plusk, PC pc, HarmType_t harmMode,
|
Vec *initV, PetscInt size_initV, PetscInt plusk, PC pc, HarmType_t harmMode,
|
KSP ksp)
|
KSP ksp, InitType_t init)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscInt check_sum0, check_sum1;
|
PetscInt check_sum0, check_sum1;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
| Line 28... |
Line 28... |
/* Setup basic management of V */
|
/* Setup basic management of V */
|
dvd_managementV_basic(d, b, bs, max_size_V, min_size_V, plusk,
|
dvd_managementV_basic(d, b, bs, max_size_V, min_size_V, plusk,
|
harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);
|
harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);
|
|
|
/* Setup the initial subspace for V */
|
/* Setup the initial subspace for V */
|
if (initV)
|
if (initV) dvd_initV_user(d, b, initV, size_initV, ini_size_V);
|
dvd_initV_user(d, b, initV, size_initV, ini_size_V);
|
else switch(init) {
|
else
|
case DVD_INITV_CLASSIC: dvd_initV_classic(d, b, ini_size_V); break;
|
dvd_initV_classic(d, b, ini_size_V);
|
case DVD_INITV_KRYLOV: dvd_initV_krylov(d, b, ini_size_V); break;
|
|
}
|
|
|
/* Setup basic testing convergence routines */
|
/* Setup basic testing convergence routines */
|
dvd_testconv_basic(d, b);
|
dvd_testconv_basic(d, b);
|
|
|
/* Setup Raileigh-Ritz for selecting the best eigenpairs in V */
|
/* Setup Raileigh-Ritz for selecting the best eigenpairs in V */
|
dvd_calcpairs_qz(d, b, PETSC_NULL);
|
dvd_calcpairs_qz(d, b, PETSC_NULL);
|
|
if (harmMode != DVD_HARM_NONE)
|
|
dvd_harm_conf(d, b, harmMode, PETSC_FALSE, 0.0);
|
|
|
/* Setup the preconditioner */
|
/* Setup the preconditioner */
|
if (pc == 0) dvd_jacobi_precond(d, b);
|
if (pc == 0) dvd_jacobi_precond(d, b);
|
else dvd_static_precond_PC(d, b, pc);
|
else dvd_static_precond_PC(d, b, pc);
|
|
|
| Line 50... |
Line 53... |
//dvd_improvex_gdbasic(d, b, PETSC_NULL, PETSC_NULL);
|
//dvd_improvex_gdbasic(d, b, PETSC_NULL, PETSC_NULL);
|
dvd_improvex_gdolsen(d, b, PETSC_FALSE);
|
dvd_improvex_gdolsen(d, b, PETSC_FALSE);
|
else {
|
else {
|
dvd_improvex_jd(d, b, ksp);
|
dvd_improvex_jd(d, b, ksp);
|
dvd_improvex_jd_proj_uv(d, b, PETSC_FALSE, PETSC_TRUE);
|
dvd_improvex_jd_proj_uv(d, b, PETSC_FALSE, PETSC_TRUE);
|
dvd_improvex_jd_lit_const(d, b, 0, 0.0);
|
dvd_improvex_jd_lit_const(d, b, 0, 0.0, 0.0);
|
}
|
}
|
}
|
}
|
|
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
| Line 64... |
Line 67... |
EXTERN_C_BEGIN
|
EXTERN_C_BEGIN
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "dvd_schm_basic_conf"
|
#define __FUNCT__ "dvd_schm_basic_conf"
|
PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d, dvdBlackboard *b,
|
PetscErrorCode dvd_schm_basic_conf(dvdDashboard *d, dvdBlackboard *b,
|
PetscInt max_size_V, PetscInt min_size_V, PetscInt bs, PetscInt ini_size_V,
|
PetscInt max_size_V, PetscInt min_size_V, PetscInt bs, PetscInt ini_size_V,
|
Vec *initV, PetscInt size_initV, PetscInt plusk, PC pc, Vec diagA, IP ip,
|
Vec *initV, PetscInt size_initV, PetscInt plusk, PC pc, IP ip,
|
HarmType_t harmMode, PetscTruth fixedTarget, PetscScalar t, KSP ksp)
|
HarmType_t harmMode, PetscTruth fixedTarget, PetscScalar t, KSP ksp,
|
|
PetscReal fix, InitType_t init)
|
{
|
{
|
PetscInt check_sum0, check_sum1, maxits;
|
PetscInt check_sum0, check_sum1, maxits;
|
Vec *fv;
|
Vec *fv;
|
PetscScalar *fs;
|
PetscScalar *fs;
|
PetscReal tol;
|
PetscReal tol;
|
| Line 86... |
Line 90... |
/* Setup basic management of V */
|
/* Setup basic management of V */
|
dvd_managementV_basic(d, b, bs, max_size_V, min_size_V, plusk,
|
dvd_managementV_basic(d, b, bs, max_size_V, min_size_V, plusk,
|
harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);
|
harmMode==DVD_HARM_NONE?PETSC_FALSE:PETSC_TRUE);
|
|
|
/* Setup the initial subspace for V */
|
/* Setup the initial subspace for V */
|
if (initV)
|
if (initV) dvd_initV_user(d, b, initV, size_initV, ini_size_V);
|
dvd_initV_user(d, b, initV, size_initV, ini_size_V);
|
else switch(init) {
|
else
|
case DVD_INITV_CLASSIC: dvd_initV_classic(d, b, ini_size_V); break;
|
dvd_initV_classic(d, b, ini_size_V);
|
case DVD_INITV_KRYLOV: dvd_initV_krylov(d, b, ini_size_V); break;
|
|
}
|
|
|
/* Setup basic testing convergence routines */
|
/* Setup basic testing convergence routines */
|
dvd_testconv_basic(d, b);
|
dvd_testconv_basic(d, b);
|
|
|
/* Setup Raileigh-Ritz for selecting the best eigenpairs in V */
|
/* Setup Raileigh-Ritz for selecting the best eigenpairs in V */
|
| Line 113... |
Line 118... |
dvd_improvex_jd(d, b, ksp);
|
dvd_improvex_jd(d, b, ksp);
|
dvd_improvex_jd_proj_uv(d, b, DVD_ISNOT(d->sEP, DVD_EP_HERMITIAN),
|
dvd_improvex_jd_proj_uv(d, b, DVD_ISNOT(d->sEP, DVD_EP_HERMITIAN),
|
PETSC_TRUE);
|
PETSC_TRUE);
|
ierr = KSPGetTolerances(ksp, &tol, PETSC_NULL, PETSC_NULL, &maxits);
|
ierr = KSPGetTolerances(ksp, &tol, PETSC_NULL, PETSC_NULL, &maxits);
|
CHKERRQ(ierr);
|
CHKERRQ(ierr);
|
dvd_improvex_jd_lit_const(d, b, maxits, tol);
|
dvd_improvex_jd_lit_const(d, b, maxits, tol, fix);
|
}
|
}
|
|
|
check_sum1 = b->max_size_V + b->max_size_auxV + b->max_size_auxS +
|
check_sum1 = b->max_size_V + b->max_size_auxV + b->max_size_auxS +
|
b->own_vecs + b->own_scalars + b->max_size_oldX;
|
b->own_vecs + b->own_scalars + b->max_size_oldX;
|
if ((check_sum0 != check_sum1) ||
|
if ((check_sum0 != check_sum1) ||
|
(fv + b->own_vecs != b->free_vecs) ||
|
(b->free_vecs - fv > b->own_vecs) ||
|
(fs + b->own_scalars < b->free_scalars))
|
(b->free_scalars - fs > b->own_scalars))
|
SETERRQ(1, "Something awful happened!");
|
SETERRQ(1, "Something awful happened!");
|
|
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
EXTERN_C_END
|
EXTERN_C_END
|