12#ifndef ARCCORE_BASE_SPAN_H
13#define ARCCORE_BASE_SPAN_H
49template <
typename T,
typename SizeType>
76template <
typename SizeType>
77class DynamicExtentStorage
79 template <
typename T,
typename SpanSizeType, SpanSizeType SpanExtent>
80 friend class ::Arcane::SpanImpl;
84 explicit constexpr DynamicExtentStorage(SizeType s) noexcept
90 constexpr SizeType size()
const noexcept {
return m_size; }
101 static void _throwBadSize [[noreturn]] (
Int64 wanted_size,
Int64 expected_size);
105template <
typename SizeType, SizeType FixedExtent>
108 template <
typename T,
typename SpanSizeType, SpanSizeType SpanExtent>
109 friend class ::Arcane::SpanImpl;
113 explicit constexpr ExtentStorage([[maybe_unused]] SizeType s)
noexcept
115#if defined(ARCCORE_CHECK) && !defined(ARCCORE_DEVICE_CODE)
116 if (s != FixedExtent)
117 ExtentStorageBase::_throwBadSize(s, FixedExtent);
120 ExtentStorage() =
default;
124 constexpr SizeType size()
const noexcept {
return FixedExtent; }
128 static constexpr SizeType m_size = FixedExtent;
134:
public DynamicExtentStorage<Int32>
136 using BaseClass = DynamicExtentStorage<Int32>;
140 explicit constexpr ExtentStorage(
Int32 s) noexcept
148:
public DynamicExtentStorage<Int64>
150 using BaseClass = DynamicExtentStorage<Int64>;
154 explicit constexpr ExtentStorage(
Int64 s) noexcept
187template <
typename T,
typename SizeType, SizeType Extent>
196 using size_type = SizeType;
197 using ElementType = T;
198 using element_type = ElementType;
199 using value_type =
typename std::remove_cv_t<ElementType>;
200 using const_value_type =
typename std::add_const_t<value_type>;
201 using index_type = SizeType;
202 using difference_type = SizeType;
203 using pointer = ElementType*;
204 using const_pointer =
const ElementType*;
205 using reference = ElementType&;
206 using const_reference =
const ElementType&;
209 using view_type =
typename Impl::ViewTypeT<ElementType>::view_type;
210 using reverse_iterator = std::reverse_iterator<iterator>;
211 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
214 template <
typename X>
215 using is_same_const_type = std::enable_if_t<std::is_same_v<X, T> || std::is_same_v<std::add_const_t<X>, T>>;
217 static constexpr bool IsDynamic = (Extent ==
DynExtent);
229 template <
typename X, SizeType XExtent,
typename = std::enable_if_t<std::is_same_v<const X, T>>>
232 , m_size(from.size())
235 template <SizeType XExtent>
238 , m_size(from.size())
243 constexpr ARCCORE_HOST_DEVICE
SpanImpl(pointer ptr, SizeType asize) noexcept
249 template <std::
size_t N,
typename X,
typename = is_same_const_type<X>>
250 constexpr ARCCORE_HOST_DEVICE
SpanImpl(std::array<X, N>& from)
256 explicit constexpr ARCCORE_HOST_DEVICE
SpanImpl(T* ptr)
requires(!IsDynamic)
261 template <std::
size_t N,
typename X,
typename = is_same_const_type<X>>
262 constexpr ARCCORE_HOST_DEVICE ThatClass&
operator=(std::array<X, N>& from)
273 static constexpr ThatClass
create(pointer ptr, SizeType asize)
noexcept
275 return ThatClass(ptr, asize);
285 constexpr ARCCORE_HOST_DEVICE reference
operator[](SizeType i)
const
287 ARCCORE_CHECK_AT(i, m_size.m_size);
296 constexpr ARCCORE_HOST_DEVICE reference
operator()(SizeType i)
const
298 ARCCORE_CHECK_AT(i, m_size.m_size);
307 constexpr ARCCORE_HOST_DEVICE reference
item(SizeType i)
const
309 ARCCORE_CHECK_AT(i, m_size.m_size);
318 constexpr ARCCORE_HOST_DEVICE
void setItem(SizeType i, const_reference v)
noexcept
320 ARCCORE_CHECK_AT(i, m_size.m_size);
325 constexpr ARCCORE_HOST_DEVICE SizeType
size() const noexcept {
return m_size.m_size; }
327 constexpr ARCCORE_HOST_DEVICE SizeType
sizeBytes() const noexcept
330 return static_cast<SizeType
>(m_size.m_size *
sizeof(value_type));
333 constexpr ARCCORE_HOST_DEVICE SizeType
length() const noexcept {
return m_size.m_size; }
338 constexpr ARCCORE_HOST_DEVICE iterator
begin() const noexcept {
return iterator(m_ptr); }
342 constexpr ARCCORE_HOST_DEVICE iterator
end() const noexcept {
return iterator(m_ptr + m_size.m_size); }
344 constexpr ARCCORE_HOST_DEVICE reverse_iterator
rbegin() const noexcept {
return std::make_reverse_iterator(
end()); }
346 constexpr ARCCORE_HOST_DEVICE reverse_iterator
rend() const noexcept {
return std::make_reverse_iterator(
begin()); }
351 ARCCORE_DEPRECATED_REASON(
"Y2023: Use begin()/end() instead")
360 constexpr ARCCORE_HOST_DEVICE pointer
ptrAt(SizeType index)
const
362 ARCCORE_CHECK_AT(index, m_size.m_size);
363 return m_ptr + index;
367 constexpr ARCCORE_HOST_DEVICE
reference at(SizeType i)
const
374 constexpr ARCCORE_HOST_DEVICE
void setAt(SizeType i, const_reference value)
381 ARCCORE_HOST_DEVICE
inline void fill(T o)
383 for (SizeType i = 0, n = m_size.m_size; i < n; ++i)
393 return view_type(s, m_ptr);
412 constexpr ARCCORE_HOST_DEVICE SubSpanType
subSpan(SizeType abegin, SizeType asize)
const
414 if (abegin >= m_size.m_size)
416 asize = _min(asize, m_size.m_size - abegin);
417 return { m_ptr + abegin, asize };
424 constexpr ARCCORE_HOST_DEVICE SubSpanType
subPart(SizeType abegin, SizeType asize)
const
436 ARCCORE_DEPRECATED_REASON(
"Y2023: use subSpan() instead")
437 constexpr SubSpanType
subView(SizeType abegin, SizeType asize)
const
443 constexpr ARCCORE_HOST_DEVICE SubSpanType
subspan(SizeType abegin, SizeType asize)
const
449 ARCCORE_DEPRECATED_REASON(
"Y2023: use subSpanInterval() instead")
452 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
458 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
464 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
475 template <
class U> ARCCORE_HOST_DEVICE
void copy(
const U& copy_array)
477 Int64 n = copy_array.size();
478 Int64 size_as_int64 = m_size.m_size;
480 const_pointer copy_begin = copy_array.data();
481 pointer to_ptr = m_ptr;
484 SizeType n_as_sizetype =
static_cast<SizeType
>(n);
485 for (SizeType i = 0; i < n_as_sizetype; ++i)
486 to_ptr[i] = copy_begin[i];
490 constexpr ARCCORE_HOST_DEVICE
bool empty() const noexcept {
return m_size.m_size == 0; }
492 ARCCORE_HOST_DEVICE
bool contains(const_reference v)
const
494 for (SizeType i = 0; i < m_size.m_size; ++i) {
507 std::optional<SizeType>
findFirst(const_reference v)
const
509 for (SizeType i = 0; i < m_size.m_size; ++i) {
518 constexpr ARCCORE_HOST_DEVICE
void setArray(
const ArrayView<T>& v)
noexcept
523 constexpr ARCCORE_HOST_DEVICE
void setArray(
const Span<T>& v)
noexcept
537 constexpr ARCCORE_HOST_DEVICE pointer
data() const noexcept {
return m_ptr; }
540 template <
typename X, SizeType Extent2,
typename = std::enable_if_t<std::is_same_v<X, value_type>>>
friend bool
547 template <
typename X, SizeType Extent2,
typename = std::enable_if_t<std::is_same_v<X, value_type>>>
friend bool
554 template <SizeType Extent2>
friend bool
561 template <SizeType Extent2>
friend bool
567 friend inline std::ostream&
operator<<(std::ostream& o,
const ThatClass& val)
581 constexpr void _setArray(pointer v, SizeType s)
noexcept
593 constexpr void _setPtr(pointer v)
noexcept { m_ptr = v; }
601 constexpr void _setSize(SizeType s)
noexcept { m_size = ExtentStorageType(s); }
607 ARCCORE_NO_UNIQUE_ADDRESS ExtentStorageType m_size;
611 static constexpr SizeType _min(SizeType a, SizeType b)
613 return ((a < b) ? a : b);
630template <
typename T, Int64 Extent>
638 using size_type =
Int64;
639 using value_type =
typename BaseClass::value_type;
640 using pointer =
typename BaseClass::pointer;
641 template <
typename X>
642 using is_same_const_type = std::enable_if_t<std::is_same_v<X, T> || std::is_same_v<std::add_const_t<X>, T>>;
643 static constexpr bool IsDynamic = (Extent ==
DynExtent);
651 : BaseClass(from.m_ptr, from.m_size)
655 template <
typename X,
typename = std::enable_if_t<std::is_same_v<X, value_type>>>
657 : BaseClass(from.m_ptr, from.m_size)
660 template <
typename X, Int64 XExtent,
typename = std::enable_if_t<std::is_same_v<const X, T>>>
665 template <
typename X, Int32 XExtent,
typename = std::enable_if_t<std::is_same_v<const X, T>>>
666 constexpr ARCCORE_HOST_DEVICE
Span(
const SmallSpan<X, XExtent>& from) noexcept
667 : BaseClass(from.data(), from.size())
669 template <Int64 XExtent>
673 template <Int32 XExtent>
675 : BaseClass(from.data(), from.size())
680 constexpr ARCCORE_HOST_DEVICE
Span(pointer ptr,
Int64 asize) noexcept
681 : BaseClass(ptr, asize)
685 template <std::
size_t N,
typename X,
typename = is_same_const_type<X>>
686 constexpr ARCCORE_HOST_DEVICE
Span(std::array<X, N>& from) noexcept
687 : BaseClass(from.data(), from.size())
691 explicit constexpr ARCCORE_HOST_DEVICE
Span(T* ptr)
requires(!IsDynamic)
696 template <std::
size_t N,
typename X,
typename = is_same_const_type<X>>
697 constexpr ARCCORE_HOST_DEVICE ThatClass&
operator=(std::array<X, N>& from)
noexcept
708 static constexpr ThatClass
create(pointer ptr, size_type asize)
noexcept
710 return ThatClass(ptr, asize);
754 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
760 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
770 ARCCORE_DEPRECATED_REASON(
"Y2023: use subSpan() instead")
777 ARCCORE_DEPRECATED_REASON(
"Y2023: use subSpanInterval() instead")
780 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
800template <
typename T, Int32 Extent>
808 using size_type =
Int32;
809 using value_type =
typename BaseClass::value_type;
810 using pointer =
typename BaseClass::pointer;
811 template <
typename X>
812 using is_same_const_type = std::enable_if_t<std::is_same_v<X, T> || std::is_same_v<std::add_const_t<X>, T>>;
813 static constexpr bool IsDynamic = (Extent ==
DynExtent);
822 : BaseClass(from.m_ptr, from.m_size)
827 template <typename X, typename = std::enable_if_t<std::is_same<X, value_type>::value>>
829 : BaseClass(from.m_ptr, from.m_size)
833 template <typename X, typename = std::enable_if_t<std::is_same<X, value_type>::value>>
838 template <Int32 XExtent>
846 : BaseClass(ptr, asize)
849 template <std::
size_t N,
typename X,
typename = is_same_const_type<X>>
850 constexpr ARCCORE_HOST_DEVICE
SmallSpan(std::array<X, N>& from)
855 explicit constexpr ARCCORE_HOST_DEVICE
SmallSpan(T* ptr)
requires(!IsDynamic)
860 template <std::
size_t N,
typename X,
typename = is_same_const_type<X>>
861 constexpr ARCCORE_HOST_DEVICE ThatClass&
operator=(std::array<X, N>& from)
871 static constexpr ThatClass
create(pointer ptr, size_type asize)
noexcept
873 return ThatClass(ptr, asize);
917 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
933 ARCCORE_DEPRECATED_REASON(
"Y2023: use subPart() instead")
940 ARCCORE_DEPRECATED_REASON(
"Y2023: use subPartInterval() instead")
943 return Arcane::Impl::subViewInterval<ThatClass>(*
this, index, nb_interval);
958template <
typename T,
typename SizeType>
inline void
961 Arcane::Impl::dumpArray(o, val, max_print);
975template <
typename DataType,
typename IntegerType,
typename SizeType>
inline void
980 const Int64 result_size = indexes.
size();
981 [[maybe_unused]]
const Int64 my_size = values.
size();
982 const DataType* ptr = values.
data();
983 for (
Int64 i = 0; i < result_size; ++i) {
984 IntegerType index = indexes[i];
985 ARCCORE_CHECK_AT(index, my_size);
986 result[i] = ptr[index];
1001template <
typename DataType>
inline void
1016template <
typename DataType>
inline void
1028template <
typename DataType,
typename SizeType, SizeType Extent>
1029inline typename Impl::SpanTypeFromSize<const std::byte, SizeType>::SpanType
1032 return {
reinterpret_cast<const std::byte*
>(s.
data()), s.
sizeBytes() };
1038template <
typename DataType>
1039inline SmallSpan<const std::byte>
1048template <
typename DataType>
1049inline SmallSpan<const std::byte>
1063template <
typename DataType,
typename SizeType, SizeType Extent,
1064 typename std::enable_if_t<!std::is_const<DataType>::value,
int> = 0>
1065inline typename Impl::SpanTypeFromSize<std::byte, SizeType>::SpanType
1068 return {
reinterpret_cast<std::byte*
>(s.
data()), s.
sizeBytes() };
1076template <
typename DataType>
inline SmallSpan<std::byte>
1087 template <
typename ByteType,
typename DataType, Int64 Extent>
inline Span<DataType>
1088 asSpanInternal(Span<ByteType, Extent> bytes)
1090 Int64 size = bytes.
size();
1093 static constexpr Int64 data_type_size =
static_cast<Int64>(
sizeof(DataType));
1094 static_assert(data_type_size > 0,
"Bad datatype size");
1095 ARCCORE_ASSERT((size % data_type_size) == 0, (
"Size is not a multiple of sizeof(DataType)"));
1096 auto* ptr =
reinterpret_cast<DataType*
>(bytes.data());
1097 return { ptr, size / data_type_size };
1100 template <
typename ByteType,
typename DataType, Int32 Extent>
inline SmallSpan<DataType>
1101 asSmallSpanInternal(SmallSpan<ByteType, Extent> bytes)
1103 Int32 size = bytes.size();
1106 static constexpr Int32 data_type_size =
static_cast<Int32>(
sizeof(DataType));
1107 static_assert(data_type_size > 0,
"Bad datatype size");
1108 ARCCORE_ASSERT((size % data_type_size) == 0, (
"Size is not a multiple of sizeof(DataType)"));
1109 auto* ptr =
reinterpret_cast<DataType*
>(bytes.data());
1110 return { ptr, size / data_type_size };
1124 return Arcane::Impl::asSpanInternal<std::byte, DataType, Extent>(bytes);
1131template <
typename DataType, Int64 Extent>
inline Span<const DataType>
1134 return Arcane::Impl::asSpanInternal<const std::byte, const DataType, Extent>(bytes);
1141template <
typename DataType, Int32 Extent>
inline SmallSpan<DataType>
1144 return Arcane::Impl::asSmallSpanInternal<std::byte, DataType, Extent>(bytes);
1151template <
typename DataType, Int32 Extent>
inline SmallSpan<const DataType>
1154 return Arcane::Impl::asSmallSpanInternal<const std::byte, const DataType, Extent>(bytes);
1163template <
typename DataType,
size_t SizeType>
inline Span<DataType, SizeType>
1167 return { s.data(), size };
1173template <
typename DataType,
size_t SizeType>
inline SmallSpan<DataType, SizeType>
1177 return { s.data(), size };
1188extern "C++" ARCCORE_BASE_EXPORT
void
1189binaryWrite(std::ostream& ostr,
const Span<const std::byte>& bytes);
1196extern "C++" ARCCORE_BASE_EXPORT
void
1197binaryRead(std::istream& istr,
const Span<std::byte>& bytes);
Types and functions associated with the classes ArrayView and ConstArrayView.
Iterator over Arccore array classes.
Interval over Arccore array classes.
Modifiable view of an array of type T.
Constant view of an array of type T.
Specialization for the compile-time known number of elements.
To have the type (SmallSpan or Span) depending on the size (Int32 or Int64).
View of an array of elements of type T.
constexpr __host__ __device__ SmallSpan< T, DynExtent > subspan(Int32 abegin, Int32 asize) const
Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ SmallSpan< Pointer > subViewInterval(Int32 index, Int32 nb_interval) const
constexpr __host__ __device__ ThatClass & operator=(std::array< X, N > &from)
Copy assignment operator.
constexpr __host__ __device__ SmallSpan< T, DynExtent > subSpanInterval(Int32 index, Int32 nb_interval) const
Sub-view corresponding to the interval index over nb_interval.
constexpr __host__ __device__ SmallSpan< T, DynExtent > subPart(Int32 abegin, Int32 asize) const
Sub-view starting from element abegin and containing asize elements.
SmallSpan()=default
Constructs an empty view.
constexpr __host__ __device__ SmallSpan(const ArrayView< value_type > &from) noexcept
Copy constructor from another view.
constexpr __host__ __device__ SmallSpan(pointer ptr, Int32 asize) noexcept
constexpr __host__ __device__ SmallSpan< Pointer > subView(Int32 abegin, Int32 asize) const
constexpr __host__ __device__ SmallSpan(T *ptr)
Constructs a view from a pointer with a fixed size.
static constexpr ThatClass create(pointer ptr, size_type asize) noexcept
Constructs a view over a memory region starting at ptr and.
constexpr __host__ __device__ SmallSpan< T, DynExtent > subSpan(Int32 abegin, Int32 asize) const
Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ ThatClass subPartInterval(Int32 index, Int32 nb_interval) const
Sub-view corresponding to the interval index over nb_interval.
View of an array of elements of type T.
constexpr __host__ __device__ SpanImpl(pointer ptr, SizeType asize) noexcept
constexpr __host__ __device__ SpanImpl(const SpanImpl< X, SizeType, XExtent > &from) noexcept
Copy constructor from another view.
constexpr view_type smallView()
Constant view of this view.
__host__ __device__ void copy(const U ©_array)
Copies the array copy_array into the instance.
constexpr SubSpanType subView(SizeType abegin, SizeType asize) const
friend bool operator==(const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< X, SizeType, Extent2 > &lhs)
Equality operator (valid if T is const but not X).
constexpr __host__ __device__ SpanImpl(std::array< X, N > &from)
Constructs a view from a std::array.
std::optional< SizeType > findFirst(const_reference v) const
constexpr void _setArray(pointer v, SizeType s) noexcept
Modifies the array pointer and size.
constexpr __host__ __device__ SpanImpl(T *ptr)
Constructs a view from a pointer with a fixed size.
constexpr __host__ __device__ pointer data() const noexcept
constexpr __host__ __device__ SizeType length() const noexcept
Number of elements in the array.
constexpr __host__ __device__ iterator begin() const noexcept
Iterator for the first element of the array.
__host__ __device__ void fill(T o)
Fills the array with the value o.
constexpr __host__ __device__ pointer ptrAt(SizeType index) const
Address of the index-th element.
constexpr __host__ __device__ reference operator()(SizeType i) const
i-th element of the array.
constexpr __host__ __device__ reference operator[](SizeType i) const
i-th element of the array.
ArrayRange< pointer > range() const
constexpr __host__ __device__ bool empty() const noexcept
Returns true if the array is empty (zero dimension).
constexpr SubSpanType subViewInterval(SizeType index, SizeType nb_interval) const
constexpr __host__ __device__ SubSpanType subSpan(SizeType abegin, SizeType asize) const
Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ reference item(SizeType i) const
i-th element of the array.
constexpr ConstArrayView< value_type > constSmallView() const
Constant view of this view.
friend bool operator==(const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< T, SizeType, Extent2 > &lhs)
Equality operator.
constexpr SubSpanType subPartInterval(SizeType index, SizeType nb_interval) const
Sub-view corresponding to the interval index over nb_interval.
__host__ __device__ bool contains(const_reference v) const
Returns true if the array contains the element with value v.
constexpr __host__ __device__ ThatClass & operator=(std::array< X, N > &from)
Copy assignment operator.
constexpr __host__ __device__ iterator end() const noexcept
Iterator for the element after the end of the array.
constexpr void _setPtr(pointer v) noexcept
Modifies the array start pointer.
friend bool operator!=(const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< X, SizeType, Extent2 > &lhs)
Inequality operator (valid if T is const but not X).
constexpr __host__ __device__ reverse_iterator rend() const noexcept
Reverse iterator for the element after the end of the array.
constexpr __host__ __device__ SizeType size() const noexcept
constexpr __host__ __device__ SizeType sizeBytes() const noexcept
Returns the size of the array in bytes.
constexpr __host__ __device__ reverse_iterator rbegin() const noexcept
Reverse iterator for the first element of the array.
friend bool operator!=(const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< T, SizeType, Extent2 > &lhs)
Inequality operator.
constexpr void _setSize(SizeType s) noexcept
Modifies the array size.
constexpr __host__ __device__ SubSpanType subspan(SizeType abegin, SizeType asize) const
For C++20 compatibility.
constexpr __host__ __device__ SubSpanType subPart(SizeType abegin, SizeType asize) const
Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ SpanImpl() noexcept
Constructs an empty view.
constexpr SubSpanType subSpanInterval(SizeType index, SizeType nb_interval) const
Sub-view corresponding to the interval index over nb_interval.
constexpr __host__ __device__ void setItem(SizeType i, const_reference v) noexcept
Sets the i-th element of the array.
static constexpr ThatClass create(pointer ptr, SizeType asize) noexcept
Constructs a view on a memory region starting at ptr and.
std::enable_if_t< std::is_same_v< X, T >||std::is_same_v< std::add_const_t< X >, T > > is_same_const_type
View of an array of elements of type T.
constexpr __host__ __device__ Span< T, DynExtent > subPart(Int64 abegin, Int64 asize) const
Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ Span< T, DynExtent > subSpanInterval(Int64 index, Int64 nb_interval) const
Sub-view corresponding to the interval index over nb_interval.
static constexpr ThatClass create(pointer ptr, size_type asize) noexcept
Constructs a view on a memory area starting at ptr and.
constexpr __host__ __device__ Span(std::array< X, N > &from) noexcept
Constructs a view from a std::array.
constexpr __host__ __device__ Span< DataType > subView(Int64 abegin, Int64 asize) const
constexpr __host__ __device__ Span(pointer ptr, Int64 asize) noexcept
constexpr __host__ __device__ ThatClass & operator=(std::array< X, N > &from) noexcept
Copy assignment operator.
constexpr __host__ __device__ Span(T *ptr)
Constructs a view from a pointer with a fixed size.
constexpr __host__ __device__ Span(const ArrayView< value_type > &from) noexcept
Copy constructor from another view.
Span()=default
Constructs an empty view.
constexpr __host__ __device__ Span< DataType > subViewInterval(Int64 index, Int64 nb_interval) const
constexpr __host__ __device__ Span< T, DynExtent > subPartInterval(Int64 index, Int64 nb_interval) const
Sub-view corresponding to the interval index over nb_interval.
constexpr __host__ __device__ Span< T, DynExtent > subSpan(Int64 abegin, Int64 asize) const
Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ Span< T, DynExtent > subspan(Int64 abegin, Int64 asize) const
Sub-view starting from element abegin and containing asize elements.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
constexpr __host__ __device__ Integer arccoreCheckArraySize(unsigned long long size)
Checks that size can be converted into an 'Integer' to serve as an array size. If possible,...
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
constexpr Int32 DynExtent
Constant to indicate that an array dimension is dynamic.
__host__ __device__ void arccoreCheckAt(Int64 i, Int64 max_size)
Checks for potential array overflow.
void dumpArray(std::ostream &o, ConstArrayView< T > val, int max_print)
Displays the values of array val to the stream o.
void sampleSpan(Span< const DataType > values, Span< const Int64 > indexes, Span< DataType > result)
Extracts a sub-array from a list of indices.
SmallSpan< DataType > asSmallSpan(SmallSpan< std::byte, Extent > bytes)
Converts a SmallSpan<std::byte> into a SmallSpan<DataType>.
Span< DataType > asSpan(Span< std::byte, Extent > bytes)
Converts a Span<std::byte> into a Span<DataType>.
void binaryRead(std::istream &istr, const Span< std::byte > &bytes)
Reads the content of bytes from the stream istr in binary format.
Impl::SpanTypeFromSize< conststd::byte, SizeType >::SpanType asBytes(const SpanImpl< DataType, SizeType, Extent > &s)
Converts the view into an array of non-modifiable bytes.
Impl::SpanTypeFromSize< std::byte, SizeType >::SpanType asWritableBytes(const SpanImpl< DataType, SizeType, Extent > &s)
Converts the view into an array of modifiable bytes.
void binaryWrite(std::ostream &ostr, const Span< const std::byte > &bytes)
Writes the content of bytes to the stream ostr in binary format.
void _sampleSpan(SpanImpl< const DataType, SizeType > values, SpanImpl< const IntegerType, SizeType > indexes, SpanImpl< DataType, SizeType > result)
Extracts a sub-array from a list of indices.
std::ostream & operator<<(std::ostream &ostr, eItemKind item_kind)
Output operator for a stream.
std::int32_t Int32
Signed integer type of 32 bits.