omega_h
Reliable mesh adaptation
Omega_h_functors.hpp
1 #ifndef OMEGA_H_FUNCTORS_HPP
2 #define OMEGA_H_FUNCTORS_HPP
3 
4 #include <Omega_h_scalar.hpp>
5 
6 namespace Omega_h {
7 
8 struct AndFunctor {
9  typedef I64 value_type;
10  OMEGA_H_INLINE void init(value_type& update) const { update = 1; }
11  OMEGA_H_INLINE void join(
12  volatile value_type& update, const volatile value_type& input) const {
13  update = update && input;
14  }
15 };
16 
17 template <typename T>
18 struct MaxFunctor {
19  typedef promoted_t<T> value_type;
20  typedef T input_type;
21  OMEGA_H_INLINE void init(value_type& update) const {
22  update = ArithTraits<T>::min();
23  }
24  OMEGA_H_INLINE void join(
25  volatile value_type& update, const volatile value_type& input) const {
26  update = max2(update, input);
27  }
28 };
29 
30 template <typename T>
31 struct MinFunctor {
32  typedef promoted_t<T> value_type;
33  typedef T input_type;
34  OMEGA_H_INLINE void init(value_type& update) const {
35  update = ArithTraits<T>::max();
36  }
37  OMEGA_H_INLINE void join(
38  volatile value_type& update, const volatile value_type& input) const {
39  update = min2(update, input);
40  }
41 };
42 
43 template <typename T>
44 struct SumFunctor {
45  using value_type = promoted_t<T>;
46  using input_type = T;
47  OMEGA_H_INLINE void init(value_type& update) const { update = 0; }
48  OMEGA_H_INLINE void join(
49  volatile value_type& update, const volatile value_type& input) const {
50  update = update + input;
51  }
52 };
53 
54 } // end namespace Omega_h
55 
56 #endif
Definition: amr_mpi_test.cpp:6
Definition: Omega_h_functors.hpp:8
Definition: Omega_h_scalar.hpp:30
Definition: Omega_h_functors.hpp:18
Definition: Omega_h_functors.hpp:31
Definition: Omega_h_functors.hpp:44