libMesh::PetscSolverException Class Reference

#include <petsc_solver_exception.h>

Inheritance diagram for libMesh::PetscSolverException:

Public Member Functions

 PetscSolverException (int error_code_in)
 
virtual const char * what () const noexcept
 

Public Attributes

int error_code
 
std::string what_message
 

Detailed Description

A specialization of the SolverException class for PETSc.

Definition at line 37 of file petsc_solver_exception.h.

Constructor & Destructor Documentation

◆ PetscSolverException()

libMesh::PetscSolverException::PetscSolverException ( int  error_code_in)
inline

Definition at line 40 of file petsc_solver_exception.h.

References libMesh::SolverException::error_code, and libMesh::SolverException::what_message.

40  :
41  SolverException(error_code_in)
42  {
43  const char * text;
44  // This is one scenario where we don't catch the error code
45  // returned by a PETSc function :)
46  PetscErrorMessage(error_code, &text, nullptr);
47  what_message = text;
48  }
SolverException(int error_code_in)

Member Function Documentation

◆ what()

virtual const char* libMesh::SolverException::what ( ) const
inlinevirtualnoexceptinherited

Override the what() function to provide a generic error message.

Definition at line 127 of file libmesh_exceptions.h.

References libMesh::SolverException::what_message.

128  {
129  // std::string::c_str() is noexcept in C++11, so it's safe to call
130  // in what() because it can't throw.
131  return what_message.c_str();
132  }

Member Data Documentation

◆ error_code

int libMesh::SolverException::error_code
inherited

The error code generated by the solver.

Definition at line 137 of file libmesh_exceptions.h.

Referenced by PetscSolverException(), and libMesh::SolverException::SolverException().

◆ what_message

std::string libMesh::SolverException::what_message
inherited

string which holds the message built in the constructor.

Definition at line 142 of file libmesh_exceptions.h.

Referenced by PetscSolverException(), libMesh::SolverException::SolverException(), and libMesh::SolverException::what().


The documentation for this class was generated from the following file: