3
// ************************************************************************
5
// Kokkos: Manycore Performance-Portable Multidimensional Arrays
6
// Copyright (2012) Sandia Corporation
8
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9
// the U.S. Government retains certain rights in this software.
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov)
40
// ************************************************************************
44
#ifndef KOKKOS_VIEWDEFAULT_HPP
45
#define KOKKOS_VIEWDEFAULT_HPP
47
//----------------------------------------------------------------------------
48
//----------------------------------------------------------------------------
54
struct ViewAssignment< ViewDefault , ViewDefault , void >
56
typedef ViewDefault Specialize ;
58
//------------------------------------
59
/** \brief Compatible value and shape */
61
template< class DT , class DL , class DD , class DM ,
62
class ST , class SL , class SD , class SM >
63
KOKKOS_INLINE_FUNCTION
64
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
65
const View<ST,SL,SD,SM,Specialize> & src ,
66
const typename enable_if<(
67
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
68
ViewTraits<ST,SL,SD,SM> >::value
70
( ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
71
ViewTraits<ST,SL,SD,SM> >::assignable_value
73
ShapeCompatible< typename ViewTraits<DT,DL,DD,DM>::shape_type ,
74
typename ViewTraits<ST,SL,SD,SM>::shape_type >::value
76
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout,LayoutStride>::value )
79
dst.m_management.decrement( dst.m_ptr_on_device );
81
dst.m_offset_map.assign( src.m_offset_map );
83
dst.m_management = src.m_management ;
85
dst.m_ptr_on_device = typename ViewDataManagement< ViewTraits<DT,DL,DD,DM> >::handle_type( src.m_ptr_on_device );
87
dst.m_management.increment( dst.m_ptr_on_device );
90
//------------------------------------
91
/** \brief Extract Rank-0 from Rank-1 */
93
template< class DT , class DL , class DD , class DM ,
94
class ST , class SL , class SD , class SM >
95
KOKKOS_INLINE_FUNCTION
96
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
97
const View<ST,SL,SD,SM,Specialize> & src ,
98
const typename enable_if< (
99
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
100
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
101
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
102
( ViewTraits<ST,SL,SD,SM>::rank == 1 )
103
), unsigned >::type i0 )
105
assert_shape_bounds( src.m_offset_map , 1 , i0 );
107
dst.m_management.decrement( dst.m_ptr_on_device );
109
dst.m_management = src.m_management ;
111
dst.m_ptr_on_device = src.ptr_on_device() + i0 ;
113
dst.m_management.increment( dst.m_ptr_on_device );
116
//------------------------------------
117
/** \brief Extract Rank-0 from Rank-2 */
119
template< class DT , class DL , class DD , class DM ,
120
class ST , class SL , class SD , class SM >
121
KOKKOS_INLINE_FUNCTION
122
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
123
const View<ST,SL,SD,SM,Specialize> & src ,
124
const typename enable_if< (
125
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
126
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
127
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
128
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
129
), unsigned >::type i0 ,
132
assert_shape_bounds( src.m_offset_map , 2 , i0 , i1 );
134
dst.m_management.decrement( dst.m_ptr_on_device );
136
dst.m_management = src.m_management ;
138
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1);
140
dst.m_management.increment( dst.m_ptr_on_device );
143
//------------------------------------
144
/** \brief Extract Rank-0 from Rank-3 */
146
template< class DT , class DL , class DD , class DM ,
147
class ST , class SL , class SD , class SM >
148
KOKKOS_INLINE_FUNCTION
149
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
150
const View<ST,SL,SD,SM,Specialize> & src ,
151
const typename enable_if< (
152
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
153
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
154
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
155
( ViewTraits<ST,SL,SD,SM>::rank == 3 )
156
), unsigned >::type i0 ,
160
assert_shape_bounds( src.m_offset_map, 3, i0, i1, i2 );
162
dst.m_management.decrement( dst.m_ptr_on_device );
164
dst.m_management = src.m_management ;
166
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1,i2);
168
dst.m_management.increment( dst.m_ptr_on_device );
171
//------------------------------------
172
/** \brief Extract Rank-0 from Rank-4 */
174
template< class DT , class DL , class DD , class DM ,
175
class ST , class SL , class SD , class SM >
176
KOKKOS_INLINE_FUNCTION
177
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
178
const View<ST,SL,SD,SM,Specialize> & src ,
179
const typename enable_if< (
180
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
181
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
182
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
183
( ViewTraits<ST,SL,SD,SM>::rank == 4 )
184
), unsigned >::type i0 ,
189
assert_shape_bounds( src.m_offset_map, 4, i0, i1, i2, i3 );
191
dst.m_management.decrement( dst.m_ptr_on_device );
193
dst.m_management = src.m_management ;
195
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1,i2,i3);
197
dst.m_management.increment( dst.m_ptr_on_device );
200
//------------------------------------
201
/** \brief Extract Rank-0 from Rank-5 */
203
template< class DT , class DL , class DD , class DM ,
204
class ST , class SL , class SD , class SM >
205
KOKKOS_INLINE_FUNCTION
206
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
207
const View<ST,SL,SD,SM,Specialize> & src ,
208
const typename enable_if< (
209
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
210
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
211
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
212
( ViewTraits<ST,SL,SD,SM>::rank == 5 )
213
), unsigned >::type i0 ,
219
assert_shape_bounds( src.m_offset_map, 5, i0, i1, i2, i3, i4);
221
dst.m_management.decrement( dst.m_ptr_on_device );
223
dst.m_management = src.m_management ;
225
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1,i2,i3,i4);
227
dst.m_management.increment( dst.m_ptr_on_device );
230
//------------------------------------
231
/** \brief Extract Rank-0 from Rank-6 */
233
template< class DT , class DL , class DD , class DM ,
234
class ST , class SL , class SD , class SM >
235
KOKKOS_INLINE_FUNCTION
236
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
237
const View<ST,SL,SD,SM,Specialize> & src ,
238
const typename enable_if< (
239
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
240
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
241
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
242
( ViewTraits<ST,SL,SD,SM>::rank == 6 )
243
), unsigned >::type i0 ,
250
assert_shape_bounds( src.m_offset_map, 6, i0, i1, i2, i3, i4, i5);
252
dst.m_management.decrement( dst.m_ptr_on_device );
254
dst.m_management = src.m_management ;
256
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1,i2,i3,i4,i5);
258
dst.m_management.increment( dst.m_ptr_on_device );
261
//------------------------------------
262
/** \brief Extract Rank-0 from Rank-7 */
264
template< class DT , class DL , class DD , class DM ,
265
class ST , class SL , class SD , class SM >
266
KOKKOS_INLINE_FUNCTION
267
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
268
const View<ST,SL,SD,SM,Specialize> & src ,
269
const typename enable_if< (
270
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
271
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
272
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
273
( ViewTraits<ST,SL,SD,SM>::rank == 7 )
274
), unsigned >::type i0 ,
282
assert_shape_bounds( src.m_offset_map, 7, i0, i1, i2, i3, i4, i5, i6 );
284
dst.m_management.decrement( dst.m_ptr_on_device );
286
dst.m_management = src.m_management ;
288
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1,i2,i3,i4,i5,i6);
290
dst.m_management.increment( dst.m_ptr_on_device );
293
//------------------------------------
294
/** \brief Extract Rank-0 from Rank-8 */
296
template< class DT , class DL , class DD , class DM ,
297
class ST , class SL , class SD , class SM >
298
KOKKOS_INLINE_FUNCTION
299
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
300
const View<ST,SL,SD,SM,Specialize> & src ,
301
const typename enable_if< (
302
ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
303
ViewTraits<ST,SL,SD,SM> >::assignable_value &&
304
( ViewTraits<DT,DL,DD,DM>::rank == 0 ) &&
305
( ViewTraits<ST,SL,SD,SM>::rank == 8 )
306
), unsigned >::type i0 ,
315
assert_shape_bounds( src.m_offset_map, 8, i0, i1, i2, i3, i4, i5, i6, i7 );
317
dst.m_management.decrement( dst.m_ptr_on_device );
319
dst.m_management = src.m_management ;
321
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,i1,i2,i3,i4,i5,i6,i7);
323
dst.m_management.increment( dst.m_ptr_on_device );
326
//------------------------------------
327
/** \brief Extract Rank-1 array from range of Rank-1 array, either layout */
328
template< class DT , class DL , class DD , class DM ,
329
class ST , class SL , class SD , class SM ,
331
KOKKOS_INLINE_FUNCTION
332
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
333
const View<ST,SL,SD,SM,Specialize> & src ,
334
const std::pair<iType,iType> & range ,
335
typename enable_if< (
336
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
338
( ViewTraits<ST,SL,SD,SM>::rank == 1 )
340
( ViewTraits<DT,DL,DD,DM>::rank == 1 )
342
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 1 )
345
dst.m_management.decrement( dst.m_ptr_on_device );
347
dst.m_offset_map.N0 = 0 ;
348
dst.m_ptr_on_device = 0 ;
350
if ( range.first < range.second ) {
351
assert_shape_bounds( src.m_offset_map , 1 , range.first );
352
assert_shape_bounds( src.m_offset_map , 1 , range.second - 1 );
354
dst.m_management = src.m_management ;
355
dst.m_offset_map.N0 = range.second - range.first ;
356
dst.m_ptr_on_device = src.ptr_on_device() + range.first ;
358
dst.m_management.increment( dst.m_ptr_on_device );
362
//------------------------------------
363
/** \brief Extract Rank-1 array from LayoutLeft Rank-2 array, using ALL as first argument. */
364
template< class DT , class DL , class DD , class DM ,
365
class ST , class SL , class SD , class SM >
366
KOKKOS_INLINE_FUNCTION
367
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
368
const View<ST,SL,SD,SM,Specialize> & src ,
370
const typename enable_if< (
371
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
373
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutLeft >::value
375
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
377
( ViewTraits<DT,DL,DD,DM>::rank == 1 )
379
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 1 )
380
), unsigned >::type i1 )
382
dst.m_management.decrement( dst.m_ptr_on_device );
384
dst.m_management = src.m_management ;
385
dst.m_offset_map.N0 = src.m_offset_map.N0 ;
386
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(0,i1);
388
dst.m_management.increment( dst.m_ptr_on_device );
392
//------------------------------------
393
/** \brief Extract Rank-1 array from LayoutLeft Rank-2 array, using a row range as first argument. */
394
template< class DT , class DL , class DD , class DM ,
395
class ST , class SL , class SD , class SM ,
397
KOKKOS_INLINE_FUNCTION
398
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
399
const View<ST,SL,SD,SM,Specialize> & src ,
400
const std::pair<IndexType, IndexType>& rowRange,
401
const typename enable_if< (
402
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
404
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutLeft >::value
406
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
408
( ViewTraits<DT,DL,DD,DM>::rank == 1 )
410
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 1 )
411
), IndexType >::type columnIndex )
413
dst.m_management.decrement( dst.m_ptr_on_device );
415
if (rowRange.first < rowRange.second) { // valid row range
416
dst.m_management = src.m_management;
417
dst.m_offset_map.N0 = rowRange.second - rowRange.first;
418
dst.m_ptr_on_device = src.ptr_on_device () +
419
src.m_offset_map (rowRange.first, columnIndex);
421
dst.m_management.increment( dst.m_ptr_on_device );
423
else { // not a valid row range
424
dst.m_offset_map.N0 = 0;
425
dst.m_ptr_on_device = 0;
430
//------------------------------------
431
/** \brief Extract Rank-1 array from LayoutRight Rank-2 array. */
432
template< class DT , class DL , class DD , class DM ,
433
class ST , class SL , class SD , class SM >
434
KOKKOS_INLINE_FUNCTION
435
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
436
const View<ST,SL,SD,SM,Specialize> & src ,
438
const typename enable_if< (
439
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
441
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
443
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
445
( ViewTraits<DT,DL,DD,DM>::rank == 1 )
447
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 1 )
450
dst.m_management.decrement( dst.m_ptr_on_device );
452
dst.m_management = src.m_management ;
453
dst.m_offset_map.N0 = src.m_offset_map.N1 ;
454
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,0);
456
dst.m_management.increment( dst.m_ptr_on_device );
459
//------------------------------------
460
/** \brief Extract Rank-2 array from LayoutLeft Rank-2 array. */
461
template< class DT , class DL , class DD , class DM ,
462
class ST , class SL , class SD , class SM ,
464
KOKKOS_INLINE_FUNCTION
465
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
466
const View<ST,SL,SD,SM,Specialize> & src ,
467
const std::pair<iType,iType> & range ,
468
const typename enable_if< (
469
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
471
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutLeft >::value
473
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
475
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
477
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
478
), unsigned >::type i1 )
480
assert_shape_bounds( src.m_offset_map , 2 , range.first , i1 );
481
assert_shape_bounds( src.m_offset_map , 2 , range.second - 1 , i1 );
483
dst.m_management.decrement( dst.m_ptr_on_device );
485
if ( range.first < range.second ) {
486
dst.m_management = src.m_management ;
487
dst.m_offset_map.N0 = range.second - range.first ;
488
dst.m_offset_map.N1 = 1 ;
489
dst.m_offset_map.S0 = range.second - range.first ;
490
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(range.first,i1);
492
dst.m_management.increment( dst.m_ptr_on_device );
496
//------------------------------------
497
/** \brief Extract Rank-2 array from LayoutLeft Rank-2 array. */
498
template< class DT , class DL , class DD , class DM ,
499
class ST , class SL , class SD , class SM >
500
KOKKOS_INLINE_FUNCTION
501
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
502
const View<ST,SL,SD,SM,Specialize> & src ,
504
const typename enable_if< (
505
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
507
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutLeft >::value
509
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
511
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
513
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
514
), unsigned >::type i1 )
516
dst.m_management.decrement( dst.m_ptr_on_device );
518
dst.m_management = src.m_management ;
519
dst.m_offset_map.N0 = src.m_offset_map.N0 ;
520
dst.m_offset_map.N1 = 1 ;
522
dst.m_offset_map.S0 = src.m_offset_map.N0 ;
523
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(0,i1);
525
dst.m_management.increment( dst.m_ptr_on_device );
528
//------------------------------------
529
/** \brief Extract Rank-2 array from LayoutRight Rank-2 array. */
530
template< class DT , class DL , class DD , class DM ,
531
class ST , class SL , class SD , class SM >
532
KOKKOS_INLINE_FUNCTION
533
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
534
const View<ST,SL,SD,SM,Specialize> & src ,
536
const typename enable_if< (
537
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
539
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
541
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
543
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
545
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
548
dst.m_management.decrement( dst.m_ptr_on_device );
550
dst.m_management = src.m_management ;
551
dst.m_offset_map.N0 = 1 ;
552
dst.m_offset_map.N1 = src.m_offset_map.N1 ;
553
dst.m_offset_map.SR = src.m_offset_map.SR ;
554
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(i0,0);
556
dst.m_management.increment( dst.m_ptr_on_device );
558
//------------------------------------
559
/** \brief Extract LayoutRight Rank-N array from range of LayoutRight Rank-N array */
560
template< class DT , class DL , class DD , class DM ,
561
class ST , class SL , class SD , class SM ,
563
KOKKOS_INLINE_FUNCTION
564
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
565
const View<ST,SL,SD,SM,Specialize> & src ,
566
const std::pair<iType,iType> & range ,
567
typename enable_if< (
568
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::value
570
Impl::is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutRight >::value
572
( ViewTraits<ST,SL,SD,SM>::rank > 1 )
574
( ViewTraits<DT,DL,DD,DM>::rank_dynamic > 0 )
577
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
578
//typedef typename traits_type::shape_type shape_type ; // unused
579
//typedef typename View<DT,DL,DD,DM,Specialize>::stride_type stride_type ; // unused
581
dst.m_management.decrement( dst.m_ptr_on_device );
583
dst.m_offset_map.assign( 0, 0, 0, 0, 0, 0, 0, 0 );
585
dst.m_ptr_on_device = 0 ;
587
if ( ( range.first == range.second ) ||
588
( (src.capacity()==0u) && (range.second<src.m_offset_map.N0) )) {
589
dst.m_offset_map.assign( 0 , src.m_offset_map.N1 , src.m_offset_map.N2 , src.m_offset_map.N3 ,
590
src.m_offset_map.N4 , src.m_offset_map.N5 , src.m_offset_map.N6 , src.m_offset_map.N7 );
591
dst.m_offset_map.SR = src.m_offset_map.SR ;
593
else if ( (range.first < range.second) ) {
594
assert_shape_bounds( src.m_offset_map , 8 , range.first , 0,0,0,0,0,0,0);
595
assert_shape_bounds( src.m_offset_map , 8 , range.second - 1 , 0,0,0,0,0,0,0);
597
dst.m_offset_map.assign( range.second - range.first
598
, src.m_offset_map.N1 , src.m_offset_map.N2 , src.m_offset_map.N3
599
, src.m_offset_map.N4 , src.m_offset_map.N5 , src.m_offset_map.N6 , src.m_offset_map.N7 );
601
dst.m_offset_map.SR = src.m_offset_map.SR ;
603
dst.m_management = src.m_management ;
605
dst.m_ptr_on_device = src.ptr_on_device() + range.first * src.m_offset_map.SR ;
607
dst.m_management.increment( dst.m_ptr_on_device );
611
//------------------------------------
612
/** \brief Extract rank-2 from rank-2 array */
613
template< class DT , class DL , class DD , class DM ,
614
class ST , class SL , class SD , class SM ,
615
typename iType0 , typename iType1 >
616
KOKKOS_INLINE_FUNCTION
617
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
618
const View<ST,SL,SD,SM,Specialize> & src ,
619
const std::pair<iType0,iType0> & range0 ,
620
const std::pair<iType1,iType1> & range1 ,
621
typename enable_if< (
622
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::value
624
ViewTraits<DT,DL,DD,DM>::rank == 2
626
ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2
629
dst.m_management.decrement( dst.m_ptr_on_device );
630
dst.m_offset_map.assign(0,0,0,0, 0,0,0,0);
631
dst.m_ptr_on_device = 0 ;
633
if ( (range0.first == range0.second) ||
634
(range1.first == range1.second) ||
635
( ( src.capacity() == 0u ) &&
636
( long(range0.second) < long(src.m_offset_map.N0) ) &&
637
( long(range1.second) < long(src.m_offset_map.N1) ) ) ) {
639
dst.m_offset_map.assign( src.m_offset_map );
640
dst.m_offset_map.N0 = range0.second - range0.first ;
641
dst.m_offset_map.N1 = range1.second - range1.first ;
643
else if ( (range0.first < range0.second && range1.first < range1.second) ) {
645
assert_shape_bounds( src.m_offset_map , 2 , range0.first , range1.first );
646
assert_shape_bounds( src.m_offset_map , 2 , range0.second - 1 , range1.second - 1 );
648
dst.m_offset_map.assign( src.m_offset_map );
649
dst.m_offset_map.N0 = range0.second - range0.first ;
650
dst.m_offset_map.N1 = range1.second - range1.first ;
652
dst.m_management = src.m_management ;
654
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(range0.first,range1.first);
656
dst.m_management.increment( dst.m_ptr_on_device );
660
//------------------------------------
661
/** \brief Extract rank-2 from rank-2 array */
662
template< class DT , class DL , class DD , class DM ,
663
class ST , class SL , class SD , class SM ,
665
KOKKOS_INLINE_FUNCTION
666
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
667
const View<ST,SL,SD,SM,Specialize> & src ,
669
const std::pair<iType,iType> & range1 ,
670
typename enable_if< (
671
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::value
673
ViewTraits<DT,DL,DD,DM>::rank == 2
675
ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2
678
dst.m_management.decrement( dst.m_ptr_on_device );
679
dst.m_offset_map.assign(0,0,0,0, 0,0,0,0);
680
dst.m_ptr_on_device = 0 ;
682
if ( (range1.first == range1.second) || ( (src.capacity()==0) && (range1.second<src.m_offset_map.N1) )) {
683
dst.m_offset_map.assign(src.m_offset_map);
684
dst.m_offset_map.N1 = range1.second - range1.first ;
686
else if ( (range1.first < range1.second) ) {
687
assert_shape_bounds( src.m_offset_map , 2 , 0 , range1.first );
688
assert_shape_bounds( src.m_offset_map , 2 , src.m_offset_map.N0 - 1 , range1.second - 1 );
690
dst.m_offset_map.assign(src.m_offset_map);
691
dst.m_offset_map.N1 = range1.second - range1.first ;
692
dst.m_management = src.m_management ;
694
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(0,range1.first);
696
dst.m_management.increment( dst.m_ptr_on_device );
700
//------------------------------------
701
/** \brief Extract rank-2 from rank-2 array */
702
template< class DT , class DL , class DD , class DM ,
703
class ST , class SL , class SD , class SM ,
705
KOKKOS_INLINE_FUNCTION
706
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
707
const View<ST,SL,SD,SM,Specialize> & src ,
708
const std::pair<iType,iType> & range0 ,
710
typename enable_if< (
711
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::value
713
ViewTraits<DT,DL,DD,DM>::rank == 2
715
ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2
718
dst.m_management.decrement( dst.m_ptr_on_device );
719
dst.m_offset_map.assign(0,0,0,0, 0,0,0,0);
720
dst.m_ptr_on_device = 0 ;
722
if ( (range0.first == range0.second) || ( (src.capacity()==0) && (range0.second<src.m_offset_map.N0) )) {
723
dst.m_offset_map.assign(src.m_offset_map);
724
dst.m_offset_map.N0 = range0.second - range0.first ;
726
else if ( (range0.first < range0.second) ) {
727
assert_shape_bounds( src.m_offset_map , 2 , range0.first , 0 );
728
assert_shape_bounds( src.m_offset_map , 2 , range0.second - 1 , src.m_offset_map.N1 - 1 );
730
dst.m_offset_map.assign(src.m_offset_map);
731
dst.m_offset_map.N0 = range0.second - range0.first ;
732
dst.m_management = src.m_management ;
734
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(range0.first,0);
736
dst.m_management.increment( dst.m_ptr_on_device );
740
//------------------------------------
741
/** \brief Extract rank-2 from rank-2 array */
742
template< class DT , class DL , class DD , class DM ,
743
class ST , class SL , class SD , class SM ,
745
KOKKOS_INLINE_FUNCTION
746
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
747
const View<ST,SL,SD,SM,Specialize> & src ,
748
const std::pair<iType,iType> & range0 ,
750
typename enable_if< (
751
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::value
753
ViewTraits<DT,DL,DD,DM>::rank == 2
755
ViewTraits<DT,DL,DD,DM>::rank_dynamic == 1
758
dst.m_tracking.decrement( dst.ptr_on_device() );
759
dst.m_offset_map.assign(0,0,0,0, 0,0,0,0);
760
dst.m_ptr_on_device = 0 ;
762
if ( (range0.first == range0.second) || ( (src.capacity()==0) && (range0.second<src.m_offset_map.N0) )) {
763
dst.m_offset_map.assign(src.m_offset_map);
764
dst.m_offset_map.N0 = range0.second - range0.first ;
766
else if ( (range0.first < range0.second) ) {
767
assert_shape_bounds( src.m_offset_map , 2 , range0.first , 0 );
768
assert_shape_bounds( src.m_offset_map , 2 , range0.second - 1 , src.m_offset_map.N1 - 1 );
770
dst.m_offset_map.assign(src.m_offset_map);
771
dst.m_offset_map.N0 = range0.second - range0.first ;
772
dst.m_tracking = src.m_tracking ;
774
dst.m_ptr_on_device = src.ptr_on_device() + src.m_offset_map(range0.first,0);
776
dst.m_tracking.increment( dst.ptr_on_device() );
779
//------------------------------------
780
/** \brief Extract Rank-2 array from LayoutRight Rank-3 array. */
781
template< class DT , class DL , class DD , class DM ,
782
class ST , class SL , class SD , class SM >
783
KOKKOS_INLINE_FUNCTION
784
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
785
const View<ST,SL,SD,SM,Specialize> & src ,
788
const typename enable_if< (
789
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
791
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
793
( ViewTraits<ST,SL,SD,SM>::rank == 3 )
795
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
797
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
800
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
802
dst.m_management.decrement( dst.m_ptr_on_device );
804
dst.m_management = src.m_management ;
805
dst.m_offset_map.N0 = src.m_offset_map.N1 ;
806
dst.m_offset_map.N1 = src.m_offset_map.N2 ;
807
dst.m_offset_map.SR = dst.m_offset_map.N1 ;
808
dst.m_ptr_on_device = &src(i0,0,0);
810
dst.m_management.increment( dst.m_ptr_on_device );
813
//------------------------------------
814
/** \brief Extract Rank-2 array from LayoutRight Rank-4 array. */
815
template< class DT , class DL , class DD , class DM ,
816
class ST , class SL , class SD , class SM >
817
KOKKOS_INLINE_FUNCTION
818
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
819
const View<ST,SL,SD,SM,Specialize> & src ,
823
const typename enable_if< (
824
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
826
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
828
( ViewTraits<ST,SL,SD,SM>::rank == 4 )
830
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
832
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
835
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
837
dst.m_management.decrement( dst.m_ptr_on_device );
839
dst.m_management = src.m_management ;
840
dst.m_offset_map.N0 = src.m_offset_map.N2 ;
841
dst.m_offset_map.N1 = src.m_offset_map.N3 ;
842
dst.m_offset_map.SR = dst.m_offset_map.N1 ;
843
dst.m_ptr_on_device = &src(i0,i1,0,0);
845
dst.m_management.increment( dst.m_ptr_on_device );
848
//------------------------------------
849
/** \brief Extract Rank-2 array from LayoutRight Rank-5 array. */
850
template< class DT , class DL , class DD , class DM ,
851
class ST , class SL , class SD , class SM >
852
KOKKOS_INLINE_FUNCTION
853
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
854
const View<ST,SL,SD,SM,Specialize> & src ,
859
const typename enable_if< (
860
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
862
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
864
( ViewTraits<ST,SL,SD,SM>::rank == 5 )
866
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
868
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
871
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
873
dst.m_management.decrement( dst.m_ptr_on_device );
875
dst.m_management = src.m_management ;
876
dst.m_offset_map.N0 = src.m_offset_map.N3 ;
877
dst.m_offset_map.N1 = src.m_offset_map.N4 ;
878
dst.m_offset_map.SR = dst.m_offset_map.N1 ;
879
dst.m_ptr_on_device = &src(i0,i1,i2,0,0);
881
dst.m_management.increment( dst.m_ptr_on_device );
885
//------------------------------------
886
/** \brief Extract Rank-2 array from LayoutRight Rank-6 array. */
887
template< class DT , class DL , class DD , class DM ,
888
class ST , class SL , class SD , class SM >
889
KOKKOS_INLINE_FUNCTION
890
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
891
const View<ST,SL,SD,SM,Specialize> & src ,
897
const typename enable_if< (
898
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
900
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
902
( ViewTraits<ST,SL,SD,SM>::rank == 6 )
904
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
906
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
909
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
911
dst.m_management.decrement( dst.m_ptr_on_device );
913
dst.m_management = src.m_management ;
914
dst.m_offset_map.N0 = src.m_offset_map.N4 ;
915
dst.m_offset_map.N1 = src.m_offset_map.N5 ;
916
dst.m_offset_map.SR = dst.m_offset_map.N1 ;
917
dst.m_ptr_on_device = &src(i0,i1,i2,i3,0,0);
919
dst.m_management.increment( dst.m_ptr_on_device );
922
//------------------------------------
923
/** \brief Extract Rank-2 array from LayoutRight Rank-7 array. */
924
template< class DT , class DL , class DD , class DM ,
925
class ST , class SL , class SD , class SM >
926
KOKKOS_INLINE_FUNCTION
927
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
928
const View<ST,SL,SD,SM,Specialize> & src ,
935
const typename enable_if< (
936
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
938
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
940
( ViewTraits<ST,SL,SD,SM>::rank == 7 )
942
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
944
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
947
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
949
dst.m_management.decrement( dst.m_ptr_on_device );
951
dst.m_management = src.m_management ;
952
dst.m_offset_map.N0 = src.m_offset_map.N5 ;
953
dst.m_offset_map.N1 = src.m_offset_map.N6 ;
954
dst.m_offset_map.SR = dst.m_offset_map.N1 ;
955
dst.m_ptr_on_device = &src(i0,i1,i2,i3,i4,0,0);
957
dst.m_management.increment( dst.m_ptr_on_device );
961
//------------------------------------
962
/** \brief Extract Rank-2 array from LayoutRight Rank-8 array. */
963
template< class DT , class DL , class DD , class DM ,
964
class ST , class SL , class SD , class SM >
965
KOKKOS_INLINE_FUNCTION
966
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
967
const View<ST,SL,SD,SM,Specialize> & src ,
975
const typename enable_if< (
976
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
978
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
980
( ViewTraits<ST,SL,SD,SM>::rank == 8 )
982
( ViewTraits<DT,DL,DD,DM>::rank == 2 )
984
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 2 )
987
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
989
dst.m_management.decrement( dst.m_ptr_on_device );
991
dst.m_management = src.m_management ;
992
dst.m_offset_map.N0 = src.m_offset_map.N6 ;
993
dst.m_offset_map.N1 = src.m_offset_map.N7 ;
994
dst.m_offset_map.SR = dst.m_offset_map.N1 ;
995
dst.m_ptr_on_device = &src(i0,i1,i2,i3,i4,i5,0,0);
997
dst.m_management.increment( dst.m_ptr_on_device );
1000
//------------------------------------
1001
/** \brief Extract Rank-3 array from LayoutRight Rank-4 array. */
1002
template< class DT , class DL , class DD , class DM ,
1003
class ST , class SL , class SD , class SM >
1004
KOKKOS_INLINE_FUNCTION
1005
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1006
const View<ST,SL,SD,SM,Specialize> & src ,
1010
const typename enable_if< (
1011
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1013
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1015
( ViewTraits<ST,SL,SD,SM>::rank == 4 )
1017
( ViewTraits<DT,DL,DD,DM>::rank == 3 )
1019
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 3 )
1022
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1024
dst.m_management.decrement( dst.m_ptr_on_device );
1026
dst.m_management = src.m_management ;
1027
dst.m_offset_map.N0 = src.m_offset_map.N1 ;
1028
dst.m_offset_map.N1 = src.m_offset_map.N2 ;
1029
dst.m_offset_map.N2 = src.m_offset_map.N3 ;
1030
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 ;
1031
dst.m_ptr_on_device = &src(i0,0,0,0);
1033
dst.m_management.increment( dst.m_ptr_on_device );
1036
//------------------------------------
1037
/** \brief Extract Rank-3 array from LayoutRight Rank-5 array. */
1038
template< class DT , class DL , class DD , class DM ,
1039
class ST , class SL , class SD , class SM >
1040
KOKKOS_INLINE_FUNCTION
1041
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1042
const View<ST,SL,SD,SM,Specialize> & src ,
1047
const typename enable_if< (
1048
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1050
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1052
( ViewTraits<ST,SL,SD,SM>::rank == 5 )
1054
( ViewTraits<DT,DL,DD,DM>::rank == 3 )
1056
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 3 )
1059
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1061
dst.m_management.decrement( dst.m_ptr_on_device );
1063
dst.m_management = src.m_management ;
1064
dst.m_offset_map.N0 = src.m_offset_map.N2 ;
1065
dst.m_offset_map.N1 = src.m_offset_map.N3 ;
1066
dst.m_offset_map.N2 = src.m_offset_map.N4 ;
1067
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 ;
1068
dst.m_ptr_on_device = &src(i0,i1,0,0,0);
1070
dst.m_management.increment( dst.m_ptr_on_device );
1073
//------------------------------------
1074
/** \brief Extract Rank-3 array from LayoutRight Rank-6 array. */
1075
template< class DT , class DL , class DD , class DM ,
1076
class ST , class SL , class SD , class SM >
1077
KOKKOS_INLINE_FUNCTION
1078
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1079
const View<ST,SL,SD,SM,Specialize> & src ,
1085
const typename enable_if< (
1086
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1088
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1090
( ViewTraits<ST,SL,SD,SM>::rank == 6 )
1092
( ViewTraits<DT,DL,DD,DM>::rank == 3 )
1094
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 3 )
1097
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1099
dst.m_management.decrement( dst.m_ptr_on_device );
1101
dst.m_management = src.m_management ;
1102
dst.m_offset_map.N0 = src.m_offset_map.N3 ;
1103
dst.m_offset_map.N1 = src.m_offset_map.N4 ;
1104
dst.m_offset_map.N2 = src.m_offset_map.N5 ;
1105
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 ;
1106
dst.m_ptr_on_device = &src(i0,i1,i2,0,0,0);
1108
dst.m_management.increment( dst.m_ptr_on_device );
1111
//------------------------------------
1112
/** \brief Extract Rank-3 array from LayoutRight Rank-7 array. */
1113
template< class DT , class DL , class DD , class DM ,
1114
class ST , class SL , class SD , class SM >
1115
KOKKOS_INLINE_FUNCTION
1116
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1117
const View<ST,SL,SD,SM,Specialize> & src ,
1124
const typename enable_if< (
1125
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1127
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1129
( ViewTraits<ST,SL,SD,SM>::rank == 7 )
1131
( ViewTraits<DT,DL,DD,DM>::rank == 3 )
1133
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 3 )
1136
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1138
dst.m_management.decrement( dst.m_ptr_on_device );
1140
dst.m_management = src.m_management ;
1141
dst.m_offset_map.N0 = src.m_offset_map.N4 ;
1142
dst.m_offset_map.N1 = src.m_offset_map.N5 ;
1143
dst.m_offset_map.N2 = src.m_offset_map.N6 ;
1144
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 ;
1145
dst.m_ptr_on_device = &src(i0,i1,i2,i3,0,0,0);
1147
dst.m_management.increment( dst.m_ptr_on_device );
1150
//------------------------------------
1151
/** \brief Extract Rank-3 array from LayoutRight Rank-8 array. */
1152
template< class DT , class DL , class DD , class DM ,
1153
class ST , class SL , class SD , class SM >
1154
KOKKOS_INLINE_FUNCTION
1155
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1156
const View<ST,SL,SD,SM,Specialize> & src ,
1164
const typename enable_if< (
1165
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1167
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1169
( ViewTraits<ST,SL,SD,SM>::rank == 8 )
1171
( ViewTraits<DT,DL,DD,DM>::rank == 3 )
1173
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 3 )
1176
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1178
dst.m_management.decrement( dst.m_ptr_on_device );
1180
dst.m_management = src.m_management ;
1181
dst.m_offset_map.N0 = src.m_offset_map.N5 ;
1182
dst.m_offset_map.N1 = src.m_offset_map.N6 ;
1183
dst.m_offset_map.N2 = src.m_offset_map.N7 ;
1184
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 ;
1185
dst.m_ptr_on_device = &src(i0,i1,i2,i3,i4,0,0,0);
1187
dst.m_management.increment( dst.m_ptr_on_device );
1190
//------------------------------------
1191
/** \brief Extract Rank-4 array from LayoutRight Rank-5 array. */
1192
template< class DT , class DL , class DD , class DM ,
1193
class ST , class SL , class SD , class SM >
1194
KOKKOS_INLINE_FUNCTION
1195
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1196
const View<ST,SL,SD,SM,Specialize> & src ,
1201
const typename enable_if< (
1202
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1204
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1206
( ViewTraits<ST,SL,SD,SM>::rank == 5 )
1208
( ViewTraits<DT,DL,DD,DM>::rank == 4 )
1210
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 4 )
1213
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1215
dst.m_management.decrement( dst.m_ptr_on_device );
1217
dst.m_management = src.m_management ;
1218
dst.m_offset_map.N0 = src.m_offset_map.N1 ;
1219
dst.m_offset_map.N1 = src.m_offset_map.N2 ;
1220
dst.m_offset_map.N2 = src.m_offset_map.N3 ;
1221
dst.m_offset_map.N3 = src.m_offset_map.N4 ;
1222
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1223
dst.m_offset_map.N3 ;
1224
dst.m_ptr_on_device = &src(i0,0,0,0,0);
1226
dst.m_management.increment( dst.m_ptr_on_device );
1229
//------------------------------------
1230
/** \brief Extract Rank-4 array from LayoutRight Rank-6 array. */
1231
template< class DT , class DL , class DD , class DM ,
1232
class ST , class SL , class SD , class SM >
1233
KOKKOS_INLINE_FUNCTION
1234
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1235
const View<ST,SL,SD,SM,Specialize> & src ,
1241
const typename enable_if< (
1242
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1244
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1246
( ViewTraits<ST,SL,SD,SM>::rank == 6 )
1248
( ViewTraits<DT,DL,DD,DM>::rank == 4 )
1250
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 4 )
1253
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1255
dst.m_management.decrement( dst.m_ptr_on_device );
1257
dst.m_management = src.m_management ;
1258
dst.m_offset_map.N0 = src.m_offset_map.N2 ;
1259
dst.m_offset_map.N1 = src.m_offset_map.N3 ;
1260
dst.m_offset_map.N2 = src.m_offset_map.N4 ;
1261
dst.m_offset_map.N3 = src.m_offset_map.N5 ;
1262
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1263
dst.m_offset_map.N3 ;
1264
dst.m_ptr_on_device = &src(i0,i1,0,0,0,0);
1266
dst.m_management.increment( dst.m_ptr_on_device );
1269
//------------------------------------
1270
/** \brief Extract Rank-4 array from LayoutRight Rank-7 array. */
1271
template< class DT , class DL , class DD , class DM ,
1272
class ST , class SL , class SD , class SM >
1273
KOKKOS_INLINE_FUNCTION
1274
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1275
const View<ST,SL,SD,SM,Specialize> & src ,
1282
const typename enable_if< (
1283
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1285
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1287
( ViewTraits<ST,SL,SD,SM>::rank == 7 )
1289
( ViewTraits<DT,DL,DD,DM>::rank == 4 )
1291
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 4 )
1294
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1296
dst.m_management.decrement( dst.m_ptr_on_device );
1298
dst.m_management = src.m_management ;
1299
dst.m_offset_map.N0 = src.m_offset_map.N3 ;
1300
dst.m_offset_map.N1 = src.m_offset_map.N4 ;
1301
dst.m_offset_map.N2 = src.m_offset_map.N5 ;
1302
dst.m_offset_map.N3 = src.m_offset_map.N6 ;
1303
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1304
dst.m_offset_map.N3 ;
1305
dst.m_ptr_on_device = &src(i0,i1,i2,0,0,0,0);
1307
dst.m_management.increment( dst.m_ptr_on_device );
1310
//------------------------------------
1311
/** \brief Extract Rank-4 array from LayoutRight Rank-8 array. */
1312
template< class DT , class DL , class DD , class DM ,
1313
class ST , class SL , class SD , class SM >
1314
KOKKOS_INLINE_FUNCTION
1315
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1316
const View<ST,SL,SD,SM,Specialize> & src ,
1324
const typename enable_if< (
1325
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1327
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1329
( ViewTraits<ST,SL,SD,SM>::rank == 8 )
1331
( ViewTraits<DT,DL,DD,DM>::rank == 4 )
1333
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 4 )
1336
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1338
dst.m_management.decrement( dst.m_ptr_on_device );
1340
dst.m_management = src.m_management ;
1341
dst.m_offset_map.N0 = src.m_offset_map.N4 ;
1342
dst.m_offset_map.N1 = src.m_offset_map.N5 ;
1343
dst.m_offset_map.N2 = src.m_offset_map.N6 ;
1344
dst.m_offset_map.N3 = src.m_offset_map.N7 ;
1345
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1346
dst.m_offset_map.N3 ;
1347
dst.m_ptr_on_device = &src(i0,i1,i2,i3,0,0,0,0);
1349
dst.m_management.increment( dst.m_ptr_on_device );
1352
//------------------------------------
1353
/** \brief Extract Rank-5 array from LayoutRight Rank-6 array. */
1354
template< class DT , class DL , class DD , class DM ,
1355
class ST , class SL , class SD , class SM >
1356
KOKKOS_INLINE_FUNCTION
1357
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1358
const View<ST,SL,SD,SM,Specialize> & src ,
1364
const typename enable_if< (
1365
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1367
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1369
( ViewTraits<ST,SL,SD,SM>::rank == 6 )
1371
( ViewTraits<DT,DL,DD,DM>::rank == 5 )
1373
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 5 )
1376
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1378
dst.m_management.decrement( dst.m_ptr_on_device );
1380
dst.m_management = src.m_management ;
1381
dst.m_offset_map.N0 = src.m_offset_map.N1 ;
1382
dst.m_offset_map.N1 = src.m_offset_map.N2 ;
1383
dst.m_offset_map.N2 = src.m_offset_map.N3 ;
1384
dst.m_offset_map.N3 = src.m_offset_map.N4 ;
1385
dst.m_offset_map.N4 = src.m_offset_map.N5 ;
1386
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1387
dst.m_offset_map.N3 * dst.m_offset_map.N4 ;
1388
dst.m_ptr_on_device = &src(i0,0,0,0,0,0);
1390
dst.m_management.increment( dst.m_ptr_on_device );
1393
//------------------------------------
1394
/** \brief Extract Rank-5 array from LayoutRight Rank-7 array. */
1395
template< class DT , class DL , class DD , class DM ,
1396
class ST , class SL , class SD , class SM >
1397
KOKKOS_INLINE_FUNCTION
1398
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1399
const View<ST,SL,SD,SM,Specialize> & src ,
1406
const typename enable_if< (
1407
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1409
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1411
( ViewTraits<ST,SL,SD,SM>::rank == 7 )
1413
( ViewTraits<DT,DL,DD,DM>::rank == 5 )
1415
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 5 )
1418
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1420
dst.m_management.decrement( dst.m_ptr_on_device );
1422
dst.m_management = src.m_management ;
1423
dst.m_offset_map.N0 = src.m_offset_map.N2 ;
1424
dst.m_offset_map.N1 = src.m_offset_map.N3 ;
1425
dst.m_offset_map.N2 = src.m_offset_map.N4 ;
1426
dst.m_offset_map.N3 = src.m_offset_map.N5 ;
1427
dst.m_offset_map.N4 = src.m_offset_map.N6 ;
1428
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1429
dst.m_offset_map.N3 * dst.m_offset_map.N4 ;
1430
dst.m_ptr_on_device = &src(i0,i1,0,0,0,0,0);
1432
dst.m_management.increment( dst.m_ptr_on_device );
1435
//------------------------------------
1436
/** \brief Extract Rank-5 array from LayoutRight Rank-8 array. */
1437
template< class DT , class DL , class DD , class DM ,
1438
class ST , class SL , class SD , class SM >
1439
KOKKOS_INLINE_FUNCTION
1440
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1441
const View<ST,SL,SD,SM,Specialize> & src ,
1449
const typename enable_if< (
1450
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1452
is_same< typename ViewTraits<ST,SL,SD,SM>::array_layout , LayoutRight >::value
1454
( ViewTraits<ST,SL,SD,SM>::rank == 8 )
1456
( ViewTraits<DT,DL,DD,DM>::rank == 5 )
1458
( ViewTraits<DT,DL,DD,DM>::rank_dynamic == 5 )
1461
//typedef ViewTraits<DT,DL,DD,DM> traits_type ; // unused
1463
dst.m_management.decrement( dst.m_ptr_on_device );
1465
dst.m_management = src.m_management ;
1466
dst.m_offset_map.N0 = src.m_offset_map.N3 ;
1467
dst.m_offset_map.N1 = src.m_offset_map.N4 ;
1468
dst.m_offset_map.N2 = src.m_offset_map.N5 ;
1469
dst.m_offset_map.N3 = src.m_offset_map.N6 ;
1470
dst.m_offset_map.N4 = src.m_offset_map.N7 ;
1471
dst.m_offset_map.SR = dst.m_offset_map.N1 * dst.m_offset_map.N2 *
1472
dst.m_offset_map.N3 * dst.m_offset_map.N4 ;
1473
dst.m_ptr_on_device = &src(i0,i1,i2,0,0,0,0,0);
1475
dst.m_management.increment( dst.m_ptr_on_device );
1478
//------------------------------------
1480
template< class DT , class DL , class DD , class DM
1481
, class ST , class SL , class SD , class SM
1484
KOKKOS_INLINE_FUNCTION
1485
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1486
const View<ST,SL,SD,SM,Specialize> & src ,
1487
const Type0 & arg0 ,
1488
const typename enable_if< (
1489
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1491
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1493
( ViewTraits<ST,SL,SD,SM>::rank == 1 )
1495
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1496
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) )
1499
enum { src_rank = 1 };
1501
size_t str[2] = {0,0};
1503
src.m_offset_map.stride( str );
1505
const size_t offset = ViewOffsetRange< Type0 >::begin( arg0 ) * str[0] ;
1509
// Collapse dimension for non-ranges
1510
if ( ViewOffsetRange< Type0 >::is_range ) {
1511
spec.dimension[0] = ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 );
1512
spec.stride[0] = str[0] ;
1515
spec.dimension[0] = 1 ;
1516
spec.stride[0] = 1 ;
1519
dst.m_management.decrement( dst.m_ptr_on_device );
1520
dst.m_management = src.m_management ;
1521
dst.m_offset_map.assign( spec );
1522
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1523
dst.m_management.increment( dst.m_ptr_on_device );
1526
template< class DT , class DL , class DD , class DM
1527
, class ST , class SL , class SD , class SM
1531
KOKKOS_INLINE_FUNCTION
1532
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1533
const View<ST,SL,SD,SM,Specialize> & src ,
1534
const Type0 & arg0 ,
1535
const Type1 & arg1 ,
1536
const typename enable_if< (
1537
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1539
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1541
( ViewTraits<ST,SL,SD,SM>::rank == 2 )
1543
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1544
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
1545
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) )
1548
enum { src_rank = 2 };
1550
const bool is_range[ src_rank ] =
1551
{ ViewOffsetRange< Type0 >::is_range
1552
, ViewOffsetRange< Type1 >::is_range
1555
const unsigned begin[ src_rank ] =
1556
{ static_cast<unsigned>(ViewOffsetRange< Type0 >::begin( arg0 ))
1557
, static_cast<unsigned>(ViewOffsetRange< Type1 >::begin( arg1 ))
1562
src.m_offset_map.stride( stride );
1566
spec.dimension[0] = ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 );
1567
spec.dimension[1] = ViewOffsetRange< Type1 >::dimension( src.m_offset_map.N1 , arg1 );
1568
spec.stride[0] = stride[0] ;
1569
spec.stride[1] = stride[1] ;
1573
// Collapse dimension for non-ranges
1574
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
1575
spec.dimension[j] = spec.dimension[i] ;
1576
spec.stride[j] = spec.stride[i] ;
1577
offset += begin[i] * spec.stride[i] ;
1578
if ( is_range[i] ) { ++j ; }
1581
dst.m_management.decrement( dst.m_ptr_on_device );
1582
dst.m_management = src.m_management ;
1583
dst.m_offset_map.assign( spec );
1584
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1585
dst.m_management.increment( dst.m_ptr_on_device );
1588
template< class DT , class DL , class DD , class DM
1589
, class ST , class SL , class SD , class SM
1594
KOKKOS_INLINE_FUNCTION
1595
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1596
const View<ST,SL,SD,SM,Specialize> & src ,
1597
const Type0 & arg0 ,
1598
const Type1 & arg1 ,
1599
const Type2 & arg2 ,
1600
const typename enable_if< (
1601
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1603
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1605
( ViewTraits<ST,SL,SD,SM>::rank == 3 )
1607
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1608
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
1609
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) +
1610
( ViewOffsetRange< Type2 >::is_range ? 1u : 0 ) )
1613
enum { src_rank = 3 };
1615
const bool is_range[ src_rank ] =
1616
{ ViewOffsetRange< Type0 >::is_range
1617
, ViewOffsetRange< Type1 >::is_range
1618
, ViewOffsetRange< Type2 >::is_range
1621
// FIXME (mfh 26 Oct 2014) Should use size_type typedef here
1622
// instead of unsigned. If we did that, the static_casts would be
1624
const unsigned begin[ src_rank ] = {
1625
static_cast<unsigned> (ViewOffsetRange< Type0 >::begin (arg0))
1626
, static_cast<unsigned> (ViewOffsetRange< Type1 >::begin (arg1))
1627
, static_cast<unsigned> (ViewOffsetRange< Type2 >::begin (arg2))
1630
// FIXME (mfh 26 Oct 2014) Should use size_type typedef here
1631
// instead of unsigned. If we did that, the static_casts would be
1633
unsigned dim[ src_rank ] = {
1634
static_cast<unsigned> (ViewOffsetRange< Type0 >::dimension (src.m_offset_map.N0, arg0))
1635
, static_cast<unsigned> (ViewOffsetRange< Type1 >::dimension (src.m_offset_map.N1, arg1))
1636
, static_cast<unsigned> (ViewOffsetRange< Type2 >::dimension (src.m_offset_map.N2, arg2))
1639
size_t stride[9] = {0,0,0,0,0,0,0,0,0};
1641
src.m_offset_map.stride( stride );
1647
// Collapse dimension for non-ranges
1648
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
1649
spec.dimension[j] = dim[i] ;
1650
spec.stride[j] = stride[i] ;
1651
offset += begin[i] * stride[i] ;
1652
if ( is_range[i] ) { ++j ; }
1655
dst.m_management.decrement( dst.m_ptr_on_device );
1656
dst.m_management = src.m_management ;
1657
dst.m_offset_map.assign( spec );
1658
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1659
dst.m_management.increment( dst.m_ptr_on_device );
1662
template< class DT , class DL , class DD , class DM
1663
, class ST , class SL , class SD , class SM
1669
KOKKOS_INLINE_FUNCTION
1670
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1671
const View<ST,SL,SD,SM,Specialize> & src ,
1672
const Type0 & arg0 ,
1673
const Type1 & arg1 ,
1674
const Type2 & arg2 ,
1675
const Type3 & arg3 ,
1676
const typename enable_if< (
1677
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1679
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1681
( ViewTraits<ST,SL,SD,SM>::rank == 4 )
1683
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1684
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
1685
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) +
1686
( ViewOffsetRange< Type2 >::is_range ? 1u : 0 ) +
1687
( ViewOffsetRange< Type3 >::is_range ? 1u : 0 ) )
1690
enum { src_rank = 4 };
1691
const bool is_range[ src_rank ] =
1692
{ ViewOffsetRange< Type0 >::is_range
1693
, ViewOffsetRange< Type1 >::is_range
1694
, ViewOffsetRange< Type2 >::is_range
1695
, ViewOffsetRange< Type3 >::is_range
1698
const unsigned begin[ src_rank ] =
1699
{ static_cast<unsigned>(ViewOffsetRange< Type0 >::begin( arg0 ))
1700
, static_cast<unsigned>(ViewOffsetRange< Type1 >::begin( arg1 ))
1701
, static_cast<unsigned>(ViewOffsetRange< Type2 >::begin( arg2 ))
1702
, static_cast<unsigned>(ViewOffsetRange< Type3 >::begin( arg3 ))
1705
unsigned dim[ src_rank ] =
1706
{ static_cast<unsigned>(ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 ))
1707
, static_cast<unsigned>(ViewOffsetRange< Type1 >::dimension( src.m_offset_map.N1 , arg1 ))
1708
, static_cast<unsigned>(ViewOffsetRange< Type2 >::dimension( src.m_offset_map.N2 , arg2 ))
1709
, static_cast<unsigned>(ViewOffsetRange< Type3 >::dimension( src.m_offset_map.N3 , arg3 ))
1712
size_t stride[9] = {0,0,0,0,0,0,0,0,0};
1714
src.m_offset_map.stride( stride );
1720
// Collapse dimension for non-ranges
1721
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
1722
spec.dimension[j] = dim[i] ;
1723
spec.stride[j] = stride[i] ;
1724
offset += begin[i] * stride[i] ;
1725
if ( is_range[i] ) { ++j ; }
1728
dst.m_management.decrement( dst.m_ptr_on_device );
1729
dst.m_management = src.m_management ;
1730
dst.m_offset_map.assign( spec );
1731
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1732
dst.m_management.increment( dst.m_ptr_on_device );
1735
template< class DT , class DL , class DD , class DM
1736
, class ST , class SL , class SD , class SM
1743
KOKKOS_INLINE_FUNCTION
1744
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1745
const View<ST,SL,SD,SM,Specialize> & src ,
1746
const Type0 & arg0 ,
1747
const Type1 & arg1 ,
1748
const Type2 & arg2 ,
1749
const Type3 & arg3 ,
1750
const Type4 & arg4 ,
1751
const typename enable_if< (
1752
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1754
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1756
( ViewTraits<ST,SL,SD,SM>::rank == 5 )
1758
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1759
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
1760
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) +
1761
( ViewOffsetRange< Type2 >::is_range ? 1u : 0 ) +
1762
( ViewOffsetRange< Type3 >::is_range ? 1u : 0 ) +
1763
( ViewOffsetRange< Type4 >::is_range ? 1u : 0 ) )
1766
enum { src_rank = 5 };
1767
const bool is_range[ src_rank ] =
1768
{ ViewOffsetRange< Type0 >::is_range
1769
, ViewOffsetRange< Type1 >::is_range
1770
, ViewOffsetRange< Type2 >::is_range
1771
, ViewOffsetRange< Type3 >::is_range
1772
, ViewOffsetRange< Type4 >::is_range
1775
const unsigned begin[ src_rank ] =
1776
{ ViewOffsetRange< Type0 >::begin( arg0 )
1777
, ViewOffsetRange< Type1 >::begin( arg1 )
1778
, ViewOffsetRange< Type2 >::begin( arg2 )
1779
, ViewOffsetRange< Type3 >::begin( arg3 )
1780
, ViewOffsetRange< Type4 >::begin( arg4 )
1783
unsigned dim[ src_rank ] =
1784
{ ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 )
1785
, ViewOffsetRange< Type1 >::dimension( src.m_offset_map.N1 , arg1 )
1786
, ViewOffsetRange< Type2 >::dimension( src.m_offset_map.N2 , arg2 )
1787
, ViewOffsetRange< Type3 >::dimension( src.m_offset_map.N3 , arg3 )
1788
, ViewOffsetRange< Type4 >::dimension( src.m_offset_map.N4 , arg4 )
1791
size_t stride[9] = {0,0,0,0,0,0,0,0,0};
1793
src.m_offset_map.stride( stride );
1799
// Collapse dimension for non-ranges
1800
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
1801
spec.dimension[j] = dim[i] ;
1802
spec.stride[j] = stride[i] ;
1803
offset += begin[i] * stride[i] ;
1804
if ( is_range[i] ) { ++j ; }
1807
dst.m_management.decrement( dst.m_ptr_on_device );
1808
dst.m_management = src.m_management ;
1809
dst.m_offset_map.assign( spec );
1810
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1811
dst.m_management.increment( dst.m_ptr_on_device );
1814
template< class DT , class DL , class DD , class DM
1815
, class ST , class SL , class SD , class SM
1823
KOKKOS_INLINE_FUNCTION
1824
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1825
const View<ST,SL,SD,SM,Specialize> & src ,
1826
const Type0 & arg0 ,
1827
const Type1 & arg1 ,
1828
const Type2 & arg2 ,
1829
const Type3 & arg3 ,
1830
const Type4 & arg4 ,
1831
const Type5 & arg5 ,
1832
const typename enable_if< (
1833
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1835
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1837
( ViewTraits<ST,SL,SD,SM>::rank == 6 )
1839
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1840
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
1841
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) +
1842
( ViewOffsetRange< Type2 >::is_range ? 1u : 0 ) +
1843
( ViewOffsetRange< Type3 >::is_range ? 1u : 0 ) +
1844
( ViewOffsetRange< Type4 >::is_range ? 1u : 0 ) +
1845
( ViewOffsetRange< Type5 >::is_range ? 1u : 0 ) )
1848
enum { src_rank = 6 };
1849
const bool is_range[ src_rank ] =
1850
{ ViewOffsetRange< Type0 >::is_range
1851
, ViewOffsetRange< Type1 >::is_range
1852
, ViewOffsetRange< Type2 >::is_range
1853
, ViewOffsetRange< Type3 >::is_range
1854
, ViewOffsetRange< Type4 >::is_range
1855
, ViewOffsetRange< Type5 >::is_range
1858
const unsigned begin[ src_rank ] =
1859
{ ViewOffsetRange< Type0 >::begin( arg0 )
1860
, ViewOffsetRange< Type1 >::begin( arg1 )
1861
, ViewOffsetRange< Type2 >::begin( arg2 )
1862
, ViewOffsetRange< Type3 >::begin( arg3 )
1863
, ViewOffsetRange< Type4 >::begin( arg4 )
1864
, ViewOffsetRange< Type5 >::begin( arg5 )
1867
unsigned dim[ src_rank ] =
1868
{ ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 )
1869
, ViewOffsetRange< Type1 >::dimension( src.m_offset_map.N1 , arg1 )
1870
, ViewOffsetRange< Type2 >::dimension( src.m_offset_map.N2 , arg2 )
1871
, ViewOffsetRange< Type3 >::dimension( src.m_offset_map.N3 , arg3 )
1872
, ViewOffsetRange< Type4 >::dimension( src.m_offset_map.N4 , arg4 )
1873
, ViewOffsetRange< Type5 >::dimension( src.m_offset_map.N5 , arg5 )
1876
size_t stride[9] = {0,0,0,0,0,0,0,0,0};
1878
src.m_offset_map.stride( stride );
1884
// Collapse dimension for non-ranges
1885
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
1886
spec.dimension[j] = dim[i] ;
1887
spec.stride[j] = stride[i] ;
1888
offset += begin[i] * stride[i] ;
1889
if ( is_range[i] ) { ++j ; }
1892
dst.m_management.decrement( dst.m_ptr_on_device );
1893
dst.m_management = src.m_management ;
1894
dst.m_offset_map.assign( spec );
1895
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1896
dst.m_management.increment( dst.m_ptr_on_device );
1899
template< class DT , class DL , class DD , class DM
1900
, class ST , class SL , class SD , class SM
1909
KOKKOS_INLINE_FUNCTION
1910
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
1911
const View<ST,SL,SD,SM,Specialize> & src ,
1912
const Type0 & arg0 ,
1913
const Type1 & arg1 ,
1914
const Type2 & arg2 ,
1915
const Type3 & arg3 ,
1916
const Type4 & arg4 ,
1917
const Type5 & arg5 ,
1918
const Type6 & arg6 ,
1919
const typename enable_if< (
1920
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
1922
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
1924
( ViewTraits<ST,SL,SD,SM>::rank == 7 )
1926
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
1927
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
1928
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) +
1929
( ViewOffsetRange< Type2 >::is_range ? 1u : 0 ) +
1930
( ViewOffsetRange< Type3 >::is_range ? 1u : 0 ) +
1931
( ViewOffsetRange< Type4 >::is_range ? 1u : 0 ) +
1932
( ViewOffsetRange< Type5 >::is_range ? 1u : 0 ) +
1933
( ViewOffsetRange< Type6 >::is_range ? 1u : 0 ) )
1936
enum { src_rank = 7 };
1937
const bool is_range[ src_rank ] =
1938
{ ViewOffsetRange< Type0 >::is_range
1939
, ViewOffsetRange< Type1 >::is_range
1940
, ViewOffsetRange< Type2 >::is_range
1941
, ViewOffsetRange< Type3 >::is_range
1942
, ViewOffsetRange< Type4 >::is_range
1943
, ViewOffsetRange< Type5 >::is_range
1944
, ViewOffsetRange< Type6 >::is_range
1947
const unsigned begin[ src_rank ] =
1948
{ ViewOffsetRange< Type0 >::begin( arg0 )
1949
, ViewOffsetRange< Type1 >::begin( arg1 )
1950
, ViewOffsetRange< Type2 >::begin( arg2 )
1951
, ViewOffsetRange< Type3 >::begin( arg3 )
1952
, ViewOffsetRange< Type4 >::begin( arg4 )
1953
, ViewOffsetRange< Type5 >::begin( arg5 )
1954
, ViewOffsetRange< Type6 >::begin( arg6 )
1957
unsigned dim[ src_rank ] =
1958
{ ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 )
1959
, ViewOffsetRange< Type1 >::dimension( src.m_offset_map.N1 , arg1 )
1960
, ViewOffsetRange< Type2 >::dimension( src.m_offset_map.N2 , arg2 )
1961
, ViewOffsetRange< Type3 >::dimension( src.m_offset_map.N3 , arg3 )
1962
, ViewOffsetRange< Type4 >::dimension( src.m_offset_map.N4 , arg4 )
1963
, ViewOffsetRange< Type5 >::dimension( src.m_offset_map.N5 , arg5 )
1964
, ViewOffsetRange< Type6 >::dimension( src.m_offset_map.N6 , arg6 )
1967
size_t stride[9] = {0,0,0,0,0,0,0,0,0};
1969
src.m_offset_map.stride( stride );
1975
// Collapse dimension for non-ranges
1976
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
1977
spec.dimension[j] = dim[i] ;
1978
spec.stride[j] = stride[i] ;
1979
offset += begin[i] * stride[i] ;
1980
if ( is_range[i] ) { ++j ; }
1983
dst.m_management.decrement( dst.m_ptr_on_device );
1984
dst.m_management = src.m_management ;
1985
dst.m_offset_map.assign( spec );
1986
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
1987
dst.m_management.increment( dst.m_ptr_on_device );
1990
template< class DT , class DL , class DD , class DM
1991
, class ST , class SL , class SD , class SM
2001
KOKKOS_INLINE_FUNCTION
2002
ViewAssignment( View<DT,DL,DD,DM,Specialize> & dst ,
2003
const View<ST,SL,SD,SM,Specialize> & src ,
2004
const Type0 & arg0 ,
2005
const Type1 & arg1 ,
2006
const Type2 & arg2 ,
2007
const Type3 & arg3 ,
2008
const Type4 & arg4 ,
2009
const Type5 & arg5 ,
2010
const Type6 & arg6 ,
2011
const Type7 & arg7 ,
2012
const typename enable_if< (
2013
ViewAssignable< ViewTraits<DT,DL,DD,DM> , ViewTraits<ST,SL,SD,SM> >::assignable_value
2015
is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout , LayoutStride >::value
2017
( ViewTraits<ST,SL,SD,SM>::rank == 8 )
2019
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) ==
2020
( ViewOffsetRange< Type0 >::is_range ? 1u : 0 ) +
2021
( ViewOffsetRange< Type1 >::is_range ? 1u : 0 ) +
2022
( ViewOffsetRange< Type2 >::is_range ? 1u : 0 ) +
2023
( ViewOffsetRange< Type3 >::is_range ? 1u : 0 ) +
2024
( ViewOffsetRange< Type4 >::is_range ? 1u : 0 ) +
2025
( ViewOffsetRange< Type5 >::is_range ? 1u : 0 ) +
2026
( ViewOffsetRange< Type6 >::is_range ? 1u : 0 ) +
2027
( ViewOffsetRange< Type7 >::is_range ? 1u : 0 ) )
2030
enum { src_rank = 8 };
2032
const bool is_range[ src_rank ] =
2033
{ ViewOffsetRange< Type0 >::is_range
2034
, ViewOffsetRange< Type1 >::is_range
2035
, ViewOffsetRange< Type2 >::is_range
2036
, ViewOffsetRange< Type3 >::is_range
2037
, ViewOffsetRange< Type4 >::is_range
2038
, ViewOffsetRange< Type5 >::is_range
2039
, ViewOffsetRange< Type6 >::is_range
2040
, ViewOffsetRange< Type7 >::is_range
2043
const unsigned begin[ src_rank ] =
2044
{ ViewOffsetRange< Type0 >::begin( arg0 )
2045
, ViewOffsetRange< Type1 >::begin( arg1 )
2046
, ViewOffsetRange< Type2 >::begin( arg2 )
2047
, ViewOffsetRange< Type3 >::begin( arg3 )
2048
, ViewOffsetRange< Type4 >::begin( arg4 )
2049
, ViewOffsetRange< Type5 >::begin( arg5 )
2050
, ViewOffsetRange< Type6 >::begin( arg6 )
2051
, ViewOffsetRange< Type7 >::begin( arg7 )
2054
unsigned dim[ src_rank ] =
2055
{ ViewOffsetRange< Type0 >::dimension( src.m_offset_map.N0 , arg0 )
2056
, ViewOffsetRange< Type1 >::dimension( src.m_offset_map.N1 , arg1 )
2057
, ViewOffsetRange< Type2 >::dimension( src.m_offset_map.N2 , arg2 )
2058
, ViewOffsetRange< Type3 >::dimension( src.m_offset_map.N3 , arg3 )
2059
, ViewOffsetRange< Type4 >::dimension( src.m_offset_map.N4 , arg4 )
2060
, ViewOffsetRange< Type5 >::dimension( src.m_offset_map.N5 , arg5 )
2061
, ViewOffsetRange< Type6 >::dimension( src.m_offset_map.N6 , arg6 )
2062
, ViewOffsetRange< Type7 >::dimension( src.m_offset_map.N7 , arg7 )
2065
size_t stride[9] = {0,0,0,0,0,0,0,0,0};
2067
src.m_offset_map.stride( stride );
2073
// Collapse dimension for non-ranges
2074
for ( int i = 0 , j = 0 ; i < int(src_rank) ; ++i ) {
2075
spec.dimension[j] = dim[i] ;
2076
spec.stride[j] = stride[i] ;
2077
offset += begin[i] * stride[i] ;
2078
if ( is_range[i] ) { ++j ; }
2081
dst.m_management.decrement( dst.m_ptr_on_device );
2083
dst.m_management = src.m_management ;
2085
dst.m_offset_map.assign( spec );
2087
dst.m_ptr_on_device = src.ptr_on_device() + offset ;
2089
dst.m_management.increment( dst.m_ptr_on_device );
2092
//------------------------------------
2093
/** \brief Deep copy data from compatible value type, layout, rank, and specialization.
2094
* Check the dimensions and allocation lengths at runtime.
2096
template< class DT , class DL , class DD , class DM ,
2097
class ST , class SL , class SD , class SM >
2099
void deep_copy( const View<DT,DL,DD,DM,Specialize> & dst ,
2100
const View<ST,SL,SD,SM,Specialize> & src ,
2101
const typename Impl::enable_if<(
2102
Impl::is_same< typename ViewTraits<DT,DL,DD,DM>::value_type ,
2103
typename ViewTraits<ST,SL,SD,SM>::non_const_value_type >::value
2105
Impl::is_same< typename ViewTraits<DT,DL,DD,DM>::array_layout ,
2106
typename ViewTraits<ST,SL,SD,SM>::array_layout >::value
2108
( unsigned(ViewTraits<DT,DL,DD,DM>::rank) == unsigned(ViewTraits<ST,SL,SD,SM>::rank) )
2111
typedef typename ViewTraits<DT,DL,DD,DM>::memory_space dst_memory_space ;
2112
typedef typename ViewTraits<ST,SL,SD,SM>::memory_space src_memory_space ;
2114
if ( dst.ptr_on_device() != src.ptr_on_device() ) {
2116
Impl::assert_shapes_are_equal( dst.m_offset_map , src.m_offset_map );
2118
const size_t nbytes = dst.m_offset_map.scalar_size * dst.m_offset_map.capacity();
2120
DeepCopy< dst_memory_space , src_memory_space >( dst.ptr_on_device() , src.ptr_on_device() , nbytes );
2125
} /* namespace Impl */
2126
} /* namespace Kokkos */
2128
//----------------------------------------------------------------------------
2129
//----------------------------------------------------------------------------
2134
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2135
, class SubArg0_type , class SubArg1_type , class SubArg2_type , class SubArg3_type
2136
, class SubArg4_type , class SubArg5_type , class SubArg6_type , class SubArg7_type
2138
struct ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2139
, SubArg0_type , SubArg1_type , SubArg2_type , SubArg3_type
2140
, SubArg4_type , SubArg5_type , SubArg6_type , SubArg7_type >
2144
typedef View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > SrcViewType ;
2146
enum { V0 = Impl::is_same< SubArg0_type , void >::value ? 1 : 0 };
2147
enum { V1 = Impl::is_same< SubArg1_type , void >::value ? 1 : 0 };
2148
enum { V2 = Impl::is_same< SubArg2_type , void >::value ? 1 : 0 };
2149
enum { V3 = Impl::is_same< SubArg3_type , void >::value ? 1 : 0 };
2150
enum { V4 = Impl::is_same< SubArg4_type , void >::value ? 1 : 0 };
2151
enum { V5 = Impl::is_same< SubArg5_type , void >::value ? 1 : 0 };
2152
enum { V6 = Impl::is_same< SubArg6_type , void >::value ? 1 : 0 };
2153
enum { V7 = Impl::is_same< SubArg7_type , void >::value ? 1 : 0 };
2155
// The source view rank must be equal to the input argument rank
2156
// Once a void argument is encountered all subsequent arguments must be void.
2158
Impl::StaticAssert<( SrcViewType::rank ==
2166
V7 ? 7 : 8 ))))))) ))
2168
( SrcViewType::rank ==
2169
( 8 - ( V0 + V1 + V2 + V3 + V4 + V5 + V6 + V7 ) ) )
2170
>::value ? SrcViewType::rank : 0 };
2172
enum { R0 = Impl::ViewOffsetRange< SubArg0_type >::is_range ? 1 : 0 };
2173
enum { R1 = Impl::ViewOffsetRange< SubArg1_type >::is_range ? 1 : 0 };
2174
enum { R2 = Impl::ViewOffsetRange< SubArg2_type >::is_range ? 1 : 0 };
2175
enum { R3 = Impl::ViewOffsetRange< SubArg3_type >::is_range ? 1 : 0 };
2176
enum { R4 = Impl::ViewOffsetRange< SubArg4_type >::is_range ? 1 : 0 };
2177
enum { R5 = Impl::ViewOffsetRange< SubArg5_type >::is_range ? 1 : 0 };
2178
enum { R6 = Impl::ViewOffsetRange< SubArg6_type >::is_range ? 1 : 0 };
2179
enum { R7 = Impl::ViewOffsetRange< SubArg7_type >::is_range ? 1 : 0 };
2181
enum { OutputRank = unsigned(R0) + unsigned(R1) + unsigned(R2) + unsigned(R3)
2182
+ unsigned(R4) + unsigned(R5) + unsigned(R6) + unsigned(R7) };
2185
enum { R0_rev = 0 == InputRank ? 0u : (
2186
1 == InputRank ? unsigned(R0) : (
2187
2 == InputRank ? unsigned(R1) : (
2188
3 == InputRank ? unsigned(R2) : (
2189
4 == InputRank ? unsigned(R3) : (
2190
5 == InputRank ? unsigned(R4) : (
2191
6 == InputRank ? unsigned(R5) : (
2192
7 == InputRank ? unsigned(R6) : unsigned(R7) ))))))) };
2194
typedef typename SrcViewType::array_layout SrcViewLayout ;
2196
// Choose array layout, attempting to preserve original layout if at all possible.
2197
typedef typename Impl::if_c<
2202
// OutputRank 1 or 2, InputLayout Left, Interval 0
2203
// because single stride one or second index has a stride.
2204
( OutputRank <= 2 && R0 && Impl::is_same<SrcViewLayout,LayoutLeft>::value )
2206
// OutputRank 1 or 2, InputLayout Right, Interval [InputRank-1]
2207
// because single stride one or second index has a stride.
2208
( OutputRank <= 2 && R0_rev && Impl::is_same<SrcViewLayout,LayoutRight>::value )
2209
), SrcViewLayout , Kokkos::LayoutStride >::type OutputViewLayout ;
2211
// Choose data type as a purely dynamic rank array to accomodate a runtime range.
2212
typedef typename Impl::if_c< OutputRank == 0 , typename SrcViewType::value_type ,
2213
typename Impl::if_c< OutputRank == 1 , typename SrcViewType::value_type *,
2214
typename Impl::if_c< OutputRank == 2 , typename SrcViewType::value_type **,
2215
typename Impl::if_c< OutputRank == 3 , typename SrcViewType::value_type ***,
2216
typename Impl::if_c< OutputRank == 4 , typename SrcViewType::value_type ****,
2217
typename Impl::if_c< OutputRank == 5 , typename SrcViewType::value_type *****,
2218
typename Impl::if_c< OutputRank == 6 , typename SrcViewType::value_type ******,
2219
typename Impl::if_c< OutputRank == 7 , typename SrcViewType::value_type *******,
2220
typename SrcViewType::value_type ********
2221
>::type >::type >::type >::type >::type >::type >::type >::type OutputData ;
2224
// If the source view's template arg1 or arg2 is a space then use it,
2225
// otherwise use the source view's execution space.
2227
typedef typename Impl::if_c< Impl::is_space< SrcArg1Type >::value , SrcArg1Type ,
2228
typename Impl::if_c< Impl::is_space< SrcArg2Type >::value , SrcArg2Type , typename SrcViewType::execution_space
2229
>::type >::type OutputSpace ;
2233
// If keeping the layout then match non-data type arguments
2234
// else keep execution space and memory traits.
2236
Impl::if_c< Impl::is_same< SrcViewLayout , OutputViewLayout >::value
2237
, Kokkos::View< OutputData , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2238
, Kokkos::View< OutputData , OutputViewLayout , OutputSpace
2239
, typename SrcViewType::memory_traits
2240
, Impl::ViewDefault >
2244
} /* namespace Impl */
2245
} /* namespace Kokkos */
2247
//----------------------------------------------------------------------------
2248
//----------------------------------------------------------------------------
2252
// Construct subview of a Rank 8 view
2253
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2254
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2255
, class SubArg0_type , class SubArg1_type , class SubArg2_type , class SubArg3_type
2256
, class SubArg4_type , class SubArg5_type , class SubArg6_type , class SubArg7_type
2258
KOKKOS_INLINE_FUNCTION
2259
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2260
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2261
, const SubArg0_type & arg0
2262
, const SubArg1_type & arg1
2263
, const SubArg2_type & arg2
2264
, const SubArg3_type & arg3
2265
, const SubArg4_type & arg4
2266
, const SubArg5_type & arg5
2267
, const SubArg6_type & arg6
2268
, const SubArg7_type & arg7
2270
: m_ptr_on_device( (typename traits::value_type*) NULL)
2274
// This constructor can only be used to construct a subview
2275
// from the source view. This type must match the subview type
2276
// deduced from the source view and subview arguments.
2278
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2279
, SubArg0_type , SubArg1_type , SubArg2_type , SubArg3_type
2280
, SubArg4_type , SubArg5_type , SubArg6_type , SubArg7_type >
2281
ViewSubviewDeduction ;
2283
enum { is_a_valid_subview_constructor =
2285
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2289
if ( is_a_valid_subview_constructor ) {
2291
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2292
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2293
typedef Impl::ViewOffsetRange< SubArg2_type > R2 ;
2294
typedef Impl::ViewOffsetRange< SubArg3_type > R3 ;
2295
typedef Impl::ViewOffsetRange< SubArg4_type > R4 ;
2296
typedef Impl::ViewOffsetRange< SubArg5_type > R5 ;
2297
typedef Impl::ViewOffsetRange< SubArg6_type > R6 ;
2298
typedef Impl::ViewOffsetRange< SubArg7_type > R7 ;
2300
// 'assign_subview' returns whether the subview offset_map
2301
// introduces noncontiguity in the view.
2302
const bool introduce_noncontiguity =
2303
m_offset_map.assign_subview( src.m_offset_map
2304
, R0::dimension( src.m_offset_map.N0 , arg0 )
2305
, R1::dimension( src.m_offset_map.N1 , arg1 )
2306
, R2::dimension( src.m_offset_map.N2 , arg2 )
2307
, R3::dimension( src.m_offset_map.N3 , arg3 )
2308
, R4::dimension( src.m_offset_map.N4 , arg4 )
2309
, R5::dimension( src.m_offset_map.N5 , arg5 )
2310
, R6::dimension( src.m_offset_map.N6 , arg6 )
2311
, R7::dimension( src.m_offset_map.N7 , arg7 )
2314
if ( m_offset_map.capacity() ) {
2316
m_management = src.m_management ;
2318
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2320
m_ptr_on_device = src.m_ptr_on_device +
2321
src.m_offset_map( R0::begin( arg0 )
2328
, R7::begin( arg7 ) );
2329
m_management.increment( m_ptr_on_device );
2334
// Construct subview of a Rank 7 view
2335
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2336
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2337
, class SubArg0_type , class SubArg1_type , class SubArg2_type , class SubArg3_type
2338
, class SubArg4_type , class SubArg5_type , class SubArg6_type
2340
KOKKOS_INLINE_FUNCTION
2341
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2342
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2343
, const SubArg0_type & arg0
2344
, const SubArg1_type & arg1
2345
, const SubArg2_type & arg2
2346
, const SubArg3_type & arg3
2347
, const SubArg4_type & arg4
2348
, const SubArg5_type & arg5
2349
, const SubArg6_type & arg6
2351
: m_ptr_on_device( (typename traits::value_type*) NULL)
2355
// This constructor can only be used to construct a subview
2356
// from the source view. This type must match the subview type
2357
// deduced from the source view and subview arguments.
2359
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2360
, SubArg0_type , SubArg1_type , SubArg2_type , SubArg3_type
2361
, SubArg4_type , SubArg5_type , SubArg6_type , void >
2362
ViewSubviewDeduction ;
2364
enum { is_a_valid_subview_constructor =
2366
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2370
if ( is_a_valid_subview_constructor ) {
2372
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2373
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2374
typedef Impl::ViewOffsetRange< SubArg2_type > R2 ;
2375
typedef Impl::ViewOffsetRange< SubArg3_type > R3 ;
2376
typedef Impl::ViewOffsetRange< SubArg4_type > R4 ;
2377
typedef Impl::ViewOffsetRange< SubArg5_type > R5 ;
2378
typedef Impl::ViewOffsetRange< SubArg6_type > R6 ;
2380
// 'assign_subview' returns whether the subview offset_map
2381
// introduces noncontiguity in the view.
2382
const bool introduce_noncontiguity =
2383
m_offset_map.assign_subview( src.m_offset_map
2384
, R0::dimension( src.m_offset_map.N0 , arg0 )
2385
, R1::dimension( src.m_offset_map.N1 , arg1 )
2386
, R2::dimension( src.m_offset_map.N2 , arg2 )
2387
, R3::dimension( src.m_offset_map.N3 , arg3 )
2388
, R4::dimension( src.m_offset_map.N4 , arg4 )
2389
, R5::dimension( src.m_offset_map.N5 , arg5 )
2390
, R6::dimension( src.m_offset_map.N6 , arg6 )
2394
if ( m_offset_map.capacity() ) {
2396
m_management = src.m_management ;
2398
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2400
m_ptr_on_device = src.m_ptr_on_device +
2401
src.m_offset_map( R0::begin( arg0 )
2409
m_management.increment( m_ptr_on_device );
2414
// Construct subview of a Rank 6 view
2415
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2416
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2417
, class SubArg0_type , class SubArg1_type , class SubArg2_type , class SubArg3_type
2418
, class SubArg4_type , class SubArg5_type
2420
KOKKOS_INLINE_FUNCTION
2421
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2422
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2423
, const SubArg0_type & arg0
2424
, const SubArg1_type & arg1
2425
, const SubArg2_type & arg2
2426
, const SubArg3_type & arg3
2427
, const SubArg4_type & arg4
2428
, const SubArg5_type & arg5
2430
: m_ptr_on_device( (typename traits::value_type*) NULL)
2434
// This constructor can only be used to construct a subview
2435
// from the source view. This type must match the subview type
2436
// deduced from the source view and subview arguments.
2438
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2439
, SubArg0_type , SubArg1_type , SubArg2_type , SubArg3_type
2440
, SubArg4_type , SubArg5_type , void , void >
2441
ViewSubviewDeduction ;
2443
enum { is_a_valid_subview_constructor =
2445
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2449
if ( is_a_valid_subview_constructor ) {
2451
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2452
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2453
typedef Impl::ViewOffsetRange< SubArg2_type > R2 ;
2454
typedef Impl::ViewOffsetRange< SubArg3_type > R3 ;
2455
typedef Impl::ViewOffsetRange< SubArg4_type > R4 ;
2456
typedef Impl::ViewOffsetRange< SubArg5_type > R5 ;
2458
// 'assign_subview' returns whether the subview offset_map
2459
// introduces noncontiguity in the view.
2460
const bool introduce_noncontiguity =
2461
m_offset_map.assign_subview( src.m_offset_map
2462
, R0::dimension( src.m_offset_map.N0 , arg0 )
2463
, R1::dimension( src.m_offset_map.N1 , arg1 )
2464
, R2::dimension( src.m_offset_map.N2 , arg2 )
2465
, R3::dimension( src.m_offset_map.N3 , arg3 )
2466
, R4::dimension( src.m_offset_map.N4 , arg4 )
2467
, R5::dimension( src.m_offset_map.N5 , arg5 )
2472
if ( m_offset_map.capacity() ) {
2474
m_management = src.m_management ;
2476
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2478
m_ptr_on_device = src.m_ptr_on_device +
2479
src.m_offset_map( R0::begin( arg0 )
2487
m_management.increment( m_ptr_on_device );
2492
// Construct subview of a Rank 5 view
2493
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2494
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2495
, class SubArg0_type , class SubArg1_type , class SubArg2_type , class SubArg3_type
2496
, class SubArg4_type
2498
KOKKOS_INLINE_FUNCTION
2499
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2500
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2501
, const SubArg0_type & arg0
2502
, const SubArg1_type & arg1
2503
, const SubArg2_type & arg2
2504
, const SubArg3_type & arg3
2505
, const SubArg4_type & arg4
2507
: m_ptr_on_device( (typename traits::value_type*) NULL)
2511
// This constructor can only be used to construct a subview
2512
// from the source view. This type must match the subview type
2513
// deduced from the source view and subview arguments.
2515
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2516
, SubArg0_type , SubArg1_type , SubArg2_type , SubArg3_type
2517
, SubArg4_type , void , void , void >
2518
ViewSubviewDeduction ;
2520
enum { is_a_valid_subview_constructor =
2522
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2526
if ( is_a_valid_subview_constructor ) {
2528
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2529
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2530
typedef Impl::ViewOffsetRange< SubArg2_type > R2 ;
2531
typedef Impl::ViewOffsetRange< SubArg3_type > R3 ;
2532
typedef Impl::ViewOffsetRange< SubArg4_type > R4 ;
2534
// 'assign_subview' returns whether the subview offset_map
2535
// introduces noncontiguity in the view.
2536
const bool introduce_noncontiguity =
2537
m_offset_map.assign_subview( src.m_offset_map
2538
, R0::dimension( src.m_offset_map.N0 , arg0 )
2539
, R1::dimension( src.m_offset_map.N1 , arg1 )
2540
, R2::dimension( src.m_offset_map.N2 , arg2 )
2541
, R3::dimension( src.m_offset_map.N3 , arg3 )
2542
, R4::dimension( src.m_offset_map.N4 , arg4 )
2548
if ( m_offset_map.capacity() ) {
2550
m_management = src.m_management ;
2552
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2554
m_ptr_on_device = src.m_ptr_on_device +
2555
src.m_offset_map( R0::begin( arg0 )
2563
m_management.increment( m_ptr_on_device );
2568
// Construct subview of a Rank 4 view
2569
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2570
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2571
, class SubArg0_type , class SubArg1_type , class SubArg2_type , class SubArg3_type
2573
KOKKOS_INLINE_FUNCTION
2574
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2575
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2576
, const SubArg0_type & arg0
2577
, const SubArg1_type & arg1
2578
, const SubArg2_type & arg2
2579
, const SubArg3_type & arg3
2581
: m_ptr_on_device( (typename traits::value_type*) NULL)
2585
// This constructor can only be used to construct a subview
2586
// from the source view. This type must match the subview type
2587
// deduced from the source view and subview arguments.
2589
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2590
, SubArg0_type , SubArg1_type , SubArg2_type , SubArg3_type
2591
, void , void , void , void >
2592
ViewSubviewDeduction ;
2594
enum { is_a_valid_subview_constructor =
2596
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2600
if ( is_a_valid_subview_constructor ) {
2602
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2603
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2604
typedef Impl::ViewOffsetRange< SubArg2_type > R2 ;
2605
typedef Impl::ViewOffsetRange< SubArg3_type > R3 ;
2607
// 'assign_subview' returns whether the subview offset_map
2608
// introduces noncontiguity in the view.
2609
const bool introduce_noncontiguity =
2610
m_offset_map.assign_subview( src.m_offset_map
2611
, R0::dimension( src.m_offset_map.N0 , arg0 )
2612
, R1::dimension( src.m_offset_map.N1 , arg1 )
2613
, R2::dimension( src.m_offset_map.N2 , arg2 )
2614
, R3::dimension( src.m_offset_map.N3 , arg3 )
2621
if ( m_offset_map.capacity() ) {
2623
m_management = src.m_management ;
2625
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2627
m_ptr_on_device = src.m_ptr_on_device +
2628
src.m_offset_map( R0::begin( arg0 )
2636
m_management.increment( m_ptr_on_device );
2641
// Construct subview of a Rank 3 view
2642
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2643
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2644
, class SubArg0_type , class SubArg1_type , class SubArg2_type
2646
KOKKOS_INLINE_FUNCTION
2647
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2648
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2649
, const SubArg0_type & arg0
2650
, const SubArg1_type & arg1
2651
, const SubArg2_type & arg2
2653
: m_ptr_on_device( (typename traits::value_type*) NULL)
2657
// This constructor can only be used to construct a subview
2658
// from the source view. This type must match the subview type
2659
// deduced from the source view and subview arguments.
2661
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2662
, SubArg0_type , SubArg1_type , SubArg2_type , void , void , void , void , void >
2663
ViewSubviewDeduction ;
2665
enum { is_a_valid_subview_constructor =
2667
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2671
if ( is_a_valid_subview_constructor ) {
2673
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2674
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2675
typedef Impl::ViewOffsetRange< SubArg2_type > R2 ;
2677
// 'assign_subview' returns whether the subview offset_map
2678
// introduces noncontiguity in the view.
2679
const bool introduce_noncontiguity =
2680
m_offset_map.assign_subview( src.m_offset_map
2681
, R0::dimension( src.m_offset_map.N0 , arg0 )
2682
, R1::dimension( src.m_offset_map.N1 , arg1 )
2683
, R2::dimension( src.m_offset_map.N2 , arg2 )
2684
, 0 , 0 , 0 , 0 , 0);
2686
if ( m_offset_map.capacity() ) {
2688
m_management = src.m_management ;
2690
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2692
m_ptr_on_device = src.m_ptr_on_device +
2693
src.m_offset_map( R0::begin( arg0 )
2696
, 0 , 0 , 0 , 0 , 0 );
2697
m_management.increment( m_ptr_on_device );
2702
// Construct subview of a Rank 2 view
2703
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2704
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2705
, class SubArg0_type , class SubArg1_type
2707
KOKKOS_INLINE_FUNCTION
2708
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2709
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2710
, const SubArg0_type & arg0
2711
, const SubArg1_type & arg1
2713
: m_ptr_on_device( (typename traits::value_type*) NULL)
2717
// This constructor can only be used to construct a subview
2718
// from the source view. This type must match the subview type
2719
// deduced from the source view and subview arguments.
2721
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2722
, SubArg0_type , SubArg1_type , void , void , void , void , void , void >
2723
ViewSubviewDeduction ;
2725
enum { is_a_valid_subview_constructor =
2727
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2731
if ( is_a_valid_subview_constructor ) {
2733
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2734
typedef Impl::ViewOffsetRange< SubArg1_type > R1 ;
2736
// 'assign_subview' returns whether the subview offset_map
2737
// introduces noncontiguity in the view.
2738
const bool introduce_noncontiguity =
2739
m_offset_map.assign_subview( src.m_offset_map
2740
, R0::dimension( src.m_offset_map.N0 , arg0 )
2741
, R1::dimension( src.m_offset_map.N1 , arg1 )
2742
, 0 , 0 , 0 , 0 , 0 , 0 );
2744
if ( m_offset_map.capacity() ) {
2746
m_management = src.m_management ;
2748
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2750
m_ptr_on_device = src.m_ptr_on_device +
2751
src.m_offset_map( R0::begin( arg0 )
2753
, 0 , 0 , 0 , 0 , 0 , 0 );
2754
m_management.increment( m_ptr_on_device );
2759
// Construct subview of a Rank 1 view
2760
template< class DstDataType , class DstArg1Type , class DstArg2Type , class DstArg3Type >
2761
template< class SrcDataType , class SrcArg1Type , class SrcArg2Type , class SrcArg3Type
2762
, class SubArg0_type
2764
KOKKOS_INLINE_FUNCTION
2765
View< DstDataType , DstArg1Type , DstArg2Type , DstArg3Type , Impl::ViewDefault >::
2766
View( const View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault > & src
2767
, const SubArg0_type & arg0
2769
: m_ptr_on_device( (typename traits::value_type*) NULL)
2773
// This constructor can only be used to construct a subview
2774
// from the source view. This type must match the subview type
2775
// deduced from the source view and subview arguments.
2777
typedef Impl::ViewSubview< View< SrcDataType , SrcArg1Type , SrcArg2Type , SrcArg3Type , Impl::ViewDefault >
2778
, SubArg0_type , void , void , void , void , void , void , void >
2779
ViewSubviewDeduction ;
2781
enum { is_a_valid_subview_constructor =
2783
Impl::is_same< View , typename ViewSubviewDeduction::type >::value
2787
if ( is_a_valid_subview_constructor ) {
2789
typedef Impl::ViewOffsetRange< SubArg0_type > R0 ;
2791
// 'assign_subview' returns whether the subview offset_map
2792
// introduces noncontiguity in the view.
2793
const bool introduce_noncontiguity =
2794
m_offset_map.assign_subview( src.m_offset_map
2795
, R0::dimension( src.m_offset_map.N0 , arg0 )
2796
, 0 , 0 , 0 , 0 , 0 , 0 , 0 );
2798
if ( m_offset_map.capacity() ) {
2800
m_management = src.m_management ;
2802
if ( introduce_noncontiguity ) m_management.set_noncontiguous();
2804
m_ptr_on_device = src.m_ptr_on_device +
2805
src.m_offset_map( R0::begin( arg0 )
2806
, 0 , 0 , 0 , 0 , 0 , 0 , 0 );
2807
m_management.increment( m_ptr_on_device );
2812
} /* namespace Kokkos */
2814
//----------------------------------------------------------------------------
2815
//----------------------------------------------------------------------------
2817
#endif /* #ifndef KOKKOS_VIEWDEFAULT_HPP */