|
| TableData () noexcept=default |
|
| TableData (Arena *ar) noexcept |
|
| TableData (Array< int, N > const &lo, Array< int, N > const &hi, Arena *ar=nullptr) |
|
| TableData (TableData< T, N, ORDER > const &)=delete |
|
TableData< T, N, ORDER > & | operator= (TableData< T, N, ORDER > const &)=delete |
|
| TableData (TableData< T, N, ORDER > &&rhs) noexcept |
|
TableData< T, N, ORDER > & | operator= (TableData< T, N, ORDER > &&rhs) noexcept |
|
| ~TableData () noexcept |
|
constexpr int | dim () const noexcept |
|
void | resize (Array< int, N > const &lo, Array< int, N > const &hi, Arena *ar=nullptr) |
|
Long | size () const noexcept |
|
Array< int, N > const & | lo () const noexcept |
|
Array< int, N > const & | hi () const noexcept |
|
void | clear () noexcept |
|
void | copy (TableData< T, N, ORDER > const &rhs) noexcept |
|
table_type | table () noexcept |
|
const_table_type | table () const noexcept |
|
const_table_type | const_table () const noexcept |
|
| DataAllocator () noexcept=default |
|
| DataAllocator (Arena *ar) noexcept |
|
void * | alloc (std::size_t sz) const noexcept |
|
void | free (void *pt) const noexcept |
|
Arena * | arena () const noexcept |
|
template<typename T, int N, Order ORDER = Order::F>
class amrex::TableData< T, N, ORDER >
Multi-dimensional array class.
This class is somewhat similar to FArrayBox/BaseFab. The main difference is the dimension of the array in this class can be 1, 2, 3, or 4, whereas the dimension of FArrayBox/BaseFab is the spatial dimension (AMREX_SPACEDIM) plus a component dimension. Another difference is that this class supports both column-major order (i.e., Fortran order) and row-major order (i.e., C order), whereas FArrayBox/BaseFab is always column-major. Below is an example of using it to store a 3D table of data that is initialized on CPU and is read-only by all GPU threads on the device.
Array<int,3> tlo{0,0,0};
Array<int,3> thi{100,100,100};
TableData<Real,3> table_data(tlo, thi);
#ifdef AMREX_USE_GPU
auto const& h_table = h_table_data.table();
#else
auto const& h_table = table_data.table();
#endif
for (int k = tlo[0]; k <= thi[0]; ++k) {
for (int j = tlo[1]; j <= thi[1]; ++j) {
for (int i = tlo[2]; i <= thi[2]; ++i) {
h_table(i,j,k) = i + 1.e3*j + 1.e6*k;
}}}
#ifdef AMREX_USE_GPU
table_data.copy(h_table_data);
#endif
auto const&
table = table_data.const_table();
table_type table() noexcept
Definition: AMReX_TableData.H:604
void streamSynchronize() noexcept
Definition: AMReX_GpuDevice.H:237
Arena * The_Pinned_Arena()
Definition: AMReX_Arena.cpp:649