[petsc-users] Printing _some_ options
Barry Smith
bsmith at petsc.dev
Tue Jul 22 13:14:31 CDT 2025
Hm, what is the advantage of dropping bags? Maybe we just need to improve bags to make them better for you.
> On Jul 22, 2025, at 10:23 AM, Blaise Bourdin <bourdin at mcmaster.ca> wrote:
>
> Hi,
>
> My (Fortran) code currently makes heavy use of PetscBag to store parameters and options in fortran derived types. I would like to simplify it by getting rid of these bags and simply querying the PETSc options database as needed.
>
> One nice thing about PetscBags, though, is that I can easily display help messages related to a specific family of options by calling PetscBagView and get nicely formatted output like this:
>
> Registering cell set 1 prefix: cs0001_
> PetscBag Object: Cell set 1 (cs0001_) HeatXferCellSetOptions MEF90 Heat transfer Cell Set options
> Flux = 0. ; [J.s^(-1).m^(-3) / J.s^(-1).m^(-2)] (f): Internal / applied heat flux
> TemperatureBC = FALSE; Temperature has Dirichlet boundary Condition (Y/N)
> boundaryTemperature = 0. [K] (); Temperature boundary value
> advectionVector = 0. 0. 0. ; [m.s^(-1)] (V): advection vector
>
> even when -help is not passed in the command line, so that these messages are not drowned in Vec, SNES etc help messages.
>
> Is there an easy way to achieve the same thing when using PetscOptionsXXX or PetscOptionsGetXXX?
>
> Ideally, I’d like to be able to do <progName> -mef90_help and display only the help messages associated to the calls to PetscOptionsXXX or PetscOptionsGetXXX I made and have been executed. Does that make sense?
>
> Regards,
> Blaise
>
> —
> Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1)
> Professor, Department of Mathematics & Statistics
> Hamilton Hall room 409A, McMaster University
> 1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada
> https://urldefense.us/v3/__https://www.math.mcmaster.ca/bourdin__;!!G_uCfscf7eWS!fgK0I4XQdmA4YFzlulAe0gnPsrtmmt_KjqXJy9r3CefbaPNCHyAQIZFpe-XT4H2K0zjYzsxw7ZuSQtzS4WfS1ZUg$ | +1 (905) 525 9140 ext. 27243
>
More information about the petsc-users
mailing list