[petsc-dev] GAMG hiding MG -help

Barry Smith bsmith at mcs.anl.gov
Mon Mar 19 22:11:54 CDT 2012


  Mark,

    The problem is all the code Jed added to prevent the same help message from being printed more than once. He added a field to each object, optionsprinted, which gets set once an object is used with PetscObjectOptionsBegin() and prevents printing the next time that same object is used with options. Since the same PC is used for the setfromoptions for gamg and mg the second one mg gets ignored.

    I cannot see, off hand, the correct fix that respects Jed's desire to have the help messages printed exactly once. You can change PetscObjectOptionsBegin() to PetscOptionsBegin() to get the MG message printed but it will be printed again for each new GAMG setup violating Jed's clean output. You could hide a variable in the _GAMG data structure indicating the help for MG was printed to prevent multiple prints but that is ugly and ideally Jed will point out the correct way to do what you want to do.


   Barry

   It never bothered me that help messages were printed more than once .....


On Mar 19, 2012, at 6:58 PM, Mark F. Adams wrote:

> I just found that GAMG seems to be hiding MG's parameters when -help is used.  
> 
> I have this code in my PCSetUp_GAMG:
> 
>    /* should be called in PCSetFromOptions_GAMG(), but cannot be called prior to PCMGSetLevels() */
>    ierr = PetscObjectOptionsBegin((PetscObject)pc);CHKERRQ(ierr);
>    ierr = PCSetFromOptions_MG( pc ); CHKERRQ(ierr);
>    ierr = PetscOptionsEnd();CHKERRQ(ierr);
>    if (mg->galerkin != 2) SETERRQ(wcomm,PETSC_ERR_USER,"GAMG does Galerkin manually so the -pc_mg_galerkin option must not be used.");
> 
> Which seems funky, but I think I cloned this or had some reason to put this here.  And I set:
> 
>  pc->ops->setfromoptions = PCSetFromOptions_GAMG;
> 
> in PCCreate_GAMG.
> 
> Any advice on how I should fix this?
> 
> Mark




More information about the petsc-dev mailing list