Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_TieBreak.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_DETAILS_TIEBREAK_HPP
11 #define TPETRA_DETAILS_TIEBREAK_HPP
12 
15 
16 #include "Tpetra_TieBreak_fwd.hpp"
17 #include "Teuchos_RCP.hpp"
18 #include <utility>
19 #include <vector>
20 
21 namespace Tpetra {
22 namespace Details {
23 
37  template <typename LocalOrdinal, typename GlobalOrdinal>
38  class TieBreak {
39  public:
53  struct Triplet {
54  LocalOrdinal LID;
55  GlobalOrdinal GID;
56  int PID;
57  };
58 
68  virtual bool mayHaveSideEffects () const {
69  return true;
70  }
71 
73  virtual ~TieBreak () = default;
74 
95  virtual std::size_t
96  selectedIndex (GlobalOrdinal GID,
97  const std::vector<std::pair<int, LocalOrdinal> >& pid_and_lid) const = 0;
98  };
99 
100 } // namespace Details
101 } // namespace Tpetra
102 
103 #endif // TPETRA_DETAILS_TIEBREAK_HPP
Interface for breaking ties in ownership.
Representation of a global index on a process.
virtual std::size_t selectedIndex(GlobalOrdinal GID, const std::vector< std::pair< int, LocalOrdinal > > &pid_and_lid) const =0
Break any ties in ownership of the given global index GID.
virtual ~TieBreak()=default
Virtual destructor (for memory safety of derived classes).
Forward declaration for Tpetra::TieBreak.
virtual bool mayHaveSideEffects() const
Whether selectedIndex() may have side effects.