gavin971 / cvmix

Automatically exported from code.google.com/p/cvmix
0 stars 0 forks source link

Warning / Error handling #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We've talked via email about added an error code as an optional argument (to 
allow modules to handle errors on their own rather than getting a stop call 
which is sure to cause issues with MPI). There would also be a cvmix_error 
module in src/ to handle the errors for the stand-alone drivers... likely just 
printing a statement followed by a stop call.

On the same note, we should put some thought into handling warnings - I think 
we should print warnings in a variety of cases (over-writing existing 
parameters, using cvmix_put to write a scalar into an array, etc)... but there 
should be an easy way to suppress the warnings. I'm leaning towards a namelist 
option that sets the global variable lwarn, but I'm open to other ideas - a 
namelist variable stored somewhere else? Copious ifdefs along with a 
compile-time setting? Going with the namelist option, I'm picturing a 
cvmix_warn routine that takes a string as an argument and prints "WARNING: " // 
warn_string... with the check against lwarn or whatever in the cvmix_warn 
routine.

Original issue reported on code.google.com by mike.lev...@gmail.com on 7 Jun 2013 at 10:13

GoogleCodeExporter commented 9 years ago
Maybe something like

module cvmix_warn

  public :: cvmix_warn
  public :: cvmix_set_lwarn

  logical, private, save :: lwarn = .true.

  ...

end module cvmix_warn

So by default we print all warnings, but the user can call 
cvmix_set_lwarn(.false.) to suppress them (and then later call 
cvmix_set_lwarn(.true.) to turn them back on).

Original comment by mike.lev...@gmail.com on 7 Jun 2013 at 10:16

GoogleCodeExporter commented 9 years ago
moved to github

Original comment by mike.lev...@gmail.com on 9 Feb 2014 at 7:13