[petsc-users] How to replace the default global database?
Barry Smith
bsmith at mcs.anl.gov
Fri May 26 17:55:41 CDT 2017
I do not think you want to do this. The standard way we handle what it seems you need is to use PetscObjectSetOptionsPrefix() for the different PETSc objects giving them different prefixes and then appending the prefix for the options when you provide them to the options database. For example if you have a KSP for a flow solver and a KSP for a pressure solver you might do
KSPCreate(PETSC_COMM_WORLD,&flow);
KSPSetOptionsPrefix(flow,"u");
KSPCreate(PETSC_COMM_WORLD,&pressure);
KSPSetOptionsPrefix(pressure,"p");
and set options like
-u_pc_type jacobi
-p_pc_type gamg
Will this do what you need?
Barry
Because the options data base can be accessed by any object at any time (not just when it is created), it doesn't make sense to change the default options database ever because it would be uncertain what objects the change affected or did not affect.
> On May 26, 2017, at 4:20 PM, Lucas Clemente Vella <lvella at gmail.com> wrote:
>
> Here is what I want to do:
> - Take the global PetscOptions and store it somewhere;
> - Create my own PetscOptions;
> - Populate it with my options;
> - Set my new PetscOptions as the global default;
> - Create some PETSc objects;
> - Restore old PetscOptions as default global;
> - Destroy the PetscOptions I created.
>
> I could not find a function to replace global PetscOptions, or to copy one PetscOptions to another. Is it possible to do what I want to do? How?
>
> --
> Lucas Clemente Vella
> lvella at gmail.com
More information about the petsc-users
mailing list