On Fri, 7 Feb 2014, Francesco Ballarin wrote:

> is there any simple way to catch a LIBMESH_CHKERRABORT thrown in
> PetscLinearSolver<T>::solve()? I would like to be able to continue the
> execution of the program even after the failure.
>
> I took Introduction Example 4, purposely commented out the line
> "system.matrix->add_matrix (Ke, dof_indices);" and I tried something like
> =====
>  try {
> system.solve();
>  } catch (...) {
> std::cerr << "ERROR" << std::endl;
>  }
> =====
> without luck.

Hmm... LIBMESH_CHKERRABORT just calls PETSc's CHKERRABORT with the
appropriate communicator, and PETSc isn't going to throw an exception.
You could probably set a PETSc error handler that does the throw.

Would it be reasonable for libMesh to always check the error manually
and throw an exception instead?  If users want to catch the exception
and retry, though, that's probably only reasonable if PETSc remains in
a valid state for subsequent calls, and I'm not sure which PETSc
errors guarantee that.
---
Roy

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to