omega_h
Reliable mesh adaptation
Omega_h_host_few.hpp
1 #ifndef OMEGA_H_HOST_FEW_HPP
2 #define OMEGA_H_HOST_FEW_HPP
3 
4 #include <initializer_list>
5 
6 #include <Omega_h_defines.hpp>
7 
8 namespace Omega_h {
9 
10 /* this class is different from Omega_h::Few<T,n>
11  * because it avoids dealing with volatile
12  * operations, thus saving its members from having
13  * to implement them. */
14 template <typename T, Int n>
15 class HostFew {
16  T array_[n];
17 
18  public:
19  enum { size = n };
20  OMEGA_H_INLINE T& operator[](Int i) { return array_[i]; }
21  OMEGA_H_INLINE T const& operator[](Int i) const { return array_[i]; }
22  OMEGA_H_INLINE HostFew() {}
23  HostFew(std::initializer_list<T> l) {
24  Int i = 0;
25  for (auto v : l) array_[i++] = v;
26  }
27 };
28 
29 } // end namespace Omega_h
30 
31 #endif
Definition: Omega_h_host_few.hpp:15
Definition: amr_mpi_test.cpp:6