8 #ifndef KOKKOS_OFFSETVIEW_HPP_ 
    9 #define KOKKOS_OFFSETVIEW_HPP_ 
   12 #include <Kokkos_Core.hpp> 
   14 #include <Kokkos_View.hpp> 
   18    namespace Experimental {
 
   22       template< 
class DataType , 
class ... Properties >
 
   25       template< 
class > 
struct is_offset_view : 
public std::false_type {};
 
   27       template< 
class D, 
class ... P >
 
   28       struct is_offset_view< OffsetView<D,P...> > : 
public std::true_type {};
 
   30       template< 
class D, 
class ... P >
 
   31       struct is_offset_view< const OffsetView<D,P...> > : 
public std::true_type {};
 
   33 #define KOKKOS_INVALID_OFFSET int64_t(0) 
   34 #define KOKKOS_INVALID_INDEX_RANGE {KOKKOS_INVALID_OFFSET, KOKKOS_INVALID_OFFSET} 
   36       template <typename iType, typename std::enable_if< std::is_integral<iType>::value &&
 
   37       std::is_signed<iType>::value, iType >::type = 0>
 
   41       using index_list_type = std::initializer_list<int64_t>;
 
   50          template<
class ViewType>
 
   51          struct GetOffsetViewTypeFromViewType {
 
   53             typedef OffsetView<
typename ViewType::data_type,
typename ViewType::array_layout,
 
   54                   typename ViewType::device_type,
typename ViewType::memory_traits> type;
 
   58          template< 
unsigned , 
class MapType, 
class BeginsType >
 
   59          KOKKOS_INLINE_FUNCTION
 
   60          bool offsetview_verify_operator_bounds( 
const MapType &, 
const BeginsType & )
 
   63          template< 
unsigned R , 
class MapType , 
class BeginsType, 
class iType , 
class ... Args >
 
   64          KOKKOS_INLINE_FUNCTION
 
   65          bool offsetview_verify_operator_bounds
 
   67            , 
const BeginsType & begins
 
   73            const bool legalIndex =  ( int64_t(i) >=  begins[R]  ) &&
 
   74                ( int64_t(i) <= int64_t(begins[R] + map.extent(R) - 1) );
 
   76                && offsetview_verify_operator_bounds<R+1>( map , begins,  args ... );
 
   78          template< 
unsigned , 
class MapType, 
class BeginsType >
 
   80          void offsetview_error_operator_bounds( 
char * , 
int , 
const MapType & , 
const BeginsType &)
 
   83          template< 
unsigned R , 
class MapType , 
class BeginsType , 
class iType , 
class ... Args >
 
   85          void offsetview_error_operator_bounds
 
   89            , 
const  BeginsType begins
 
   94            const int64_t b = begins[R];
 
   95            const int64_t e = b + map.extent(R) - 1;
 
   97              snprintf(buf,len,
" %ld <= %ld <= %ld %c" 
   98                      , static_cast<unsigned long>(b)
 
   99                      , static_cast<unsigned long>(i)
 
  100                      , static_cast<unsigned long>(e)
 
  101                      , ( 
sizeof...(Args) ? 
',' : 
')' )
 
  103            offsetview_error_operator_bounds<R+1>(buf+n,len-n,map,begins,args...);
 
  106          template< 
class MemorySpace , 
class MapType , 
class BeginsType, 
class ... Args >
 
  107          KOKKOS_INLINE_FUNCTION
 
  108          void offsetview_verify_operator_bounds
 
  109            ( Kokkos::Impl::SharedAllocationTracker 
const & tracker
 
  110            , 
const MapType & map , 
const BeginsType & begins, Args ... args )
 
  112            if ( ! offsetview_verify_operator_bounds<0>( map , begins, args ... ) ) {
 
  113 #if defined( KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST ) 
  116               const std::string label = tracker.template get_label<MemorySpace>();
 
  117               int n = snprintf(buffer,LEN,
"OffsetView bounds error of view labeled %s (",label.c_str());
 
  118               offsetview_error_operator_bounds<0>( buffer + n , LEN - n , map ,begins, args ... );
 
  119               Kokkos::Impl::throw_runtime_exception(std::string(buffer));
 
  126               if (tracker.has_record()) {
 
  127     Kokkos::Impl::operator_bounds_error_on_device<MapType>(
 
  128             map, Kokkos::Impl::has_printable_label_typedef<MapType>());
 
  130                  Kokkos::abort(
"OffsetView bounds error");
 
  136 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 
  137          KOKKOS_INLINE_FUNCTION
 
  138          void runtime_check_rank_host(
const size_t rank_dynamic, 
const size_t rank,
 
  139                const index_list_type minIndices, 
const std::string & label)
 
  142             std::string message = 
"Kokkos::Experimental::OffsetView ERROR: for OffsetView labeled '" + label + 
"':";
 
  143             if (rank_dynamic != rank) {
 
  144                message += 
"The full rank must be the same as the dynamic rank. full rank = ";
 
  145                message += std::to_string(rank) + 
" dynamic rank = " + std::to_string(rank_dynamic) + 
"\n";
 
  149             size_t numOffsets = 0;
 
  150             for(
size_t i = 0; i < minIndices.size(); ++i ){
 
  151                if( minIndices.begin()[i] != -KOKKOS_INVALID_OFFSET) numOffsets++;
 
  153             if (numOffsets != rank_dynamic) {
 
  154                message += 
"The number of offsets provided ( " + std::to_string(numOffsets) +
 
  155                      " ) must equal the dynamic rank ( " + std::to_string(rank_dynamic) + 
" ).";
 
  159             if(isBad) Kokkos::abort(message.c_str());
 
  163          KOKKOS_INLINE_FUNCTION
 
  164          void runtime_check_rank_device(
const size_t rank_dynamic, 
const size_t rank,
 
  165                const index_list_type minIndices)
 
  167             if (rank_dynamic != rank) {
 
  168                Kokkos::abort(
"The full rank of an OffsetView must be the same as the dynamic rank.");
 
  170             size_t numOffsets = 0;
 
  171             for(
size_t i = 0; i < minIndices.size(); ++i ){
 
  172                if( minIndices.begin()[i] != -KOKKOS_INVALID_OFFSET) numOffsets++;
 
  174             if (numOffsets != rank) {
 
  175                Kokkos::abort(
"The number of offsets provided to an OffsetView constructor must equal the dynamic rank.");
 
  181       template< 
class DataType , 
class ... Properties >
 
  182       class OffsetView : 
public ViewTraits< DataType , Properties ... > {
 
  185          typedef ViewTraits< DataType , Properties ... > traits ;
 
  191          template< class , 
class ... > 
friend class OffsetView ;
 
  192          template< class , 
class ... > 
friend class View ;  
 
  193          template< class , 
class ... > 
friend class Kokkos::Impl::ViewMapping ;
 
  196          typedef Kokkos::Impl::ViewMapping< traits , void > map_type ;
 
  197          typedef Kokkos::Impl::SharedAllocationTracker      track_type ;
 
  199          enum { Rank = map_type::Rank };
 
  203          template <typename iType, typename std::enable_if< std::is_integral<iType>::value, iType>::type = 0>
 
  204          KOKKOS_INLINE_FUNCTION
 
  205          int64_t begin(
const iType local_dimension)
 const {
 
  206              return local_dimension < Rank ? m_begins[local_dimension] : 0;
 
  209          KOKKOS_INLINE_FUNCTION
 
  210          begins_type begins()
 const { 
return m_begins;}
 
  212          template <typename iType, typename std::enable_if< std::is_integral<iType>::value, iType>::type = 0>
 
  213          KOKKOS_INLINE_FUNCTION
 
  214          int64_t end(
const iType local_dimension)
 const {
 
  215              return begin(local_dimension) + m_map.extent(local_dimension);
 
  222          begins_type  m_begins;
 
  227          typedef OffsetView< 
typename traits::scalar_array_type ,
 
  228                typename traits::array_layout ,
 
  229                typename traits::device_type ,
 
  230                typename traits::memory_traits >
 
  234          typedef OffsetView< 
typename traits::const_data_type ,
 
  235                typename traits::array_layout ,
 
  236                typename traits::device_type ,
 
  237                typename traits::memory_traits >
 
  241          typedef OffsetView< 
typename traits::non_const_data_type ,
 
  242                typename traits::array_layout ,
 
  243                typename traits::device_type ,
 
  244                typename traits::memory_traits >
 
  248          typedef OffsetView< 
typename traits::non_const_data_type ,
 
  249                typename traits::array_layout ,
 
  250                typename traits::host_mirror_space >
 
  262          template< 
typename iType >
 
  263          KOKKOS_INLINE_FUNCTION constexpr
 
  264          typename std::enable_if< std::is_integral<iType>::value , 
size_t >::type
 
  265          extent( 
const iType & r )
 const 
  266          { 
return m_map.extent(r); }
 
  268          template< 
typename iType >
 
  269          KOKKOS_INLINE_FUNCTION constexpr
 
  270          typename std::enable_if< std::is_integral<iType>::value , 
int >::type
 
  271          extent_int( 
const iType & r )
 const 
  272          { 
return static_cast<int>(m_map.extent(r)); }
 
  274          KOKKOS_INLINE_FUNCTION constexpr
 
  275          typename traits::array_layout layout()
 const 
  276          { 
return m_map.layout(); }
 
  279          KOKKOS_INLINE_FUNCTION constexpr 
size_t size()
 const { 
return m_map.dimension_0() *
 
  280                m_map.dimension_1() *
 
  281                m_map.dimension_2() *
 
  282                m_map.dimension_3() *
 
  283                m_map.dimension_4() *
 
  284                m_map.dimension_5() *
 
  285                m_map.dimension_6() *
 
  286                m_map.dimension_7(); }
 
  288          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_0()
 const { 
return m_map.stride_0(); }
 
  289          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_1()
 const { 
return m_map.stride_1(); }
 
  290          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_2()
 const { 
return m_map.stride_2(); }
 
  291          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_3()
 const { 
return m_map.stride_3(); }
 
  292          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_4()
 const { 
return m_map.stride_4(); }
 
  293          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_5()
 const { 
return m_map.stride_5(); }
 
  294          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_6()
 const { 
return m_map.stride_6(); }
 
  295          KOKKOS_INLINE_FUNCTION constexpr 
size_t stride_7()
 const { 
return m_map.stride_7(); }
 
  297          template< 
typename iType >
 
  298          KOKKOS_INLINE_FUNCTION constexpr
 
  299          typename std::enable_if< std::is_integral<iType>::value , 
size_t >::type
 
  300          stride(iType r)
 const {
 
  301             return (r == 0 ? m_map.stride_0() :
 
  302                   (r == 1 ? m_map.stride_1() :
 
  303                         (r == 2 ? m_map.stride_2() :
 
  304                               (r == 3 ? m_map.stride_3() :
 
  305                                     (r == 4 ? m_map.stride_4() :
 
  306                                           (r == 5 ? m_map.stride_5() :
 
  307                                                 (r == 6 ? m_map.stride_6() :
 
  308                                                       m_map.stride_7())))))));
 
  311          template< 
typename iType >
 
  312          KOKKOS_INLINE_FUNCTION 
void stride( iType * 
const s )
 const { m_map.stride(s); }
 
  317          typedef typename map_type::reference_type  reference_type ;
 
  318          typedef typename map_type::pointer_type    pointer_type ;
 
  320          enum { reference_type_is_lvalue_reference = std::is_lvalue_reference< reference_type >::value };
 
  322          KOKKOS_INLINE_FUNCTION constexpr 
size_t span()
 const { 
return m_map.span(); }
 
  323          KOKKOS_INLINE_FUNCTION 
bool span_is_contiguous()
 const { 
return m_map.span_is_contiguous(); }
 
  324          KOKKOS_INLINE_FUNCTION constexpr pointer_type data()
 const { 
return m_map.data(); }
 
  329          KOKKOS_INLINE_FUNCTION
 
  330          const Kokkos::Impl::ViewMapping< traits , void > &
 
  331          implementation_map()
 const { 
return m_map ; }
 
  338             is_layout_left = std::is_same< 
typename traits::array_layout
 
  341             is_layout_right = std::is_same< 
typename traits::array_layout
 
  344             is_layout_stride = std::is_same< 
typename traits::array_layout
 
  348                   std::is_same< typename traits::specialize , void >::value &&
 
  349                   ( is_layout_left || is_layout_right || is_layout_stride )
 
  352          template< class Space , bool = Kokkos::Impl::MemorySpaceAccess< Space , typename traits::memory_space >::accessible > 
struct verify_space
 
  353                { KOKKOS_FORCEINLINE_FUNCTION 
static void check() {} };
 
  355          template< 
class Space > 
struct verify_space<Space,false>
 
  356          { KOKKOS_FORCEINLINE_FUNCTION 
static void check()
 
  357          { Kokkos::abort(
"Kokkos::View ERROR: attempt to access inaccessible memory space");
 
  361 #if defined( KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK ) 
  363 #define KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( ARG ) \ 
  364       OffsetView::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check(); \ 
  365       Kokkos::Experimental::Impl::offsetview_verify_operator_bounds< typename traits::memory_space > ARG ; 
  369 #define KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( ARG ) \ 
  370       OffsetView::template verify_space< Kokkos::Impl::ActiveExecutionMemorySpace >::check(); 
  378          KOKKOS_FORCEINLINE_FUNCTION
 
  382             return m_map.reference();
 
  388          template< 
typename I0>
 
  389          KOKKOS_FORCEINLINE_FUNCTION
 
  390          typename std::enable_if<
 
  391          ( Kokkos::Impl::are_integral<I0>::value
 
  394          ), reference_type >::type
 
  395          operator()( 
const I0 & i0)
 const 
  398             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0) )
 
  399                           const 
size_t j0 = i0 - m_begins[0];
 
  400             return m_map.reference(j0);
 
  403          template< typename I0>
 
  404          KOKKOS_FORCEINLINE_FUNCTION
 
  405          typename std::enable_if<
 
  406          ( Kokkos::Impl::are_integral<I0>::value
 
  409                && ! is_layout_stride
 
  410          ), reference_type >::type
 
  411          operator()( const I0 & i0 )
 const 
  413             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0) )
 
  414                           const 
size_t j0 = i0 - m_begins[0];
 
  415             return m_map.m_impl_handle[ j0 ];
 
  418          template< typename I0 >
 
  419          KOKKOS_FORCEINLINE_FUNCTION
 
  420          typename std::enable_if<
 
  421          ( Kokkos::Impl::are_integral<I0>::value
 
  425          ), reference_type >::type
 
  426          operator()( const I0 & i0)
 const 
  428             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0) )
 
  429                           const 
size_t j0 = i0 - m_begins[0];
 
  430             return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * j0 ];
 
  435          template< typename I0 >
 
  436          KOKKOS_FORCEINLINE_FUNCTION
 
  437          typename std::enable_if<
 
  438          ( Kokkos::Impl::are_integral<I0>::value
 
  441          ), reference_type >::type
 
  442          operator[]( const I0 & i0 )
 const 
  444             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0) )
 
  445                           const 
size_t j0 = i0 - m_begins[0];
 
  446             return m_map.reference(j0);
 
  449          template< typename I0 >
 
  450          KOKKOS_FORCEINLINE_FUNCTION
 
  451          typename std::enable_if<
 
  452          ( Kokkos::Impl::are_integral<I0>::value
 
  455                && ! is_layout_stride
 
  456          ), reference_type >::type
 
  457          operator[]( const I0 & i0 )
 const 
  459             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0) )
 
  460                           const 
size_t j0 = i0 - m_begins[0];
 
  461             return m_map.m_impl_handle[ j0 ];
 
  464          template< typename I0 >
 
  465          KOKKOS_FORCEINLINE_FUNCTION
 
  466          typename std::enable_if<
 
  467          ( Kokkos::Impl::are_integral<I0>::value
 
  471          ), reference_type >::type
 
  472          operator[]( const I0 & i0 )
 const 
  474             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0) )
 
  475                           const 
size_t j0 = i0 - m_begins[0];
 
  476             return m_map.m_impl_handle[ m_map.m_impl_offset.m_stride.S0 * j0 ];
 
  483          template< typename I0 , typename I1 >
 
  484          KOKKOS_FORCEINLINE_FUNCTION
 
  485          typename std::enable_if<
 
  486          ( Kokkos::Impl::are_integral<I0,I1>::value
 
  489          ), reference_type >::type
 
  490          operator()( const I0 & i0 , const I1 & i1)
 const 
  492             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1) )
 
  493                           const 
size_t j0 = i0 - m_begins[0];
 
  494             const 
size_t j1 = i1 - m_begins[1];
 
  495             return m_map.reference(j0,j1);
 
  498          template< typename I0 , typename I1 >
 
  499          KOKKOS_FORCEINLINE_FUNCTION
 
  500          typename std::enable_if<
 
  501          ( Kokkos::Impl::are_integral<I0,I1>::value
 
  504                && is_layout_left && ( traits::rank_dynamic == 0 )
 
  505          ), reference_type >::type
 
  506          operator()( const I0 & i0 , const I1 & i1)
 const 
  508             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1) )
 
  509                           const 
size_t j0 = i0 - m_begins[0];
 
  510             const 
size_t j1 = i1 - m_begins[1];
 
  511             return m_map.m_impl_handle[ j0 + m_map.m_impl_offset.m_dim.N0 * j1 ];
 
  514          template< typename I0 , typename I1>
 
  515          KOKKOS_FORCEINLINE_FUNCTION
 
  516          typename std::enable_if<
 
  517          ( Kokkos::Impl::are_integral<I0,I1>::value
 
  520                && is_layout_left && ( traits::rank_dynamic != 0 )
 
  521          ), reference_type >::type
 
  522          operator()( const I0 & i0 , const I1 & i1)
 const 
  524             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1) )
 
  525                           const 
size_t j0 = i0 - m_begins[0];
 
  526             const 
size_t j1 = i1 - m_begins[1];
 
  527             return m_map.m_impl_handle[ j0 + m_map.m_impl_offset.m_stride * j1 ];
 
  530          template< typename I0 , typename I1 >
 
  531          KOKKOS_FORCEINLINE_FUNCTION
 
  532          typename std::enable_if<
 
  533          ( Kokkos::Impl::are_integral<I0,I1>::value
 
  536                && is_layout_right && ( traits::rank_dynamic == 0 )
 
  537          ), reference_type >::type
 
  538          operator()( const I0 & i0 , const I1 & i1 )
 const 
  540             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1) )
 
  541                           const 
size_t j0 = i0 - m_begins[0];
 
  542             const 
size_t j1 = i1 - m_begins[1];
 
  543             return m_map.m_impl_handle[ j1 + m_map.m_impl_offset.m_dim.N1 * j0 ];
 
  546          template< typename I0 , typename I1 >
 
  547          KOKKOS_FORCEINLINE_FUNCTION
 
  548          typename std::enable_if<
 
  549          ( Kokkos::Impl::are_integral<I0,I1>::value
 
  552                && is_layout_right && ( traits::rank_dynamic != 0 )
 
  553          ), reference_type >::type
 
  554          operator()( const I0 & i0 , const I1 & i1 )
 const 
  556             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1) )
 
  557                           const 
size_t j0 = i0 - m_begins[0];
 
  558             const 
size_t j1 = i1 - m_begins[1];
 
  559             return m_map.m_impl_handle[ j1 + m_map.m_impl_offset.m_stride * j0 ];
 
  562          template< typename I0 , typename I1>
 
  563          KOKKOS_FORCEINLINE_FUNCTION
 
  564          typename std::enable_if<
 
  565          ( Kokkos::Impl::are_integral<I0,I1>::value
 
  569          ), reference_type >::type
 
  570          operator()( const I0 & i0 , const I1 & i1 )
 const 
  572             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1) )
 
  573                           const 
size_t j0 = i0 - m_begins[0];
 
  574             const 
size_t j1 = i1 - m_begins[1];
 
  575             return m_map.m_impl_handle[ j0 * m_map.m_impl_offset.m_stride.S0 +
 
  576                                         j1 * m_map.m_impl_offset.m_stride.S1 ];
 
  582          template< typename I0 , typename I1 , typename I2 >
 
  583          KOKKOS_FORCEINLINE_FUNCTION
 
  584          typename std::enable_if<
 
  585          ( Kokkos::Impl::are_integral<I0,I1,I2>::value
 
  588          ), reference_type >::type
 
  589          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2)
 const 
  591             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1, i2) )
 
  592                           const 
size_t j0 = i0 - m_begins[0];
 
  593             const 
size_t j1 = i1 - m_begins[1];
 
  594             const 
size_t j2 = i2 - m_begins[2];
 
  595             return m_map.m_impl_handle[ m_map.m_impl_offset(j0, j1, j2) ];
 
  598          template< typename I0 , typename I1 , typename I2>
 
  599          KOKKOS_FORCEINLINE_FUNCTION
 
  600          typename std::enable_if<
 
  601          ( Kokkos::Impl::are_integral<I0,I1,I2>::value
 
  604          ), reference_type >::type
 
  605          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2)
 const 
  607             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2) )
 
  608                           const 
size_t j0 = i0 - m_begins[0];
 
  609             const 
size_t j1 = i1 - m_begins[1];
 
  610             const 
size_t j2 = i2 - m_begins[2];
 
  611             return m_map.reference(j0, j1, j2);
 
  617          template< typename I0 , typename I1 , typename I2 , typename I3>
 
  618          KOKKOS_FORCEINLINE_FUNCTION
 
  619          typename std::enable_if<
 
  620          ( Kokkos::Impl::are_integral<I0,I1,I2,I3>::value
 
  623          ), reference_type >::type
 
  624          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3)
 const 
  626             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1, i2, i3) )
 
  627                           const 
size_t j0 = i0 - m_begins[0];
 
  628             const 
size_t j1 = i1 - m_begins[1];
 
  629             const 
size_t j2 = i2 - m_begins[2];
 
  630             const 
size_t j3 = i3 - m_begins[3];
 
  631             return m_map.m_impl_handle[ m_map.m_impl_offset(j0,j1,j2,j3) ];
 
  634          template< typename I0 , typename I1 , typename I2 , typename I3 >
 
  635          KOKKOS_FORCEINLINE_FUNCTION
 
  636          typename std::enable_if<
 
  637          ( Kokkos::Impl::are_integral<I0,I1,I2,I3>::value
 
  640          ), reference_type >::type
 
  641          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3)
 const 
  643             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1, i2, i3) )
 
  644                           const 
size_t j0 = i0 - m_begins[0];
 
  645             const 
size_t j1 = i1 - m_begins[1];
 
  646             const 
size_t j2 = i2 - m_begins[2];
 
  647             const 
size_t j3 = i3 - m_begins[3];
 
  648             return m_map.reference(j0,j1,j2,j3);
 
  654          template< typename I0 , typename I1 , typename I2 , typename I3
 
  656          KOKKOS_FORCEINLINE_FUNCTION
 
  657          typename std::enable_if<
 
  658          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4>::value
 
  661          ), reference_type >::type
 
  662          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  663                , const I4 & i4 )
 const 
  665             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1, i2, i3, i4) )
 
  666                           const 
size_t j0 = i0 - m_begins[0];
 
  667             const 
size_t j1 = i1 - m_begins[1];
 
  668             const 
size_t j2 = i2 - m_begins[2];
 
  669             const 
size_t j3 = i3 - m_begins[3];
 
  670             const 
size_t j4 = i4 - m_begins[4];
 
  671             return m_map.m_impl_handle[ m_map.m_impl_offset(j0, j1,j2, j3, j4) ];
 
  674          template< typename I0 , typename I1 , typename I2 , typename I3
 
  676          KOKKOS_FORCEINLINE_FUNCTION
 
  677          typename std::enable_if<
 
  678          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4>::value
 
  681          ), reference_type >::type
 
  682          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  683                , const I4 & i4)
 const 
  685             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map, m_begins, i0,i1, i2, i3, i4) )
 
  686                           const 
size_t j0 = i0 - m_begins[0];
 
  687             const 
size_t j1 = i1 - m_begins[1];
 
  688             const 
size_t j2 = i2 - m_begins[2];
 
  689             const 
size_t j3 = i3 - m_begins[3];
 
  690             const 
size_t j4 = i4 - m_begins[4];
 
  691             return m_map.reference(j0,j1,j2,j3,j4);
 
  697          template< typename I0 , typename I1 , typename I2 , typename I3
 
  698          , typename I4 , typename I5 >
 
  699          KOKKOS_FORCEINLINE_FUNCTION
 
  700          typename std::enable_if<
 
  701          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5>::value
 
  704          ), reference_type >::type
 
  705          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  706                , const I4 & i4 , const I5 & i5 )
 const 
  708             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2, i3, i4, i5) )
 
  709                           const 
size_t j0 = i0 - m_begins[0];
 
  710             const 
size_t j1 = i1 - m_begins[1];
 
  711             const 
size_t j2 = i2 - m_begins[2];
 
  712             const 
size_t j3 = i3 - m_begins[3];
 
  713             const 
size_t j4 = i4 - m_begins[4];
 
  714             const 
size_t j5 = i5 - m_begins[5];
 
  715             return m_map.m_impl_handle[ m_map.m_impl_offset(j0,j1,j2,j3,j4,j5) ];
 
  718          template< typename I0 , typename I1 , typename I2 , typename I3
 
  719          , typename I4 , typename I5>
 
  720          KOKKOS_FORCEINLINE_FUNCTION
 
  721          typename std::enable_if<
 
  722          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5>::value
 
  725          ), reference_type >::type
 
  726          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  727                , const I4 & i4 , const I5 & i5)
 const 
  729             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2, i3, i4, i5) )
 
  730                           const 
size_t j0 = i0 - m_begins[0];
 
  731             const 
size_t j1 = i1 - m_begins[1];
 
  732             const 
size_t j2 = i2 - m_begins[2];
 
  733             const 
size_t j3 = i3 - m_begins[3];
 
  734             const 
size_t j4 = i4 - m_begins[4];
 
  735             const 
size_t j5 = i5 - m_begins[5];
 
  736             return m_map.reference(j0,j1,j2,j3,j4,j5);
 
  742          template< typename I0 , typename I1 , typename I2 , typename I3
 
  743          , typename I4 , typename I5 , typename I6>
 
  744          KOKKOS_FORCEINLINE_FUNCTION
 
  745          typename std::enable_if<
 
  746          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6>::value
 
  749          ), reference_type >::type
 
  750          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  751                , const I4 & i4 , const I5 & i5 , const I6 & i6)
 const 
  753             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2, i3, i4, i5, i6) )
 
  754                           const 
size_t j0 = i0 - m_begins[0];
 
  755             const 
size_t j1 = i1 - m_begins[1];
 
  756             const 
size_t j2 = i2 - m_begins[2];
 
  757             const 
size_t j3 = i3 - m_begins[3];
 
  758             const 
size_t j4 = i4 - m_begins[4];
 
  759             const 
size_t j5 = i5 - m_begins[5];
 
  760             const 
size_t j6 = i6 - m_begins[6];
 
  761             return m_map.m_impl_handle[ m_map.m_impl_offset(j0,j1,j2,j3,j4,j5,j6) ];
 
  764          template< typename I0 , typename I1 , typename I2 , typename I3
 
  765          , typename I4 , typename I5 , typename I6 >
 
  766          KOKKOS_FORCEINLINE_FUNCTION
 
  767          typename std::enable_if<
 
  768          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6>::value
 
  771          ), reference_type >::type
 
  772          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  773                , const I4 & i4 , const I5 & i5 , const I6 & i6)
 const 
  775             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2, i3, i4, i5, i6) )
 
  776                           const 
size_t j0 = i0 - m_begins[0];
 
  777             const 
size_t j1 = i1 - m_begins[1];
 
  778             const 
size_t j2 = i2 - m_begins[2];
 
  779             const 
size_t j3 = i3 - m_begins[3];
 
  780             const 
size_t j4 = i4 - m_begins[4];
 
  781             const 
size_t j5 = i5 - m_begins[5];
 
  782             const 
size_t j6 = i6 - m_begins[6];
 
  783             return m_map.reference(j0,j1,j2,j3,j4,j5,j6);
 
  789          template< typename I0 , typename I1 , typename I2 , typename I3
 
  790          , typename I4 , typename I5 , typename I6 , typename I7 >
 
  791          KOKKOS_FORCEINLINE_FUNCTION
 
  792          typename std::enable_if<
 
  793          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7>::value
 
  796          ), reference_type >::type
 
  797          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  798                , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7)
 const 
  800             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2, i3, i4, i5, i6, i7) )
 
  801                           const 
size_t j0 = i0 - m_begins[0];
 
  802             const 
size_t j1 = i1 - m_begins[1];
 
  803             const 
size_t j2 = i2 - m_begins[2];
 
  804             const 
size_t j3 = i3 - m_begins[3];
 
  805             const 
size_t j4 = i4 - m_begins[4];
 
  806             const 
size_t j5 = i5 - m_begins[5];
 
  807             const 
size_t j6 = i6 - m_begins[6];
 
  808             const 
size_t j7 = i7 - m_begins[7];
 
  809             return m_map.m_impl_handle[ m_map.m_impl_offset(j0,j1,j2,j3,j4,j5,j6,j7) ];
 
  812          template< typename I0 , typename I1 , typename I2 , typename I3
 
  813          , typename I4 , typename I5 , typename I6 , typename I7>
 
  814          KOKKOS_FORCEINLINE_FUNCTION
 
  815          typename std::enable_if<
 
  816          ( Kokkos::Impl::are_integral<I0,I1,I2,I3,I4,I5,I6,I7>::value
 
  819          ), reference_type >::type
 
  820          operator()( const I0 & i0 , const I1 & i1 , const I2 & i2 , const I3 & i3
 
  821                , const I4 & i4 , const I5 & i5 , const I6 & i6 , const I7 & i7 )
 const 
  823             KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY( (m_track,m_map,m_begins, i0,i1, i2, i3, i4, i5, i6, i7) )
 
  824                           const 
size_t j0 = i0 - m_begins[0];
 
  825             const 
size_t j1 = i1 - m_begins[1];
 
  826             const 
size_t j2 = i2 - m_begins[2];
 
  827             const 
size_t j3 = i3 - m_begins[3];
 
  828             const 
size_t j4 = i4 - m_begins[4];
 
  829             const 
size_t j5 = i5 - m_begins[5];
 
  830             const 
size_t j6 = i6 - m_begins[6];
 
  831             const 
size_t j7 = i7 - m_begins[7];
 
  832             return m_map.reference(j0,j1,j2,j3,j4,j5,j6,j7);
 
  836 #undef KOKKOS_IMPL_OFFSETVIEW_OPERATOR_VERIFY 
  841          KOKKOS_INLINE_FUNCTION
 
  844          KOKKOS_INLINE_FUNCTION
 
  845          OffsetView() : m_track(), m_map() {
 
  847             for(
size_t i = 0; i < Rank; ++i) m_begins[i] = KOKKOS_INVALID_INDEX;
 
  850          KOKKOS_INLINE_FUNCTION
 
  851          OffsetView( 
const OffsetView & rhs ) : m_track( rhs.m_track, traits::is_managed ), m_map( rhs.m_map ),
 
  852          m_begins(rhs.m_begins) {}
 
  854          KOKKOS_INLINE_FUNCTION
 
  855          OffsetView( OffsetView && rhs ) : m_track( std::move(rhs.m_track) ),
 
  856          m_map( std::move(rhs.m_map)), m_begins(std::move(rhs.m_begins)) {}
 
  858          KOKKOS_INLINE_FUNCTION
 
  859          OffsetView & operator = ( 
const OffsetView & rhs ) {
 
  860             m_track = rhs.m_track ;
 
  862             m_begins = rhs.m_begins;
 
  866          KOKKOS_INLINE_FUNCTION
 
  867          OffsetView & operator = ( OffsetView && rhs ) {
 
  868             m_track = std::move(rhs.m_track) ;
 
  869             m_map = std::move(rhs.m_map) ;
 
  870             m_begins = std::move(rhs.m_begins) ;
 
  876          typedef View< 
typename traits::scalar_array_type ,
 
  877                typename traits::array_layout ,
 
  878                typename traits::device_type ,
 
  879                typename traits::memory_traits > view_type;
 
  882          KOKKOS_INLINE_FUNCTION
 
  883          view_type view()
 const {
 
  885             view_type v(m_track, m_map);
 
  889          template<
class RT, 
class ... RP>
 
  890          KOKKOS_INLINE_FUNCTION
 
  891          OffsetView( 
const View<RT, RP...> & aview) :
 
  892          m_track(aview.impl_track()), m_map(){
 
  894             typedef typename OffsetView<RT,RP...>::traits  SrcTraits ;
 
  895             typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , void >  Mapping ;
 
  896             static_assert( Mapping::is_assignable , 
"Incompatible OffsetView copy construction" );
 
  897             Mapping::assign( m_map , aview.impl_map() , m_track );
 
  899             for (
int i = 0; i < aview.Rank; ++i) {
 
  904          template<
class RT, 
class ... RP>
 
  905          KOKKOS_INLINE_FUNCTION
 
  906          OffsetView( 
const View<RT, RP...> & aview
 
  907                ,
const index_list_type & minIndices) :
 
  908                m_track(aview.impl_track()), m_map(){
 
  910             typedef typename OffsetView<RT,RP...>::traits  SrcTraits ;
 
  911             typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , void >  Mapping ;
 
  912             static_assert( Mapping::is_assignable , 
"Incompatible OffsetView copy construction" );
 
  913             Mapping::assign( m_map , aview.impl_map() , m_track );
 
  915 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 
  916             Kokkos::Experimental::Impl::runtime_check_rank_host(traits::rank_dynamic, Rank, minIndices, label());
 
  918             Kokkos::Experimental::Impl::runtime_check_rank_device(traits::rank_dynamic, Rank, minIndices);
 
  922             for (
size_t i = 0; i < minIndices.size(); ++i) {
 
  923                m_begins[i] = minIndices.begin()[i];
 
  926          template<
class RT, 
class ... RP>
 
  927          KOKKOS_INLINE_FUNCTION
 
  928          OffsetView( 
const View<RT, RP...> & aview
 
  929                ,
const begins_type & beg) :
 
  930                m_track(aview.impl_track()), m_map(), m_begins(beg){
 
  932             typedef typename OffsetView<RT,RP...>::traits  SrcTraits ;
 
  933             typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , void >  Mapping ;
 
  934             static_assert( Mapping::is_assignable , 
"Incompatible OffsetView copy construction" );
 
  935             Mapping::assign( m_map , aview.impl_map() , m_track );
 
  950          template< 
class RT , 
class ... RP >
 
  951          KOKKOS_INLINE_FUNCTION
 
  952          OffsetView( 
const OffsetView<RT,RP...> & rhs )
 
  953          : m_track( rhs.m_track , traits::is_managed )
 
  955          , m_begins(rhs.m_begins)
 
  957             typedef typename OffsetView<RT,RP...>::traits  SrcTraits ;
 
  958             typedef Kokkos::Impl::ViewMapping< traits , SrcTraits , void >  Mapping ;
 
  959             static_assert( Mapping::is_assignable , 
"Incompatible OffsetView copy construction" );
 
  960             Mapping::assign( m_map , rhs.m_map , rhs.m_track );  
 
  966          KOKKOS_INLINE_FUNCTION
 
  967          int use_count()
 const 
  968          { 
return m_track.use_count(); }
 
  971          const std::string label()
 const 
  972          { 
return m_track.template get_label< typename traits::memory_space >(); }
 
  975          template< 
typename Label>
 
  977          OffsetView( 
const Label & arg_label
 
  978                ,
typename std::enable_if<Kokkos::Impl::is_view_label<Label>::value , 
const index_list_type >::type
 
  980                ,
const index_list_type range1 = KOKKOS_INVALID_INDEX_RANGE
 
  981                ,
const index_list_type range2 = KOKKOS_INVALID_INDEX_RANGE
 
  982                ,
const index_list_type range3 = KOKKOS_INVALID_INDEX_RANGE
 
  983                ,
const index_list_type range4 = KOKKOS_INVALID_INDEX_RANGE
 
  984                ,
const index_list_type range5 = KOKKOS_INVALID_INDEX_RANGE
 
  985                ,
const index_list_type range6 = KOKKOS_INVALID_INDEX_RANGE
 
  986                ,
const index_list_type range7 = KOKKOS_INVALID_INDEX_RANGE
 
  988          ) : OffsetView( Kokkos::Impl::ViewCtorProp< std::string >( arg_label ),
 
  989                typename traits::array_layout
 
  990                ( range0.begin()[1] - range0.begin()[0] + 1, range1.begin()[1] - range1.begin()[0] + 1 ,
 
  991                      range2.begin()[1] - range2.begin()[0] + 1, range3.begin()[1] - range3.begin()[0] + 1,
 
  992                      range4.begin()[1] - range4.begin()[0] + 1, range5.begin()[1] - range5.begin()[0] + 1 ,
 
  993                      range6.begin()[1] - range6.begin()[0] + 1, range7.begin()[1] - range7.begin()[0] + 1 ),
 
  994                      {range0.begin()[0], range1.begin()[0], range2.begin()[0], range3.begin()[0], range4.begin()[0],
 
  995                            range5.begin()[0], range6.begin()[0], range7.begin()[0] })
 
 1002          template<
class ... P >
 
 1003          explicit KOKKOS_INLINE_FUNCTION
 
 1004          OffsetView( 
const Kokkos::Impl::ViewCtorProp< P ... > & arg_prop
 
 1005                ,
typename std::enable_if< Kokkos::Impl::ViewCtorProp< P... >::has_pointer , 
typename traits::array_layout >::type 
const & arg_layout
 
 1006                ,
const index_list_type minIndices
 
 1009          , m_map( arg_prop , arg_layout )
 
 1013             for (
size_t i = 0; i < minIndices.size(); ++i) {
 
 1014                m_begins[i] = minIndices.begin()[i];
 
 1017                   std::is_same< pointer_type
 
 1018                   , 
typename Kokkos::Impl::ViewCtorProp< P... >::pointer_type
 
 1020                   "When constructing OffsetView to wrap user memory, you must supply matching pointer type" );
 
 1023          template<
class ... P >
 
 1025          OffsetView( 
const Kokkos::Impl::ViewCtorProp< P ... > & arg_prop
 
 1026                , 
typename std::enable_if< ! Kokkos::Impl::ViewCtorProp< P... >::has_pointer , 
typename traits::array_layout>::type 
const & arg_layout
 
 1027                ,
const index_list_type minIndices
 
 1034             for(
size_t i = 0; i < Rank; ++i)
 
 1035                m_begins[i] = minIndices.begin()[i];
 
 1038             typedef Kokkos::Impl::ViewCtorProp< P ... > alloc_prop_input ;
 
 1042             typedef Kokkos::Impl::ViewCtorProp
 
 1043                   < P ..., 
typename std::conditional < alloc_prop_input::has_label
 
 1044                   , std::integral_constant<unsigned,0>, 
typename std::string >::type
 
 1045                   , 
typename std::conditional
 
 1046                   < alloc_prop_input::has_memory_space
 
 1047                   , std::integral_constant<unsigned,1>
 
 1048             , 
typename traits::device_type::memory_space
 
 1050             , 
typename std::conditional
 
 1051             < alloc_prop_input::has_execution_space
 
 1052             , std::integral_constant<unsigned,2>
 
 1053             , 
typename traits::device_type::execution_space
 
 1057             static_assert( traits::is_managed
 
 1058                   , 
"OffsetView allocation constructor requires managed memory" );
 
 1060             if ( alloc_prop::initialize &&
 
 1061 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE
 
 1062                   ! alloc_prop::execution_space::is_initialized()
 
 1064             ! alloc_prop::execution_space::impl_is_initialized()
 
 1069                Kokkos::Impl::throw_runtime_exception(
"Constructing OffsetView and initializing data with uninitialized execution space");
 
 1073             alloc_prop prop_copy( arg_prop );
 
 1076 #if defined( KOKKOS_ENABLE_CUDA ) 
 1082             if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
 
 1083                typename traits::device_type::memory_space::execution_space().fence();
 
 1088             Kokkos::Impl::SharedAllocationRecord<> *
 
 1089             record = m_map.allocate_shared( prop_copy , arg_layout );
 
 1092 #if defined( KOKKOS_ENABLE_CUDA ) 
 1093             if ( std::is_same< Kokkos::CudaUVMSpace , typename traits::device_type::memory_space >::value ) {
 
 1094                typename traits::device_type::memory_space::execution_space().fence();
 
 1100             m_track.assign_allocated_record_to_uninitialized( record );
 
 1102 #ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST 
 1103             Kokkos::Experimental::Impl::runtime_check_rank_host(traits::rank_dynamic, Rank, minIndices, label());
 
 1105             Kokkos::Experimental::Impl::runtime_check_rank_device(traits::rank_dynamic, Rank, minIndices);
 
 1120       template < 
typename D , 
class ... P >
 
 1121       KOKKOS_INLINE_FUNCTION
 
 1122       constexpr 
unsigned rank( 
const OffsetView<D , P...> & V ) { 
return V.Rank; } 
 
 1129          KOKKOS_INLINE_FUNCTION
 
 1130          typename  std::enable_if< std::is_integral<T>::value, T>::type
 
 1131          shift_input(
const T arg, 
const int64_t offset)
 
 1133             return arg - offset;
 
 1136          KOKKOS_INLINE_FUNCTION
 
 1138          shift_input(
const Kokkos::Impl::ALL_t arg, 
const int64_t offset)
 
 1144          KOKKOS_INLINE_FUNCTION
 
 1149             return Kokkos::make_pair<T,T>(arg.
first - offset, arg.
second - offset);
 
 1154          typename  std::enable_if< std::is_integral<T>::value, std::pair<T,T> >::type
 
 1155          shift_input(
const std::pair<T, T> arg, 
const int64_t offset)
 
 1158             return std::make_pair<T,T>(arg.first - offset, arg.second - offset);
 
 1162          template <
size_t N, 
class Arg, 
class A>
 
 1163          KOKKOS_INLINE_FUNCTION
 
 1165          map_arg_to_new_begin(
const size_t i,
 
 1167                const Arg arg, 
const A viewBegins, 
size_t & counter) {
 
 1169             if( !std::is_integral<Arg>::value) {
 
 1170                subviewBegins[counter] = shiftedArg == arg ? viewBegins[i] : 0;
 
 1175          template <
size_t N, 
class Arg, 
class A>
 
 1176          KOKKOS_INLINE_FUNCTION
 
 1178          map_arg_to_new_begin(
const size_t i,
 
 1180                const Arg arg, 
const A viewBegins, 
size_t & counter) {
 
 1185          template< 
class D, 
class ... P , 
class T >
 
 1186          KOKKOS_INLINE_FUNCTION
 
 1187          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1189          , ViewTraits< D , P... >
 
 1192          subview_offset(
const OffsetView< D, P... > & src, T arg) {
 
 1194             auto theView = src.view();
 
 1195             auto begins = src.begins();
 
 1197             T shiftedArg = shift_input(arg, begins[0]);
 
 1199             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1201                   , ViewTraits< D , P... >
 
 1204             auto theSubview = Kokkos::subview( theView , shiftedArg);
 
 1208             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg, arg, begins, counter);
 
 1210             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1212             , ViewTraits< D , P... > , T >::type >::type offsetView(theSubview, subviewBegins);
 
 1218          template< 
class D, 
class ... P , 
class T0, 
class T1 >
 
 1219          KOKKOS_INLINE_FUNCTION
 
 1220          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1222          , ViewTraits< D , P... >
 
 1225          subview_offset(
const Kokkos::Experimental::OffsetView< D, P... > & src, T0 arg0, T1 arg1) {
 
 1227             auto theView = src.view();
 
 1228             auto begins = src.begins();
 
 1230             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1231             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1233             auto theSubview = Kokkos::subview(theView , shiftedArg0, shiftedArg1);
 
 1234             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1236                   , ViewTraits< D , P... >
 
 1237             , T0, T1>::type::Rank;
 
 1241             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1242             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1244             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1246             , ViewTraits< D , P... > , T0, T1 >::type >::type offsetView(theSubview, subviewBegins);
 
 1252          template< 
class D, 
class ... P , 
class T0, 
class T1, 
class T2 >
 
 1253          KOKKOS_INLINE_FUNCTION
 
 1254          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1256          , ViewTraits< D , P... >
 
 1259          subview_offset(
const OffsetView< D, P... > & src, T0 arg0, T1 arg1, T2 arg2) {
 
 1261             auto theView = src.view();
 
 1262             auto begins = src.begins();
 
 1264             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1265             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1266             T2 shiftedArg2 = shift_input(arg2, begins[2]);
 
 1268             auto theSubview = Kokkos::subview( theView , shiftedArg0, shiftedArg1, shiftedArg2);
 
 1270             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1272                   , ViewTraits< D , P... >
 
 1273             , T0, T1, T2>::type::Rank;
 
 1278             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1279             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1280             Kokkos::Experimental::Impl::map_arg_to_new_begin(2, subviewBegins, shiftedArg2, arg2, begins, counter);
 
 1282             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1284             , ViewTraits< D , P... > , T0, T1, T2 >::type >::type offsetView(theSubview, subviewBegins);
 
 1289          template< 
class D, 
class ... P , 
class T0, 
class T1, 
class T2, 
class T3 >
 
 1290          KOKKOS_INLINE_FUNCTION
 
 1291          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1293          , ViewTraits< D , P... >
 
 1296          subview_offset(
const OffsetView< D, P... > & src, T0 arg0, T1 arg1, T2 arg2, T3 arg3) {
 
 1298             auto theView = src.view();
 
 1299             auto begins = src.begins();
 
 1301             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1302             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1303             T2 shiftedArg2 = shift_input(arg2, begins[2]);
 
 1304             T3 shiftedArg3 = shift_input(arg3, begins[3]);
 
 1306             auto theSubview = Kokkos::subview( theView , shiftedArg0, shiftedArg1, shiftedArg2, shiftedArg3);
 
 1308             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1310                   , ViewTraits< D , P... >
 
 1311             , T0, T1, T2, T3>::type::Rank;
 
 1315             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1316             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1317             Kokkos::Experimental::Impl::map_arg_to_new_begin(2, subviewBegins, shiftedArg2, arg2, begins, counter);
 
 1318             Kokkos::Experimental::Impl::map_arg_to_new_begin(3, subviewBegins, shiftedArg3, arg3, begins, counter);
 
 1320             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1322             , ViewTraits< D , P... > , T0, T1, T2, T3 >::type >::type offsetView(theSubview, subviewBegins);
 
 1327          template< 
class D, 
class ... P , 
class T0, 
class T1, 
class T2, 
class T3, 
class T4 >
 
 1328          KOKKOS_INLINE_FUNCTION
 
 1329          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1331          , ViewTraits< D , P... >
 
 1332          , T0, T1, T2, T3, T4
 
 1334          subview_offset(
const OffsetView< D, P... > & src, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) {
 
 1336             auto theView = src.view();
 
 1337             auto begins = src.begins();
 
 1339             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1340             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1341             T2 shiftedArg2 = shift_input(arg2, begins[2]);
 
 1342             T3 shiftedArg3 = shift_input(arg3, begins[3]);
 
 1343             T4 shiftedArg4 = shift_input(arg4, begins[4]);
 
 1345             auto theSubview = Kokkos::subview( theView , shiftedArg0, shiftedArg1, shiftedArg2, shiftedArg3, shiftedArg4);
 
 1347             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1349                   , ViewTraits< D , P... >
 
 1350             , T0, T1, T2, T3, T4>::type::Rank;
 
 1354             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1355             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1356             Kokkos::Experimental::Impl::map_arg_to_new_begin(2, subviewBegins, shiftedArg2, arg2, begins, counter);
 
 1357             Kokkos::Experimental::Impl::map_arg_to_new_begin(3, subviewBegins, shiftedArg3, arg3, begins, counter);
 
 1358             Kokkos::Experimental::Impl::map_arg_to_new_begin(4, subviewBegins, shiftedArg4, arg4, begins, counter);
 
 1360             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1362             , ViewTraits< D , P... > , T0, T1, T2, T3, T4 >::type >::type offsetView(theSubview, subviewBegins);
 
 1367          template< 
class D, 
class ... P , 
class T0, 
class T1, 
class T2, 
class T3, 
class T4,
 
 1369          KOKKOS_INLINE_FUNCTION
 
 1370          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1372          , ViewTraits< D , P... >
 
 1373          , T0, T1, T2, T3, T4, T5
 
 1375          subview_offset(
const OffsetView< D, P... > & src, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) {
 
 1377             auto theView = src.view();
 
 1378             auto begins = src.begins();
 
 1380             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1381             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1382             T2 shiftedArg2 = shift_input(arg2, begins[2]);
 
 1383             T3 shiftedArg3 = shift_input(arg3, begins[3]);
 
 1384             T4 shiftedArg4 = shift_input(arg4, begins[4]);
 
 1385             T5 shiftedArg5 = shift_input(arg5, begins[5]);
 
 1387             auto theSubview = Kokkos::subview( theView , shiftedArg0, shiftedArg1, shiftedArg2, shiftedArg3, shiftedArg4, shiftedArg5);
 
 1389             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1391                   , ViewTraits< D , P... >
 
 1392             , T0, T1, T2, T3, T4, T5>::type::Rank;
 
 1397             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1398             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1399             Kokkos::Experimental::Impl::map_arg_to_new_begin(2, subviewBegins, shiftedArg2, arg2, begins, counter);
 
 1400             Kokkos::Experimental::Impl::map_arg_to_new_begin(3, subviewBegins, shiftedArg3, arg3, begins, counter);
 
 1401             Kokkos::Experimental::Impl::map_arg_to_new_begin(4, subviewBegins, shiftedArg4, arg4, begins, counter);
 
 1402             Kokkos::Experimental::Impl::map_arg_to_new_begin(5, subviewBegins, shiftedArg5, arg5, begins, counter);
 
 1404             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1406             , ViewTraits< D , P... > , T0, T1, T2, T3, T4, T5 >::type >::type offsetView(theSubview, subviewBegins);
 
 1410          template< 
class D, 
class ... P , 
class T0, 
class T1, 
class T2, 
class T3, 
class T4,
 
 1412          KOKKOS_INLINE_FUNCTION
 
 1413          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1415          , ViewTraits< D , P... >
 
 1416          , T0, T1, T2, T3, T4, T5, T6
 
 1418          subview_offset(
const OffsetView< D, P... > & src, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
 
 1421             auto theView = src.view();
 
 1422             auto begins = src.begins();
 
 1424             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1425             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1426             T2 shiftedArg2 = shift_input(arg2, begins[2]);
 
 1427             T3 shiftedArg3 = shift_input(arg3, begins[3]);
 
 1428             T4 shiftedArg4 = shift_input(arg4, begins[4]);
 
 1429             T5 shiftedArg5 = shift_input(arg5, begins[5]);
 
 1430             T6 shiftedArg6 = shift_input(arg6, begins[6]);
 
 1432             auto theSubview = Kokkos::subview( theView , shiftedArg0, shiftedArg1, shiftedArg2, shiftedArg3, shiftedArg4, shiftedArg5,
 
 1435             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1437                   , ViewTraits< D , P... >
 
 1438             , T0, T1, T2, T3, T4, T5, T6>::type::Rank;
 
 1443             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1444             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1445             Kokkos::Experimental::Impl::map_arg_to_new_begin(2, subviewBegins, shiftedArg2, arg2, begins, counter);
 
 1446             Kokkos::Experimental::Impl::map_arg_to_new_begin(3, subviewBegins, shiftedArg3, arg3, begins, counter);
 
 1447             Kokkos::Experimental::Impl::map_arg_to_new_begin(4, subviewBegins, shiftedArg4, arg4, begins, counter);
 
 1448             Kokkos::Experimental::Impl::map_arg_to_new_begin(5, subviewBegins, shiftedArg5, arg5, begins, counter);
 
 1449             Kokkos::Experimental::Impl::map_arg_to_new_begin(6, subviewBegins, shiftedArg6, arg6, begins, counter);
 
 1451             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1453             , ViewTraits< D , P... > , T0, T1, T2, T3, T4, T5,
 
 1454             T6 >::type >::type offsetView(theSubview, subviewBegins);
 
 1459          template< 
class D, 
class ... P , 
class T0, 
class T1, 
class T2, 
class T3, 
class T4,
 
 1460          class T5, 
class T6, 
class T7>
 
 1461          KOKKOS_INLINE_FUNCTION
 
 1462          typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1464          , ViewTraits< D , P... >
 
 1465          , T0, T1, T2, T3, T4, T5, T6, T7
 
 1467          subview_offset(
const OffsetView< D, P... > & src, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5,
 
 1470             auto theView = src.view();
 
 1471             auto begins = src.begins();
 
 1473             T0 shiftedArg0 = shift_input(arg0, begins[0]);
 
 1474             T1 shiftedArg1 = shift_input(arg1, begins[1]);
 
 1475             T2 shiftedArg2 = shift_input(arg2, begins[2]);
 
 1476             T3 shiftedArg3 = shift_input(arg3, begins[3]);
 
 1477             T4 shiftedArg4 = shift_input(arg4, begins[4]);
 
 1478             T5 shiftedArg5 = shift_input(arg5, begins[5]);
 
 1479             T6 shiftedArg6 = shift_input(arg6, begins[6]);
 
 1480             T7 shiftedArg7 = shift_input(arg7, begins[7]);
 
 1482             auto theSubview = Kokkos::subview( theView , shiftedArg0, shiftedArg1, shiftedArg2, shiftedArg3, shiftedArg4, shiftedArg5,
 
 1483                   shiftedArg6, shiftedArg7);
 
 1485             constexpr 
size_t rank = Kokkos::Impl::ViewMapping
 
 1487                   , ViewTraits< D , P... >
 
 1488             , T0, T1, T2, T3, T4, T5, T6, T7>::type::Rank;
 
 1493             Kokkos::Experimental::Impl::map_arg_to_new_begin(0, subviewBegins, shiftedArg0, arg0, begins, counter);
 
 1494             Kokkos::Experimental::Impl::map_arg_to_new_begin(1, subviewBegins, shiftedArg1, arg1, begins, counter);
 
 1495             Kokkos::Experimental::Impl::map_arg_to_new_begin(2, subviewBegins, shiftedArg2, arg2, begins, counter);
 
 1496             Kokkos::Experimental::Impl::map_arg_to_new_begin(3, subviewBegins, shiftedArg3, arg3, begins, counter);
 
 1497             Kokkos::Experimental::Impl::map_arg_to_new_begin(4, subviewBegins, shiftedArg4, arg4, begins, counter);
 
 1498             Kokkos::Experimental::Impl::map_arg_to_new_begin(5, subviewBegins, shiftedArg5, arg5, begins, counter);
 
 1499             Kokkos::Experimental::Impl::map_arg_to_new_begin(6, subviewBegins, shiftedArg6, arg6, begins, counter);
 
 1500             Kokkos::Experimental::Impl::map_arg_to_new_begin(7, subviewBegins, shiftedArg7, arg7, begins, counter);
 
 1502             typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping<
 
 1504             , ViewTraits< D , P... > , T0, T1, T2, T3, T4, T5,
 
 1505             T6, T7 >::type >::type offsetView(theSubview, subviewBegins);
 
 1511       template< 
class D, 
class ... P , 
class ... Args >
 
 1512       KOKKOS_INLINE_FUNCTION
 
 1513       typename Kokkos::Experimental::Impl::GetOffsetViewTypeFromViewType<
typename Kokkos::Impl::ViewMapping
 
 1515       , ViewTraits< D , P... >
 
 1518       subview( 
const OffsetView< D, P... > & src , Args ... args )
 
 1520          static_assert( OffsetView< D , P... >::Rank == 
sizeof...(Args) ,
 
 1521                "subview requires one argument for each source OffsetView rank" );
 
 1524          return Kokkos::Experimental::Impl::subview_offset(src, args...);
 
 1535    namespace Experimental {
 
 1536       template< 
class LT , 
class ... LP , 
class RT , 
class ... RP >
 
 1537       KOKKOS_INLINE_FUNCTION
 
 1538       bool operator == ( 
const OffsetView<LT,LP...> & lhs ,
 
 1539             const OffsetView<RT,RP...> & rhs )
 
 1542          typedef ViewTraits<LT,LP...>  lhs_traits ;
 
 1543          typedef ViewTraits<RT,RP...>  rhs_traits ;
 
 1546                std::is_same< 
typename lhs_traits::const_value_type ,
 
 1547                typename rhs_traits::const_value_type >::value &&
 
 1548                std::is_same< 
typename lhs_traits::array_layout ,
 
 1549                typename rhs_traits::array_layout >::value &&
 
 1550                std::is_same< 
typename lhs_traits::memory_space ,
 
 1551                typename rhs_traits::memory_space >::value &&
 
 1552                unsigned(lhs_traits::rank) == unsigned(rhs_traits::rank) &&
 
 1553                lhs.data()        == rhs.data() &&
 
 1554                lhs.span()        == rhs.span() &&
 
 1555                lhs.extent(0) == rhs.extent(0) &&
 
 1556                lhs.extent(1) == rhs.extent(1) &&
 
 1557                lhs.extent(2) == rhs.extent(2) &&
 
 1558                lhs.extent(3) == rhs.extent(3) &&
 
 1559                lhs.extent(4) == rhs.extent(4) &&
 
 1560                lhs.extent(5) == rhs.extent(5) &&
 
 1561                lhs.extent(6) == rhs.extent(6) &&
 
 1562                lhs.extent(7) == rhs.extent(7) &&
 
 1563                lhs.begin(0) == rhs.begin(0) &&
 
 1564                lhs.begin(1) == rhs.begin(1) &&
 
 1565                lhs.begin(2) == rhs.begin(2) &&
 
 1566                lhs.begin(3) == rhs.begin(3) &&
 
 1567                lhs.begin(4) == rhs.begin(4) &&
 
 1568                lhs.begin(5) == rhs.begin(5) &&
 
 1569                lhs.begin(6) == rhs.begin(6) &&
 
 1570                lhs.begin(7) == rhs.begin(7)
 
 1574       template< 
class LT , 
class ... LP , 
class RT , 
class ... RP >
 
 1575       KOKKOS_INLINE_FUNCTION
 
 1576       bool operator != ( 
const OffsetView<LT,LP...> & lhs ,
 
 1577             const OffsetView<RT,RP...> & rhs )
 
 1582       template< 
class LT , 
class ... LP , 
class RT , 
class ... RP >
 
 1583       KOKKOS_INLINE_FUNCTION
 
 1585             const OffsetView<RT,RP...> & rhs )
 
 1588          typedef ViewTraits<LT,LP...>  lhs_traits ;
 
 1589          typedef ViewTraits<RT,RP...>  rhs_traits ;
 
 1592                std::is_same< 
typename lhs_traits::const_value_type ,
 
 1593                typename rhs_traits::const_value_type >::value &&
 
 1594                std::is_same< 
typename lhs_traits::array_layout ,
 
 1595                typename rhs_traits::array_layout >::value &&
 
 1596                std::is_same< 
typename lhs_traits::memory_space ,
 
 1597                typename rhs_traits::memory_space >::value &&
 
 1598                unsigned(lhs_traits::rank) == unsigned(rhs_traits::rank) &&
 
 1599                lhs.data()        == rhs.data() &&
 
 1600                lhs.span()        == rhs.span() &&
 
 1601                lhs.extent(0) == rhs.extent(0) &&
 
 1602                lhs.extent(1) == rhs.extent(1) &&
 
 1603                lhs.extent(2) == rhs.extent(2) &&
 
 1604                lhs.extent(3) == rhs.extent(3) &&
 
 1605                lhs.extent(4) == rhs.extent(4) &&
 
 1606                lhs.extent(5) == rhs.extent(5) &&
 
 1607                lhs.extent(6) == rhs.extent(6) &&
 
 1608                lhs.extent(7) == rhs.extent(7)
 
 1612       template< 
class LT , 
class ... LP , 
class RT , 
class ... RP >
 
 1613       KOKKOS_INLINE_FUNCTION
 
 1614       bool operator == ( 
const OffsetView<LT,LP...> & lhs ,
 
 1615             const View<RT,RP...> & rhs )
 
 1616             { 
return rhs == lhs;}
 
 1626    namespace Experimental {
 
 1627       template< 
class DT , 
class ... DP >
 
 1630       ( 
const OffsetView<DT,DP...> & dst
 
 1631             , 
typename ViewTraits<DT,DP...>::const_value_type & value
 
 1632             , 
typename std::enable_if<
 
 1633             std::is_same< 
typename ViewTraits<DT,DP...>::specialize , 
void >::value
 
 1637                std::is_same< 
typename ViewTraits<DT,DP...>::non_const_value_type ,
 
 1638                typename ViewTraits<DT,DP...>::value_type >::value
 
 1639                , 
"deep_copy requires non-const type" );
 
 1641          auto dstView = dst.view();
 
 1646       template< 
class DT , 
class ... DP , 
class ST , 
class ... SP >
 
 1649       ( 
const OffsetView<DT,DP...> & dst
 
 1650             , 
const OffsetView<ST,SP...> & value
 
 1651             , 
typename std::enable_if<
 
 1652             std::is_same< 
typename ViewTraits<DT,DP...>::specialize , 
void >::value
 
 1656                std::is_same< 
typename ViewTraits<DT,DP...>::value_type ,
 
 1657                typename ViewTraits<ST,SP...>::non_const_value_type >::value
 
 1658                , 
"deep_copy requires matching non-const destination type" );
 
 1660          auto dstView = dst.view();
 
 1664       template< 
class DT , 
class ... DP , 
class ST , 
class ... SP >
 
 1667       ( 
const OffsetView<DT,DP...> & dst
 
 1668             , 
const View<ST,SP...> & value
 
 1669             , 
typename std::enable_if<
 
 1670             std::is_same< 
typename ViewTraits<DT,DP...>::specialize , 
void >::value
 
 1674                std::is_same< 
typename ViewTraits<DT,DP...>::value_type ,
 
 1675                typename ViewTraits<ST,SP...>::non_const_value_type >::value
 
 1676                , 
"deep_copy requires matching non-const destination type" );
 
 1678          auto dstView = dst.view();
 
 1683       template< 
class DT , 
class ... DP , 
class ST , 
class ... SP >
 
 1686       ( 
const View<DT,DP...> & dst
 
 1687             , 
const OffsetView<ST,SP...> & value
 
 1688             , 
typename std::enable_if<
 
 1689             std::is_same< 
typename ViewTraits<DT,DP...>::specialize , 
void >::value
 
 1693                std::is_same< 
typename ViewTraits<DT,DP...>::value_type ,
 
 1694                typename ViewTraits<ST,SP...>::non_const_value_type >::value
 
 1695                , 
"deep_copy requires matching non-const destination type" );
 
 1703          template<
class Space, 
class T, 
class ... P>
 
 1704          struct MirrorOffsetViewType {
 
 1706             typedef typename Kokkos::Experimental::OffsetView<T,P...> src_view_type;
 
 1708             typedef typename Space::memory_space memory_space;
 
 1710             enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
 
 1712             typedef typename src_view_type::array_layout array_layout;
 
 1714             typedef typename src_view_type::non_const_data_type data_type;
 
 1716             typedef Kokkos::Experimental::OffsetView<data_type,array_layout,Space> dest_view_type;
 
 1719             typedef typename std::conditional<is_same_memspace,src_view_type,dest_view_type>::type view_type;
 
 1722          template<
class Space, 
class T, 
class ... P>
 
 1723          struct MirrorOffsetType {
 
 1725             typedef typename Kokkos::Experimental::OffsetView<T,P...> src_view_type;
 
 1727             typedef typename Space::memory_space memory_space;
 
 1729             enum { is_same_memspace = std::is_same<memory_space,typename src_view_type::memory_space>::value };
 
 1731             typedef typename src_view_type::array_layout array_layout;
 
 1733             typedef typename src_view_type::non_const_data_type data_type;
 
 1735             typedef Kokkos::Experimental::OffsetView<data_type,array_layout,Space> view_type;
 
 1740       template< 
class T , 
class ... P >
 
 1742       typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror
 
 1743       create_mirror( 
const Kokkos::Experimental::OffsetView<T,P...> & src
 
 1744             , 
typename std::enable_if<
 
 1745             ! std::is_same< 
typename Kokkos::ViewTraits<T,P...>::array_layout
 
 1750          typedef OffsetView<T,P...>             src_type ;
 
 1751          typedef typename src_type::HostMirror  dst_type ;
 
 1753          return dst_type( Kokkos::Impl::ViewCtorProp< std::string >(std::string( src.label() ).append(
"_mirror") ),
 
 1754                typename Kokkos::ViewTraits<T,P...>::array_layout
 
 1755                ( src.extent(0), src.extent(1), src.extent(2), src.extent(3), src.extent(4),
 
 1756                      src.extent(5), src.extent(6), src.extent(7) ),
 
 1757                      { src.begin(0), src.begin(1), src.begin(2), src.begin(3), src.begin(4),
 
 1758                            src.begin(5), src.begin(6), src.begin(7) });
 
 1761       template< 
class T , 
class ... P >
 
 1763       typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror
 
 1764       create_mirror( 
const Kokkos::Experimental::OffsetView<T,P...> & src
 
 1765             , 
typename std::enable_if<
 
 1766             std::is_same< 
typename Kokkos::ViewTraits<T,P...>::array_layout
 
 1771          typedef OffsetView<T,P...>             src_type ;
 
 1772          typedef typename src_type::HostMirror  dst_type ;
 
 1776          layout.dimension[0] = src.extent(0);
 
 1777          layout.dimension[1] = src.extent(1);
 
 1778          layout.dimension[2] = src.extent(2);
 
 1779          layout.dimension[3] = src.extent(3);
 
 1780          layout.dimension[4] = src.extent(4);
 
 1781          layout.dimension[5] = src.extent(5);
 
 1782          layout.dimension[6] = src.extent(6);
 
 1783          layout.dimension[7] = src.extent(7);
 
 1785          layout.stride[0] = src.stride_0();
 
 1786          layout.stride[1] = src.stride_1();
 
 1787          layout.stride[2] = src.stride_2();
 
 1788          layout.stride[3] = src.stride_3();
 
 1789          layout.stride[4] = src.stride_4();
 
 1790          layout.stride[5] = src.stride_5();
 
 1791          layout.stride[6] = src.stride_6();
 
 1792          layout.stride[7] = src.stride_7();
 
 1794          return dst_type( std::string( src.label() ).append(
"_mirror") , layout,
 
 1795                { src.begin(0), src.begin(1), src.begin(2), src.begin(3), src.begin(4),
 
 1796                      src.begin(5), src.begin(6), src.begin(7) } );
 
 1801       template<
class Space, 
class T, 
class ... P>
 
 1802       typename Kokkos::Experimental::Impl::MirrorOffsetType<Space,T,P ...>::view_type
 
 1803       create_mirror(
const Space& , 
const Kokkos::Experimental::OffsetView<T,P...> & src) {
 
 1804          return typename Kokkos::Experimental::Impl::MirrorOffsetType<Space,T,P ...>::view_type(src.label(),src.layout(),
 
 1805                { src.begin(0), src.begin(1), src.begin(2), src.begin(3), src.begin(4),
 
 1806                      src.begin(5), src.begin(6), src.begin(7) } );
 
 1810       template< 
class T , 
class ... P >
 
 1812       typename Kokkos::Experimental::OffsetView< T, P... >::HostMirror
 
 1813       create_mirror_view( 
const typename Kokkos::Experimental::OffsetView< T,P... > & src
 
 1814             , 
typename std::enable_if<(
 
 1815                   std::is_same< 
typename Kokkos::Experimental::OffsetView<T,P...>::memory_space
 
 1816                   , 
typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror::memory_space
 
 1819                   std::is_same< 
typename Kokkos::Experimental::OffsetView<T,P...>::data_type
 
 1820                   , 
typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror::data_type
 
 1828       template< 
class T , 
class ... P >
 
 1830       typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror
 
 1831       create_mirror_view( 
const Kokkos::Experimental::OffsetView<T,P...> & src
 
 1832             , 
typename std::enable_if< ! (
 
 1833                   std::is_same< 
typename Kokkos::Experimental::OffsetView<T,P...>::memory_space
 
 1834                   , 
typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror::memory_space
 
 1837                   std::is_same< 
typename Kokkos::Experimental::OffsetView<T,P...>::data_type
 
 1838                   , 
typename Kokkos::Experimental::OffsetView<T,P...>::HostMirror::data_type
 
 1843   return Kokkos::Experimental::create_mirror( src );
 
 1847       template<
class Space, 
class T, 
class ... P>
 
 1848       typename Kokkos::Experimental::Impl::MirrorOffsetViewType<Space,T,P ...>::view_type
 
 1849       create_mirror_view(
const Space& , 
const Kokkos::Experimental::OffsetView<T,P...> & src
 
 1850             , 
typename std::enable_if<Impl::MirrorOffsetViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
 
 1855       template<
class Space, 
class T, 
class ... P>
 
 1856       typename Kokkos::Experimental::Impl::MirrorOffsetViewType<Space,T,P ...>::view_type
 
 1857       create_mirror_view(
const Space& , 
const Kokkos::Experimental::OffsetView<T,P...> & src
 
 1858             , 
typename std::enable_if<!Impl::MirrorOffsetViewType<Space,T,P ...>::is_same_memspace>::type* = 0 ) {
 
 1859          return typename Kokkos::Experimental::Impl::MirrorOffsetViewType<Space,T,P ...>::view_type(src.label(),src.layout(),
 
 1860                { src.begin(0), src.begin(1), src.begin(2), src.begin(3), src.begin(4),
 
 1861                      src.begin(5), src.begin(6), src.begin(7) } );
 
KOKKOS_INLINE_FUNCTION bool operator==(const complex< RealType1 > &x, const complex< RealType2 > &y)
Equality operator for two complex numbers. 
 
KOKKOS_INLINE_FUNCTION bool operator!=(const complex< RealType1 > &x, const complex< RealType2 > &y)
Inequality operator for two complex numbers. 
 
Memory layout tag indicating left-to-right (Fortran scheme) striding of multi-indices. 
 
Derived from the C++17 'std::array'. Dropping the iterator interface. 
 
Replacement for std::pair that works on CUDA devices. 
 
Memory layout tag indicated arbitrarily strided multi-index mapping into contiguous memory...
 
void deep_copy(const View< DT, DP...> &dst, typename ViewTraits< DT, DP...>::const_value_type &value, typename std::enable_if< std::is_same< typename ViewTraits< DT, DP...>::specialize, void >::value >::type *=0)
Deep copy a value from Host memory into a view. 
 
first_type first
The first element of the pair. 
 
Memory layout tag indicating right-to-left (C or lexigraphical scheme) striding of multi-indices...
 
KOKKOS_INLINE_FUNCTION constexpr unsigned rank(const View< D, P...> &V)
Temporary free function rank() until rank() is implemented in the View. 
 
second_type second
The second element of the pair.