HavoqGT
edge_node_identifier.hpp
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2013, Lawrence Livermore National Security, LLC.
4  * Produced at the Lawrence Livermore National Laboratory.
5  * Written by Steven Feldman <feldman12@llnl.gov>.
6  * LLNL-CODE-644630.
7  * All rights reserved.
8  *
9  * This file is part of HavoqGT, Version 0.1.
10  * For details, see https://computation.llnl.gov/casc/dcca-pub/dcca/Downloads.html
11  *
12  * Please also read this link – Our Notice and GNU Lesser General Public License.
13  * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
14  *
15  * This program is free software; you can redistribute it and/or modify it under
16  * the terms of the GNU Lesser General Public License (as published by the Free
17  * Software Foundation) version 2.1 dated February 1999.
18  *
19  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
20  * WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A
21  * PARTICULAR PURPOSE. See the terms and conditions of the GNU General Public
22  * License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License along
25  * with this program; if not, write to the Free Software Foundation, Inc.,
26  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27  *
28  * OUR NOTICE AND TERMS AND CONDITIONS OF THE GNU GENERAL PUBLIC LICENSE
29  *
30  * Our Preamble Notice
31  *
32  * A. This notice is required to be provided under our contract with the
33  * U.S. Department of Energy (DOE). This work was produced at the Lawrence
34  * Livermore National Laboratory under Contract No. DE-AC52-07NA27344 with the DOE.
35  *
36  * B. Neither the United States Government nor Lawrence Livermore National
37  * Security, LLC nor any of their employees, makes any warranty, express or
38  * implied, or assumes any liability or responsibility for the accuracy,
39  * completeness, or usefulness of any information, apparatus, product, or process
40  * disclosed, or represents that its use would not infringe privately-owned rights.
41  *
42  * C. Also, reference herein to any specific commercial products, process, or
43  * services by trade name, trademark, manufacturer or otherwise does not
44  * necessarily constitute or imply its endorsement, recommendation, or favoring by
45  * the United States Government or Lawrence Livermore National Security, LLC. The
46  * views and opinions of authors expressed herein do not necessarily state or
47  * reflect those of the United States Government or Lawrence Livermore National
48  * Security, LLC, and shall not be used for advertising or product endorsement
49  * purposes.
50  *
51  */
52 
53 #ifndef __HAVOQGT_IMP_EDGE_NODE_IDENTIFIER_HPP__
54 #define __HAVOQGT_IMP_EDGE_NODE_IDENTIFIER_HPP__
55 
56 namespace havoqgt {
57 namespace mpi {
58 
60  public:
61  explicit local_source_id(int p):m_mpi_size(p) {}
62  template<typename T>
63  T operator()(std::pair<T, T> i) const { return i.first / m_mpi_size; }
64  private:
65  uint64_t m_mpi_size;
66 };
67 
69  public:
70  explicit local_dest_id(int p):m_mpi_size(p) {}
71  template<typename T>
72  T operator()(std::pair<T, T> i) const { return i.second / m_mpi_size; }
73  private:
74  uint64_t m_mpi_size;
75 };
76 
77 class get_local_id {
78  public:
79  explicit get_local_id(int p):m_mpi_size(p) {}
80  template<typename T>
81  T operator()(T i) const { return i / m_mpi_size; }
82  private:
83  uint64_t m_mpi_size;
84 };
85 
87  public:
88  explicit owner_source_id(int p):m_mpi_size(p) {}
89  template<typename T>
90  int operator()(std::pair<T, T> i) const { return i.first % m_mpi_size; }
91  private:
92  uint64_t m_mpi_size;
93 };
94 
96  public:
97  explicit owner_dest_id(int p):m_mpi_size(p) {}
98  template<typename T>
99  int operator()(std::pair<T, T> i) const { return i.second % m_mpi_size; }
100  private:
101  uint64_t m_mpi_size;
102 };
103 
105  public:
106  explicit get_owner_id(int p):m_mpi_size(p) {}
107  template<typename T>
108  int operator()(T i) const { return i % m_mpi_size; }
109  private:
110  uint64_t m_mpi_size;
111 };
112 
113 } // namespace mpi
114 } // namespace havoqgt
115 
116 #endif // __HAVOQGT_IMP_EDGE_NODE_IDENTIFIER_HPP__
int operator()(std::pair< T, T > i) const
T operator()(std::pair< T, T > i) const
T operator()(std::pair< T, T > i) const
int operator()(std::pair< T, T > i) const