[petsc-users] PetscOptionsGetRealArray command line format

Xiangdong epscodes at gmail.com
Fri Feb 14 14:47:05 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.
>
> > 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.
>


Now I see some random behavior. After compiling the code, for the same
command line input, the output sometimes are correct (print values
1,2,3,4,5 with nmax=5), but sometime output all zeros (nmax is zero). I did
not change anything, but just running same input many times.

Any hints for this random behavior? Thank you.

Xiangdong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140214/0481b0fb/attachment.html>


More information about the petsc-users mailing list