[petsc-users] using PCFieldSplitGetSubKSP in c++

Klaij, Christiaan C.Klaij at marin.nl
Mon Mar 12 02:56:46 CDT 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];
>>
>
>Declare this as KSP *subksp;
>
>   Matt
>

Thanks Matt, but when I do that I cannot use KSPSetNullSpace:

  KSP *subksp[2];
  PetscInt n=2;
  ierr = PCFieldSplitGetSubKSP(pc,&n,subksp); CHKERRQ(ierr);
  ierr = KSPSetNullSpace(subksp[1],subnullsp); CHKERRQ(ierr);

This gives the error:

 error: argument of type "KSP *" is incompatible with parameter of type
 "KSP"
    ierr = KSPSetNullSpace(subksp[1],subnullsp); CHKERRQ(ierr);
                           ^


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