[petsc-dev] PetscPrintf() is never suppose to be used to print error messages

Barry Smith bsmith at mcs.anl.gov
Wed Jan 2 11:53:26 CST 2013


On Jan 2, 2013, at 11:39 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Wed, Jan 2, 2013 at 11:32 AM, Matthew Knepley <knepley at gmail.com> wrote:
> I fixed the simple thing, but the PrintMatSetValues() is problematic. Right now, it just prints using
> PetscPrintf, which is wrong for errors like this, but correct for other things. For normal things, I
> could make it take a viewer, which could be PETSC_VIEWER_STDOUT_SELF, and reproduce
> this behavior. However, do we need to add default viewers for the error streams?
> 
> Like PETSC_VIEWER_STDERR_ ?

   I'm not sure I'm comfortable with things like PrintMatSetValues() that are suppose to print out both using "normal" output and error messages from a PETSC_ERR (which are suppose to be fault things with unknown issues, memory corruption, etc). I think it is better to stick with with very lightweight error output messages. Yes printing out a few "tried" values may be ok but only in a lightweight way.  

   Also I'm not sure if PETSC_VIEWER_STDERR_ really corresponds to (*PetscErrorPrintf)(). 


   Barry





More information about the petsc-dev mailing list