[petsc-users] Set the options NOT from argc and argv
Barry Smith
bsmith at mcs.anl.gov
Mon May 20 23:10:04 CDT 2013
PetscOptionsSetValue() call it for each option you want to set BEFORE the option will get used
On May 20, 2013, at 11:01 PM, Longxiang Chen <suifengls at gmail.com> wrote:
> The fortran program is too long (several files with more than 10,000 lines).
> And I just want to insert the P_solve inside one of the subroutine to solve Ax=b.
> Or it can only use argc and argv?
>
> Thanks.
> Longxiang
>
> Best regards,
> Longxiang Chen
>
> Do something every day that gets you closer to being done.
> --------------------------------------------------------------
> 465 Winston Chung Hall
> Computer Science Engineering
> University of California, Riverside
>
>
>
> On Mon, May 20, 2013 at 8:52 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On May 20, 2013, at 10:38 PM, Longxiang Chen <suifengls at gmail.com> wrote:
>
> > To whom it may concern,
> >
> > I am using KSP to solve Ax=b.
> > The main() is in Fortran, and it calls a function I write in C.The parameter is array A, x, b.
> >
> > void P_solve(double x[ ], double b[ ], double A[ ], int size);
> >
> > In the function, I should call PetscInitialize() before I create the matrix and vectors for A, x, b, and also call MatSetFromOptions() and VecSetFromOptions().
> >
> > But I don't have the argc and argv from main function.
>
> If Fortran is the main program the options database still has access to the command line arguments. You should still be able to use command line arguments and not need to set them in the program.
>
> Does this not work? Can you send a sample program where it does not work?
>
> Barry
>
> >
> > I just want to fix the KSP type to bcgs and the PC type.
> > Is there another way that I can set the options not through argc and argv, just set them in the program.
> >
> > e.g. options[] = {"-ksp_type", "bcgs"}.
> >
> > Thanks,
> > Longxiang
>
>
More information about the petsc-users
mailing list