4#ifndef SVMP_FE_EXCEPTION_H
5#define SVMP_FE_EXCEPTION_H
16#include "Core/Exception.h"
70 StatusCode
status = StatusCode::Unknown)
79 StatusCode
status() const noexcept {
return status_code(); }
85SVMP_DEFINE_EXCEPTION(InvalidArgumentException, FEException,
86 StatusCode::InvalidArgument);
103 StatusCode::InvalidArgument),
112 const std::string&
element_type() const noexcept {
return element_type_; }
115 static std::string build_message(
const std::string& message,
122 return message +
" (Element type: " +
element_type +
")";
125 std::string element_type_;
143 StatusCode::InvalidArgument),
152 long long dof_index() const noexcept {
return dof_index_; }
160 static std::string build_message(
const std::string& message,
167 return message +
" (DOF index: " + std::to_string(
dof_index) +
")";
196 StatusCode::DependencyError),
206 const std::string&
backend_name() const noexcept {
return backend_name_; }
214 static std::string build_message(
const std::string& message,
218 std::ostringstream oss;
236 std::string backend_name_;
260 :
FEException(
"Missing initialization: " + feature,
261 StatusCode::InvalidState)
284 StatusCode::InvalidState),
299 double residual() const noexcept {
return residual_; }
302 static std::string build_message(
const std::string& message,
306 std::ostringstream oss;
319 double residual_ = 0.0;
338 StatusCode::InvalidState),
350 static std::string build_message(
const std::string& message,
double det)
352 return message +
" (Jacobian determinant: " + std::to_string(det) +
356 double jacobian_det_ = 0.0;
Definition Exception.h:258
Global assembly failure.
Definition FEException.h:176
Failure reported by a linear-algebra or solver backend.
Definition FEException.h:184
int error_code() const noexcept
Backend-native error code.
Definition FEException.h:211
BackendException(const std::string &message, std::string backend_name="", int error_code=0)
Construct with a message and optional backend context.
Definition FEException.h:192
const std::string & backend_name() const noexcept
Name of the failing backend.
Definition FEException.h:206
Iterative process failed to converge.
Definition FEException.h:272
double residual() const noexcept
Final residual value.
Definition FEException.h:299
ConvergenceException(const std::string &message, int iteration=-1, double residual=0.0)
Construct with a message and optional iteration context.
Definition FEException.h:280
int iteration() const noexcept
Iteration at which the failure was detected.
Definition FEException.h:294
Degree-of-freedom numbering or lookup failure.
Definition FEException.h:133
DofException(const std::string &message, long long dof_index=invalid_dof_index())
Construct with a message and optional DOF-index context.
Definition FEException.h:140
static constexpr long long invalid_dof_index() noexcept
Sentinel meaning "no DOF index attached".
Definition FEException.h:157
long long dof_index() const noexcept
Offending DOF index.
Definition FEException.h:152
Base exception type for errors originating in the FE library.
Definition FEException.h:59
StatusCode status() const noexcept
Status code classifying the failure.
Definition FEException.h:79
FEException(const std::string &message, StatusCode status=StatusCode::Unknown)
Construct with a message and optional status code.
Definition FEException.h:69
Unsupported or malformed element request.
Definition FEException.h:93
InvalidElementException(const std::string &message, std::string element_type="")
Construct with a message and optional element-type context.
Definition FEException.h:100
const std::string & element_type() const noexcept
Name of the offending element type.
Definition FEException.h:112
Required initialization step has not been performed.
Definition FEException.h:253
NotInitializedException(const std::string &feature)
Construct from the name of the uninitialized feature.
Definition FEException.h:259
Element geometric mapping is singular or inverted.
Definition FEException.h:328
SingularMappingException(const std::string &message, double jacobian_det=0.0)
Construct with a message and the offending Jacobian determinant.
Definition FEException.h:335
double jacobian_det() const noexcept
Jacobian determinant at the failure point.
Definition FEException.h:347
A requested operation or feature is not implemented.
Definition Exception.h:352