Block-Structured AMR Software Framework
AMReX_TableData.H
Go to the documentation of this file.
1 #ifndef AMREX_TABLE_DATA_H_
2 #define AMREX_TABLE_DATA_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX.H>
6 #include <AMReX_Array.H>
7 #include <AMReX_DataAllocator.H>
8 #include <AMReX_GpuDevice.H>
9 #include <AMReX_GpuPrint.H>
10 
11 #include <cstring>
12 #include <iostream>
13 #include <sstream>
14 #include <type_traits>
15 
16 namespace amrex {
17 
18 template <typename T>
19 struct Table1D
20 {
21  T* AMREX_RESTRICT p = nullptr;
22  int begin = 1;
23  int end = 0;
24 
25  constexpr Table1D () noexcept = default;
26 
27  template <class U=T, std::enable_if_t<std::is_const_v<U>,int> = 0>
29  constexpr Table1D (Table1D<std::remove_const_t<T>> const& rhs) noexcept
30  : p(rhs.p),
31  begin(rhs.begin),
32  end(rhs.end)
33  {}
34 
36  constexpr Table1D (T* a_p, int a_begin, int a_end) noexcept
37  : p(a_p),
38  begin(a_begin),
39  end(a_end)
40  {}
41 
43  explicit operator bool () const noexcept { return p != nullptr; }
44 
45  template <class U=T, std::enable_if_t<!std::is_void_v<U>,int> = 0>
47  U& operator() (int i) const noexcept {
48 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
49  index_assert(i);
50 #endif
51  return p[i-begin];
52  }
53 
54 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
56  void index_assert (int i) const
57  {
58  if (i < begin || i >= end) {
60  AMREX_DEVICE_PRINTF(" (%d) is out of bound (%d:%d)\n",
61  i, begin, end-1);
62  amrex::Abort();
63  ))
65  std::stringstream ss;
66  ss << " (" << i << ") is out of bound ("
67  << begin << ":" << end-1 << ")";
68  amrex::Abort(ss.str());
69  ))
70  }
71  }
72 #endif
73 };
74 
75 template <typename T, typename ORDER = Order::F>
76 struct Table2D
77 {
78  T* AMREX_RESTRICT p = nullptr;
79  Long stride1 = 0;
82 
83  constexpr Table2D () noexcept = default;
84 
85  template <class U=T, std::enable_if_t<std::is_const_v<U>,int> = 0>
87  constexpr Table2D (Table2D<std::remove_const_t<T>, ORDER> const& rhs) noexcept
88  : p(rhs.p),
89  stride1(rhs.stride1),
90  begin(rhs.begin),
91  end(rhs.end)
92  {}
93 
95  constexpr Table2D (T* a_p,
96  GpuArray<int,2> const& a_begin,
97  GpuArray<int,2> const& a_end) noexcept
98  : p(a_p),
99  stride1(len0(a_begin,a_end)),
100  begin(a_begin),
101  end(a_end)
102  {}
103 
105  explicit operator bool () const noexcept { return p != nullptr; }
106 
107  template <class U=T, std::enable_if_t<!std::is_void_v<U>,int> = 0>
109  U& operator() (int i, int j) const noexcept {
110 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
111  index_assert(i,j);
112 #endif
113  static_assert(std::is_same_v<ORDER,Order::F> ||
114  std::is_same_v<ORDER,Order::C>);
115  if constexpr (std::is_same_v<ORDER,Order::F>) {
116  return p[(i-begin[0])+(j-begin[1])*stride1];
117  } else {
118  return p[(i-begin[0])*stride1+(j-begin[1])];
119  }
120  }
121 
122 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
123  AMREX_GPU_HOST_DEVICE inline
124  void index_assert (int i, int j) const
125  {
126  if (i < begin[0] || i >= end[0] ||
127  j < begin[1] || j >= end[1]) {
129  AMREX_DEVICE_PRINTF(" (%d,%d) is out of bound (%d:%d,%d:%d)\n",
130  i, j, begin[0], end[0]-1, begin[1], end[1]-1);
131  amrex::Abort();
132  ))
134  std::stringstream ss;
135  ss << " (" << i << "," << j << ") is out of bound ("
136  << begin[0] << ":" << end[0]-1
137  << "," << begin[1] << ":" << end[1]-1 << ")";
138  amrex::Abort(ss.str());
139  ))
140  }
141  }
142 #endif
143 
144 private:
145 
146  static constexpr int len0 (GpuArray<int,2> const& a_begin,
147  GpuArray<int,2> const& a_end) noexcept
148  {
149  if constexpr (std::is_same_v<ORDER,Order::F>) {
150  return a_end[0] - a_begin[0];
151  } else {
152  return a_end[1] - a_begin[1];
153  }
154  }
155 };
156 
157 template <typename T, typename ORDER = Order::F>
158 struct Table3D
159 {
160  T* AMREX_RESTRICT p = nullptr;
161  Long stride1 = 0;
162  Long stride2 = 0;
165 
166  constexpr Table3D () noexcept = default;
167 
168  template <class U=T, std::enable_if_t<std::is_const_v<U>,int> = 0>
170  constexpr Table3D (Table3D<std::remove_const_t<T>,ORDER> const& rhs) noexcept
171  : p(rhs.p),
172  stride1(rhs.stride1),
173  stride2(rhs.stride2),
174  begin(rhs.begin),
175  end(rhs.end)
176  {}
177 
179  constexpr Table3D (T* a_p,
180  GpuArray<int,3> const& a_begin,
181  GpuArray<int,3> const& a_end) noexcept
182  : p(a_p),
183  stride1( len0(a_begin,a_end)),
184  stride2(stride1*len1(a_begin,a_end)),
185  begin(a_begin),
186  end(a_end)
187  {}
188 
190  explicit operator bool () const noexcept { return p != nullptr; }
191 
192  template <class U=T, std::enable_if_t<!std::is_void_v<U>,int> = 0>
194  U& operator() (int i, int j, int k) const noexcept {
195 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
196  index_assert(i,j,k);
197 #endif
198  static_assert(std::is_same_v<ORDER,Order::F> ||
199  std::is_same_v<ORDER,Order::C>);
200  if constexpr (std::is_same_v<ORDER,Order::F>) {
201  return p[(i-begin[0])+(j-begin[1])*stride1+(k-begin[2])*stride2];
202  } else {
203  return p[(i-begin[0])*stride2+(j-begin[1])*stride1+(k-begin[2])];
204  }
205  }
206 
207 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
208  AMREX_GPU_HOST_DEVICE inline
209  void index_assert (int i, int j, int k) const
210  {
211  if (i < begin[0] || i >= end[0] ||
212  j < begin[1] || j >= end[1] ||
213  k < begin[2] || k >= end[2]) {
215  AMREX_DEVICE_PRINTF(" (%d,%d,%d) is out of bound (%d:%d,%d:%d,%d:%d)\n",
216  i, j, k, begin[0], end[0]-1, begin[1], end[1]-1,
217  begin[2], end[2]-1);
218  amrex::Abort();
219  ))
221  std::stringstream ss;
222  ss << " (" << i << "," << j << "," << k << ") is out of bound ("
223  << begin[0] << ":" << end[0]-1
224  << "," << begin[1] << ":" << end[1]-1
225  << "," << begin[2] << ":" << end[2]-1 << ")";
226  amrex::Abort(ss.str());
227  ))
228  }
229  }
230 #endif
231 
232 private:
233 
234  static constexpr int len0 (GpuArray<int,3> const& a_begin,
235  GpuArray<int,3> const& a_end) noexcept
236  {
237  if constexpr (std::is_same_v<ORDER,Order::F>) {
238  return a_end[0] - a_begin[0];
239  } else {
240  return a_end[2] - a_begin[2];
241  }
242  }
243 
244  static constexpr int len1 (GpuArray<int,3> const& a_begin,
245  GpuArray<int,3> const& a_end) noexcept
246  {
247  return a_end[1] - a_begin[1];
248  }
249 };
250 
251 template <typename T, typename ORDER = Order::F>
252 struct Table4D
253 {
254  T* AMREX_RESTRICT p = nullptr;
255  Long stride1 = 0;
256  Long stride2 = 0;
257  Long stride3 = 0;
258  GpuArray<int,4> begin{{1,1,1,1}};
259  GpuArray<int,4> end{{0,0,0,0}};
260 
261  constexpr Table4D () noexcept = default;
262 
263  template <class U=T, std::enable_if_t<std::is_const_v<U>,int> = 0>
265  constexpr Table4D (Table4D<std::remove_const_t<T>,ORDER> const& rhs) noexcept
266  : p(rhs.p),
267  stride1(rhs.stride1),
268  stride2(rhs.stride2),
269  stride3(rhs.stride3),
270  begin(rhs.begin),
271  end(rhs.end)
272  {}
273 
275  constexpr Table4D (T* a_p,
276  GpuArray<int,4> const& a_begin,
277  GpuArray<int,4> const& a_end) noexcept
278  : p(a_p),
279  stride1( len0(a_begin,a_end)),
280  stride2(stride1*len1(a_begin,a_end)),
281  stride3(stride2*len2(a_begin,a_end)),
282  begin(a_begin),
283  end(a_end)
284  {}
285 
287  explicit operator bool () const noexcept { return p != nullptr; }
288 
289  template <class U=T, std::enable_if_t<!std::is_void_v<U>,int> = 0>
291  U& operator() (int i, int j, int k, int n) const noexcept {
292 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
293  index_assert(i,j,k,n);
294 #endif
295  static_assert(std::is_same_v<ORDER,Order::F> ||
296  std::is_same_v<ORDER,Order::C>);
297  if constexpr (std::is_same_v<ORDER,Order::F>) {
298  return p[(i-begin[0])+(j-begin[1])*stride1+(k-begin[2])*stride2+(n-begin[3])*stride3];
299  } else {
300  return p[(i-begin[0])*stride3+(j-begin[1])*stride2+(k-begin[2])*stride1+(n-begin[3])];
301  }
302  }
303 
304 #if defined(AMREX_DEBUG) || defined(AMREX_BOUND_CHECK)
305  AMREX_GPU_HOST_DEVICE inline
306  void index_assert (int i, int j, int k, int n) const
307  {
308  if (i < begin[0] || i >= end[0] ||
309  j < begin[1] || j >= end[1] ||
310  k < begin[2] || k >= end[2] ||
311  n < begin[3] || n >= end[3]) {
313  AMREX_DEVICE_PRINTF(" (%d,%d,%d,%d) is out of bound (%d:%d,%d:%d,%d:%d,%d:%d)\n",
314  i, j, k, n, begin[0], end[0]-1, begin[1], end[1]-1,
315  begin[2], end[2]-1, begin[3], end[3]-1);
316  amrex::Abort();
317  ))
319  std::stringstream ss;
320  ss << " (" << i << "," << j << "," << k << "," << n << ") is out of bound ("
321  << begin[0] << ":" << end[0]-1
322  << "," << begin[1] << ":" << end[1]-1
323  << "," << begin[2] << ":" << end[2]-1
324  << "," << begin[3] << ":" << end[3]-1 << ")";
325  amrex::Abort(ss.str());
326  ))
327  }
328  }
329 #endif
330 
331 private:
332 
333  static constexpr int len0 (GpuArray<int,4> const& a_begin,
334  GpuArray<int,4> const& a_end) noexcept
335  {
336  if constexpr (std::is_same_v<ORDER,Order::F>) {
337  return a_end[0] - a_begin[0];
338  } else {
339  return a_end[3] - a_begin[3];
340  }
341  }
342 
343  static constexpr int len1 (GpuArray<int,4> const& a_begin,
344  GpuArray<int,4> const& a_end) noexcept
345  {
346  if constexpr (std::is_same_v<ORDER,Order::F>) {
347  return a_end[1] - a_begin[1];
348  } else {
349  return a_end[2] - a_begin[2];
350  }
351  }
352 
353  static constexpr int len2 (GpuArray<int,4> const& a_begin,
354  GpuArray<int,4> const& a_end) noexcept
355  {
356  if constexpr (std::is_same_v<ORDER,Order::F>) {
357  return a_end[2] - a_begin[2];
358  } else {
359  return a_end[1] - a_begin[1];
360  }
361  }
362 };
363 
402 template <typename T, int N, typename ORDER = Order::F>
404  : public DataAllocator
405 {
406 public:
407 
408  template <class U, int M, class O> friend class TableData;
409  using value_type = T;
410  using table_type = std::conditional_t<N==1, Table1D<T>,
411  std::conditional_t<N==2, Table2D<T, ORDER>,
412  std::conditional_t<N==3, Table3D<T, ORDER>,
413  Table4D<T, ORDER> > > >;
414  using const_table_type = std::conditional_t<N==1, Table1D<T const>,
415  std::conditional_t<N==2, Table2D<T const, ORDER>,
416  std::conditional_t<N==3, Table3D<T const, ORDER>,
418 
419  TableData () noexcept = default;
420 
421  explicit TableData (Arena* ar) noexcept;
422 
423  TableData (Array<int,N> const& lo, Array<int,N> const& hi, Arena* ar = nullptr);
424 
425  TableData (TableData<T,N,ORDER> const&) = delete;
426  TableData<T,N,ORDER>& operator= (TableData<T,N,ORDER> const&) = delete;
427 
428  TableData (TableData<T,N,ORDER>&& rhs) noexcept;
429  TableData<T,N,ORDER>& operator= (TableData<T,N,ORDER> && rhs) noexcept;
430 
431  ~TableData () noexcept;
432 
433  [[nodiscard]] constexpr int dim () const noexcept { return N; }
434 
435  void resize (Array<int,N> const& lo, Array<int,N> const& hi, Arena* ar = nullptr);
436 
437  [[nodiscard]] Long size () const noexcept;
438 
439  Array<int,N> const& lo () const noexcept { return m_lo; }
440 
441  Array<int,N> const& hi () const noexcept { return m_hi; }
442 
443  void clear () noexcept;
444 
445  void copy (TableData<T,N,ORDER> const& rhs) noexcept;
446 
447  table_type table () noexcept;
448  const_table_type table () const noexcept;
449  const_table_type const_table () const noexcept;
450 
451 private:
452 
453  void define ();
454 
455  T* m_dptr = nullptr;
456  Array<int,N> m_lo;
457  Array<int,N> m_hi;
458  Long m_truesize = 0L;
459  bool m_ptr_owner = false;
460 };
461 
462 template <typename T, int N, typename ORDER>
463 TableData<T,N,ORDER>::TableData (Array<int,N> const& lo, Array<int,N> const& hi, Arena* ar)
464  : DataAllocator{ar}, m_lo(lo), m_hi(hi)
465 {
466  define();
467 }
468 
469 
470 template <typename T, int N, typename ORDER>
472  : DataAllocator{rhs.arena()},
473  m_dptr(rhs.m_dptr),
474  m_lo(rhs.m_lo),
475  m_hi(rhs.m_hi),
476  m_truesize(rhs.m_truesize),
477  m_ptr_owner(rhs.m_ptr_owner)
478 {
479  rhs.m_dptr = nullptr;
480  rhs.m_ptr_owner = false;
481 }
482 
483 template <typename T, int N, typename ORDER>
484 TableData<T,N,ORDER>&
486 {
487  if (this != &rhs) {
488  clear();
489  m_arena = rhs.m_arena;
490  m_dptr = rhs.m_dptr;
491  m_lo = rhs.m_lo;
492  m_hi = rhs.m_hi;
493  m_truesize = rhs.m_truesize;
494  m_ptr_owner = rhs.m_ptr_owner;
495  rhs.m_dptr = nullptr;
496  rhs.m_ptr_owner = false;
497  }
498  return *this;
499 }
500 
501 template <typename T, int N, typename ORDER>
503 {
504  static_assert(std::is_trivially_copyable<T>() &&
505  std::is_trivially_destructible<T>(),
506  "TableData<T,N,ORDER>: T must be trivially copyable and trivially destructible");
507  static_assert(N>=1 && N <=4, "TableData<T,N,ORDER>: N must be in the range of [1,4]");
508  static_assert(std::is_same_v<ORDER,Order::F> ||
509  std::is_same_v<ORDER,Order::C>,
510  "TableDat<T,N,ORDER>: ORDER must be either Order::F or Order::C");
511  clear();
512 }
513 
514 template <typename T, int N, typename ORDER>
515 void
517 {
518  m_lo = lo;
519  m_hi = hi;
520 
521  if (ar == nullptr) {
522  ar = m_arena;
523  }
524 
525  if (arena() != DataAllocator(ar).arena()) {
526  clear();
527  m_arena = ar;
528  define();
529  } else if (m_dptr == nullptr || !m_ptr_owner) {
530  m_dptr = nullptr;
531  define();
532  } else if (size() > m_truesize) {
533  clear();
534  define();
535  }
536 }
537 
538 template <typename T, int N, typename ORDER>
539 Long
540 TableData<T,N,ORDER>::size () const noexcept
541 {
542  Long r = 1;
543  for (int i = 0; i < N; ++i) {
544  r *= m_hi[i] - m_lo[i] + 1;
545  }
546  return r;
547 }
548 
549 template <typename T, int N, typename ORDER>
550 void
552 {
553  if (m_dptr) {
554  if (m_ptr_owner) {
555  this->free(m_dptr);
556  }
557  m_dptr = nullptr;
558  m_truesize = 0;
559  }
560 }
561 
562 template <typename T, int N, typename ORDER>
563 void
565 {
566  m_truesize = size();
567  AMREX_ASSERT(m_truesize >= 0);
568  if (m_truesize == 0) {
569  return;
570  } else {
571  m_ptr_owner = true;
572  m_dptr = static_cast<T*>(this->alloc(m_truesize*sizeof(T)));
573  }
574 }
575 
576 namespace detail {
577  template <typename T, typename>
578  Table1D<T> make_table (T* p, Array<int,1> const& lo, Array<int,1> const& hi) {
579  return Table1D<T>(p, lo[0], hi[0]+1);
580  }
581  template <typename T, typename ORDER>
583  return Table2D<T,ORDER>(p, {lo[0],lo[1]}, {hi[0]+1,hi[1]+1});
584  }
585  template <typename T, typename ORDER>
586  Table3D<T> make_table (T* p, Array<int,3> const& lo, Array<int,3> const& hi) {
587  return Table3D<T,ORDER>(p, {lo[0],lo[1],lo[2]}, {hi[0]+1,hi[1]+1,hi[2]+1});
588  }
589  template <typename T, typename ORDER>
590  Table4D<T> make_table (T* p, Array<int,4> const& lo, Array<int,4> const& hi) {
591  return Table4D<T,ORDER>(p, {lo[0],lo[1],lo[2],lo[3]}, {hi[0]+1,hi[1]+1,hi[2]+1,hi[3]+1});
592  }
593 }
594 
595 template <typename T, int N, typename ORDER>
598 {
599  return detail::make_table<T,ORDER>(m_dptr, m_lo, m_hi);
600 }
601 
602 template <typename T, int N, typename ORDER>
605 {
606  return detail::make_table<T const, ORDER>(m_dptr, m_lo, m_hi);
607 }
608 
609 template <typename T, int N, typename ORDER>
612 {
613  return detail::make_table<T const, ORDER>(m_dptr, m_lo, m_hi);
614 }
615 
616 template <typename T, int N, typename ORDER>
617 void
619 {
620  std::size_t count = sizeof(T)*size();
621 #ifdef AMREX_USE_GPU
622  bool this_on_device = arena()->isManaged() || arena()->isDevice();
623  bool rhs_on_device = rhs.arena()->isManaged() || rhs.arena()->isDevice();
624  if (this_on_device && rhs_on_device) {
625  Gpu::dtod_memcpy_async(m_dptr, rhs.m_dptr, count);
626  } else if (this_on_device && !rhs_on_device) {
627  Gpu::htod_memcpy_async(m_dptr, rhs.m_dptr, count);
628  } else if (!this_on_device && rhs_on_device) {
629  Gpu::dtoh_memcpy_async(m_dptr, rhs.m_dptr, count);
630  } else
631 #endif
632  {
633  std::memcpy(m_dptr, rhs.m_dptr, count);
634  }
635 }
636 
637 }
638 
639 #endif
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_RESTRICT
Definition: AMReX_Extension.H:37
#define AMREX_DEVICE_PRINTF(...)
Definition: AMReX_GpuPrint.H:21
#define AMREX_IF_ON_DEVICE(CODE)
Definition: AMReX_GpuQualifiers.H:56
#define AMREX_IF_ON_HOST(CODE)
Definition: AMReX_GpuQualifiers.H:58
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
void free(void *)
A virtual base class for objects that manage their own dynamic memory allocation.
Definition: AMReX_Arena.H:100
Multi-dimensional array class.
Definition: AMReX_TableData.H:405
std::conditional_t< N==1, Table1D< T >, std::conditional_t< N==2, Table2D< T, ORDER >, std::conditional_t< N==3, Table3D< T, ORDER >, Table4D< T, ORDER > > > > table_type
Definition: AMReX_TableData.H:413
TableData() noexcept=default
const_table_type const_table() const noexcept
Definition: AMReX_TableData.H:611
void resize(Array< int, N > const &lo, Array< int, N > const &hi, Arena *ar=nullptr)
Definition: AMReX_TableData.H:516
friend class TableData
Definition: AMReX_TableData.H:408
void copy(TableData< T, N, ORDER > const &rhs) noexcept
Definition: AMReX_TableData.H:618
std::conditional_t< N==1, Table1D< T const >, std::conditional_t< N==2, Table2D< T const, ORDER >, std::conditional_t< N==3, Table3D< T const, ORDER >, Table4D< T const, ORDER > > > > const_table_type
Definition: AMReX_TableData.H:417
Long size() const noexcept
Definition: AMReX_TableData.H:540
void define()
Definition: AMReX_TableData.H:564
TableData< T, N, ORDER > & operator=(TableData< T, N, ORDER > const &)=delete
T value_type
Definition: AMReX_TableData.H:409
Array< int, N > const & hi() const noexcept
Definition: AMReX_TableData.H:441
~TableData() noexcept
Definition: AMReX_TableData.H:502
void clear() noexcept
Definition: AMReX_TableData.H:551
table_type table() noexcept
Definition: AMReX_TableData.H:597
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
void dtod_memcpy_async(void *p_d_dst, const void *p_d_src, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:279
void copy(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous st...
Definition: AMReX_GpuContainers.H:121
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:265
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void * memcpy(void *dest, const void *src, std::size_t count)
Definition: AMReX_GpuUtility.H:214
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:251
Table4D< T > make_table(T *p, Array< int, 4 > const &lo, Array< int, 4 > const &hi)
Definition: AMReX_TableData.H:590
Definition: AMReX_Amr.cpp:49
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:221
std::array< T, N > Array
Definition: AMReX_Array.H:23
Definition: AMReX_FabArrayCommI.H:841
Definition: AMReX_DataAllocator.H:9
Arena * arena() const noexcept
Definition: AMReX_DataAllocator.H:24
Definition: AMReX_TableData.H:20
int begin
Definition: AMReX_TableData.H:22
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE U & operator()(int i) const noexcept
Definition: AMReX_TableData.H:47
int end
Definition: AMReX_TableData.H:23
constexpr AMREX_GPU_HOST_DEVICE Table1D(T *a_p, int a_begin, int a_end) noexcept
Definition: AMReX_TableData.H:36
constexpr Table1D() noexcept=default
T *AMREX_RESTRICT p
Definition: AMReX_TableData.H:21
Definition: AMReX_TableData.H:77
constexpr AMREX_GPU_HOST_DEVICE Table2D(T *a_p, GpuArray< int, 2 > const &a_begin, GpuArray< int, 2 > const &a_end) noexcept
Definition: AMReX_TableData.H:95
static constexpr int len0(GpuArray< int, 2 > const &a_begin, GpuArray< int, 2 > const &a_end) noexcept
Definition: AMReX_TableData.H:146
constexpr Table2D() noexcept=default
Definition: AMReX_TableData.H:159
static constexpr int len1(GpuArray< int, 3 > const &a_begin, GpuArray< int, 3 > const &a_end) noexcept
Definition: AMReX_TableData.H:244
constexpr Table3D() noexcept=default
static constexpr int len0(GpuArray< int, 3 > const &a_begin, GpuArray< int, 3 > const &a_end) noexcept
Definition: AMReX_TableData.H:234
constexpr AMREX_GPU_HOST_DEVICE Table3D(T *a_p, GpuArray< int, 3 > const &a_begin, GpuArray< int, 3 > const &a_end) noexcept
Definition: AMReX_TableData.H:179
Definition: AMReX_TableData.H:253
static constexpr int len1(GpuArray< int, 4 > const &a_begin, GpuArray< int, 4 > const &a_end) noexcept
Definition: AMReX_TableData.H:343
constexpr Table4D() noexcept=default
static constexpr int len2(GpuArray< int, 4 > const &a_begin, GpuArray< int, 4 > const &a_end) noexcept
Definition: AMReX_TableData.H:353
static constexpr int len0(GpuArray< int, 4 > const &a_begin, GpuArray< int, 4 > const &a_end) noexcept
Definition: AMReX_TableData.H:333
constexpr AMREX_GPU_HOST_DEVICE Table4D(T *a_p, GpuArray< int, 4 > const &a_begin, GpuArray< int, 4 > const &a_end) noexcept
Definition: AMReX_TableData.H:275