forked from AMReX-Codes/amrex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MPI Reduce for ValLocPair (AMReX-Codes#3003)
Add ParallelReduce::Min, ParallelReduce::Max, ParallelAllReduce::Min, and ParallelAllReduce::Max for ValLocPair<TV,TI>, where TV and TI are types that have corresponding MPI types (e.g., int, Real, IntVect, Box, etc.).
- Loading branch information
1 parent
3ec0768
commit 735c351
Showing
7 changed files
with
181 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef AMREX_VALLOCPAIR_H_ | ||
#define AMREX_VALLOCPAIR_H_ | ||
|
||
#include <limits> | ||
|
||
namespace amrex { | ||
|
||
template <typename TV, typename TI> | ||
struct ValLocPair | ||
{ | ||
TV value; | ||
TI index; | ||
|
||
static constexpr ValLocPair<TV,TI> max () { | ||
return ValLocPair<TV,TI>{std::numeric_limits<TV>::max(), TI()}; | ||
} | ||
|
||
static constexpr ValLocPair<TV,TI> lowest () { | ||
return ValLocPair<TV,TI>{std::numeric_limits<TV>::lowest(), TI()}; | ||
} | ||
|
||
friend constexpr bool operator< (ValLocPair<TV,TI> const& a, ValLocPair<TV,TI> const& b) | ||
{ | ||
return a.value < b.value; | ||
} | ||
|
||
friend constexpr bool operator> (ValLocPair<TV,TI> const& a, ValLocPair<TV,TI> const& b) | ||
{ | ||
return a.value > b.value; | ||
} | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters