svMultiPhysics
Loading...
Searching...
No Matches
BasisExceptions.h
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef SVMP_FE_BASIS_BASISEXCEPTIONS_H
5#define SVMP_FE_BASIS_BASISEXCEPTIONS_H
6
7#include "FEException.h"
8
9namespace svmp::FE::basis {
10
11/**
12 * @defgroup FE_BasisExceptions Exceptions
13 * @ingroup FE_Basis
14 * @brief Basis-module exception hierarchy.
15 *
16 * @details Every Basis exception derives from BasisException (and thus FEException),
17 * so a caller can catch a specific basis failure or the FE base type. See
18 * BasisException for why the module raises these basis-specific types rather than
19 * the generic FE exceptions.
20 * @{
21 */
22
23/**
24 * @brief Base exception type for errors originating in the Basis module
25 *
26 * @details The Basis module raises these basis-specific types -- rather than the
27 * generic FE exceptions in FEException.h -- so a caller can catch a basis failure
28 * precisely: an unsupported element/order pairing, a non-unisolvent node set, an
29 * out-of-range reference-node index. They all derive from FEException, so code
30 * that only wants "some FE error" can still catch the base type, and they carry
31 * the same StatusCode and source location as the rest of the hierarchy.
32 */
34public:
35 explicit BasisException(const std::string& message,
36 StatusCode status = StatusCode::Unknown)
37 : FEException(message, status) {}
38};
39
40/**
41 * @brief Invalid Basis request or configuration
42 *
43 * @details Raised when a request is malformed before any geometry is built: a
44 * missing or negative polynomial order, a named element layout paired with an
45 * explicit order that does not match its fixed order, or a field type or
46 * continuity the scalar Lagrange/Serendipity factory does not support. Example:
47 * constructing a LagrangeBasis for Tetra10 at order 1, when that layout is fixed
48 * at order 2.
49 */
50SVMP_DEFINE_EXCEPTION(BasisConfigurationException, BasisException,
51 StatusCode::InvalidArgument);
52
53/**
54 * @brief Requested element topology is incompatible with the basis family
55 *
56 * @details Raised when the family cannot represent the requested topology or
57 * named layout. Example: requesting wedge serendipity through the arbitrary-order
58 * topology path (only the named Wedge15 layout is supported), or requesting a
59 * basis on ElementType::Unknown.
60 */
62 StatusCode::InvalidArgument);
63
64/**
65 * @brief Basis evaluation request cannot be satisfied
66 *
67 * @details Raised at evaluation time rather than construction time. Example: an
68 * output span smaller than size(), or requesting analytical gradients or Hessians
69 * from a basis that does not provide them.
70 */
71SVMP_DEFINE_EXCEPTION(BasisEvaluationException, BasisException,
72 StatusCode::InvalidArgument);
73
74/**
75 * @brief Public-to-canonical node ordering or coordinate lookup failure
76 *
77 * @details Raised when a node index or coordinate lookup falls outside the
78 * reference layout. Example: requesting a tensor-axis node index outside
79 * [0, order] from line_coord_pm_one.
80 */
81SVMP_DEFINE_EXCEPTION(BasisNodeOrderingException, BasisException,
82 StatusCode::InvalidArgument);
83
84/**
85 * @brief Internal basis construction or transform setup failure
86 *
87 * @details Signals a violated internal invariant during setup (StatusCode::
88 * InternalError) rather than bad user input. Example: a generated Lagrange node
89 * lattice whose index components fall outside [0, order] in get_lagrange_lattice.
90 */
91SVMP_DEFINE_EXCEPTION(BasisConstructionException, BasisException,
92 StatusCode::InternalError);
93
94/** @} */
95
96} // namespace svmp::FE::basis
97
98#endif // SVMP_FE_BASIS_BASISEXCEPTIONS_H
Exception hierarchy for error handling in the FE library.
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
Invalid Basis request or configuration.
Definition BasisExceptions.h:51
Internal basis construction or transform setup failure.
Definition BasisExceptions.h:92
Requested element topology is incompatible with the basis family.
Definition BasisExceptions.h:62
Basis evaluation request cannot be satisfied.
Definition BasisExceptions.h:72
Base exception type for errors originating in the Basis module.
Definition BasisExceptions.h:33
Public-to-canonical node ordering or coordinate lookup failure.
Definition BasisExceptions.h:82