12 #ifdef MOOSE_KOKKOS_SCOPE 19 #define usingKokkosArrayBaseMembers(T, dimension) \ 21 using ArrayBase<T, dimension>::_n; \ 22 using ArrayBase<T, dimension>::_s; \ 23 using ArrayBase<T, dimension>::_d; \ 26 using ArrayBase<T, dimension>::create; \ 27 using ArrayBase<T, dimension>::createHost; \ 28 using ArrayBase<T, dimension>::createDevice; \ 29 using ArrayBase<T, dimension>::offset; \ 30 using ArrayBase<T, dimension>::operator= 39 void free(
void * ptr);
55 template <
typename T,
unsigned int dimension = 1>
69 static const bool value =
false;
72 template <
typename T,
unsigned int dimension>
82 template <
typename T,
unsigned int dimension>
96 #ifndef MOOSE_KOKKOS_SCOPE 98 "Kokkos array cannot be deep copied outside the Kokkos compilation scope");
129 #ifdef MOOSE_KOKKOS_SCOPE 171 KOKKOS_FUNCTION T *
data()
const 193 KOKKOS_FUNCTION T &
last()
const 207 KOKKOS_ASSERT(i <
_size);
228 void create(
const std::vector<dof_id_type> &
n) { createInternal<true, true>(
n); }
233 void createHost(
const std::vector<dof_id_type> &
n) { createInternal<true, false>(
n); }
238 void createDevice(
const std::vector<dof_id_type> &
n) { createInternal<false, true>(
n); }
253 void offset(
const std::vector<dof_id_signed_type> & d);
332 KOKKOS_FUNCTION iterator
begin()
const 334 KOKKOS_IF_ON_HOST(
return iterator(
_host_data);)
342 KOKKOS_FUNCTION iterator
end()
const 364 #ifdef MOOSE_KOKKOS_SCOPE 371 template <
bool host,
bool device>
379 void createInternal(
const std::vector<dof_id_type> &
n,
bool host,
bool device);
388 template <
typename TargetSpace,
typename SourceSpace>
393 #ifdef MOOSE_KOKKOS_SCOPE 442 template <
typename T,
unsigned int dimension>
449 if (_counter.use_count() > 1)
451 _host_data =
nullptr;
452 _device_data =
nullptr;
454 else if (_counter.use_count() == 1)
456 if (_is_host_alloc && !_is_host_alias)
458 if constexpr (std::is_default_constructible<T>::value)
471 if (_is_device_alloc && !_is_device_alias)
477 for (
unsigned int i = 0; i < dimension; ++i)
485 _is_host_alloc =
false;
486 _is_device_alloc =
false;
487 _is_host_alias =
false;
488 _is_device_alias =
false;
493 template <
typename T,
unsigned int dimension>
503 for (
unsigned int i = 0; i < dimension; ++i)
520 #ifdef MOOSE_KOKKOS_SCOPE 521 template <
typename T,
unsigned int dimension>
526 mooseError(
"Kokkos array error: attempted to alias host data before array initialization.");
528 if (_is_host_alloc && !_is_host_alias)
529 mooseError(
"Kokkos array error: cannot alias host data because host data was not aliased.");
532 _is_host_alloc =
true;
533 _is_host_alias =
true;
536 template <
typename T,
unsigned int dimension>
541 mooseError(
"Kokkos array error: attempted to alias device data before array initialization.");
543 if (_is_device_alloc && !_is_device_alias)
544 mooseError(
"Kokkos array error: cannot alias device data because device data was not aliased.");
547 _is_device_alloc =
true;
548 _is_device_alias =
true;
551 template <
typename T,
unsigned int dimension>
558 if constexpr (std::is_default_constructible<T>::value)
559 _host_data =
new T[_size];
561 _host_data =
static_cast<T *
>(std::malloc(_size *
sizeof(T)));
563 _is_host_alloc =
true;
566 template <
typename T,
unsigned int dimension>
570 if (_is_device_alloc)
574 static_cast<T *
>(::Kokkos::kokkos_malloc<ExecSpace::memory_space>(_size *
sizeof(T)));
576 _is_device_alloc =
true;
579 template <
typename T,
unsigned int dimension>
580 template <
bool host,
bool device>
584 if (n.size() != dimension)
585 mooseError(
"Kokkos array error: the number of dimensions provided (",
587 ") must match the array dimension (",
594 _counter = std::make_shared<unsigned int>();
605 _s[i] = _s[i - 1] * _n[i - 1];
611 if constexpr (device)
617 template <
typename T,
unsigned int dimension>
622 createInternal<true, true>(n);
623 else if (host && !device)
624 createInternal<true, false>(n);
625 else if (!host && device)
626 createInternal<false, true>(n);
628 createInternal<false, false>(n);
631 template <
typename T,
unsigned int dimension>
632 template <
typename TargetSpace,
typename SourceSpace>
636 ::Kokkos::Impl::DeepCopy<TargetSpace, SourceSpace>(target, source, n *
sizeof(T));
640 template <
typename T,
unsigned int dimension>
644 if (d.size() > dimension)
645 mooseError(
"Kokkos array error: the number of offsets provided (",
647 ") cannot be larger than the array dimension (",
655 template <
typename T,
unsigned int dimension>
664 if (!_is_device_alloc)
666 if (_counter.use_count() == 1)
671 mooseError(
"Kokkos array error: cannot copy from host to device because device side memory " 672 "was not allocated and array is being shared with other arrays.");
676 copyInternal<MemSpace, ::Kokkos::HostSpace>(_device_data, _host_data, _size);
679 template <
typename T,
unsigned int dimension>
684 if (!_is_device_alloc)
690 if (_counter.use_count() == 1)
695 mooseError(
"Kokkos array error: cannot copy from device to host because host side memory " 696 "was not allocated and array is being shared with other arrays.");
700 copyInternal<::Kokkos::HostSpace, MemSpace>(_host_data, _device_data, _size);
703 template <
typename T,
unsigned int dimension>
708 mooseError(
"Kokkos array error: cannot copyin data larger than the array size.");
711 mooseError(
"Kokkos array error: offset cannot be larger than the array size.");
720 copyInternal<::Kokkos::HostSpace, ::Kokkos::HostSpace>(_host_data + offset, ptr, n);
725 if (!_is_device_alloc)
729 copyInternal<MemSpace, ::Kokkos::HostSpace>(_device_data + offset, ptr, n);
738 copyInternal<::Kokkos::HostSpace, MemSpace>(_host_data + offset, ptr, n);
743 if (!_is_device_alloc)
747 copyInternal<MemSpace, MemSpace>(_device_data + offset, ptr, n);
751 template <
typename T,
unsigned int dimension>
756 mooseError(
"Kokkos array error: cannot copyout data larger than the array size.");
759 mooseError(
"Kokkos array error: offset cannot be larger than the array size.");
768 copyInternal<::Kokkos::HostSpace, ::Kokkos::HostSpace>(ptr, _host_data + offset, n);
777 copyInternal<MemSpace, ::Kokkos::HostSpace>(ptr, _host_data + offset, n);
782 if (!_is_device_alloc)
786 copyInternal<::Kokkos::HostSpace, MemSpace>(ptr, _device_data + offset, n);
791 if (!_is_device_alloc)
795 copyInternal<MemSpace, MemSpace>(ptr, _device_data + offset, n);
799 template <
typename T>
805 template <
typename T,
unsigned int dimension>
809 data.copyToDeviceNested();
812 template <
typename T,
unsigned int dimension>
816 for (
unsigned int i = 0; i < _size; ++i)
822 template <
typename T,
unsigned int dimension>
828 "Kokkos array error: cannot deep copy using constructor from array without host data.");
830 std::vector<dof_id_type> n(std::begin(array.
_n), std::end(array.
_n));
844 std::memcpy(_host_data, array.
_host_data, _size *
sizeof(T));
846 if (_is_device_alloc)
847 copyInternal<MemSpace, MemSpace>(_device_data, array.
_device_data, _size);
850 for (
unsigned int i = 0; i < dimension; ++i)
857 template <
typename T,
unsigned int dimension>
864 this->shallowCopy(array);
868 template <
typename T,
unsigned int dimension>
873 std::fill_n(_host_data, _size, scalar);
875 if (_is_device_alloc)
877 ::Kokkos::View<T *, MemSpace, ::Kokkos::MemoryTraits<::Kokkos::Unmanaged>> data(_device_data,
879 ::Kokkos::Experimental::fill_n(ExecSpace(), data, _size, scalar);
885 template <
typename T,
unsigned int dimension>
891 bool is_alloc = array.isAlloc();
897 std::string type =
typeid(T).
name();
900 unsigned int dim = dimension;
903 for (
unsigned int dim = 0;
dim < dimension; ++
dim)
905 auto n = array.n(
dim);
909 if (array.isDeviceAlloc())
915 T * data =
static_cast<T *
>(std::malloc(array.size() *
sizeof(T)));
925 for (
auto &
value : array)
929 template <
typename T,
unsigned int dimension>
936 dataLoad(stream, is_alloc,
nullptr);
941 std::string from_type_name;
942 dataLoad(stream, from_type_name,
nullptr);
944 if (from_type_name !=
typeid(T).
name())
945 mooseError(
"Kokkos array error: cannot load an array because the stored array is of type '",
947 "' but the loading array is of type '",
951 unsigned int from_dimension;
952 dataLoad(stream, from_dimension,
nullptr);
954 if (from_dimension != dimension)
955 mooseError(
"Kokkos array error: cannot load an array because the stored array is ",
957 "D but the loading array is ",
961 std::vector<dof_id_type> from_n(dimension);
962 std::vector<dof_id_type> n(dimension);
964 for (
unsigned int dim = 0;
dim < dimension; ++
dim)
971 mooseError(
"Kokkos array error: cannot load an array because the stored array has dimensions (",
973 ") but the loading array has dimensions (",
977 if (array.isHostAlloc())
979 for (
auto &
value : array)
982 if (array.isDeviceAlloc())
983 array.copyToDevice();
987 std::vector<T> data(array.size());
989 for (
auto &
value : data)
1008 template <
typename T>
1012 #ifdef MOOSE_KOKKOS_SCOPE 1013 usingKokkosArrayBaseMembers(T, 1);
1031 this->shallowCopy(array);
1036 #ifdef MOOSE_KOKKOS_SCOPE 1050 Array(
const std::vector<T> & vector) { *
this = vector; }
1085 template <
bool host,
bool device>
1088 this->
template createInternal<host, device>({
static_cast<dof_id_type>(vector.size())});
1091 std::memcpy(this->hostData(), vector.data(), this->size() *
sizeof(T));
1094 this->
template copyInternal<MemSpace, ::Kokkos::HostSpace>(
1095 this->deviceData(), vector.data(), this->size());
1104 template <
bool host,
bool device>
1107 std::vector<T> vector(
set.begin(),
set.end());
1109 copyVector<host, device>(vector);
1119 copyVector<true, true>(vector);
1130 copySet<true, true>(
set);
1143 KOKKOS_ASSERT(i0 - _d[0] >= 0 && static_cast<dof_id_type>(i0 - _d[0]) < _n[0]);
1145 return this->operator[](i0 - _d[0]);
1150 template <
typename T>
1153 #ifdef MOOSE_KOKKOS_SCOPE 1154 usingKokkosArrayBaseMembers(T, 2);
1172 this->shallowCopy(array);
1177 #ifdef MOOSE_KOKKOS_SCOPE 1194 this->
template createInternal<false, false>({n0, n1});
1203 this->
template createInternal<true, true>({n0, n1});
1212 this->
template createInternal<true, false>({n0, n1});
1221 this->
template createInternal<false, true>({n0, n1});
1239 KOKKOS_ASSERT(i0 - _d[0] >= 0 && static_cast<dof_id_type>(i0 - _d[0]) < _n[0]);
1240 KOKKOS_ASSERT(i1 - _d[1] >= 0 && static_cast<dof_id_type>(i1 - _d[1]) < _n[1]);
1242 return this->operator[](i0 - _d[0] + (i1 - _d[1]) * _s[1]);
1247 template <
typename T>
1250 #ifdef MOOSE_KOKKOS_SCOPE 1251 usingKokkosArrayBaseMembers(T, 3);
1269 this->shallowCopy(array);
1274 #ifdef MOOSE_KOKKOS_SCOPE 1293 this->
template createInternal<false, false>({n0, n1, n2});
1303 this->
template createInternal<true, true>({n0, n1, n2});
1313 this->
template createInternal<true, false>({n0, n1, n2});
1323 this->
template createInternal<false, true>({n0, n1, n2});
1347 KOKKOS_ASSERT(i0 - _d[0] >= 0 && static_cast<dof_id_type>(i0 - _d[0]) < _n[0]);
1348 KOKKOS_ASSERT(i1 - _d[1] >= 0 && static_cast<dof_id_type>(i1 - _d[1]) < _n[1]);
1349 KOKKOS_ASSERT(i2 - _d[2] >= 0 && static_cast<dof_id_type>(i2 - _d[2]) < _n[2]);
1351 return this->operator[](i0 - _d[0] + (i1 - _d[1]) * _s[1] + (i2 - _d[2]) * _s[2]);
1356 template <
typename T>
1359 #ifdef MOOSE_KOKKOS_SCOPE 1360 usingKokkosArrayBaseMembers(T, 4);
1378 this->shallowCopy(array);
1383 #ifdef MOOSE_KOKKOS_SCOPE 1404 this->
template createInternal<false, false>({n0, n1, n2, n3});
1415 this->
template createInternal<true, true>({n0, n1, n2, n3});
1426 this->
template createInternal<true, false>({n0, n1, n2, n3});
1437 this->
template createInternal<false, true>({n0, n1, n2, n3});
1466 KOKKOS_ASSERT(i0 - _d[0] >= 0 && static_cast<dof_id_type>(i0 - _d[0]) < _n[0]);
1467 KOKKOS_ASSERT(i1 - _d[1] >= 0 && static_cast<dof_id_type>(i1 - _d[1]) < _n[1]);
1468 KOKKOS_ASSERT(i2 - _d[2] >= 0 && static_cast<dof_id_type>(i2 - _d[2]) < _n[2]);
1469 KOKKOS_ASSERT(i3 - _d[3] >= 0 && static_cast<dof_id_type>(i3 - _d[3]) < _n[3]);
1471 return this->operator[](i0 - _d[0] + (i1 - _d[1]) * _s[1] + (i2 - _d[2]) * _s[2] +
1472 (i3 - _d[3]) * _s[3]);
1477 template <
typename T>
1480 #ifdef MOOSE_KOKKOS_SCOPE 1481 usingKokkosArrayBaseMembers(T, 5);
1499 this->shallowCopy(array);
1504 #ifdef MOOSE_KOKKOS_SCOPE 1517 create(n0, n1, n2, n3, n4);
1530 this->
template createInternal<false, false>({n0, n1, n2, n3, n4});
1542 this->
template createInternal<true, true>({n0, n1, n2, n3, n4});
1554 this->
template createInternal<true, false>({n0, n1, n2, n3, n4});
1566 this->
template createInternal<false, true>({n0, n1, n2, n3, n4});
1601 KOKKOS_ASSERT(i0 - _d[0] >= 0 && static_cast<dof_id_type>(i0 - _d[0]) < _n[0]);
1602 KOKKOS_ASSERT(i1 - _d[1] >= 0 && static_cast<dof_id_type>(i1 - _d[1]) < _n[1]);
1603 KOKKOS_ASSERT(i2 - _d[2] >= 0 && static_cast<dof_id_type>(i2 - _d[2]) < _n[2]);
1604 KOKKOS_ASSERT(i3 - _d[3] >= 0 && static_cast<dof_id_type>(i3 - _d[3]) < _n[3]);
1605 KOKKOS_ASSERT(i4 - _d[4] >= 0 && static_cast<dof_id_type>(i4 - _d[4]) < _n[4]);
1607 return this->operator[](i0 - _d[0] + (i1 - _d[1]) * _s[1] + (i2 - _d[2]) * _s[2] +
1608 (i3 - _d[3]) * _s[3] + (i4 - _d[4]) * _s[4]);
1614 template <
typename T>
1616 template <
typename T>
1618 template <
typename T>
1620 template <
typename T>
1622 template <
typename T>
std::string name(const ElemQuality q)
The specialization of the Kokkos array class for each dimension.
void createDevice(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3, dof_id_type n4)
Initialize and allocate array with given dimensions on device only.
void swap(ArrayBase< T, dimension > &array)
Swap with another Kokkos array.
KOKKOS_FUNCTION dof_id_type n(unsigned int dim) const
Get the size of a dimension.
KOKKOS_FUNCTION bool operator==(const iterator &other) const
void createHost(dof_id_type n0, dof_id_type n1)
Initialize and allocate array with given dimensions on host only.
bool _is_device_alias
Flag whether the device data points to an external data.
void copyOut(T *ptr, MemcpyKind dir, dof_id_type n, dof_id_type offset=0)
Copy data to an external data from this array.
KOKKOS_FUNCTION T * operator &() const
bool _is_device_alloc
Flag whether device data was allocated.
dof_id_type _n[dimension]
Size of each dimension.
void shallowCopy(const ArrayBase< T, dimension > &array)
Shallow copy another Kokkos array.
KOKKOS_FUNCTION T & first() const
Get the first element.
void copyToHost()
Copy data from device to host.
T * hostData() const
Get the host data pointer.
KOKKOS_FUNCTION dof_id_type size() const
Get the total array size.
Array(dof_id_type n0, dof_id_type n1)
Constructor Initialize and allocate array with given dimensions This allocates both host and device d...
Array(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3, dof_id_type n4)
Constructor Initialize and allocate array with given dimensions This allocates both host and device d...
void init(dof_id_type n0, dof_id_type n1)
Initialize array with given dimensions but do not allocate.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
void offset(const std::vector< dof_id_signed_type > &d)
Apply starting index offsets to each dimension.
void destroy()
Free all data and reset.
KOKKOS_FUNCTION T & operator()(dof_id_signed_type i0) const
Get an array entry.
ArrayBase(const ArrayBase< T, dimension > &array)
Copy constructor.
void allocHost()
Allocate host data for an initialized array that has not allocated host data.
Array(dof_id_type n0, dof_id_type n1, dof_id_type n2)
Constructor Initialize and allocate array with given dimensions This allocates both host and device d...
Array(const Array< T, 1 > &array)
Copy constructor.
KOKKOS_FUNCTION iterator end() const
Get the end iterator.
KOKKOS_FUNCTION T & last() const
Get the last element.
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
MemcpyKind
The enumerator that dictates the memory copy direction.
auto & operator=(const Array< T, 4 > &array)
Shallow copy another Kokkos array.
void create(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3)
Initialize and allocate array with given dimensions on host and device.
void copyToDevice()
Copy data from host to device.
KOKKOS_FUNCTION bool isDeviceAlloc() const
Get whether the array was allocated on device.
Array(const std::vector< T > &vector)
Constructor Initialize and allocate array by copying a standard vector variable This allocates and co...
KOKKOS_FUNCTION T & operator()(dof_id_signed_type i0, dof_id_signed_type i1) const
Get an array entry.
Array(const Array< T, 5 > &array)
Copy constructor.
KOKKOS_FUNCTION T & operator()(dof_id_signed_type i0, dof_id_signed_type i1, dof_id_signed_type i2, dof_id_signed_type i3) const
Get an array entry.
void offset(dof_id_signed_type d0, dof_id_signed_type d1, dof_id_signed_type d2, dof_id_signed_type d3)
Set starting index offsets.
void copySet(const std::set< T > &set)
Copy a standard set variable This re-initializes and re-allocates array with the size of the set...
Array(const Array< T, 4 > &array)
Copy constructor.
void create(dof_id_type n0, dof_id_type n1, dof_id_type n2)
Initialize and allocate array with given dimensions on host and device.
void offset(dof_id_signed_type d0, dof_id_signed_type d1)
Set starting index offsets.
Array(const Array< T, 3 > &array)
Copy constructor.
void create(dof_id_type n0, dof_id_type n1)
Initialize and allocate array with given dimensions on host and device.
void createDevice(dof_id_type n0)
Initialize and allocate array with given dimensions on device only.
ArrayBase()=default
Default constructor.
void aliasDevice(T *ptr)
Point the device data to an external data instead of allocating it.
void createDevice(dof_id_type n0, dof_id_type n1)
Initialize and allocate array with given dimensions on device only.
void copyIn(const T *ptr, MemcpyKind dir, dof_id_type n, dof_id_type offset=0)
Copy data from an external data to this array.
bool _is_init
Flag whether array was initialized.
void createHost(dof_id_type n0)
Initialize and allocate array with given dimensions on host only.
KOKKOS_FUNCTION iterator operator++(int)
dof_id_type _size
Total size.
KOKKOS_FUNCTION bool operator!=(const iterator &other) const
auto & operator=(const std::vector< T > &vector)
Copy a standard vector variable This allocates and copies to both host and device data...
KOKKOS_FUNCTION T & operator[](dof_id_type i) const
Get an array entry.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void init(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3, dof_id_type n4)
Initialize array with given dimensions but do not allocate.
void createHost(dof_id_type n0, dof_id_type n1, dof_id_type n2)
Initialize and allocate array with given dimensions on host only.
dof_id_type _s[dimension]
Stride of each dimension.
KOKKOS_FUNCTION bool isDeviceAlias() const
Get whether the device array was aliased.
auto & operator=(const Array< T, 3 > &array)
Shallow copy another Kokkos array.
void copyToDeviceInner(T &)
KOKKOS_FUNCTION bool isHostAlloc() const
Get whether the array was allocated on host.
void deepCopy(const ArrayBase< T, dimension > &array)
Deep copy another Kokkos array If ArrayDeepCopy<T>::value is true, it will copy-construct each entry ...
KOKKOS_FUNCTION bool isAlloc() const
Get whether the array was allocated either on host or device.
void createDevice(const std::vector< dof_id_type > &n)
Allocate array on device only.
int8_t dof_id_signed_type
void init(dof_id_type n0)
Initialize array with given dimensions but do not allocate.
The base class for Kokkos arrays.
void createHost(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3, dof_id_type n4)
Initialize and allocate array with given dimensions on host only.
void createHost(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3)
Initialize and allocate array with given dimensions on host only.
unsigned int useCount() const
Get the reference count.
void createDevice(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3)
Initialize and allocate array with given dimensions on device only.
std::string stringify(const T &t)
conversion to string
std::string demangle(const char *name)
void createDevice(dof_id_type n0, dof_id_type n1, dof_id_type n2)
Initialize and allocate array with given dimensions on device only.
KOKKOS_FUNCTION T * data() const
Get the data pointer.
void copyInternal(T *target, const T *source, dof_id_type n)
The internal method to perform a memory copy.
void copyToDeviceNested()
Copy all the nested Kokkos arrays including self from host to device.
void create(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3, dof_id_type n4)
Initialize and allocate array with given dimensions on host and device.
auto & operator=(const Array< T, 5 > &array)
Shallow copy another Kokkos array.
The type trait that determines the default behavior of copy constructor and deepCopy() If this type t...
KOKKOS_FUNCTION T & operator()(dof_id_signed_type i0, dof_id_signed_type i1, dof_id_signed_type i2) const
Get an array entry.
bool _is_host_alias
Flag whether the host data points to an external data.
KOKKOS_FUNCTION iterator begin() const
Get the beginning iterator.
void create(dof_id_type n0)
Initialize and allocate array with given dimensions on host and device.
T * deviceData() const
Get the device data pointer.
void dataStore(std::ostream &stream, Array< T, dimension > &array, void *context)
void dataLoad(std::istream &stream, Array< T, dimension > &array, void *context)
std::shared_ptr< unsigned int > _counter
Reference counter.
auto & operator=(const T &scalar)
Assign a scalar value uniformly.
T * _device_data
Device data.
void createInternal(const std::vector< dof_id_type > &n)
The internal method to initialize and allocate this array.
void init(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3)
Initialize array with given dimensions but do not allocate.
void offset(dof_id_signed_type d0)
Set starting index offsets.
KOKKOS_FUNCTION iterator(T *it)
void createHost(const std::vector< dof_id_type > &n)
Allocate array on host only.
IntRange< T > make_range(T beg, T end)
void copyVector(const std::vector< T > &vector)
Copy a standard vector variable This re-initializes and re-allocates array with the size of the vecto...
KOKKOS_FUNCTION T & operator()(dof_id_signed_type i0, dof_id_signed_type i1, dof_id_signed_type i2, dof_id_signed_type i3, dof_id_signed_type i4) const
Get an array entry.
KOKKOS_FUNCTION iterator & operator++()
Array(dof_id_type n0, dof_id_type n1, dof_id_type n2, dof_id_type n3)
Constructor Initialize and allocate array with given dimensions This allocates both host and device d...
void allocDevice()
Allocate device data for an initialized array that has not allocated device data. ...
Array(dof_id_type n0)
Constructor Initialize and allocate array with given dimensions This allocates both host and device d...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
dof_id_signed_type _d[dimension]
Offset of each dimension.
void offset(dof_id_signed_type d0, dof_id_signed_type d1, dof_id_signed_type d2)
Set starting index offsets.
void init(dof_id_type n0, dof_id_type n1, dof_id_type n2)
Initialize array with given dimensions but do not allocate.
Array(const Array< T, 2 > &array)
Copy constructor.
void destroy(triangulateio &t, IO_Type)
bool _is_host_alloc
Flag whether host data was allocated.
void create(const std::vector< dof_id_type > &n)
Allocate array on host and device.
KOKKOS_FUNCTION T & operator*() const
auto & operator=(const std::set< T > &set)
Copy a standard set variable This allocates and copies to both host and device data.
auto & operator=(const Array< T, 1 > &array)
Shallow copy another Kokkos array.
auto index_range(const T &sizable)
void offset(dof_id_signed_type d0, dof_id_signed_type d1, dof_id_signed_type d2, dof_id_signed_type d3, dof_id_signed_type d4)
Set starting index offsets.
KOKKOS_FUNCTION bool isHostAlias() const
Get whether the host array was aliased.
auto & operator=(const Array< T, 2 > &array)
Shallow copy another Kokkos array.
std::string prettyCppType(const std::string &cpp_type)
void aliasHost(T *ptr)
Point the host data to an external data instead of allocating it.