> On May 29, 2015, at 10:32 AM, Mark Adams <[email protected]> wrote: > > I am getting errors in code that I thought was working ... > > I create a PC shell like so: > > ! set shell PC > call SNESGetKSP(solver%snes,innerksp,ierr) > call KSPGetPC(innerksp,spc,ierr) > call PCSetType(spc,PCSHELL,ierr) ! overriding opions !!! > call PCShellSetApply(spc,PCShermanMorrisonApply,ierr) > call PCSetApplicationContext(spc,solver,ierr) > > and in PCShermanMorrisonApply I have: > > call PCGetApplicationContext(pc,solver,ierr) > call > DMCompositeGetAccessArray(solver%da,xin,itwo,PETSC_NULL_INTEGER,Xsub,ierr) > call > DMCompositeGetAccessArray(solver%da,yout,itwo,PETSC_NULL_INTEGER,Ysub,ierr) > call PCFieldSplitGetSubKSP(solver%pc,PETSC_NULL_INTEGER,subksp,ierr) > call KSPSolve(subksp(1),Xsub(1),Ysub(1),ierr) > call MatMult(solver%Cmat,Ysub(1),Xsub(2),ierr) ! ignoring <> input > > I get an error on this last statement about a vector being locked.
What vector? the Xsub(2) vector? Based on the names of the variable I am guessing that xin is the input vector to your Apply() hence it is read only. Thus Xsub is read only, but you are trying to put the results of a MatMult() int Xsub(2) which is completely wrong. You cannot use Xsub for work space because it will corrupt the outer solver. > There does not seem to be: > > call DMCompositeGetAccessArrayRead( ... There doesn't need to be. Internally the DMCompositeGetAccessArray() will make the subvectors read only if the large vector is read only. > > I thought I fixed this problem ... or at least one like it. > > Mark
