I was referring to the input file of my application, I do not want to pass PETSc option by the command line or using another specific file input. <div><br></div><div>Anyway, I tried the strategy "<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">KSPSetOptionsPrefix(..)"/"SNES</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">SetOptionsPrefix(...);</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">" + "</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">PetscOptionsSetValue(...)</span><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">" and it works very well!!! But now I have another question. Using these routines, every time I cyclically call KSP and/or SNES in my program I put new options inside the PETSc option database. Most of these options, that have the same prefix, are replicated. Is this a problem? Is it always true that I will use the last one inserted?</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Let's consider this example:</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">begin program </span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"> begin program iteration number 1</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"> CreateKSP(myksp1); </span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><meta charset="utf-8"><span class="Apple-style-span" style="font-size: 13px; "> PetscOptionsSetValue("-a", "1");</span></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="font-size: 13px; "> PetscOptionsSetValue("-b", "2");</span></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><span class="Apple-style-span" style="font-size: 13px; "><meta charset="utf-8"> KSPSolve(</span></span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp1</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">)</span></div>
<meta charset="utf-8"><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"> DestroyKSP(</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp1</span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">);</span></div>
<meta charset="utf-8"><div><font class="Apple-style-span" face="arial, sans-serif"><meta charset="utf-8"><div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> end program iteration number 1</span></font></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> </span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><meta charset="utf-8"><div style="border-collapse: separate; font-family: arial; ">
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> begin program iteration number 2</span></font></div><div style="border-collapse: separate; font-family: arial; ">
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> CreateKSP(</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp2</span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">); </span></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="font-size: 13px; "> PetscOptionsSetValue("-a", "5");</span></span></font></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="font-size: 13px; "> PetscOptionsSetValue("-c", "5");</span></span></font></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="font-size: 13px; "><meta charset="utf-8"> KSPSolve(</span></span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp2</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">);</span></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> DestroyKSP(</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp2</span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">);</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> end program iteration number 2</span></font></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><meta charset="utf-8"><div style="border-collapse: separate; font-family: arial; ">
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> begin program iteration number 3</span></font></div><div style="border-collapse: separate; font-family: arial; ">
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> CreateKSP(</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp3</span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">); </span></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="font-size: 13px; "> PetscOptionsSetValue("-a", "10");</span></span></font></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="font-size: 13px; "> PetscOptionsSetValue("-b", "20");</span></span></font></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="font-size: 13px; "> KESPSolve(</span></span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp3</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">);</span></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> DestroyKSP(</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">myksp3</span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">);</span></div>
<div style="border-collapse: separate; font-family: arial; "><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; "><div>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "> end program iteration number 3</span></font></div></span></span></font></div></font></div></font></div>
</font></div></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">end program</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">In the iteration 2 appears the option "-c", what can I do to remove the option "-b" inside the internal PETSc option database?</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">And similar, i</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">n the iteration 3 the option "-c" disappears and the option "-b" returns with a different value. What can I do to remove the option "-c" inside the internal PETSc option database?</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; "><br></span></div><meta charset="utf-8"><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Is there a routine that reset/empty completely the internal PETSc database option without terminate the program? Or the only way is to assign a different prefix for every program iteration?</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Thanks very much in advance,</span></font></div>
<meta charset="utf-8"><meta charset="utf-8"><meta charset="utf-8"><div>Cheers!</div><div><br clear="all">--<br>Filippo SPIGA, MSc Computer Science<br><div>~ homepage: <a href="http://tinyurl.com/fspiga" target="_blank">http://tinyurl.com/fspiga</a> ~<br>
<br>«Nobody will drive us out of Cantor's paradise.»<br> -- David Hilbert<br><br>*****<br>Disclaimer: "Please note this message and any attachment are CONFIDENTIAL an may be privileged or otherwise protected from disclosure. The contents are not to be disclosed to anyone other than the addressee. Unauthorized recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission."</div>
<br>
<br><br><div class="gmail_quote">On Fri, Dec 10, 2010 at 2:09 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org">jed@59a2.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">On Fri, Dec 10, 2010 at 19:54, Filippo Spiga <span dir="ltr"><<a href="mailto:filippo.spiga@disco.unimib.it" target="_blank">filippo.spiga@disco.unimib.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span style="border-collapse:collapse"><font face="arial, sans-serif">I know that it is possible to use API to set parameters (KSPSetType, SNESSetType). But a lot of options of HYPRE or SUPERLU for example have no API. Instead of mix option from command-line and API I would like to put everything in a config file</font></span></blockquote>
<div><br></div></div><div>You might be interested in the -options_file command line option and PetscOptionsInsertFile. Also, any options present in</div><div><br></div><div>~/.petscrc</div><div>.petscrc (in current directory)</div>
<div>petscrc (in current directory)</div><div><br></div><div>get slurped in automatically, as well as the string in the PETSC_OPTIONS environment variable.</div></div>
</blockquote></div><br></div>