14.1.2. User-Defined Options

Up: Contents Next: Keeping Track of Options Previous: The Options Database

Any subroutine in a PETSc program can add entries to the database with the command

   ierr = OptionsSetValue(char *name,char *value); 
though this is rarely done. To locate options in the database, one should use the commands
   ierr = OptionsHasName(char *pre,char *name,int *flg); 
   ierr = OptionsGetInt(char *pre,char *name,int *value,int *flg); 
   ierr = OptionsGetDouble(char *pre,char *name,double *value,int *flg); 
   ierr = OptionsGetString(char *pre,char *name,char *value,int maxlen,int *flg); 
   ierr = OptionsGetStringArray(char *pre,char *name,char **values,int *maxlen,int *flg); 
   ierr = OptionsGetIntArray(char *pre,char *name,int *value,int *nmax,int *flg); 
   ierr = OptionsGetDoubleArray(char *pre,char *name,double *value, int *nmax,int *flg); 
All of these routines set flg=1 if the corresponding option was found, flg=0 if it was not found. The optional argument pre indicates that the true name of the option is the given name (with the dash ``-'' removed) prepended by the prefix pre. Usually pre should be set to PETSC_NULL (or PETSC_NULL_CHARACTER for Fortran); its purpose is to allow someone to rename all the options in a package without knowing the names of the individual options. For example, when using block Jacobi preconditioning, the KSP and PC methods used on the individual blocks can be controlled via the options -sub_ksp_type and -sub_pc_type.


Up: Contents Next: Keeping Track of Options Previous: The Options Database