Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2022-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4/**
5 * @file exceptions.h
6 * @brief Common exception declarations shared across multiple solvers in Lethe.
7 *
8 * This file defines deal.II-style exception macros used to report errors that
9 * are raised from more than one place in Lethe, such as the errors related to
10 * the Nitsche immersed boundary method or to the files that Lethe reads,
11 * avoiding code repetition.
12 */
13
14#ifndef lethe_exceptions_h
15#define lethe_exceptions_h
16
17#include <deal.II/base/exceptions.h>
18
19using namespace dealii;
20
21/**
22 * @brief Exception raised when a solver does not support Nitsche solid
23 * restriction but solids are defined in the parameter file.
24 *
25 * @param[in] arg1 Number of solids defined in the parameter file.
26 * @param[in] arg2 Name of the current solver that does not support Nitsche.
27 * @param[in] arg3 Name of the solver that should be used instead.
28 */
29DeclException3(SolidWarning,
30 unsigned int,
31 std::string,
32 std::string,
33 << "'number of solids = " << arg1 << "' but " << arg2
34 << " solver does not support nitsche restriction. Use " << arg3
35 << " solver instead.");
36
37/**
38 * @brief Exception raised when no solid is defined but the solver attempts
39 * to assemble a Nitsche restriction.
40 *
41 * @param[in] arg1 Name of the solver in which the error occurred.
42 */
44 NoSolidWarning,
45 std::string,
46 << "No solid defined: impossible to assemble nitsche restriction in " << arg1
47 << " solver. Change the 'number of solids' parameter.");
48
49/**
50 * @brief Exception raised when no name was given for a file that Lethe must
51 * read.
52 *
53 * @param[in] arg1 Description of the role of the file.
54 */
55DeclException1(EmptyFileName,
56 std::string,
57 << "No file name was given for the " << arg1
58 << ". Specify it in the parameter file before running Lethe.");
59
60/**
61 * @brief Exception raised when a file that Lethe must read does not exist.
62 *
63 * @param[in] arg1 Path of the file, as given by the user.
64 * @param[in] arg2 Description of the role of the file.
65 */
67 FileDoesNotExist,
68 std::string,
69 std::string,
70 << "The " << arg2 << " <" << arg1 << "> does not exist. "
71 << "Verify that its name is spelled correctly. Relative paths are "
72 << "interpreted from the directory in which the application was launched, "
73 << "not from the directory of the parameter file.");
74
75/**
76 * @brief Exception raised when a file that Lethe must read exists but cannot
77 * be opened for reading.
78 *
79 * @param[in] arg1 Path of the file, as given by the user.
80 * @param[in] arg2 Description of the role of the file.
81 */
83 FileIsNotReadable,
84 std::string,
85 std::string,
86 << "The " << arg2 << " <" << arg1 << "> exists but could not be opened for "
87 << "reading. Verify that it is a file and not a directory, and that its "
88 << "permissions allow Lethe to read it.");
89
90#endif
DeclException3(SolidWarning, unsigned int, std::string, std::string,<< "'number of solids = "<< arg1<< "' but "<< arg2<< " solver does not support nitsche restriction. Use "<< arg3<< " solver instead.")
Exception raised when a solver does not support Nitsche solid restriction but solids are defined in t...
DeclException2(FileDoesNotExist, std::string, std::string,<< "The "<< arg2<< " <"<< arg1<< "> does not exist. "<< "Verify that its name is spelled correctly. Relative paths are "<< "interpreted from the directory in which the application was launched, "<< "not from the directory of the parameter file.")
Exception raised when a file that Lethe must read does not exist.
DeclException1(NoSolidWarning, std::string,<< "No solid defined: impossible to assemble nitsche restriction in "<< arg1<< " solver. Change the 'number of solids' parameter.")
Exception raised when no solid is defined but the solver attempts to assemble a Nitsche restriction.