[petsc-users] PetscOptionsGetRealArray command line format
Xiangdong
epscodes at gmail.com
Fri Feb 14 13:10:39 CST 2014
On Fri, Feb 14, 2014 at 1:31 PM, Jed Brown <jed at jedbrown.org> wrote:
> Xiangdong <epscodes at gmail.com> writes:
>
> > I tired that, however it does not work either.
>
> "does not work" is not specific.
>
It always crashed before, but I just figured out the reason. I use
CHKERRQ(ierr) right after PetscOptionsGetRealArray. However, I forgot to
set ierr to be the return value of that function call.
Thanks a lot for your help.
Xiangdong
>
> > I call the function like this:
> > double myarray[10];
> > int nmax=10;
> > PetscOptionsGetRealArray(PETSC_NULL,'-myarray', myarray, &nmax,&flg);
>
> printf("nmax = %d\n",nmax);
> for (i=0; i<nmax; i++) {
> printf(" %g\n",myarray[i]);
> }
>
>
> Also, please just use NULL.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140214/12657d0c/attachment.html>
More information about the petsc-users
mailing list