[petsc-dev] We need to cleanup viewers

Barry Smith bsmith at mcs.anl.gov
Thu Mar 27 16:51:10 CDT 2014


On Mar 27, 2014, at 11:29 AM, Jed Brown <jed at jedbrown.org> wrote:

> Barry Smith <bsmith at mcs.anl.gov> writes:
>>>    I cannot think of a reason not to throw an error for unrecognized viewers.
>> 
>>   That was the old model and it was terrible. Thus we changed to silently ignore unrecognized viewers.
> 
> How is this not confusing to users?  If they explicitly call XXView(x,v)
> and it does nothing, how do they figure out what is wrong?  

    If a user calls XXX() and it doesn’t do what they expect, how do they figure out what is wrong? It is called debugging and usually it is because what they expect is not what it does.



> Maybe
> viewers could have an option marking them as optional?
> 
>>> 2) We need to rationalize behavior with conditionally compiled viewers
>>> 
>>>    Jed proposes a registration process.
>> 
>>    Finally a real system for double dispatch?
> 
> I hate the fact that Viewers are not really extensible.  We have a hacky
> sort of multiple dispatch in Mat, but we could do it right and improve
> Mat performance while we're at it.  Fast implementations in the CL world
> are as old as I am, which brings us to
> 
> https://en.wikipedia.org/wiki/Greenspun%27s_Tenth_Rule
> 
>>> A simpler, but uglier solution is to
>>>    protect the dispatch call and speciailzed view function with #ifdef and
>>>    provide an error at the dispatch point.
>> 
>>  How are we not doing this now?
> 
> There are places in the code where #ifdef is used at a higher level,
> creating lots of clutter.




More information about the petsc-dev mailing list