On Aug 31, 2012, at 6:14 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Fri, Aug 31, 2012 at 12:38 AM, Arun Kamath <arun.kamath.m at gmail.com> 
> wrote:
> My idea is to add Petsc options to the control file I have for my code for 
> other options in the code and read them as in an example bit below.. So I was 
> putting in the routines that we would be expecting to use in one file. That 
> seems to be done now. Thanks for all the help.
> 
> This looks hopelessly cryptic. Why not just pass the name of the options file 
> to PetscInitialize() or PetscOptionsInsertFile(). It's one line and 
> automatically "supports" all current and future options (of which there are 
> infinitely many because options contain a compositional algebra).
>  
> 
> case 'B': control>>numint;
>                                 switch(numint)
>                                 {
>                                 case  5: control>>B5;
>                                                  clear(c,numint);
>                                                  break;
>                                 case 10: control>>B10;
>                                                  clear(c,numint);
>                                                  break;
>                             case 11: control>>B11;
>                                                  clear(c,numint);
>                                                  break;
> 

   Note that it is also possible to include your options and PETSc options in 
the same file. So for example you may have a file with something like the 
following

#     My options
#
myoption 1
myoption 2
etc
#
#    PETSc options
#
-ksp_type fgmres
-pc_type hypre
etc

just make sure your options processing skips or ignores the PETSc options. 
PETSc will ignore your options in reading the file.

   Barry



Reply via email to