[petsc-dev] GAMG hiding MG -help

Jed Brown jedbrown at mcs.anl.gov
Tue Mar 20 09:37:57 CDT 2012


No, this fails for anyone with more than one PCGAMG.
On Mar 20, 2012 9:10 AM, "Mark F. Adams" <mark.adams at columbia.edu> wrote:

> How about this added to the end of my setoptions:
>
>   ierr = PetscOptionsTail();CHKERRQ(ierr);
>
> static PetscInt nc=0;
> if(!nc++)obj->optionsprinted=PETSC_FALSE;
>
>   PetscFunctionReturn(0);
> }
>
> Mark
>
>
> On Mar 19, 2012, at 11:23 PM, Jed Brown wrote:
>
> On Mon, Mar 19, 2012 at 22:11, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>>
>>  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.
>>
>
> I don't know anything simple. Best would be to make it possible to call
> PCSetFromOptions_MG() before the number of levels has been set. I don't
> know if people really want to see the options printed for every level
> anyway.
>
> The easiest thing might be to save and restore obj->optionsprinted. (We
> could make it an integer instead of a PetscBool.)
>
>
>>
>>
>>   Barry
>>
>>   It never bothered me that help messages were printed more than once
>> .....
>>
>
> It's still a mess, actually. Try running
>
> $ ./ex5 -snes_grid_sequence 4 -help
>
> and tell me you are patient enough to scroll up far enough to see a
> meaningful option.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120320/f232d1b0/attachment.html>


More information about the petsc-dev mailing list