Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Span2Impl< T, SizeType, Extent1, Extent2 > Class Template Reference

View for a 2D array. More...

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

Inheritance diagram for Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >:
Collaboration diagram for Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >:

Public Types

using ElementType = T
using element_type = ElementType
using value_type = typename std::remove_cv<ElementType>::type
using index_type = SizeType
using difference_type = SizeType
using size_type = SizeType
using pointer = ElementType*
using const_pointer = typename std::add_const<ElementType*>::type
using reference = ElementType&
using const_reference = const ElementType&
using view_type = typename detail::View2TypeT<ElementType>::view_type
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 an 'X' or 'const X' can be converted to a 'T'.

Public Member Functions

__host__ __device__ Span2Impl (pointer ptr, SizeType dim1_size, SizeType dim2_size)
 Creates a 2D view of dimension [dim1_size][dim2_size].
__host__ __device__ Span2Impl ()
 Creates an empty 2D view.
template<typename X, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
 Span2Impl (const ConstArray2View< X > &from)
template<typename X, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
__host__ __device__ Span2Impl (const Span2< X > &from)
constexpr __host__ __device__ SizeType dim1Size () const
 Number of elements in the first dimension.
constexpr __host__ __device__ SizeType dim2Size () const
 Number of elements in the second dimension.
constexpr __host__ __device__ SizeType totalNbElement () const
 Total number of elements.
constexpr __host__ __device__ SpanImpl< ElementType, SizeType > operator[] (SizeType i) const
constexpr __host__ __device__ SpanImpl< ElementType, SizeType > operator() (SizeType i) const
constexpr __host__ __device__ reference operator() (SizeType i, SizeType j) const
constexpr __host__ __device__ ElementType item (SizeType i, SizeType j) const
 Value of the element [i][j].
constexpr __host__ __device__ ElementType setItem (SizeType i, SizeType j, const ElementType &value)
 Positions the element [i][j] at value.
constexpr view_type smallView ()
 Constant view of this view.
constexpr ConstArrayView< value_type > constSmallView () const
 Constant view of this view.
constexpr ElementType * unguardedBasePointer ()
 Pointer to the allocated memory.
constexpr __host__ __device__ ElementType * data ()
 Pointer to the allocated memory.
constexpr __host__ __device__ const ElementType * data () const
 Pointer to the allocated memory.

Protected Attributes

ElementType * m_ptr
SizeType m_dim1_size
SizeType m_dim2_size

Private Types

using ThatClass = Span2Impl<T, SizeType, Extent1, Extent2>

Friends

template<typename X, SizeType XExtent1, SizeType XExtent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator== (const ThatClass &lhs, const Span2Impl< X, SizeType, XExtent1, XExtent2 > &rhs)
 Equality operator (valid if T is const but not X).
template<typename X, SizeType XExtent1, SizeType XExtent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator!= (const ThatClass &lhs, const Span2Impl< X, SizeType, XExtent1, XExtent2 > &rhs)
 Inequality operator (valid if T is const but not X).
template<SizeType XExtent1, SizeType XExtent2>
bool operator== (const ThatClass &lhs, const Span2Impl< T, SizeType, XExtent1, XExtent2 > &rhs)
 Equality operator.
template<SizeType XExtent1, SizeType XExtent2>
bool operator!= (const ThatClass &lhs, const Span2Impl< T, SizeType, XExtent1, XExtent2 > &rhs)
 Inequality operator.

Detailed Description

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
class Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >

View for a 2D array.

Like any view, an instance of this class is only valid as long as the container it originated from does not change its number of elements. 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'.

Definition at line 65 of file Span2.h.

Member Typedef Documentation

◆ const_pointer

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::const_pointer = typename std::add_const<ElementType*>::type

Definition at line 78 of file Span2.h.

◆ const_reference

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::const_reference = const ElementType&

Definition at line 80 of file Span2.h.

◆ difference_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::difference_type = SizeType

Definition at line 75 of file Span2.h.

◆ element_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::element_type = ElementType

Definition at line 72 of file Span2.h.

◆ ElementType

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::ElementType = T

Definition at line 71 of file Span2.h.

◆ index_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::index_type = SizeType

Definition at line 74 of file Span2.h.

◆ is_same_const_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<typename X>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::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 an 'X' or 'const X' can be converted to a 'T'.

Definition at line 85 of file Span2.h.

◆ pointer

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::pointer = ElementType*

Definition at line 77 of file Span2.h.

◆ reference

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::reference = ElementType&

Definition at line 79 of file Span2.h.

◆ size_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::size_type = SizeType

Definition at line 76 of file Span2.h.

◆ ThatClass

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::ThatClass = Span2Impl<T, SizeType, Extent1, Extent2>
private

Definition at line 67 of file Span2.h.

◆ value_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::value_type = typename std::remove_cv<ElementType>::type

Definition at line 73 of file Span2.h.

◆ view_type

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
using Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::view_type = typename detail::View2TypeT<ElementType>::view_type

Definition at line 81 of file Span2.h.

Constructor & Destructor Documentation

◆ Span2Impl() [1/4]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::Span2Impl ( pointer ptr,
SizeType dim1_size,
SizeType dim2_size )
inline

Creates a 2D view of dimension [dim1_size][dim2_size].

Definition at line 90 of file Span2.h.

◆ Span2Impl() [2/4]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::Span2Impl ( )
inline

Creates an empty 2D view.

Definition at line 96 of file Span2.h.

◆ Span2Impl() [3/4]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<typename X, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::Span2Impl ( const ConstArray2View< X > & from)
inline

Definition at line 104 of file Span2.h.

◆ Span2Impl() [4/4]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<typename X, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
__host__ __device__ Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::Span2Impl ( const Span2< X > & from)
inline

Definition at line 111 of file Span2.h.

Member Function Documentation

◆ constSmallView()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
ConstArrayView< value_type > Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::constSmallView ( ) const
inlineconstexpr

Constant view of this view.

Definition at line 183 of file Span2.h.

◆ data() [1/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ ElementType * Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::data ( )
inlineconstexpr

Pointer to the allocated memory.

Definition at line 196 of file Span2.h.

Referenced by Arcane::GatherGroup::gatherToMasterIOT(), and Arcane::NumArrayDataT< DataType, RankValue >::serialize().

Here is the caller graph for this function:

◆ data() [2/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ const ElementType * Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::data ( ) const
inlineconstexpr

Pointer to the allocated memory.

Definition at line 199 of file Span2.h.

◆ dim1Size()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ SizeType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::dim1Size ( ) const
inlineconstexpr

Number of elements in the first dimension.

Definition at line 120 of file Span2.h.

Referenced by Arcane::ValueChecker::areEqualArray(), Arcane::GatherGroupInfo::computeSizeT(), and Arcane::SmallSpan2< DataType >::SmallSpan2().

Here is the caller graph for this function:

◆ dim2Size()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ SizeType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::dim2Size ( ) const
inlineconstexpr

Number of elements in the second dimension.

Definition at line 122 of file Span2.h.

Referenced by Arcane::GatherGroup::gatherToMasterIOT(), and Arcane::SmallSpan2< DataType >::SmallSpan2().

Here is the caller graph for this function:

◆ item()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ ElementType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::item ( SizeType i,
SizeType j ) const
inlineconstexpr

Value of the element [i][j].

Definition at line 155 of file Span2.h.

◆ operator()() [1/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ SpanImpl< ElementType, SizeType > Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::operator() ( SizeType i) const
inlineconstexpr

Definition at line 134 of file Span2.h.

◆ operator()() [2/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ reference Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::operator() ( SizeType i,
SizeType j ) const
inlineconstexpr

Definition at line 140 of file Span2.h.

◆ operator[]()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ SpanImpl< ElementType, SizeType > Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::operator[] ( SizeType i) const
inlineconstexpr

Definition at line 128 of file Span2.h.

◆ setItem()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ ElementType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::setItem ( SizeType i,
SizeType j,
const ElementType & value )
inlineconstexpr

Positions the element [i][j] at value.

Definition at line 162 of file Span2.h.

◆ smallView()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
view_type Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::smallView ( )
inlineconstexpr

Constant view of this view.

Definition at line 173 of file Span2.h.

◆ totalNbElement()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
__host__ __device__ SizeType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::totalNbElement ( ) const
inlineconstexpr

Total number of elements.

Definition at line 124 of file Span2.h.

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

Here is the caller graph for this function:

◆ unguardedBasePointer()

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
ElementType * Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::unguardedBasePointer ( )
inlineconstexpr

Pointer to the allocated memory.

Definition at line 193 of file Span2.h.

◆ operator!= [1/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<SizeType XExtent1, SizeType XExtent2>
bool operator!= ( const ThatClass & lhs,
const Span2Impl< T, SizeType, XExtent1, XExtent2 > & rhs )
friend

Inequality operator.

Definition at line 223 of file Span2.h.

◆ operator!= [2/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<typename X, SizeType XExtent1, SizeType XExtent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator!= ( const ThatClass & lhs,
const Span2Impl< X, SizeType, XExtent1, XExtent2 > & rhs )
friend

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

Definition at line 211 of file Span2.h.

◆ operator== [1/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<SizeType XExtent1, SizeType XExtent2>
bool operator== ( const ThatClass & lhs,
const Span2Impl< T, SizeType, XExtent1, XExtent2 > & rhs )
friend

Equality operator.

Definition at line 217 of file Span2.h.

◆ operator== [2/2]

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
template<typename X, SizeType XExtent1, SizeType XExtent2, typename = std::enable_if_t<std::is_same_v<X, value_type>>>
bool operator== ( const ThatClass & lhs,
const Span2Impl< X, SizeType, XExtent1, XExtent2 > & rhs )
friend

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

Definition at line 205 of file Span2.h.

Member Data Documentation

◆ m_dim1_size

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
SizeType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::m_dim1_size
protected

Definition at line 231 of file Span2.h.

◆ m_dim2_size

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
SizeType Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::m_dim2_size
protected

Definition at line 232 of file Span2.h.

◆ m_ptr

template<typename T, typename SizeType, SizeType Extent1, SizeType Extent2>
ElementType* Arcane::Span2Impl< T, SizeType, Extent1, Extent2 >::m_ptr
protected

Definition at line 230 of file Span2.h.


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