Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Exceptions_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_EXCEPTIONS_DECL_HPP
11 #define TPETRA_EXCEPTIONS_DECL_HPP
12 
13 #include <Tpetra_ConfigDefs.hpp>
14 #include <stdexcept>
15 
16 namespace Tpetra {
17 
35 
40 namespace Details {
41 
47 template <class GlobalOrdinal>
48 class InvalidGlobalIndex : public std::domain_error {
49  public:
54  InvalidGlobalIndex(const std::string& msg, const GlobalOrdinal globalIndex)
55  : std::domain_error(msg)
56  , glInd_(globalIndex) {}
57 
59  GlobalOrdinal offendingIndex() const { return glInd_; }
60 
61  private:
63  const GlobalOrdinal glInd_;
64 };
65 
71 template <class GlobalOrdinal>
72 class InvalidGlobalRowIndex : public InvalidGlobalIndex<GlobalOrdinal> {
73  public:
78  InvalidGlobalRowIndex(const std::string& msg, const GlobalOrdinal globalIndex)
79  : InvalidGlobalIndex<GlobalOrdinal>(msg, globalIndex) {}
80 };
81 
82 } // namespace Details
83 } // namespace Tpetra
84 
85 #endif // TPETRA_EXCEPTIONS_DECL_HPP
InvalidGlobalIndex(const std::string &msg, const GlobalOrdinal globalIndex)
Constructor.
InvalidGlobalRowIndex(const std::string &msg, const GlobalOrdinal globalIndex)
Constructor.
Exception thrown by CrsMatrix on invalid global row index.
Exception thrown by CrsMatrix on invalid global index.
GlobalOrdinal offendingIndex() const
The offending global index.