[petsc-users] Petsc Bag example redundancy

Barry Smith bsmith at mcs.anl.gov
Wed May 16 17:06:46 CDT 2012


On May 16, 2012, at 3:54 PM, Andrew Spott wrote:

> 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.

   Yes they are redundant.

> 
> Or do I not understand what PetscBagSetFromOptions does?
> 
> -Andrew



More information about the petsc-users mailing list