Block-Structured AMR Software Framework
AMReX_ValLocPair.H
Go to the documentation of this file.
1 #ifndef AMREX_VALLOCPAIR_H_
2 #define AMREX_VALLOCPAIR_H_
3 
4 #include <limits>
5 
6 namespace amrex {
7 
8 template <typename TV, typename TI>
9 struct ValLocPair
10 {
11  TV value;
12  TI index;
13 
14  constexpr TV& first () { return value; }
15  constexpr TV const& first () const { return value; }
16  constexpr TI& second () { return index; }
17  constexpr TI const& second () const { return index; }
18 
19  static constexpr ValLocPair<TV,TI> max () {
21  }
22 
23  static constexpr ValLocPair<TV,TI> lowest () {
24  return ValLocPair<TV,TI>{std::numeric_limits<TV>::lowest(), TI()};
25  }
26 
27  friend constexpr bool operator< (ValLocPair<TV,TI> const& a, ValLocPair<TV,TI> const& b)
28  {
29  return a.value < b.value;
30  }
31 
32  friend constexpr bool operator> (ValLocPair<TV,TI> const& a, ValLocPair<TV,TI> const& b)
33  {
34  return a.value > b.value;
35  }
36 };
37 
38 template <typename K, typename V> using KeyValuePair = ValLocPair<K,V>;
39 
40 }
41 
42 #endif
@ max
Definition: AMReX_ParallelReduce.H:17
Definition: AMReX_Amr.cpp:49
Definition: AMReX_ValLocPair.H:10
TI index
Definition: AMReX_ValLocPair.H:12
constexpr friend bool operator>(ValLocPair< TV, TI > const &a, ValLocPair< TV, TI > const &b)
Definition: AMReX_ValLocPair.H:32
constexpr TV & first()
Definition: AMReX_ValLocPair.H:14
constexpr TI & second()
Definition: AMReX_ValLocPair.H:16
constexpr TV const & first() const
Definition: AMReX_ValLocPair.H:15
constexpr friend bool operator<(ValLocPair< TV, TI > const &a, ValLocPair< TV, TI > const &b)
Definition: AMReX_ValLocPair.H:27
constexpr TI const & second() const
Definition: AMReX_ValLocPair.H:17
TV value
Definition: AMReX_ValLocPair.H:11
static constexpr ValLocPair< TV, TI > lowest()
Definition: AMReX_ValLocPair.H:23
static constexpr ValLocPair< TV, TI > max()
Definition: AMReX_ValLocPair.H:19