<div dir="ltr">On Mon, May 20, 2013 at 11:01 PM, Longxiang Chen <span dir="ltr"><<a href="mailto:suifengls@gmail.com" target="_blank">suifengls@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>The fortran program is too long (several files with more than 10,000 lines).<br>And I just want to insert the P_solve inside one of the subroutine to solve Ax=b.<br>
</div>Or it can only use argc and argv?<br></div></div></div></blockquote><div><br></div><div style>Barry is correct that you can use PetscOptionsSetValue(), however I think you are</div><div style>still missing the point.</div>
<div style><br></div><div style>Command line options are processed in PetscInitialize(). You do not have to do anything</div><div style>else. You do not have to change your huge Fortran code. You just use the command line.</div>
<div style>It is much better than hard coding a solver type since you can use ALL solver types. There</div><div style>is no reason not to use it.</div><div style><br></div><div style>  Thanks,</div><div style><br></div><div style>
     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div></div>Thanks.<br></div>Longxiang<br></div><div class="gmail_extra">
<br clear="all"><div><div dir="ltr">Best regards,<div>Longxiang Chen</div><div><br></div><div>Do something every day that gets you closer to being done.</div>

<div>--------------------------------------------------------------</div><div>465 Winston Chung Hall</div><div>Computer Science Engineering</div><div>University of California, Riverside</div><div><br></div></div></div><div>
<div class="h5">
<br><br><div class="gmail_quote">On Mon, May 20, 2013 at 8:52 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><br>
On May 20, 2013, at 10:38 PM, Longxiang Chen <<a href="mailto:suifengls@gmail.com" target="_blank">suifengls@gmail.com</a>> wrote:<br>
<br>
> To whom it may concern,<br>
><br>
> I am using KSP to solve Ax=b.<br>
> The main() is in Fortran, and it calls a function I write in C.The parameter is array A, x, b.<br>
><br>
> void P_solve(double x[ ], double b[ ], double A[ ], int size);<br>
><br>
> In the function, I should call PetscInitialize() before I create the matrix and vectors for A, x, b, and also call MatSetFromOptions() and VecSetFromOptions().<br>
><br>
> But I don't have the argc and argv from main function.<br>
<br>
</div>    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.<br>
<br>
     Does this not work? Can you send a sample program where it does not work?<br>
<span><font color="#888888"><br>
   Barry<br>
</font></span><div><div><br>
><br>
> I just want to fix the KSP type to bcgs and the PC type.<br>
> Is there another way that I can set the options not through argc and argv, just set them in the program.<br>
><br>
> e.g. options[] = {"-ksp_type", "bcgs"}.<br>
><br>
> Thanks,<br>
> Longxiang<br>
<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>