Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_Functional.H
Go to the documentation of this file.
1#ifndef AMREX_FUNCTIONAL_H_
2#define AMREX_FUNCTIONAL_H_
3#include <AMReX_Config.H>
4
10#include <AMReX_GpuQualifiers.H>
11
12// Note that since C++14, std::functional class's operator() is constexpr.
13// So we don't need to use the classes here except for Minimum and Maximum.
14
15namespace amrex {
16
21template <typename T>
22struct Plus
23{
25 constexpr T operator() (const T & lhs, const T & rhs) const
26 {
27 return lhs + rhs;
28 }
29};
30
35template <typename T>
36struct Minus
37{
39 constexpr T operator() (const T & lhs, const T & rhs) const
40 {
41 return lhs - rhs;
42 }
43};
44
49template <typename T>
50struct Minimum
51{
53 constexpr T operator() (const T & lhs, const T & rhs) const
54 {
55 return (lhs < rhs) ? lhs : rhs;
56 }
57};
58
63template <typename T>
64struct Maximum
65{
67 constexpr T operator() (const T & lhs, const T & rhs) const
68 {
69 return (lhs > rhs) ? lhs : rhs;
70 }
71};
72
77template <typename T>
79{
81 constexpr T operator() (const T & lhs, const T & rhs) const
82 {
83 return lhs && rhs;
84 }
85};
86
91template <typename T>
93{
95 constexpr T operator() (const T & lhs, const T & rhs) const
96 {
97 return lhs || rhs;
98 }
99};
100
105template <typename T>
107{
109 constexpr T operator() (const T & lhs, const T & rhs) const
110 {
111 return lhs * rhs;
112 }
113};
114
119template <typename T>
121{
123 constexpr T operator() (const T & lhs, const T & rhs) const
124 {
125 return lhs / rhs;
126 }
127};
128
129}
130
131#endif
Definition AMReX_Amr.cpp:50
Function object that returns the quotient of two values.
Definition AMReX_Functional.H:121
constexpr T operator()(const T &lhs, const T &rhs) const
Return lhs / rhs.
Definition AMReX_Functional.H:123
Function object that returns the logical AND of two values.
Definition AMReX_Functional.H:79
constexpr T operator()(const T &lhs, const T &rhs) const
Return lhs && rhs.
Definition AMReX_Functional.H:81
Function object that returns the logical OR of two values.
Definition AMReX_Functional.H:93
constexpr T operator()(const T &lhs, const T &rhs) const
Return lhs || rhs.
Definition AMReX_Functional.H:95
Function object that returns the larger of two values.
Definition AMReX_Functional.H:65
constexpr T operator()(const T &lhs, const T &rhs) const
Return the larger of lhs and rhs.
Definition AMReX_Functional.H:67
Function object that returns the smaller of two values.
Definition AMReX_Functional.H:51
constexpr T operator()(const T &lhs, const T &rhs) const
Return the smaller of lhs and rhs.
Definition AMReX_Functional.H:53
Function object that returns the difference of two values.
Definition AMReX_Functional.H:37
constexpr T operator()(const T &lhs, const T &rhs) const
Return lhs - rhs.
Definition AMReX_Functional.H:39
Function object that returns the product of two values.
Definition AMReX_Functional.H:107
constexpr T operator()(const T &lhs, const T &rhs) const
Return lhs * rhs.
Definition AMReX_Functional.H:109
Function object that returns the sum of two values.
Definition AMReX_Functional.H:23
constexpr T operator()(const T &lhs, const T &rhs) const
Return lhs + rhs.
Definition AMReX_Functional.H:25