array::array Constructor

Initializes a new instance of the array class. There is no default constructor for array<T,N>. All constructors are run on the CPU only. They cannot be executed on a Direct3D target.

explicit array(
   const Concurrency::extent<_Rank> & _Extent                     
) ;
                     
explicit array(
   int _E0                     
) ;
                     
explicit array(
   int _E0,
   int _E1                     
) ;
                     
explicit array(
   int _E0,
   int _E1,
   int _E2                     
) ;
                     
array(
   const Concurrency::extent<_Rank>& _Extent,
   Concurrency::accelerator_view _Av                     
) ;
                     
array(
   int _E0,
   Concurrency::accelerator_view _Av                     
) ;
                     
array(
   int _E0,
   int _E1,
   Concurrency::accelerator_view _Av                     
) ;
                     
array(
   int _E0,
   int _E1,
   int _E2,
   Concurrency::accelerator_view _Av                     
) ;
                     
array(
   const Concurrency::extent<_Rank>& _Extent,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
array(
   int _E0,
   accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
array(
   int _E0,
   int _E1,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
array(
   int _E0,
   int _E1,
   int _E2,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   _InputIterator _Src_last                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   _InputIterator _Src_first,
   _InputIterator _Src_last                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   _InputIterator _Src_first                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   _InputIterator _Src_last                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   _InputIterator _Src_last                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   const Concurrency::extent<_Rank>& _Extent,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
);
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   _InputIterator _Src_last,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
template <
   typename _InputIterator                     
>
array(
   int _E0,
   int _E1,
   int _E2,
   _InputIterator _Src_first,
   Concurrency::accelerator_view _Av,
   Concurrency::accelerator_view _Associated_Av                     
) ;
                     
explicit array(
   const array_view<const _Value_type,
   _Rank>& _Src                     
) ;
                     
array(
   const array_view<const _Value_type,
   _Rank>& _Src,
   accelerator_view _Av                     
) ;
                     
array(
   const array_view<const _Value_type,
   _Rank>& _Src,
   accelerator_view _Av,
   accelerator_view _Associated_Av                     
) ;
                     
array(
   const array& _Other                     
) ;
                     
array(
   array && _Other                     
) ;

Parameters

  • _Associated_Av
    An accelerator_view which specifies the preferred target location of the array.

  • _Av
    An accelerator_view object that specifies the location of the array.

  • _Extent
    The extent in each dimension of the array.

  • _E0
    The most significant component of the extent of this section.

  • _E1
    The next-to-most-significant component of the extent of this section.

  • _E2
    The least significant component of the extent of this section.

  • InputIterator
    The type of the input interator.

  • _Src
    To object to copy.

  • _Src_first
    A beginning iterator into the source container.

  • _Src_last
    An ending iterator into the source container.

  • _Other
    Other data source.

  • _Rank
    The rank of the section.

  • _Value_type
    The data type of the elements that are copied.

Remarks

Staging constructors have two accelerator_view objects as constructor parameters. Staging arrays are used as a hint to optimize repeated copies between two accelerators (between the CPU and a Direct3D accelerator). Staging arrays are optimized for data transfer and do not have stable user-space memory. They are backed by DirectX staging buffers that have the correct hardware alignment to make sure there is an efficient Direct Memory Access (DMA) transfer between the CPU and the accelerator. The accelerator_view property of a staging array returns the value of the first accelerator argument that it was constructed with. You can't change or examine the contents of a staging array when it is involved in a transfer operation, as demonstrated in the following code.

class SimulationServer 
{ 
    array<float,2> acceleratorArray; 
    array<float,2> stagingArray; 
public: 
    SimulationServer(const accelerator_view& av) 
        :acceleratorArray(extent<2>(1000,1000), av), 
         stagingArray(extent<2>(1000,1000), accelerator("cpu"), 
         accelerator("gpu")) 
    { 
    } 
 
    void OnCompute() 
    { 
        array<float,2> &a = acceleratorArray; 
        ApplyNetworkChanges(stagingArray.data()); 
        
        // Starting here, you can't change or examine contents.
        a = stagingArray; 
        parallel_for_each(a.extents, [&](index<2> idx) 
        { 
           // Update a[idx] according to simulation. 
        } 
        stagingArray = a; 
        
        // Starting here, you can change or examine contents.
        SendToClient(stagingArray.data()); 
     } 
}; 

Requirements

Header: amp.h

Namespace: Concurrency

See Also

Reference

array Class