[petsc-users] Set the options NOT from argc and argv
Barry Smith
bsmith at mcs.anl.gov
Mon May 20 22:52:59 CDT 2013
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