The check is simply if (A->rmap->n == PETSC_DECIDE || A->cmap->n == PETSC_DECIDE) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Must give local row and column count for matrix");
it is basically a "make sure the user doesn't shoot himself in the foot" check. I can see arguments both ways but since PETSc is suppose to be as flexible as possible and give as much choice to the user as possible I am going to take that check out of petsc-dev (you can just remove this one line from your copy of src/mat/impls/shell/shell.c ) and give the choice to the user. Barry On Jun 25, 2010, at 1:39 AM, Klaij, Christiaan wrote: > I thought the spirit of ex15f was to only specify global dimensions and let > PETSc take care of the partitioning at runtime. So I was expecting > > call MatCreateShell(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE, > m*n,m*n,PETSC_NULL_INTEGER,AA,ierr) > > which is illegal. But thanks to your explanation I understand why. Of course > it's much beter to check what PETSc decided and use it for my own MatMult. > Thanks for clearing this up! > > Chris > > > Date: Thu, 24 Jun 2010 13:00:54 +0200 > From: Jed Brown <jed at 59A2.org> > Subject: Re: [petsc-users] MatShell & PCShell > To: "Klaij\, Christiaan" <C.Klaij at marin.nl>, > "petsc-users\@mcs.anl.gov" <petsc-users at mcs.anl.gov> > Message-ID: <87vd98pue1.fsf at 59A2.org> > Content-Type: text/plain; charset=us-ascii > > On Thu, 24 Jun 2010 08:08:37 +0000, "Klaij, Christiaan" <C.Klaij at marin.nl> > wrote: >> Thanks! I modified ex15f so that it uses a new MatShell AA with >> associated multiplication Ax. Only problem is that MatCreateShell >> expects the local matrix dimensions which is somewhat contrary to the >> spirit of ex15f, but at least I got it working for one proc. > > How is this contrary to the spirit? It needs to be determined for > compatibility with the vector you will multiply against. Perhaps it > should determine this automatically, but it's easy to provide, and > allows PETSc to check for this compatibility before calling your > function. If it was determined automatically, then you would have to > check what PETSc decided so you can set up your internal data structures > (which you usually need in your implementation of MatMult) > appropriately. I think it's more common to create these structures > first, then call MatCreateShell, in which case you know the local sizes. > > Jed > > > dr. ir.ChristiaanKlaij > CFD Researcher > Research & Development > E mailto:C.Klaij at marin.nl > T +31 317 49 33 44M > > 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 > > > > ----------------------------- > [Insert your disclaimer here] > ----------------------------- >
