20#ifndef OPM_HYPRE_ERROR_HANDLING_HPP
21#define OPM_HYPRE_ERROR_HANDLING_HPP
24#include <HYPRE_parcsr_ls.h>
25#include <_hypre_utilities.h>
36class HypreError :
public std::runtime_error
39 explicit HypreError(
const std::string& msg)
40 : std::runtime_error(msg)
57 HYPRE_Int err,
const std::string& expression,
const std::string& file,
const std::string& function,
int line)
59 return fmt::format(
"Hypre error in expression: {}\nError code: {}\nLocation: {}:{} in function {}",
81 HYPRE_Int rc,
const std::string& expression,
const std::string& file,
const std::string& function,
int line)
96#define OPM_HYPRE_SAFE_CALL(expr) ::Opm::gpuistl::hypreSafeCall((expr), #expr, __FILE__, __func__, __LINE__)
101#ifndef HYPRE_SAFE_CALL
102#define HYPRE_SAFE_CALL(expr) OPM_HYPRE_SAFE_CALL(expr)
Exception class for Hypre errors.
Definition HypreErrorHandling.hpp:37
A small, fixed‑dimension MiniVector class backed by std::array that can be used in both host and CUDA...
Definition AmgxInterface.hpp:38
void hypreSafeCall(HYPRE_Int rc, const std::string &expression, const std::string &file, const std::string &function, int line)
Safe call wrapper for Hypre functions.
Definition HypreErrorHandling.hpp:80
std::string getHypreErrorMessage(HYPRE_Int err, const std::string &expression, const std::string &file, const std::string &function, int line)
Get a descriptive error message for a Hypre error code.
Definition HypreErrorHandling.hpp:56