[petsc-users] using PCFieldSplitGetSubKSP in c++
Klaij, Christiaan
C.Klaij at marin.nl
Thu Mar 8 03:17:08 CST 2012
This may be a dumb question (new to c++), well anyway: I'm trying
to get the sub KSP associated with the Schur complement S, in
order to set the null space. This is the code:
KSP subksp[2];
PetscInt n=2;
ierr = PCFieldSplitGetSubKSP(pc,&n,&subksp); CHKERRQ(ierr);
ierr = KSPSetNullSpace(subksp[1],subnullsp); CHKERRQ(ierr);
It gives the following compiler error:
error: argument of type "KSP (*)[2]" is incompatible with parameter of type "KSP **"
ierr = PCFieldSplitGetSubKSP(pc,&n,&subksp); CHKERRQ(ierr);
^
So I changed the code to:
KSP *subksp[2];
PetscInt n=2;
ierr = PCFieldSplitGetSubKSP(pc,&n,subksp); CHKERRQ(ierr);
ierr = KSPSetNullSpace(subksp[1],subnullsp); CHKERRQ(ierr);
Now I get the error:
error: argument of type "KSP *" is incompatible with parameter of type "KSP"
ierr = KSPSetNullSpace(subksp[1],subnullsp); CHKERRQ(ierr);
^
What is the proper way to set the null space of the Schur
complement? I already have the null space of the matrix [A00 A01,
A10 A11], the null space of A11 - A10 inv(A00) A01 is clearly
related and could perhaps be deduced somehow?
dr. ir. Christiaan Klaij
CFD Researcher
Research & Development
E mailto:C.Klaij at marin.nl
T +31 317 49 33 44
MARIN
2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
T +31 317 49 39 11, F +31 317 49 32 45, I www.marin.nl
More information about the petsc-users
mailing list