| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2004 - 2022 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
#ifndef dealii_lac_exceptions_h |
| 16 |
#define dealii_lac_exceptions_h |
| 17 |
|
| 18 |
#include <deal.II/base/config.h> |
| 19 |
|
| 20 |
#include <deal.II/base/exceptions.h> |
| 21 |
|
| 22 |
DEAL_II_NAMESPACE_OPEN |
| 23 |
|
| 24 |
namespace LACExceptions |
| 25 |
{ |
| 26 |
/** |
| 27 |
* @addtogroup Exceptions |
| 28 |
*/ |
| 29 |
/** @{ */ |
| 30 |
|
| 31 |
/** |
| 32 |
* This function only works for quadratic matrices. |
| 33 |
*/ |
| 34 |
DeclExceptionMsg(ExcNotQuadratic, |
| 35 |
"This function only works for quadratic objects!"); |
| 36 |
|
| 37 |
/** |
| 38 |
* The operation cannot be finished since the matrix is singular. |
| 39 |
*/ |
| 40 |
DeclException0(ExcSingular); |
| 41 |
|
| 42 |
/** |
| 43 |
* Block indices of two block objects are different. |
| 44 |
*/ |
| 45 |
DeclException0(ExcDifferentBlockIndices); |
| 46 |
|
| 47 |
/** |
| 48 |
* The operation requires a sparsity pattern. |
| 49 |
*/ |
| 50 |
DeclExceptionMsg( |
| 51 |
ExcNeedsSparsityPattern, |
| 52 |
"This function requires that the current object have a " |
| 53 |
"sparsity pattern attached to it, but no sparsity pattern " |
| 54 |
"is available. This usually means that there is a missing " |
| 55 |
"reinit() call which would have added the sparsity pattern."); |
| 56 |
|
| 57 |
/** |
| 58 |
* Exception thrown when a PETSc function reports an error. If possible, |
| 59 |
* this exception uses the message provided by |
| 60 |
* <code>PetscErrorMessage</code> to print a description of the error. |
| 61 |
* |
| 62 |
* @note For backwards compatibility this is defined whether or not deal.II |
| 63 |
* is compiled with PETSc. |
| 64 |
*/ |
| 65 |
class ExcPETScError : public dealii::ExceptionBase |
| 66 |
{ |
| 67 |
public: |
| 68 |
ExcPETScError(const int error_code); |
| 69 |
|
| 70 |
virtual void |
| 71 |
print_info(std::ostream &out) const override; |
| 72 |
|
| 73 |
const int error_code; |
| 74 |
}; |
| 75 |
|
| 76 |
/** |
| 77 |
* An error of a Trilinos function was encountered. Check the Trilinos |
| 78 |
* documentation for details. |
| 79 |
*/ |
| 80 |
DeclException1(ExcTrilinosError, |
| 81 |
int, |
| 82 |
<< "An error with error number " << arg1 |
| 83 |
<< " occurred while calling a Trilinos function"); |
| 84 |
|
| 85 |
/** @} */ |
| 86 |
} // namespace LACExceptions |
| 87 |
|
| 88 |
|
| 89 |
using namespace LACExceptions; |
| 90 |
|
| 91 |
|
| 92 |
DEAL_II_NAMESPACE_CLOSE |
| 93 |
|
| 94 |
#endif |