Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::SpanImpl< T, SizeType, Extent > Class Template Reference

View of an array of elements of type T. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/base/arccore/base/Span.h>

Inherited by Arcane::SmallSpan< const ConstituentItemType_ >, Arcane::SmallSpan< DataType >, Arcane::SmallSpan< const DataType >, Arcane::SmallSpan< Pointer >, Arcane::SmallSpan< std::byte >, Arcane::SmallSpan< UChar >, Arcane::SmallSpan< Int64 >, Arcane::SmallSpan< Int32 >, Arcane::SmallSpan< Int16 >, Arcane::SmallSpan< Integer >, Arcane::SmallSpan< Real >, Arcane::SmallSpan< bool >, Arcane::SmallSpan< Real2 >, Arcane::SmallSpan< Real3 >, Arcane::SmallSpan< Real2x2 >, Arcane::SmallSpan< Real3x3 >, Arcane::SmallSpan< const Pointer >, Arcane::SmallSpan< const std::byte >, Arcane::SmallSpan< const UChar >, Arcane::SmallSpan< const Int64 >, Arcane::SmallSpan< const Int16 >, Arcane::SmallSpan< const Integer >, Arcane::SmallSpan< const Real >, Arcane::SmallSpan< const bool >, Arcane::SmallSpan< const Real2 >, Arcane::SmallSpan< const Real3 >, Arcane::SmallSpan< const Real2x2 >, Arcane::SmallSpan< const Real3x3 >, Arcane::Span< DataType >, Arcane::Span< Pointer >, Arcane::Span< std::byte >, Arcane::Span< UChar >, Arcane::Span< Int64 >, Arcane::Span< Int32 >, Arcane::Span< Int16 >, Arcane::Span< Integer >, Arcane::Span< Real >, Arcane::Span< bool >, Arcane::Span< Real2 >, Arcane::Span< Real3 >, Arcane::Span< Real2x2 >, Arcane::Span< Real3x3 >, Arcane::Span< const Pointer >, Arcane::Span< const std::byte >, Arcane::Span< const UChar >, Arcane::Span< const Int64 >, Arcane::Span< const Int32 >, Arcane::Span< const Int16 >, Arcane::Span< const Integer >, Arcane::Span< const Real >, Arcane::Span< const bool >, Arcane::Span< const Real2 >, Arcane::Span< const Real3 >, Arcane::Span< const Real2x2 >, Arcane::Span< const Real3x3 >, and Arcane::Span< return_value_type >.

Collaboration diagram for Arcane::SpanImpl< T, SizeType, Extent >:

Public Types

using ThatClass = SpanImpl<T, SizeType, Extent>
using SubSpanType = SpanImpl<T, SizeType, DynExtent>
using size_type = SizeType
using ElementType = T
using element_type = ElementType
using value_type = typename std::remove_cv_t<ElementType>
using const_value_type = typename std::add_const_t<value_type>
using index_type = SizeType
using difference_type = SizeType
using pointer = ElementType*
using const_pointer = const ElementType*
using reference = ElementType&
using const_reference = const ElementType&
using iterator = ArrayIterator<pointer>
using const_iterator = ArrayIterator<const_pointer>
using view_type = typename Impl::ViewTypeT<ElementType>::view_type
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>
template<typename X>
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>>
 Indicates if 'X' or 'const X' can be converted to 'T'.

Public Member Functions

constexpr __host__ __device__ SpanImpl () noexcept
 Constructs an empty view.
template<typename X, SizeType XExtent, typename = std::enable_if_t<std::is_same_v<const X, T>>>
constexpr __host__ __device__ SpanImpl (const SpanImpl< X, SizeType, XExtent > &from) noexcept
 Copy constructor from another view.
template<SizeType XExtent>
constexpr __host__ __device__ SpanImpl (const SpanImpl< T, SizeType, XExtent > &from) noexcept
constexpr __host__ __device__ SpanImpl (pointer ptr, SizeType asize) noexcept
template<std::size_t N, typename X, typename = is_same_const_type<X>>
constexpr __host__ __device__ SpanImpl (std::array< X, N > &from)
 Constructs a view from a std::array.
constexpr __host__ __device__ SpanImpl (T *ptr)
 Constructs a view from a pointer with a fixed size.
template<std::size_t N, typename X, typename = is_same_const_type<X>>
constexpr __host__ __device__ ThatClass & operator= (std::array< X, N > &from)
 Copy assignment operator.
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.
constexpr __host__ __device__ reference item (SizeType i) const
 i-th element of the array.
constexpr __host__ __device__ void setItem (SizeType i, const_reference v) noexcept
 Sets the i-th element of the array.
constexpr __host__ __device__ SizeType size () const noexcept
 Returns the size of the array.
constexpr __host__ __device__ SizeType sizeBytes () const noexcept
 Returns the size of the array in bytes.
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.
constexpr __host__ __device__ iterator end () const noexcept
 Iterator for the element after the end of the array.
constexpr __host__ __device__ reverse_iterator rbegin () const noexcept
 Reverse iterator for the first element of the array.
constexpr __host__ __device__ reverse_iterator rend () const noexcept
 Reverse iterator for the element after the end of the array.
ArrayRange< pointer > range () const
 Iteration range from the first to the last element.
constexpr __host__ __device__ pointer ptrAt (SizeType index) const
 Address of the index-th element.
constexpr __host__ __device__ reference at (SizeType i) const
constexpr __host__ __device__ void setAt (SizeType i, const_reference value)
__host__ __device__ void fill (T o)
 Fills the array with the value o.
constexpr view_type smallView ()
 Constant view of this view.
constexpr ConstArrayView< value_type > constSmallView () const
 Constant view of this view.
constexpr __host__ __device__ SubSpanType subSpan (SizeType abegin, SizeType asize) const
 Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ SubSpanType subPart (SizeType abegin, SizeType asize) const
 Sub-view starting from element abegin and containing asize elements.
constexpr SubSpanType subView (SizeType abegin, SizeType asize) const
 Sub-view starting from element abegin and containing asize elements.
constexpr __host__ __device__ SubSpanType subspan (SizeType abegin, SizeType asize) const
 For C++20 compatibility.
constexpr SubSpanType subViewInterval (SizeType index, SizeType nb_interval) const
 Sub-view corresponding to the interval index over nb_interval.
constexpr SubSpanType subSpanInterval (SizeType index, SizeType nb_interval) const
 Sub-view corresponding to the interval index over nb_interval.
constexpr SubSpanType subPartInterval (SizeType index, SizeType nb_interval) const
 Sub-view corresponding to the interval index over nb_interval.
template<class U>
__host__ __device__ void copy (const U &copy_array)
 Copies the array copy_array into the instance.
constexpr __host__ __device__ bool empty () const noexcept
 Returns true if the array is empty (zero dimension).
__host__ __device__ bool contains (const_reference v) const
 Returns true if the array contains the element with value v.
std::optional< SizeType > findFirst (const_reference v) const
constexpr __host__ __device__ void setArray (const ArrayView< T > &v) noexcept
constexpr __host__ __device__ void setArray (const Span< T > &v) noexcept
constexpr __host__ __device__ pointer data () const noexcept
 Pointer to the start of the view.

Static Public Member Functions

static constexpr ThatClass create (pointer ptr, SizeType asize) noexcept
 Constructs a view on a memory region starting at ptr and.

Static Public Attributes

static constexpr bool IsDynamic = (Extent == DynExtent)

Protected Member Functions

constexpr void _setArray (pointer v, SizeType s) noexcept
 Modifies the array pointer and size.
constexpr void _setPtr (pointer v) noexcept
 Modifies the array start pointer.
constexpr void _setSize (SizeType s) noexcept
 Modifies the array size.

Private Types

using ExtentStorageType = Impl::ExtentStorage<SizeType, Extent>

Static Private Member Functions

static constexpr SizeType _min (SizeType a, SizeType b)

Private Attributes

pointer m_ptr
ARCCORE_NO_UNIQUE_ADDRESS ExtentStorageType m_size
 Number of elements in the array.

Friends

template<typename X, SizeType Extent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator== (const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< X, SizeType, Extent2 > &lhs)
 Equality operator (valid if T is const but not X).
template<typename X, SizeType Extent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator!= (const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< X, SizeType, Extent2 > &lhs)
 Inequality operator (valid if T is const but not X).
template<SizeType Extent2>
bool operator== (const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< T, SizeType, Extent2 > &lhs)
 Equality operator.
template<SizeType Extent2>
bool operator!= (const SpanImpl< T, SizeType, Extent > &rhs, const SpanImpl< T, SizeType, Extent2 > &lhs)
 Inequality operator.
std::ostream & operator<< (std::ostream &o, const ThatClass &val)

Detailed Description

template<typename T, typename SizeType, SizeType Extent>
class Arcane::SpanImpl< T, SizeType, Extent >

View of an array of elements of type T.

This class should not be used directly. Span or SmallSpan must be used instead.

The view is non-modifiable if the template argument is of type 'const T'. This class allows accessing and using an array of elements of type T in the same way as a standard C array. SizeType is the type used to store the number of elements in the array. This can be 'Int32' or 'Int64'.

If Extent is different from DynExtent (the default), the size is variable; otherwise, it is fixed and has the value Extent.

Definition at line 190 of file Span.h.

Member Typedef Documentation

◆ const_iterator

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::const_iterator = ArrayIterator<const_pointer>

Definition at line 210 of file Span.h.

◆ const_pointer

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::const_pointer = const ElementType*

Definition at line 206 of file Span.h.

◆ const_reference

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::const_reference = const ElementType&

Definition at line 208 of file Span.h.

◆ const_reverse_iterator

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 213 of file Span.h.

◆ const_value_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::const_value_type = typename std::add_const_t<value_type>

Definition at line 202 of file Span.h.

◆ difference_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::difference_type = SizeType

Definition at line 204 of file Span.h.

◆ element_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::element_type = ElementType

Definition at line 200 of file Span.h.

◆ ElementType

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::ElementType = T

Definition at line 199 of file Span.h.

◆ ExtentStorageType

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::ExtentStorageType = Impl::ExtentStorage<SizeType, Extent>
private

Definition at line 192 of file Span.h.

◆ index_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::index_type = SizeType

Definition at line 203 of file Span.h.

◆ is_same_const_type

template<typename T, typename SizeType, SizeType Extent>
template<typename X>
using Arcane::SpanImpl< T, SizeType, Extent >::is_same_const_type = std::enable_if_t<std::is_same_v<X, T> || std::is_same_v<std::add_const_t<X>, T>>

Indicates if 'X' or 'const X' can be converted to 'T'.

Definition at line 217 of file Span.h.

◆ iterator

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::iterator = ArrayIterator<pointer>

Definition at line 209 of file Span.h.

◆ pointer

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::pointer = ElementType*

Definition at line 205 of file Span.h.

◆ reference

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::reference = ElementType&

Definition at line 207 of file Span.h.

◆ reverse_iterator

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 212 of file Span.h.

◆ size_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::size_type = SizeType

Definition at line 198 of file Span.h.

◆ SubSpanType

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::SubSpanType = SpanImpl<T, SizeType, DynExtent>

Definition at line 197 of file Span.h.

◆ ThatClass

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::ThatClass = SpanImpl<T, SizeType, Extent>

Definition at line 196 of file Span.h.

◆ value_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::value_type = typename std::remove_cv_t<ElementType>

Definition at line 201 of file Span.h.

◆ view_type

template<typename T, typename SizeType, SizeType Extent>
using Arcane::SpanImpl< T, SizeType, Extent >::view_type = typename Impl::ViewTypeT<ElementType>::view_type

Definition at line 211 of file Span.h.

Constructor & Destructor Documentation

◆ SpanImpl() [1/6]

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ Arcane::SpanImpl< T, SizeType, Extent >::SpanImpl ( )
inlineconstexprnoexcept

Constructs an empty view.

Definition at line 224 of file Span.h.

◆ SpanImpl() [2/6]

template<typename T, typename SizeType, SizeType Extent>
template<typename X, SizeType XExtent, typename = std::enable_if_t<std::is_same_v<const X, T>>>
__host__ __device__ Arcane::SpanImpl< T, SizeType, Extent >::SpanImpl ( const SpanImpl< X, SizeType, XExtent > & from)
inlineconstexprnoexcept

Copy constructor from another view.

Definition at line 232 of file Span.h.

◆ SpanImpl() [3/6]

template<typename T, typename SizeType, SizeType Extent>
template<SizeType XExtent>
__host__ __device__ Arcane::SpanImpl< T, SizeType, Extent >::SpanImpl ( const SpanImpl< T, SizeType, XExtent > & from)
inlineconstexprnoexcept

Definition at line 238 of file Span.h.

◆ SpanImpl() [4/6]

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ Arcane::SpanImpl< T, SizeType, Extent >::SpanImpl ( pointer ptr,
SizeType asize )
inlineconstexprnoexcept

Constructs a view on a memory region starting at ptr and containing asize elements.

Definition at line 245 of file Span.h.

◆ SpanImpl() [5/6]

template<typename T, typename SizeType, SizeType Extent>
template<std::size_t N, typename X, typename = is_same_const_type<X>>
__host__ __device__ Arcane::SpanImpl< T, SizeType, Extent >::SpanImpl ( std::array< X, N > & from)
inlineconstexpr

Constructs a view from a std::array.

Definition at line 252 of file Span.h.

◆ SpanImpl() [6/6]

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ Arcane::SpanImpl< T, SizeType, Extent >::SpanImpl ( T * ptr)
inlineexplicitconstexpr

Constructs a view from a pointer with a fixed size.

Definition at line 258 of file Span.h.

Member Function Documentation

◆ _min()

template<typename T, typename SizeType, SizeType Extent>
constexpr SizeType Arcane::SpanImpl< T, SizeType, Extent >::_min ( SizeType a,
SizeType b )
inlinestaticconstexprprivate

Definition at line 613 of file Span.h.

◆ _setArray()

template<typename T, typename SizeType, SizeType Extent>
void Arcane::SpanImpl< T, SizeType, Extent >::_setArray ( pointer v,
SizeType s )
inlineconstexprprotectednoexcept

Modifies the array pointer and size.

It is up to the derived class to verify the consistency between the allocated pointer and the given dimension.

Definition at line 583 of file Span.h.

◆ _setPtr()

template<typename T, typename SizeType, SizeType Extent>
void Arcane::SpanImpl< T, SizeType, Extent >::_setPtr ( pointer v)
inlineconstexprprotectednoexcept

Modifies the array start pointer.

It is up to the derived class to verify the consistency between the allocated pointer and the given dimension.

Definition at line 595 of file Span.h.

◆ _setSize()

template<typename T, typename SizeType, SizeType Extent>
void Arcane::SpanImpl< T, SizeType, Extent >::_setSize ( SizeType s)
inlineconstexprprotectednoexcept

Modifies the array size.

It is up to the derived class to verify the consistency between the allocated pointer and the given dimension.

Definition at line 603 of file Span.h.

◆ at()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ reference Arcane::SpanImpl< T, SizeType, Extent >::at ( SizeType i) const
inlineconstexpr

Definition at line 369 of file Span.h.

◆ begin()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ iterator Arcane::SpanImpl< T, SizeType, Extent >::begin ( ) const
inlineconstexprnoexcept

Iterator for the first element of the array.

Definition at line 340 of file Span.h.

Referenced by Arcane::SpanImpl< T, SizeType, DynExtent >::rend().

Here is the caller graph for this function:

◆ constSmallView()

template<typename T, typename SizeType, SizeType Extent>
ConstArrayView< value_type > Arcane::SpanImpl< T, SizeType, Extent >::constSmallView ( ) const
inlineconstexpr

Constant view of this view.

Definition at line 401 of file Span.h.

Referenced by Arcane::GatherGroup::gatherToMasterIO().

Here is the caller graph for this function:

◆ contains()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ bool Arcane::SpanImpl< T, SizeType, Extent >::contains ( const_reference v) const
inline

Returns true if the array contains the element with value v.

Definition at line 494 of file Span.h.

◆ copy()

template<typename T, typename SizeType, SizeType Extent>
template<class U>
__host__ __device__ void Arcane::SpanImpl< T, SizeType, Extent >::copy ( const U & copy_array)
inline

Copies the array copy_array into the instance.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged.

Definition at line 477 of file Span.h.

Referenced by Arcane::GatherGroup::gatherToMasterIO(), and Arcane::MachineShMemWinMDVariableT< ItemType, DataType, Extents >::updateVariable().

Here is the caller graph for this function:

◆ create()

template<typename T, typename SizeType, SizeType Extent>
constexpr ThatClass Arcane::SpanImpl< T, SizeType, Extent >::create ( pointer ptr,
SizeType asize )
inlinestaticconstexprnoexcept

Constructs a view on a memory region starting at ptr and.

Definition at line 275 of file Span.h.

◆ data()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ pointer Arcane::SpanImpl< T, SizeType, Extent >::data ( ) const
inlineconstexprnoexcept

Pointer to the start of the view.

Warning
Accesses via the returned pointer cannot be checked by Arcane, unlike accesses via operator[](): no overflow checking is possible, even in check mode.

Definition at line 539 of file Span.h.

Referenced by Arcane::AbstractArray< DataType >::_addRange(), Arcane::Materials::IncrementalComponentModifier::_applyCopyBetweenPartialsAndGlobals(), Arcane::Materials::IncrementalComponentModifier::_applyCopyVariableViews(), Arcane::VariableIOReaderMng::_checkHashFunction(), Arcane::Accelerator::Impl::DeviceStorageBase::_copyToAsync(), Arcane::Accelerator::Impl::AcceleratorSpecificMemoryCopy< DataType, Extent >::_fill(), Arcane::Impl::HostSpecificMemoryCopy< DataType, Extent >::_fill(), Arcane::AbstractArray< DataType >::_initFromSpan(), Arcane::AbstractArray< DataType >::_resizeAndCopyView(), Arcane::_sampleSpan(), Arcane::Materials::MeshMaterialVariable::_toInt32Indexes(), Arcane::MachineShMemWin< Type >::add(), Arcane::MachineShMemWin< Type >::addToAnotherSegment(), Arcane::Accelerator::GenericSorter::apply(), Arcane::Accelerator::GenericFilterer::applyIf(), Arcane::Accelerator::GenericReducer< DataType >::applyMax(), Arcane::Accelerator::GenericReducer< DataType >::applyMin(), Arcane::Accelerator::GenericReducer< DataType >::applySum(), Arcane::asBytes(), Arcane::asWritableBytes(), Arcane::StringImpl::bytes(), Arcane::Bzip2DataCompressor::compress(), Arcane::LZ4DataCompressor::compress(), Arcane::ZstdDataCompressor::compress(), Arcane::Array2DataT< DataType >::computeHash(), Arcane::NumArrayDataT< DataType, RankValue >::computeHash(), Arcane::IHashAlgorithm::computeHash64(), Arcane::MachineShMemWinMemoryAllocator::deallocate(), Arcane::Bzip2DataCompressor::decompress(), Arcane::LZ4DataCompressor::decompress(), Arcane::ZstdDataCompressor::decompress(), Arcane::String::endsWith(), Arcane::SingleDataSynchronizeBuffer::finalizeSynchronize(), Arcane::GatherGroup::gatherToMasterIOT(), Arcane::MachineShMemWinMDVariableT< ItemType, DataType, Extents >::operator()(), Arcane::MachineShMemWinMeshVariableArrayT< ItemType, DataType >::operator()(), Arcane::MachineShMemWinMemoryAllocator::reallocate(), Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::requestAdd(), Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::requestAddToAnotherSegment(), Arcane::String::startsWith(), Arcane::MachineShMemWinMDVariableT< ItemType, DataType, Extents >::view(), Arcane::MachineShMemWinMeshVariableArrayT< ItemType, DataType >::view(), Arcane::MachineShMemWinVariableArray2T< DataType >::view(), and Arcane::String::writeBytes().

Here is the caller graph for this function:

◆ empty()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ bool Arcane::SpanImpl< T, SizeType, Extent >::empty ( ) const
inlineconstexprnoexcept

Returns true if the array is empty (zero dimension).

Definition at line 492 of file Span.h.

Referenced by Arcane::MultiDataSynchronizeBuffer::copyReceiveAsync(), Arcane::MultiDataSynchronizeBuffer::copySendAsync(), Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::requestAdd(), and Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::requestAddToAnotherSegment().

Here is the caller graph for this function:

◆ end()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ iterator Arcane::SpanImpl< T, SizeType, Extent >::end ( ) const
inlineconstexprnoexcept

Iterator for the element after the end of the array.

Definition at line 344 of file Span.h.

Referenced by Arcane::SpanImpl< T, SizeType, DynExtent >::rbegin().

Here is the caller graph for this function:

◆ fill()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ void Arcane::SpanImpl< T, SizeType, Extent >::fill ( T o)
inline

Fills the array with the value o.

Definition at line 383 of file Span.h.

Referenced by Arcane::MemoryUtils::fill(), and Arcane::MemoryUtils::fillIndexed().

Here is the caller graph for this function:

◆ findFirst()

template<typename T, typename SizeType, SizeType Extent>
std::optional< SizeType > Arcane::SpanImpl< T, SizeType, Extent >::findFirst ( const_reference v) const
inline

/brief Position of the first element with value v

/param v The value to find. /return The position of the first element with value v if present, std::nullopt otherwise.

Definition at line 509 of file Span.h.

Referenced by Arcane::SimpleTableInternalMng::column(), and Arcane::SimpleTableInternalMng::row().

Here is the caller graph for this function:

◆ item()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ reference Arcane::SpanImpl< T, SizeType, Extent >::item ( SizeType i) const
inlineconstexpr

i-th element of the array.

In check mode, bounds checking is performed.

Definition at line 309 of file Span.h.

◆ length()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ SizeType Arcane::SpanImpl< T, SizeType, Extent >::length ( ) const
inlineconstexprnoexcept

Number of elements in the array.

Definition at line 335 of file Span.h.

◆ operator()()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ reference Arcane::SpanImpl< T, SizeType, Extent >::operator() ( SizeType i) const
inlineconstexpr

i-th element of the array.

In check mode, bounds checking is performed.

Definition at line 298 of file Span.h.

◆ operator=()

template<typename T, typename SizeType, SizeType Extent>
template<std::size_t N, typename X, typename = is_same_const_type<X>>
__host__ __device__ ThatClass & Arcane::SpanImpl< T, SizeType, Extent >::operator= ( std::array< X, N > & from)
inlineconstexpr

Copy assignment operator.

Definition at line 264 of file Span.h.

◆ operator[]()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ reference Arcane::SpanImpl< T, SizeType, Extent >::operator[] ( SizeType i) const
inlineconstexpr

i-th element of the array.

In check mode, bounds checking is performed.

Definition at line 287 of file Span.h.

◆ ptrAt()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ pointer Arcane::SpanImpl< T, SizeType, Extent >::ptrAt ( SizeType index) const
inlineconstexpr

Address of the index-th element.

Definition at line 362 of file Span.h.

◆ range()

template<typename T, typename SizeType, SizeType Extent>
ArrayRange< pointer > Arcane::SpanImpl< T, SizeType, Extent >::range ( ) const
inline

Iteration range from the first to the last element.

Definition at line 354 of file Span.h.

◆ rbegin()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ reverse_iterator Arcane::SpanImpl< T, SizeType, Extent >::rbegin ( ) const
inlineconstexprnoexcept

Reverse iterator for the first element of the array.

Definition at line 346 of file Span.h.

◆ rend()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ reverse_iterator Arcane::SpanImpl< T, SizeType, Extent >::rend ( ) const
inlineconstexprnoexcept

Reverse iterator for the element after the end of the array.

Definition at line 348 of file Span.h.

◆ setArray() [1/2]

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ void Arcane::SpanImpl< T, SizeType, Extent >::setArray ( const ArrayView< T > & v)
inlineconstexprnoexcept

Definition at line 520 of file Span.h.

◆ setArray() [2/2]

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ void Arcane::SpanImpl< T, SizeType, Extent >::setArray ( const Span< T > & v)
inlineconstexprnoexcept

Definition at line 525 of file Span.h.

◆ setAt()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ void Arcane::SpanImpl< T, SizeType, Extent >::setAt ( SizeType i,
const_reference value )
inlineconstexpr

Definition at line 376 of file Span.h.

◆ setItem()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ void Arcane::SpanImpl< T, SizeType, Extent >::setItem ( SizeType i,
const_reference v )
inlineconstexprnoexcept

Sets the i-th element of the array.

In check mode, bounds checking is performed.

Definition at line 320 of file Span.h.

◆ size()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ SizeType Arcane::SpanImpl< T, SizeType, Extent >::size ( ) const
inlineconstexprnoexcept

Returns the size of the array.

Definition at line 327 of file Span.h.

Referenced by Arcane::Materials::IncrementalComponentModifier::_addItemsToEnvironment(), Arcane::AbstractArray< DataType >::_addRange(), Arcane::Materials::IncrementalComponentModifier::_applyCopyBetweenPartialsAndGlobals(), Arcane::Materials::IncrementalComponentModifier::_applyCopyVariableViews(), Arcane::VariableIOReaderMng::_checkHashFunction(), Arcane::Materials::IncrementalComponentModifier::_computeCellsToTransformForEnvironments(), Arcane::Materials::AllEnvData::_computeInfosForEnvCells(), Arcane::Accelerator::Impl::AcceleratorSpecificMemoryCopy< DataType, Extent >::_fill(), Arcane::Impl::HostSpecificMemoryCopy< DataType, Extent >::_fill(), Arcane::AbstractArray< DataType >::_initFromSpan(), Arcane::MshParallelMeshReader::_readAndCheck(), Arcane::Materials::IncrementalComponentModifier::_removeItemsFromEnvironment(), Arcane::AbstractArray< DataType >::_resizeAndCopyView(), Arcane::_sampleSpan(), Arcane::Materials::IncrementalComponentModifier::_switchCellsForEnvironments(), Arcane::Materials::MeshMaterialVariable::_toInt32Indexes(), Arcane::MetisMeshPartitioner::_writeGraph(), Arcane::MessagePassing::Mpi::MpiMachineShMemWinBaseInternal::add(), Arcane::MessagePassing::SharedMemoryMachineShMemWinBaseInternal::add(), Arcane::SequentialMachineShMemWinBaseInternal::add(), Arcane::MessagePassing::Mpi::MpiMachineShMemWinBaseInternal::addToAnotherSegment(), Arcane::MessagePassing::SharedMemoryMachineShMemWinBaseInternal::addToAnotherSegment(), Arcane::SequentialMachineShMemWinBaseInternal::addToAnotherSegment(), Arcane::Accelerator::GenericFilterer::apply(), Arcane::Accelerator::GenericSorter::apply(), Arcane::Accelerator::GenericFilterer::applyIf(), Arcane::Accelerator::GenericReducer< DataType >::applyMax(), Arcane::Accelerator::GenericReducer< DataType >::applyMin(), Arcane::Accelerator::GenericReducer< DataType >::applySum(), Arcane::ValueChecker::areEqualArray(), Arcane::StringImpl::bytes(), Arcane::Bzip2DataCompressor::compress(), Arcane::LZ4DataCompressor::compress(), Arcane::ZstdDataCompressor::compress(), Arcane::ArrayDataT< DataType >::Impl::compressAndClear(), Arcane::Array2DataT< DataType >::computeHash(), Arcane::NumArrayDataT< DataType, RankValue >::computeHash(), Arcane::IHashAlgorithm::computeHash64(), Arcane::GatherGroupInfo::computeSizeT(), Arcane::Accelerator::Cuda::CudaMemoryCopier::copy(), Arcane::Accelerator::Hip::HipMemoryCopier::copy(), Arcane::Accelerator::Sycl::SyclMemoryCopier::copy(), Arcane::Accelerator::Hip::HipRunQueueStream::copyMemory(), Arcane::MemoryUtils::copyWithIndexedDestination(), Arcane::MemoryUtils::copyWithIndexedDestination(), Arcane::MemoryUtils::copyWithIndexedSource(), Arcane::MemoryUtils::copyWithIndexedSource(), Arcane::Array2DataT< DataType >::createSerializedDataRef(), Arcane::ArrayDataT< DataType >::createSerializedDataRef(), Arcane::NumArrayDataT< DataType, RankValue >::createSerializedDataRef(), Arcane::StringArrayData::createSerializedDataRef(), Arcane::StringScalarData::createSerializedDataRef(), Arcane::MachineShMemWinMemoryAllocator::deallocate(), Arcane::Bzip2DataCompressor::decompress(), Arcane::LZ4DataCompressor::decompress(), Arcane::ZstdDataCompressor::decompress(), Arcane::InternalInfosDumper::dumpArcaneDatabase(), Arcane::String::endsWith(), Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::executeAddToAnotherSegment(), Arcane::Impl::NumArrayContainer< DataType >::fill(), Arcane::Impl::NumArrayContainer< DataType >::fill(), Arcane::Materials::ConstituentConnectivityList::fillCellsIsPartial(), Arcane::Materials::ConstituentConnectivityList::fillCellsNbMaterial(), Arcane::Materials::ConstituentConnectivityList::fillCellsToTransform(), Arcane::MemoryUtils::fillIndexed(), Arcane::MemoryUtils::fillIndexed(), Arcane::Materials::ConstituentConnectivityList::fillModifiedConstituents(), Arcane::SingleDataSynchronizeBuffer::finalizeSynchronize(), Arcane::GatherGroup::gatherToMasterIO(), Arcane::MeshUtils::generateHashUniqueId(), Arcane::Platform::getLoadedSharedLibraryFullPath(), Arcane::String::hashCode(), Arcane::BasicSerializer::initFromBuffer(), Arcane::ParameterOptionAddr::ParameterOptionAddr(), Arcane::Materials::ConstituentConnectivityList::printConstituents(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::BasicSerializer::putArray(), Arcane::MachineShMemWinMemoryAllocator::reallocate(), Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::requestAdd(), Arcane::MessagePassing::Mpi::MpiMultiMachineShMemWinBaseInternal::requestAddToAnotherSegment(), Arcane::BasicSerializer::reserveSpan(), Arcane::BasicSerializer::reserveSpan(), Arcane::BasicSerializer::reserveSpan(), Arcane::BasicSerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::ISerializer::reserveSpan(), Arcane::Array2DataT< DataType >::serialize(), Arcane::NumArrayDataT< DataType, RankValue >::serialize(), Arcane::String::startsWith(), Arcane::Impl::BasicTranscoder::transcodeFromUtf16ToUtf8(), Arcane::String::writeBytes(), and Arcane::PropertyMng::writeTo().

◆ sizeBytes()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ SizeType Arcane::SpanImpl< T, SizeType, Extent >::sizeBytes ( ) const
inlineconstexprnoexcept

Returns the size of the array in bytes.

Definition at line 329 of file Span.h.

Referenced by Arcane::MachineShMemWin< Type >::add(), Arcane::MachineShMemWin< Type >::addToAnotherSegment(), Arcane::asBytes(), Arcane::asWritableBytes(), and Arcane::GatherGroup::gatherToMasterIOT().

Here is the caller graph for this function:

◆ smallView()

template<typename T, typename SizeType, SizeType Extent>
view_type Arcane::SpanImpl< T, SizeType, Extent >::smallView ( )
inlineconstexpr

◆ subPart()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subPart ( SizeType abegin,
SizeType asize ) const
inlineconstexpr

Sub-view starting from element abegin and containing asize elements.

See also
subSpan()

Definition at line 426 of file Span.h.

◆ subPartInterval()

template<typename T, typename SizeType, SizeType Extent>
SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subPartInterval ( SizeType index,
SizeType nb_interval ) const
inlineconstexpr

Sub-view corresponding to the interval index over nb_interval.

Definition at line 464 of file Span.h.

◆ subSpan()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subSpan ( SizeType abegin,
SizeType asize ) const
inlineconstexpr

Sub-view starting from element abegin and containing asize elements.

If (abegin+asize is greater than the size of the array, the view is truncated to this size, potentially returning an empty view.

Definition at line 414 of file Span.h.

Referenced by Arcane::SpanImpl< T, SizeType, DynExtent >::subPart(), Arcane::SpanImpl< T, SizeType, DynExtent >::subspan(), and Arcane::SpanImpl< T, SizeType, DynExtent >::subView().

Here is the caller graph for this function:

◆ subspan()

template<typename T, typename SizeType, SizeType Extent>
__host__ __device__ SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subspan ( SizeType abegin,
SizeType asize ) const
inlineconstexpr

For C++20 compatibility.

Definition at line 445 of file Span.h.

◆ subSpanInterval()

template<typename T, typename SizeType, SizeType Extent>
SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subSpanInterval ( SizeType index,
SizeType nb_interval ) const
inlineconstexpr

Sub-view corresponding to the interval index over nb_interval.

Definition at line 458 of file Span.h.

◆ subView()

template<typename T, typename SizeType, SizeType Extent>
SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subView ( SizeType abegin,
SizeType asize ) const
inlineconstexpr

Sub-view starting from element abegin and containing asize elements.

If (abegin+asize) is greater than the size of the array, the view is truncated to this size, potentially returning an empty view.

Definition at line 439 of file Span.h.

◆ subViewInterval()

template<typename T, typename SizeType, SizeType Extent>
SubSpanType Arcane::SpanImpl< T, SizeType, Extent >::subViewInterval ( SizeType index,
SizeType nb_interval ) const
inlineconstexpr

Sub-view corresponding to the interval index over nb_interval.

Definition at line 452 of file Span.h.

◆ operator!= [1/2]

template<typename T, typename SizeType, SizeType Extent>
template<SizeType Extent2>
bool operator!= ( const SpanImpl< T, SizeType, Extent > & rhs,
const SpanImpl< T, SizeType, Extent2 > & lhs )
friend

Inequality operator.

Definition at line 564 of file Span.h.

◆ operator!= [2/2]

template<typename T, typename SizeType, SizeType Extent>
template<typename X, SizeType Extent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator!= ( const SpanImpl< T, SizeType, Extent > & rhs,
const SpanImpl< X, SizeType, Extent2 > & lhs )
friend

Inequality operator (valid if T is const but not X).

Definition at line 550 of file Span.h.

◆ operator<<

template<typename T, typename SizeType, SizeType Extent>
std::ostream & operator<< ( std::ostream & o,
const ThatClass & val )
friend

Definition at line 569 of file Span.h.

◆ operator== [1/2]

template<typename T, typename SizeType, SizeType Extent>
template<SizeType Extent2>
bool operator== ( const SpanImpl< T, SizeType, Extent > & rhs,
const SpanImpl< T, SizeType, Extent2 > & lhs )
friend

Equality operator.

Definition at line 557 of file Span.h.

◆ operator== [2/2]

template<typename T, typename SizeType, SizeType Extent>
template<typename X, SizeType Extent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator== ( const SpanImpl< T, SizeType, Extent > & rhs,
const SpanImpl< X, SizeType, Extent2 > & lhs )
friend

Equality operator (valid if T is const but not X).

Definition at line 543 of file Span.h.

Referenced by Arcane::SpanImpl< T, SizeType, DynExtent >::operator!=, and Arcane::SpanImpl< T, SizeType, DynExtent >::operator!=.

Member Data Documentation

◆ IsDynamic

template<typename T, typename SizeType, SizeType Extent>
bool Arcane::SpanImpl< T, SizeType, Extent >::IsDynamic = (Extent == DynExtent)
staticconstexpr

Definition at line 219 of file Span.h.

◆ m_ptr

template<typename T, typename SizeType, SizeType Extent>
pointer Arcane::SpanImpl< T, SizeType, Extent >::m_ptr
private

Pointer to the array

Definition at line 607 of file Span.h.

◆ m_size

template<typename T, typename SizeType, SizeType Extent>
ARCCORE_NO_UNIQUE_ADDRESS ExtentStorageType Arcane::SpanImpl< T, SizeType, Extent >::m_size
private

Number of elements in the array.

Definition at line 609 of file Span.h.


The documentation for this class was generated from the following files: