On Wed, Feb 23, 2011 at 14:05, Roman Vetter <vetterro@student.ethz.ch> wrote:
Exactly. That's kind of the point. In order to be able to call
SNESConvergedReasons[reason], the reason enum/int must be stored
before _snes gets destroyed, which it isn't currently. Which brings be
back to my initial suggestion.

So there are a couple options for exposing reason to the user.

1. Send the raw backend-specific enum to the user. Downside: user needs to write different code for each back end.

2. Always convert to some new libmesh enum. Downside: conversion from backend value to generic value is not injective (several values might be mapped to "unknown", so you have lost information that the user might want.

3. Create a new libmesh enum, but store the backend value. This can always be converted to a generic value when convenient.

My comment regarding KSPConvergedReasons is that many PETSc users are familiar with the specific failure modes so it would be entirely reasonable to print it instead of translated strings. It is certainly much better than printing "Unknown/unsupported con(di)vergence".