| Line 71... |
Line 71... |
if (!eps->OP) { ierr = EPSGetST(eps,&eps->OP);CHKERRQ(ierr); }
|
if (!eps->OP) { ierr = EPSGetST(eps,&eps->OP);CHKERRQ(ierr); }
|
ierr = STGetOperators(eps->OP,&A,&B);CHKERRQ(ierr);
|
ierr = STGetOperators(eps->OP,&A,&B);CHKERRQ(ierr);
|
if (!A) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_WRONGSTATE,"EPSSetOperators must be called first");
|
if (!A) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_WRONGSTATE,"EPSSetOperators must be called first");
|
ierr = MatGetSize(A,&eps->n,PETSC_NULL);CHKERRQ(ierr);
|
ierr = MatGetSize(A,&eps->n,PETSC_NULL);CHKERRQ(ierr);
|
ierr = MatGetLocalSize(A,&eps->nloc,PETSC_NULL);CHKERRQ(ierr);
|
ierr = MatGetLocalSize(A,&eps->nloc,PETSC_NULL);CHKERRQ(ierr);
|
|
ierr = SlepcMatGetVecsTemplate(A,&eps->t,PETSC_NULL);CHKERRQ(ierr);
|
|
|
/* Set default problem type */
|
/* Set default problem type */
|
if (!eps->problem_type) {
|
if (!eps->problem_type) {
|
if (B==PETSC_NULL) {
|
if (B==PETSC_NULL) {
|
ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr);
|
ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr);
|
| Line 142... |
Line 143... |
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Fold spectral transformation requires a Hermitian problem");
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Fold spectral transformation requires a Hermitian problem");
|
|
|
if (eps->nds>0) {
|
if (eps->nds>0) {
|
if (!eps->ds_ortho) {
|
if (!eps->ds_ortho) {
|
/* allocate memory and copy deflation basis vectors into DS */
|
/* allocate memory and copy deflation basis vectors into DS */
|
ierr = SlepcVecDuplicateVecs(eps->V[0],eps->nds,&newDS);CHKERRQ(ierr);
|
ierr = VecDuplicateVecs(eps->t,eps->nds,&newDS);CHKERRQ(ierr);
|
for (i=0;i<eps->nds;i++) {
|
for (i=0;i<eps->nds;i++) {
|
ierr = VecCopy(eps->DS[i],newDS[i]);CHKERRQ(ierr);
|
ierr = VecCopy(eps->DS[i],newDS[i]);CHKERRQ(ierr);
|
ierr = VecDestroy(&eps->DS[i]);CHKERRQ(ierr);
|
ierr = VecDestroy(&eps->DS[i]);CHKERRQ(ierr);
|
}
|
}
|
ierr = PetscFree(eps->DS);CHKERRQ(ierr);
|
ierr = PetscFree(eps->DS);CHKERRQ(ierr);
|
| Line 366... |
Line 367... |
.seealso: EPSSetDeflationSpace()
|
.seealso: EPSSetDeflationSpace()
|
@*/
|
@*/
|
PetscErrorCode EPSRemoveDeflationSpace(EPS eps)
|
PetscErrorCode EPSRemoveDeflationSpace(EPS eps)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscInt i;
|
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
if (!eps->ds_ortho) { /* before EPSSetUp, DS are just references */
|
ierr = VecDestroyVecs(eps->nds,&eps->DS);CHKERRQ(ierr);
|
for (i=0;i<eps->nds;i++) {
|
|
ierr = VecDestroy(&eps->DS[i]);CHKERRQ(ierr);
|
|
}
|
|
ierr = PetscFree(eps->DS);CHKERRQ(ierr);
|
|
} else {
|
|
ierr = SlepcVecDestroyVecs(eps->nds,&eps->DS);CHKERRQ(ierr);
|
|
}
|
|
eps->nds = 0;
|
eps->nds = 0;
|
eps->setupcalled = 0;
|
eps->setupcalled = 0;
|
eps->ds_ortho = PETSC_FALSE;
|
eps->ds_ortho = PETSC_FALSE;
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|