[petsc-users] Multiple solves with PCMG fail

Mark Adams mfadams at lbl.gov
Tue Oct 21 20:52:13 CDT 2014


>
>
> 1) the asserts
>  PetscValidScalarPointer(r,3);
>   PetscValidScalarPointer(c,4);
>
>   are over zealous. They should actually be if (n)
> PetscValidScalarPointer(r,3);
>
>
That fixed the problem.


>   BTW: we should have an additional assert that n >=0
>

I guess I should have done a if (n<0) SETERRQ(...

>
>   ierr = PetscMemzero(c,nmax*sizeof(PetscReal));CHKERRQ(ierr);
>   if (!n) {
>     *r = 0.0;
>    ^^^^ assumes there is space in r for something even if the array
> dimension is zero which is not good.
>
>
 I'm not sure how to test this so I just protected this line.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141021/63225ab3/attachment-0001.html>


More information about the petsc-users mailing list