[petsc-users] Petsc Bag example redundancy

Andrew Spott andrew.spott at gmail.com
Wed May 16 15:54:40 CDT 2012


Isn't this redundant?

104:   PetscBagRegisterReal(bag, &user->alpha, 1.0, "alpha", "Linear coefficient");
105:   PetscBagRegisterReal(bag, &user->lambda, 6.0, "lambda", "Nonlinear coefficient");
106:   PetscBagSetFromOptions(bag);
107:   PetscOptionsGetReal(PETSC_NULL,"-alpha",&user->alpha,PETSC_NULL);
108:   PetscOptionsGetReal(PETSC_NULL,"-lambda",&user->lambda,PETSC_NULL);
(from http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex8.c.html )

Doesn't the PetscBagSetFromOptions allow you to load values into the structure using "-name", which means that the capabilities in lines 107 and 108 are implicit in the "PetscBagSetFromOptions" call.

Or do I not understand what PetscBagSetFromOptions does?

-Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120516/0d334e8c/attachment.htm>


More information about the petsc-users mailing list