PetscErrorCode PCSetFromOptions_Exotic(PetscOptions *PetscOptionsObject,PC pc) { PetscErrorCode ierr; PetscBool flg; PC_MG *mg = (PC_MG*)pc->data; PCExoticType mgctype; PC_Exotic *ctx = (PC_Exotic*) mg->innerctx; PetscFunctionBegin; ierr = PetscOptionsHead(PetscOptionsObject,"Exotic coarse space options"); CHKERRQ(ierr); ierr = PetscOptionsEnum("-pc_exotic_type","face or wirebasket","PCExoticSetType",PCExoticTypes,(PetscEnum)ctx->type,(PetscEnum*)&mgctype,&flg); CHKERRQ(ierr); if (flg) { ierr = PCExoticSetType(pc,mgctype); CHKERRQ(ierr); } ierr = PetscOptionsBool("-pc_exotic_direct_solver","use direct solver to construct interpolation","None",ctx->directSolve,&ctx->directSolve,NULL); CHKERRQ(ierr); if (!ctx->directSolve) { if (!ctx->ksp) { const char *prefix; ierr = KSPCreate(PETSC_COMM_SELF,&ctx->ksp); CHKERRQ(ierr); ierr = KSPSetErrorIfNotConverged(ctx->ksp,pc->erroriffailure); CHKERRQ(ierr); ierr = PetscObjectIncrementTabLevel((PetscObject)ctx->ksp,(PetscObject)pc,1); CHKERRQ(ierr); ierr = PetscLogObjectParent((PetscObject)pc,(PetscObject)ctx->ksp); CHKERRQ(ierr); ierr = PCGetOptionsPrefix(pc,&prefix); CHKERRQ(ierr); ierr = KSPSetOptionsPrefix(ctx->ksp,prefix); CHKERRQ(ierr); ierr = KSPAppendOptionsPrefix(ctx->ksp,"exotic_"); CHKERRQ(ierr); } ierr = KSPSetFromOptions(ctx->ksp); CHKERRQ(ierr); } ierr = PetscOptionsTail(); CHKERRQ(ierr); PetscFunctionReturn(0); }
void PETSC_STDCALL pcexoticsettype_(PC pc,PCExoticType *type, int *__ierr ){ *__ierr = PCExoticSetType( (PC)PetscToPointer((pc) ),*type); }