Skip to content

Commit

Permalink
Add Array support for 'uint32' (unsigned int)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Dec 5, 2024
1 parent 6f808ac commit 3964826
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/atlas/array/helpers/ArrayInitializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ struct array_initializer {
return array_initializer_impl<int, Rank, 0>::apply(orig, array_resized);
case DataType::KIND_INT64:
return array_initializer_impl<long, Rank, 0>::apply(orig, array_resized);
case DataType::KIND_UINT32:
return array_initializer_impl<unsigned int, Rank, 0>::apply(orig, array_resized);
case DataType::KIND_UINT64:
return array_initializer_impl<unsigned long, Rank, 0>::apply(orig, array_resized);
default: {
Expand Down Expand Up @@ -188,6 +190,9 @@ struct array_initializer_partitioned_impl {
return array_initializer_partitioned_val_impl<int, Rank, 0, PartDim>::apply(orig, dest, pos, offset);
case DataType::KIND_INT64:
return array_initializer_partitioned_val_impl<long, Rank, 0, PartDim>::apply(orig, dest, pos, offset);
case DataType::KIND_UINT32:
return array_initializer_partitioned_val_impl<unsigned int, Rank, 0, PartDim>::apply(orig, dest, pos,
offset);
case DataType::KIND_UINT64:
return array_initializer_partitioned_val_impl<unsigned long, Rank, 0, PartDim>::apply(orig, dest, pos,
offset);
Expand Down
17 changes: 14 additions & 3 deletions src/atlas/array/native/NativeArray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Array* Array::create(DataType datatype, const ArrayShape& shape) {
return new ArrayT<int>(shape);
case DataType::KIND_INT64:
return new ArrayT<long>(shape);
case DataType::KIND_UINT32:
return new ArrayT<unsigned int>(shape);
case DataType::KIND_UINT64:
return new ArrayT<unsigned long>(shape);
default: {
Expand All @@ -97,6 +99,8 @@ Array* Array::create(DataType datatype, ArraySpec&& spec) {
return new ArrayT<int>(std::move(spec));
case DataType::KIND_INT64:
return new ArrayT<long>(std::move(spec));
case DataType::KIND_UINT32:
return new ArrayT<unsigned int>(std::move(spec));
case DataType::KIND_UINT64:
return new ArrayT<unsigned long>(std::move(spec));
default: {
Expand Down Expand Up @@ -306,59 +310,66 @@ template Array* Array::create<long>(idx_t);
template Array* Array::create<float>(idx_t);
template Array* Array::create<double>(idx_t);
template Array* Array::create<long unsigned>(idx_t);
template Array* Array::create<unsigned int>(idx_t);

template Array* Array::create<int>(idx_t, idx_t);
template Array* Array::create<long>(idx_t, idx_t);
template Array* Array::create<float>(idx_t, idx_t);
template Array* Array::create<double>(idx_t, idx_t);
template Array* Array::create<long unsigned>(idx_t, idx_t);
template Array* Array::create<unsigned int>(idx_t, idx_t);

template Array* Array::create<int>(idx_t, idx_t, idx_t);
template Array* Array::create<long>(idx_t, idx_t, idx_t);
template Array* Array::create<float>(idx_t, idx_t, idx_t);
template Array* Array::create<double>(idx_t, idx_t, idx_t);
template Array* Array::create<long unsigned>(idx_t, idx_t, idx_t);
template Array* Array::create<unsigned int>(idx_t, idx_t, idx_t);

template Array* Array::create<int>(idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<long>(idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<float>(idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<double>(idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<long unsigned>(idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<unsigned int>(idx_t, idx_t, idx_t, idx_t);

template Array* Array::create<int>(idx_t, idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<long>(idx_t, idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<float>(idx_t, idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<double>(idx_t, idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<long unsigned>(idx_t, idx_t, idx_t, idx_t, idx_t);
template Array* Array::create<unsigned int>(idx_t, idx_t, idx_t, idx_t, idx_t);

template Array* Array::create<int>(const ArrayShape&);
template Array* Array::create<long>(const ArrayShape&);
template Array* Array::create<float>(const ArrayShape&);
template Array* Array::create<double>(const ArrayShape&);
template Array* Array::create<long unsigned>(const ArrayShape&);
template Array* Array::create<unsigned int>(const ArrayShape&);

template Array* Array::create<int>(const ArrayShape&, const ArrayLayout&);
template Array* Array::create<long>(const ArrayShape&, const ArrayLayout&);
template Array* Array::create<float>(const ArrayShape&, const ArrayLayout&);
template Array* Array::create<double>(const ArrayShape&, const ArrayLayout&);
template Array* Array::create<long unsigned>(const ArrayShape&, const ArrayLayout&);
template Array* Array::create<unsigned int>(const ArrayShape&, const ArrayLayout&);

template Array* Array::wrap<int>(int*, const ArrayShape&);
template Array* Array::wrap<long>(long*, const ArrayShape&);
template Array* Array::wrap<float>(float*, const ArrayShape&);
template Array* Array::wrap<double>(double*, const ArrayShape&);
template Array* Array::wrap<long unsigned>(long unsigned*, const ArrayShape&);
template Array* Array::wrap<unsigned int>(unsigned int*, const ArrayShape&);

template Array* Array::wrap<int>(int*, const ArraySpec&);
template Array* Array::wrap<long>(long*, const ArraySpec&);
template Array* Array::wrap<float>(float*, const ArraySpec&);
template Array* Array::wrap<double>(double*, const ArraySpec&);
template Array* Array::wrap<long unsigned>(long unsigned*, const ArraySpec&);
template Array* Array::wrap<unsigned int>(unsigned int*, const ArraySpec&);

template class ArrayT<int>;
template class ArrayT<long>;
template class ArrayT<float>;
template class ArrayT<double>;
template class ArrayT<unsigned int>;
template class ArrayT<unsigned long>;

} // namespace array
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/array/native/NativeArrayView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ namespace array {
template class ArrayView<const int, Rank>; \
template class ArrayView<long, Rank>; \
template class ArrayView<const long, Rank>; \
template class ArrayView<unsigned int, Rank>; \
template class ArrayView<const unsigned int, Rank>; \
template class ArrayView<long unsigned, Rank>; \
template class ArrayView<const long unsigned, Rank>; \
template class ArrayView<float, Rank>; \
Expand Down
1 change: 1 addition & 0 deletions src/atlas/array/native/NativeMakeView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ namespace array {
EXPLICIT_TEMPLATE_INSTANTIATION_TYPE_RANK(long, RANK) \
EXPLICIT_TEMPLATE_INSTANTIATION_TYPE_RANK(float, RANK) \
EXPLICIT_TEMPLATE_INSTANTIATION_TYPE_RANK(double, RANK) \
EXPLICIT_TEMPLATE_INSTANTIATION_TYPE_RANK(unsigned int, RANK) \
EXPLICIT_TEMPLATE_INSTANTIATION_TYPE_RANK(unsigned long, RANK)


Expand Down

0 comments on commit 3964826

Please sign in to comment.