Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
Kokkos_View_MP_Vector_Interlaced.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef KOKKOS_VIEW_MP_VECTOR_INTERLACED_HPP
43 #define KOKKOS_VIEW_MP_VECTOR_INTERLACED_HPP
44 
45 #include "Sacado_MP_Vector.hpp"
47 #include "Stokhos_ViewStorage.hpp"
48 #include <Kokkos_Core.hpp>
49 
50 #include "Kokkos_View_Utils.hpp"
52 
53 /*
54  * Specialization for Kokkos::View<Sacado::MP::Vector<Storage>...>
55  * where the Sacado dimension is interlaced for LayoutLeft.
56  *
57  * Currently it can't be used at the same time as other such View
58  * specializations due to conflicting specializations of AnalyzeShape.
59  */
60 
61 namespace Kokkos {
62 namespace Impl {
63 
65 
66 template< class ValueType , class MemorySpace , class MemoryTraits >
67 struct ViewSpecialize
68  < ValueType
70  , LayoutLeft
71  , MemorySpace
72  , MemoryTraits >
73 {
75 };
76 
77 template< class ValueType , class MemorySpace , class MemoryTraits >
78 struct ViewSpecialize
79  < ValueType
81  , LayoutRight
82  , MemorySpace
83  , MemoryTraits >
84 {
86 };
87 
88 } // namespace Impl
89 } // namespace Kokkos
90 
91 //----------------------------------------------------------------------------
92 //----------------------------------------------------------------------------
93 
94 namespace Kokkos {
95 namespace Impl {
96 namespace ViewError {
97 
99 
100 } // namespace ViewError
101 } // namespace Impl
102 } // namespace Kokkos
103 
104 //----------------------------------------------------------------------------
105 //----------------------------------------------------------------------------
106 
107 namespace Kokkos {
108 
110 template< class DataType ,
111  class Arg1Type ,
112  class Arg2Type ,
113  class Arg3Type >
114 class View< DataType , Arg1Type , Arg2Type , Arg3Type , Impl::ViewMPVectorInterlaced >
115  : public ViewTraits< DataType
116  , typename ViewTraits< DataType , Arg1Type, Arg2Type, Arg3Type >::array_layout
117  , typename ViewTraits< DataType , Arg1Type, Arg2Type, Arg3Type >::device_type
118  , typename ViewTraits< DataType , Arg1Type, Arg2Type, Arg3Type >::memory_traits
119  >
120 {
121 public:
122 
123  typedef ViewTraits< DataType
124  , typename ViewTraits< DataType , Arg1Type, Arg2Type, Arg3Type >::array_layout
125  , typename ViewTraits< DataType , Arg1Type, Arg2Type, Arg3Type >::device_type
126  , typename ViewTraits< DataType , Arg1Type, Arg2Type, Arg3Type >::memory_traits
127  > traits ;
128 
129  // Type of const views with same value type
130  typedef View< typename traits::const_data_type ,
131  typename traits::array_layout ,
132  typename traits::device_type ,
133  typename traits::memory_traits > const_type ;
134 
135  // Type of non-const views with same value type
136  typedef View< typename traits::non_const_data_type ,
137  typename traits::array_layout ,
138  typename traits::device_type ,
139  typename traits::memory_traits > non_const_type ;
140 
141  // Host mirror
142  typedef View< typename Impl::RebindStokhosStorageDevice<
143  typename traits::data_type ,
144  typename traits::host_mirror_space::memory_space >::type ,
145  typename traits::array_layout ,
146  typename traits::host_mirror_space ,
147  void > HostMirror ;
148 
149  // Equivalent array type for this view.
150  typedef View< typename traits::array_type ,
151  typename traits::array_layout ,
152  typename traits::device_type ,
153  typename traits::memory_traits > array_type ;
154 
155  // Equivalent const array type for this view.
156  typedef View< typename traits::const_array_type ,
157  typename traits::array_layout ,
158  typename traits::device_type ,
159  typename traits::memory_traits > const_array_type ;
160 
161  // Equivalent host array type for this view.
162  typedef View< typename traits::array_type ,
163  typename traits::array_layout ,
164  typename traits::host_mirror_space ,
165  typename traits::memory_traits > host_array_type ;
166 
167  // Equivalent const host array type for this view.
168  typedef View< typename traits::const_array_type ,
169  typename traits::array_layout ,
170  typename traits::host_mirror_space ,
171  typename traits::memory_traits > host_const_array_type ;
172 
176 
177 private:
178 
179  // Assignment of compatible views requirement:
180  template< class , class , class , class , class > friend class View ;
181 
182  // Assignment of compatible subview requirement:
183  template< class , class , class > friend struct Impl::ViewAssignment ;
184 
185  enum { StokhosStorageStaticDimension = stokhos_storage_type::static_size };
186  typedef integral_nonzero_constant< unsigned , StokhosStorageStaticDimension > sacado_size_type;
187 
188  typedef Impl::LayoutStride< typename traits::shape_type ,
189  typename traits::array_layout > stride_type ;
190  typedef typename array_type::traits::shape_type array_shape_type;
191 
193  typename traits::shape_type m_shape ;
194  array_shape_type m_array_shape ; // Shape of intrinsic array
196  typename traits::execution_space::size_type m_storage_size ; // Storage size of sacado dimension
197  sacado_size_type m_sacado_size ; // Size of sacado dimension
198  Impl::ViewDataManagement< traits > m_management ;
199  Impl::AllocationTracker m_tracker ;
200  // Note: if the view is partitioned, m_sacado_size != m_storage_size.
201  // We always have m_storage_size >= m_sacado_size
202 
203  typedef Stokhos::ViewStorage<
206  StokhosStorageStaticDimension ,
207  /* LayoutRight has stride-one stokhos storage */
208  ( Impl::is_same< typename traits::array_layout , LayoutRight >::value ? 1 : 0 ) ,
209  typename traits::device_type > stokhos_view_storage_type ;
210 
211 public:
212 
213  // This needs to be public so that we know what the return type of () is
215 
216  // Whether the storage type is statically sized
217  static const bool is_static = stokhos_storage_type::is_static;
218 
219  // Whether sacado dimension is contiguous
220  static const bool is_contiguous =
221  Impl::is_same< typename traits::array_layout , LayoutRight >::value;
222 
223  //------------------------------------
224  // Shape for the Sacado::MP::Vector value_type ignores the internal static array length.
225  enum { Rank = traits::rank };
226 
227  // Rank corresponding to the sacado dimension
228  enum { Sacado_Rank = Rank+1 };
229 
230  KOKKOS_FORCEINLINE_FUNCTION typename traits::shape_type shape() const { return m_shape ; }
231  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_0() const { return m_shape.N0 ; }
232  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_1() const { return m_shape.N1 ; }
233  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_2() const { return m_shape.N2 ; }
234  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_3() const { return m_shape.N3 ; }
235  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_4() const { return m_shape.N4 ; }
236  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_5() const { return m_shape.N5 ; }
237  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_6() const { return m_shape.N6 ; }
238  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type dimension_7() const { return m_shape.N7 ; }
239  KOKKOS_FORCEINLINE_FUNCTION typename traits::size_type size() const
240  {
241  return m_shape.N0
242  * m_shape.N1
243  * m_shape.N2
244  * m_shape.N3
245  * m_shape.N4
246  * m_shape.N5
247  * m_shape.N6
248  * m_shape.N7
249  ;
250  }
251 
252  template< typename iType >
253  KOKKOS_FORCEINLINE_FUNCTION
254  typename traits::size_type dimension( const iType & i ) const
255  { return Impl::dimension( m_shape , i ); }
256 
257  //------------------------------------
258 
259 private:
260 
261  // Restrict allocation to 'StokhosStorageStaticDimension'
262  inline
264  {
265  if ( dimension( unsigned(Rank) ) % ( StokhosStorageStaticDimension ? StokhosStorageStaticDimension : 1 ) ) {
266  std::ostringstream msg ;
267  msg << "Kokkos::View< Sacado::MP::Vector<StorageType , ... > allocation dimension ("
268  << dimension( unsigned(Rank) )
269  << ") must be a multiple of StorageType::static_size ("
270  << StokhosStorageStaticDimension
271  << ")" ;
272  Impl::throw_runtime_exception( msg.str() );
273  }
274  }
275 
276 #if defined( KOKKOS_EXPRESSION_CHECK )
277  KOKKOS_INLINE_FUNCTION
278  void verify_dimension_storage_size( const typename traits::execution_space & dev ) const
279  {
280  const int length = dimension( Rank );
281 
282  const Impl::integral_nonzero_constant< int , StokhosStorageStaticDimension >
283  per_thread( ! StokhosStorageStaticDimension ? length / dev.team_size() : 0 );
284 
285  if ( per_thread.value * dev.team_size() != length ) {
286  Kokkos::abort("Kokkos::View< Sacado::MP::Vector ... > incompatible vector-size : team-size");
287  }
288  }
289 #else
290  KOKKOS_INLINE_FUNCTION
291  void verify_dimension_storage_size( const typename traits::execution_space & ) const {}
292 #endif
293 
294 public:
295 
296  //------------------------------------
297  // Destructor, constructors, assignment operators:
298 
299  KOKKOS_INLINE_FUNCTION
300  ~View() { }
301 
302  KOKKOS_INLINE_FUNCTION
303  View() : m_ptr_on_device(0), m_storage_size(0), m_sacado_size(0)
304  {
305  traits::shape_type::assign(m_shape,0,0,0,0,0,0,0,0);
306  array_shape_type::assign(m_array_shape,0,0,0,0,0,0,0,0);
307  stride_type::assign(m_stride,0);
308  }
309 
310  KOKKOS_INLINE_FUNCTION
311  View( const View & rhs ) : m_ptr_on_device(0), m_storage_size(0), m_sacado_size(0)
312  {
313  (void) Impl::ViewAssignment<
314  typename traits::specialize ,
315  typename traits::specialize >( *this , rhs );
316  }
317 
318  KOKKOS_INLINE_FUNCTION
319  View & operator = ( const View & rhs )
320  {
321  (void) Impl::ViewAssignment<
322  typename traits::specialize ,
323  typename traits::specialize >( *this , rhs );
324  return *this ;
325  }
326 
327  //------------------------------------
328  // Construct or assign compatible view:
329 
330  template< class RT , class RL , class RD , class RM >
331  KOKKOS_INLINE_FUNCTION
332  View( const View<RT,RL,RD,RM,typename traits::specialize> & rhs )
333  : m_ptr_on_device(0)
334  {
335  (void) Impl::ViewAssignment<
336  typename traits::specialize ,
337  typename traits::specialize >( *this , rhs );
338  }
339 
340  template< class RT , class RL , class RD , class RM >
341  KOKKOS_INLINE_FUNCTION
342  View & operator = ( const View<RT,RL,RD,RM,typename traits::specialize> & rhs )
343  {
344  (void) Impl::ViewAssignment<
345  typename traits::specialize ,
346  typename traits::specialize >( *this , rhs );
347  return *this ;
348  }
349 
350  //------------------------------------
351  // Allocation of a managed view with possible alignment padding.
352 
353  template< class AllocationProperties >
354  explicit inline
355  View( const AllocationProperties & prop ,
356  // Impl::ViewAllocProp::size_type exists when the traits and allocation properties
357  // are valid for allocating viewed memory.
358  const typename Impl::ViewAllocProp< traits , AllocationProperties >::size_type n0 = 0 ,
359  const size_t n1 = 0 ,
360  const size_t n2 = 0 ,
361  const size_t n3 = 0 ,
362  const size_t n4 = 0 ,
363  const size_t n5 = 0 ,
364  const size_t n6 = 0 ,
365  const size_t n7 = 0 )
366  : m_ptr_on_device(0)
367  {
368  typedef Impl::ViewAllocProp< traits , AllocationProperties > Alloc ;
369 
370  typedef typename traits::memory_space memory_space ;
371  typedef typename traits::shape_type shape_type ;
373 
374  shape_type::assign( m_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
375  array_shape_type::assign( m_array_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
376  stride_type::assign_with_padding( m_stride , m_array_shape );
377  m_storage_size = Impl::dimension( m_array_shape , unsigned(Rank) );
378  m_sacado_size = m_storage_size;
379 
380  verify_dimension_storage_static_size();
381 
382  m_tracker = memory_space::allocate_and_track( Alloc::label( prop ) , sizeof(scalar_type) * Impl::capacity( m_array_shape , m_stride ) );
383 
384  m_ptr_on_device = (scalar_type *) m_tracker.alloc_ptr();
385 
386  (void) Kokkos::Impl::ViewDefaultConstruct< typename traits::execution_space , scalar_type , Alloc::Initialize >
387  ( m_ptr_on_device , Impl::capacity( m_array_shape , m_stride ) );
388  }
389 
390  //------------------------------------
391  // Assign an unmanaged View from pointer, can be called in functors.
392  // No alignment padding is performed.
393 
394  template< typename T >
395  View( T * ptr ,
396  const size_t n0 = 0 ,
397  const size_t n1 = 0 ,
398  const size_t n2 = 0 ,
399  const size_t n3 = 0 ,
400  const size_t n4 = 0 ,
401  const size_t n5 = 0 ,
402  const size_t n6 = 0 ,
403  typename Impl::enable_if<(
404  ( Impl::is_same<T,typename traits::value_type>::value ||
405  Impl::is_same<T,typename traits::const_value_type>::value ) &&
406  ! traits::is_managed ),
407  const size_t >::type n7 = 0 )
408  : m_ptr_on_device(ptr)
409  {
410  typedef typename traits::shape_type shape_type ;
411 
412  shape_type::assign( m_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
413  array_shape_type::assign( m_array_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
414  stride_type::assign_no_padding( m_stride , m_shape );
415  m_storage_size = Impl::dimension( m_array_shape , unsigned(Rank) );
416  m_sacado_size = m_storage_size;
417  m_management.set_unmanaged();
418 
419  verify_dimension_storage_static_size();
420  }
421 
422  //------------------------------------
423  // Is not allocated
424 
425  KOKKOS_FORCEINLINE_FUNCTION
426  bool is_null() const { return 0 == m_ptr_on_device ; }
427 
428  //------------------------------------
429  //------------------------------------
430  // Scalar operator on traits::rank == 1
431 
432  typedef std::conditional< ( traits::rank == 1 ),
433  reference_type ,
434  Impl::ViewError::scalar_operator_called_from_non_scalar_view >
436 
437  KOKKOS_FORCEINLINE_FUNCTION
438  typename if_scalar_operator::type
439  operator()() const
440  {
441  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
442 
444  m_ptr_on_device ,
445  m_shape.N0 , 1 ) );
446  }
447 
448  //------------------------------------
449  //------------------------------------
450  // Array operators, traits::rank 2:
451 
452  template< typename iType0 >
453  KOKKOS_FORCEINLINE_FUNCTION
454  typename Impl::ViewEnableArrayOper< reference_type , traits, LayoutLeft, 2, iType0 >::type
455  operator() ( const iType0 & i0 ) const
456  {
457  KOKKOS_ASSERT_SHAPE_BOUNDS_2( m_shape, i0, 0 );
458  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
459 
460  // Strided storage
462  m_ptr_on_device + i0 ,
463  m_shape.N1 ,
464  m_stride.value ) );
465  }
466 
467  template< typename iType0 >
468  KOKKOS_FORCEINLINE_FUNCTION
469  typename Impl::ViewEnableArrayOper< reference_type ,
470  traits, LayoutRight, 2, iType0 >::type
471  operator() ( const iType0 & i0 ) const
472  {
473  KOKKOS_ASSERT_SHAPE_BOUNDS_2( m_shape, i0, 0 );
474  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
475 
476  // Contiguous storage with right-most index as the stokhos dimension
478  m_ptr_on_device + ( m_stride.value * i0 ) ,
479  m_shape.N1 , 1 ) );
480  }
481 
482  template< typename iType0 >
483  KOKKOS_FORCEINLINE_FUNCTION
484  typename Impl::ViewEnableArrayOper< reference_type , traits, typename traits::array_layout, 2, iType0 >::type
485  operator[] ( const iType0 & i0 ) const
486  { return operator()( i0 ); }
487 
488  template< typename iType0 >
489  KOKKOS_FORCEINLINE_FUNCTION
490  typename Impl::ViewEnableArrayOper< reference_type ,
491  traits, typename traits::array_layout, 2,
492  iType0 >::type
493  at( const iType0 & i0 , int , int , int , int , int , int , int ) const
494  { return operator()(i0); }
495 
496  //------------------------------------
497  //------------------------------------
498  // Array operators, traits::rank 3:
499 
500  template< typename iType0 , typename iType1 >
501  KOKKOS_FORCEINLINE_FUNCTION
502  typename Impl::ViewEnableArrayOper< reference_type ,
503  traits, LayoutLeft, 3, iType0, iType1 >::type
504  operator() ( const iType0 & i0 , const iType1 & i1 ) const
505  {
506  KOKKOS_ASSERT_SHAPE_BOUNDS_3( m_shape, i0, i1, 0 );
507  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
508 
509  // Strided storage with right-most index as the stokhos dimension
511  m_ptr_on_device + ( i0 + m_stride.value * ( i1 )),
512  m_shape.N2 ,
513  m_stride.value * m_shape.N1 ) );
514  }
515 
516  template< typename iType0 , typename iType1 >
517  KOKKOS_FORCEINLINE_FUNCTION
518  typename Impl::ViewEnableArrayOper< reference_type ,
519  traits, LayoutRight, 3, iType0, iType1 >::type
520  operator() ( const iType0 & i0 , const iType1 & i1 ) const
521  {
522  KOKKOS_ASSERT_SHAPE_BOUNDS_3( m_shape, i0, i1, 0);
523  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
524 
525  // Contiguous storage with right-most index as the stokhos dimension
527  m_ptr_on_device + ( m_storage_size * ( i1 ) + m_stride.value * i0 ) ,
528  m_shape.N2 , 1 ) );
529  }
530 
531  template< typename iType0 , typename iType1 >
532  KOKKOS_FORCEINLINE_FUNCTION
533  typename Impl::ViewEnableArrayOper< reference_type ,
534  traits, typename traits::array_layout, 3,
535  iType0, iType1 >::type
536  at( const iType0 & i0 , const iType1 & i1 , int , int , int , int , int , int ) const
537  { return operator()(i0,i1); }
538 
539  //------------------------------------
540  //------------------------------------
541  // Array operators, traits::rank 4:
542 
543  template< typename iType0 , typename iType1 , typename iType2 >
544  KOKKOS_FORCEINLINE_FUNCTION
545  typename Impl::ViewEnableArrayOper< reference_type ,
546  traits, LayoutLeft, 4, iType0, iType1, iType2 >::type
547  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 ) const
548  {
549  KOKKOS_ASSERT_SHAPE_BOUNDS_4( m_shape, i0, i1, i2, 0 );
550  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
551 
552  // Strided storage with right-most index as the stokhos dimension
554  m_ptr_on_device + ( i0 + m_stride.value * (
555  i1 + m_shape.N1 * (
556  i2 ))),
557  m_shape.N3 ,
558  m_stride.value * m_shape.N1 * m_shape.N2 ) );
559  }
560 
561  template< typename iType0 , typename iType1 , typename iType2 >
562  KOKKOS_FORCEINLINE_FUNCTION
563  typename Impl::ViewEnableArrayOper< reference_type ,
564  traits, LayoutRight, 4, iType0, iType1, iType2 >::type
565  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 ) const
566  {
567  KOKKOS_ASSERT_SHAPE_BOUNDS_4( m_shape, i0, i1, i2, 0 );
568  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
569 
570  // Contiguous storage with right-most index as the stokhos dimension
572  m_ptr_on_device + ( m_storage_size * ( i2 +
573  m_shape.N2 * ( i1 )) +
574  m_stride.value * i0 ) ,
575  m_shape.N3 , 1 ) );
576  }
577 
578  template< typename iType0 , typename iType1 , typename iType2 >
579  KOKKOS_FORCEINLINE_FUNCTION
580  typename Impl::ViewEnableArrayOper< reference_type ,
581  traits, typename traits::array_layout, 4,
582  iType0, iType1, iType2 >::type
583  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , int , int , int , int , int ) const
584  { return operator()(i0,i1,i2); }
585 
586  //------------------------------------
587  //------------------------------------
588  // Array operators, traits::rank 5:
589 
590  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 >
591  KOKKOS_FORCEINLINE_FUNCTION
592  typename Impl::ViewEnableArrayOper< reference_type ,
593  traits, LayoutLeft, 5, iType0, iType1, iType2, iType3 >::type
594  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ) const
595  {
596  KOKKOS_ASSERT_SHAPE_BOUNDS_5( m_shape, i0, i1, i2, i3, 0 );
597  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
598 
599  // Strided storage with right-most index as the stokhos dimension
601  m_ptr_on_device + ( i0 + m_stride.value * (
602  i1 + m_shape.N1 * (
603  i2 + m_shape.N2 * (
604  i3 )))),
605  m_shape.N4 ,
606  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 ) );
607  }
608 
609  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 >
610  KOKKOS_FORCEINLINE_FUNCTION
611  typename Impl::ViewEnableArrayOper< reference_type ,
612  traits, LayoutRight, 5, iType0, iType1, iType2, iType3 >::type
613  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ) const
614  {
615  KOKKOS_ASSERT_SHAPE_BOUNDS_5( m_shape, i0, i1, i2, i3, 0 );
616  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
617 
618  // Contiguous storage with right-most index as the stokhos dimension
620  m_ptr_on_device + ( m_storage_size * ( i3 +
621  m_shape.N3 * ( i2 +
622  m_shape.N2 * ( i1 ))) +
623  m_stride.value * i0 ) ,
624  m_shape.N4 , 1 ) );
625  }
626 
627  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 >
628  KOKKOS_FORCEINLINE_FUNCTION
629  typename Impl::ViewEnableArrayOper< reference_type ,
630  traits, typename traits::array_layout, 5,
631  iType0, iType1, iType2, iType3 >::type
632  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 , int , int , int , int ) const
633  { return operator()(i0,i1,i2,i3); }
634 
635  //------------------------------------
636  //------------------------------------
637  // Array operators, traits::rank 6:
638 
639  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 , typename iType4 >
640  KOKKOS_FORCEINLINE_FUNCTION
641  typename Impl::ViewEnableArrayOper< reference_type ,
642  traits, LayoutLeft, 6, iType0, iType1, iType2, iType3, iType4 >::type
643  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 , const iType4 & i4 ) const
644  {
645  KOKKOS_ASSERT_SHAPE_BOUNDS_6( m_shape, i0, i1, i2, i3, i4, 0 );
646  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
647 
648  // Strided storage with right-most index as the stokhos dimension
650  m_ptr_on_device + ( i0 + m_stride.value * (
651  i1 + m_shape.N1 * (
652  i2 + m_shape.N2 * (
653  i3 + m_shape.N3 * (
654  i4 ))))),
655  m_shape.N5 ,
656  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 * m_shape.N4 ) );
657  }
658 
659  template< typename iType0 , typename iType1 , typename iType2 ,
660  typename iType3 , typename iType4 >
661  KOKKOS_FORCEINLINE_FUNCTION
662  typename Impl::ViewEnableArrayOper< reference_type ,
663  traits, LayoutRight, 6, iType0, iType1, iType2, iType3, iType4 >::type
664  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
665  const iType4 & i4 ) const
666  {
667  KOKKOS_ASSERT_SHAPE_BOUNDS_6( m_shape, i0, i1, i2, i3, i4, 0 );
668  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
669 
670  // Contiguous storage with right-most index as the stokhos dimension
672  m_ptr_on_device + ( m_storage_size * ( i4 +
673  m_shape.N4 * ( i3 +
674  m_shape.N3 * ( i2 +
675  m_shape.N2 * ( i1 )))) +
676  m_stride.value * i0 ) ,
677  m_shape.N5 , 1 ) );
678  }
679 
680  template< typename iType0 , typename iType1 , typename iType2 ,
681  typename iType3 , typename iType4 >
682  KOKKOS_FORCEINLINE_FUNCTION
683  typename Impl::ViewEnableArrayOper< reference_type ,
684  traits, typename traits::array_layout, 6,
685  iType0, iType1, iType2, iType3, iType4 >::type
686  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
687  const iType4 & i4 , int , int , int ) const
688  { return operator()(i0,i1,i2,i3,i4); }
689 
690  //------------------------------------
691  //------------------------------------
692  // Array operators, traits::rank 7:
693 
694  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 , typename iType4 , typename iType5 >
695  KOKKOS_FORCEINLINE_FUNCTION
696  typename Impl::ViewEnableArrayOper< reference_type ,
697  traits, LayoutLeft, 7, iType0, iType1, iType2, iType3, iType4, iType5 >::type
698  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 ,
699  const iType3 & i3 , const iType4 & i4 , const iType5 & i5 ) const
700  {
701  KOKKOS_ASSERT_SHAPE_BOUNDS_7( m_shape, i0, i1, i2, i3, i4, i5, 0 );
702  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
703 
704  // Strided storage with right-most index as the stokhos dimension
706  m_ptr_on_device + ( i0 + m_stride.value * (
707  i1 + m_shape.N1 * (
708  i2 + m_shape.N2 * (
709  i3 + m_shape.N3 * (
710  i4 + m_shape.N4 * (
711  i5 )))))),
712  m_shape.N6 ,
713  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 * m_shape.N4 * m_shape.N5 ) );
714  }
715 
716  template< typename iType0 , typename iType1 , typename iType2 ,
717  typename iType3 , typename iType4 , typename iType5 >
718  KOKKOS_FORCEINLINE_FUNCTION
719  typename Impl::ViewEnableArrayOper< reference_type ,
720  traits, LayoutRight, 7, iType0, iType1, iType2, iType3, iType4, iType5 >::type
721  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
722  const iType4 & i4 , const iType5 & i5 ) const
723  {
724  KOKKOS_ASSERT_SHAPE_BOUNDS_7( m_shape, i0, i1, i2, i3, i4, i5, 0 );
725  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
726 
727  // Contiguous storage with right-most index as the stokhos dimension
729  m_ptr_on_device + ( m_storage_size * ( i5 +
730  m_shape.N5 * ( i4 +
731  m_shape.N4 * ( i3 +
732  m_shape.N3 * ( i2 +
733  m_shape.N2 * ( i1 ))))) +
734  m_stride.value * i0 ) ,
735  m_shape.N6 , 1 ) );
736  }
737 
738  template< typename iType0 , typename iType1 , typename iType2 ,
739  typename iType3 , typename iType4 , typename iType5 >
740  KOKKOS_FORCEINLINE_FUNCTION
741  typename Impl::ViewEnableArrayOper< reference_type ,
742  traits, typename traits::array_layout, 7,
743  iType0, iType1, iType2, iType3, iType4, iType5 >::type
744  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
745  const iType4 & i4 , const iType5 & i5 , int , int ) const
746  { return operator()(i0,i1,i2,i3,i4,i5); }
747 
748  //------------------------------------
749  //------------------------------------
750  // Array operators, traits::rank 8:
751 
752  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 ,
753  typename iType4 , typename iType5 , typename iType6 >
754  KOKKOS_FORCEINLINE_FUNCTION
755  typename Impl::ViewEnableArrayOper< reference_type ,
756  traits, LayoutLeft, 8, iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type
757  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
758  const iType4 & i4 , const iType5 & i5 , const iType6 & i6 ) const
759  {
760  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
761  KOKKOS_ASSERT_SHAPE_BOUNDS_8( m_shape, i0, i1, i2, i3, i4, i5, i6, 0 );
762 
763  // Strided storage with right-most index as the stokhos dimension
765  m_ptr_on_device + ( i0 + m_stride.value * (
766  i1 + m_shape.N1 * (
767  i2 + m_shape.N2 * (
768  i3 + m_shape.N3 * (
769  i4 + m_shape.N4 * (
770  i5 + m_shape.N5 * (
771  i6 ))))))),
772  m_shape.N7 ,
773  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 * m_shape.N4 * m_shape.N5 * m_shape.N6 ) );
774  }
775 
776  template< typename iType0 , typename iType1 , typename iType2 ,
777  typename iType3 , typename iType4 , typename iType5, typename iType6 >
778  KOKKOS_FORCEINLINE_FUNCTION
779  typename Impl::ViewEnableArrayOper< reference_type ,
780  traits, LayoutRight, 8, iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type
781  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
782  const iType4 & i4 , const iType5 & i5 , const iType6 & i6 ) const
783  {
784  KOKKOS_ASSERT_SHAPE_BOUNDS_8( m_shape, i0, i1, i2, i3, i4, i5, i6, 0 );
785  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
786 
787  // Contiguous storage with right-most index as the stokhos dimension
789  m_ptr_on_device + ( m_storage_size * ( i6 +
790  m_shape.N6 * ( i5 +
791  m_shape.N5 * ( i4 +
792  m_shape.N4 * ( i3 +
793  m_shape.N3 * ( i2 +
794  m_shape.N2 * ( i1 )))))) +
795  m_stride.value * i0 ) ,
796  m_shape.N7 , 1 ) );
797  }
798 
799  template< typename iType0 , typename iType1 , typename iType2 ,
800  typename iType3 , typename iType4 , typename iType5, typename iType6 >
801  KOKKOS_FORCEINLINE_FUNCTION
802  typename Impl::ViewEnableArrayOper< reference_type ,
803  traits, typename traits::array_layout, 8,
804  iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type
805  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
806  const iType4 & i4 , const iType5 & i5 , const iType6 & i6 , int ) const
807  { return operator()(i0,i1,i2,i3,i4,i5,i6); }
808 
809  //------------------------------------
810  // Access to the underlying contiguous storage of this view specialization.
811  // These methods are specific to specialization of a view.
812 
813  KOKKOS_FORCEINLINE_FUNCTION
815  data() const { return m_ptr_on_device ; }
816 
817  // Stride of physical storage, dimensioned to at least Rank
818  template< typename iType >
819  KOKKOS_FORCEINLINE_FUNCTION
820  void stride( iType * const s ) const
821  { Impl::stride( s , m_array_shape , m_stride ); }
822 
823  // Count of contiguously allocated data members including padding.
824  KOKKOS_FORCEINLINE_FUNCTION
825  typename traits::size_type capacity() const
826  { return Impl::capacity( m_array_shape , m_stride ); }
827 
828  // Static storage size
829  KOKKOS_FORCEINLINE_FUNCTION
830  typename traits::size_type sacado_size() const
831  { return m_sacado_size.value; }
832 };
833 
837 template< class DT , class DL , class DD , class DM ,
838  class ST , class SL , class SD , class SM >
839 inline
840 void deep_copy( const View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced> & dst ,
841  const View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced> & src ,
842  typename Impl::enable_if<(
843  Impl::is_same< typename View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced>::intinsic_scalar_type ,
844  typename View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced>::intinsic_scalar_type >::value
845  &&
846  Impl::is_same< typename View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced>::array_layout ,
847  typename View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced>::array_layout >::value
848  &&
849  ( unsigned(View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced>::rank) ==
850  unsigned(View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced>::rank) )
851  )>::type * = 0 )
852 {
853  typedef View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced> dst_type ;
854  typedef View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced> src_type ;
855 
856  typedef typename dst_type::memory_space dst_memory_space ;
857  typedef typename src_type::memory_space src_memory_space ;
858 
859  if ( dst.data() != src.data() ) {
860 
861  Impl::assert_shapes_are_equal( dst.shape() , src.shape() );
862 
863  const size_t nbytes = sizeof(typename dst_type::value_type::storage_type::value_type) * dst.span();
864 
865  Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() , nbytes );
866  }
867 }
868 
869 } // namespace Kokkos
870 
871 //----------------------------------------------------------------------------
872 //----------------------------------------------------------------------------
873 
874 namespace Kokkos {
875 namespace Impl {
876 
883 template< class StorageType >
884 struct AnalyzeShape< Sacado::MP::Vector< StorageType > >
885  : Shape< sizeof(Sacado::MP::Vector< StorageType >) , 0 > // Treat as a scalar
886 {
887 private:
888 
889  typedef AnalyzeShape< typename StorageType::value_type > nested ;
890 
891 public:
892 
894 
895  typedef Shape< sizeof(Sacado::MP::Vector< StorageType >) , 0 > shape ;
896 
897  // If ( ! StorageType::is_static ) then 0 == StorageType::static_size and the first array declaration is not used.
898  // However, the compiler will still generate this type declaration and it must not have a zero length.
899  typedef typename
900  std::conditional< StorageType::is_static
901  , typename nested::array_intrinsic_type [ StorageType::is_static ? StorageType::static_size : 1 ]
902  , typename nested::array_intrinsic_type *
904 
905  typedef typename
906  std::conditional< StorageType::is_static
907  , typename nested::const_array_intrinsic_type [ StorageType::is_static ? StorageType::static_size : 1 ]
908  , typename nested::const_array_intrinsic_type *
910 
912 
916 
920 };
921 
922 //----------------------------------------------------------------------------
923 
924 template<>
925 struct ViewAssignment< ViewMPVectorInterlaced , ViewMPVectorInterlaced , void >
926 {
927  typedef ViewMPVectorContiguous specialize ;
928 
929  //------------------------------------
932  template< class DT , class DL , class DD , class DM ,
933  class ST , class SL , class SD , class SM >
934  KOKKOS_INLINE_FUNCTION
935  ViewAssignment( View<DT,DL,DD,DM,specialize> & dst
936  , const View<ST,SL,SD,SM,specialize> & src
937  , const typename enable_if<(
938  ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
939  ViewTraits<ST,SL,SD,SM> >::value
940  )>::type * = 0
941  )
942  {
943  typedef ViewTraits<DT,DL,DD,DM> dst_traits ;
944  typedef View<DT,DL,DD,DM,specialize> dst_type ;
945  typedef typename dst_type::shape_type shape_type ;
946  typedef typename dst_type::array_shape_type array_shape_type ;
947  typedef typename dst_type::stride_type stride_type ;
948 
949  shape_type::assign( dst.m_shape,
950  src.m_shape.N0 , src.m_shape.N1 , src.m_shape.N2 , src.m_shape.N3 ,
951  src.m_shape.N4 , src.m_shape.N5 , src.m_shape.N6 , src.m_shape.N7 );
952  array_shape_type::assign( dst.m_array_shape,
953  src.m_array_shape.N0 , src.m_array_shape.N1 , src.m_array_shape.N2 , src.m_array_shape.N3 ,
954  src.m_array_shape.N4 , src.m_array_shape.N5 , src.m_array_shape.N6 , src.m_array_shape.N7 );
955 
956  stride_type::assign( dst.m_stride , src.m_stride.value );
957  dst.m_ptr_on_device = src.m_ptr_on_device ;
958  dst.m_storage_size = src.m_storage_size ;
959  dst.m_sacado_size = src.m_sacado_size ;
960  dst.m_tracker = src.m_tracker ;
961  }
962 
963  //------------------------------------
966  template< class DT , class DL , class DD , class DM ,
967  class ST , class SL , class SD , class SM >
968  KOKKOS_INLINE_FUNCTION
969  ViewAssignment( View<DT,DL,DD,DM,specialize> & dst
970  , const View<ST,SL,SD,SM,specialize> & src
971  , typename enable_if<(
972  // Same intrinsic scalar type
973  is_same< typename View<DT,DL,DD,DM,specialize>::intrinsic_scalar_type ,
974  typename View<ST,SL,SD,SM,specialize>::intrinsic_scalar_type >::value
975  &&
976  // Same memory space
977  is_same< typename View<DT,DL,DD,DM,specialize>::memory_space ,
978  typename View<ST,SL,SD,SM,specialize>::memory_space >::value
979  &&
980  // Same layout
981  is_same< typename View<DT,DL,DD,DM,specialize>::array_layout ,
982  typename View<ST,SL,SD,SM,specialize>::array_layout >::value
983  &&
984  // Same rank
985  ( unsigned(View<DT,DL,DD,DM,specialize>::Rank) ==
986  unsigned(View<ST,SL,SD,SM,specialize>::Rank) )
987  &&
988  // Destination is not managed
989  ! View<DT,DL,DD,DM,specialize>::is_managed
990  ), const Sacado::MP::VectorPartition & >::type part )
991  {
992  typedef ViewTraits<DT,DL,DD,DM> dst_traits ;
993  typedef View<DT,DL,DD,DM,specialize> dst_type ;
994  typedef typename dst_type::shape_type dst_shape_type ;
995  typedef typename dst_type::array_shape_type dst_array_shape_type ;
996  typedef typename dst_type::stride_type dst_stride_type ;
997  typedef typename dst_traits::value_type dst_sacado_mp_vector_type ;
998  typedef typename dst_sacado_mp_vector_type::storage_type dst_stokhos_storage_type ;
999 
1000  enum { DstRank = dst_type::Rank };
1001  enum { DstStaticLength = dst_stokhos_storage_type::static_size };
1002 
1003  const int length = part.end - part.begin ;
1004 
1005  if ( DstStaticLength && DstStaticLength != length ) {
1006  Kokkos::abort("Kokkos::View< Sacado::MP::Vector ... > incompatible partitioning");
1007  }
1008 
1009  unsigned dims[8];
1010  dims[0] = src.m_array_shape.N0;
1011  dims[1] = src.m_array_shape.N1;
1012  dims[2] = src.m_array_shape.N2;
1013  dims[3] = src.m_array_shape.N3;
1014  dims[4] = src.m_array_shape.N4;
1015  dims[5] = src.m_array_shape.N5;
1016  dims[6] = src.m_array_shape.N6;
1017  dims[7] = src.m_array_shape.N7;
1018  unsigned rank = dst_type::Rank;
1019 
1020  dst_shape_type::assign( dst.m_shape,
1021  dims[0] , dims[1] , dims[2] , dims[3] ,
1022  dims[4] , dims[5] , dims[6] , dims[7] );
1023 
1024  dims[rank] = length;
1025  dst_array_shape_type::assign( dst.m_array_shape,
1026  dims[0] , dims[1] , dims[2] , dims[3] ,
1027  dims[4] , dims[5] , dims[6] , dims[7] );
1028 
1029  dst_stride_type::assign( dst.m_stride , src.m_stride.value );
1030 
1031  // Original Sacado::MP::Vector length
1032  dst.m_storage_size = src.m_storage_size ;
1033  dst.m_sacado_size = length;
1034 
1035  if ( Impl::is_same< typename dst_traits::array_layout , LayoutLeft >::value ) {
1036  dst.m_ptr_on_device = src.m_ptr_on_device + part.begin *
1037  ( 0 == DstRank ? 1 : dst.m_stride.value * (
1038  ( 1 == DstRank ? 1 : dst.m_shape.N1 * (
1039  ( 2 == DstRank ? 1 : dst.m_shape.N2 * (
1040  ( 3 == DstRank ? 1 : dst.m_shape.N3 * (
1041  ( 4 == DstRank ? 1 : dst.m_shape.N4 * (
1042  ( 5 == DstRank ? 1 : dst.m_shape.N5 * (
1043  ( 6 == DstRank ? 1 : dst.m_shape.N6 )))))))))))));
1044  }
1045  else { // if ( Impl::is_same< typename traits::array_layout , LayoutRight >::value )
1046  dst.m_ptr_on_device = src.m_ptr_on_device + part.begin ;
1047  }
1048  dst.m_tracker = src.m_tracker ;
1049  }
1050 };
1051 
1052 template<>
1053 struct ViewAssignment< ViewDefault , ViewMPVectorInterlaced , void >
1054 {
1055  //------------------------------------
1058  template< class ST , class SL , class SD , class SM >
1059  KOKKOS_INLINE_FUNCTION
1060  ViewAssignment( typename View<ST,SL,SD,SM,ViewMPVectorInterlaced>::array_type & dst
1061  , const View<ST,SL,SD,SM,ViewMPVectorInterlaced> & src )
1062  {
1063  typedef View<ST,SL,SD,SM,ViewMPVectorInterlaced> src_type ;
1064  typedef typename src_type::value_type src_sacado_mp_vector_type ;
1065  typedef typename src_sacado_mp_vector_type::storage_type src_stokhos_storage_type ;
1066 
1067  typedef typename src_type::array_type dst_type ;
1068  typedef typename dst_type::shape_type dst_shape_type ;
1069  typedef typename dst_type::stride_type dst_stride_type ;
1070 
1071  dst_shape_type::assign( dst.m_shape,
1072  src.m_array_shape.N0 , src.m_array_shape.N1 , src.m_array_shape.N2 , src.m_arrat_shape.N3 ,
1073  src.m_array_shape.N4 , src.m_array_shape.N5 , src.m_arrat_shape.N6 , src.m_arrat_shape.N7 );
1074 
1075  dst_stride_type::assign( dst.m_stride , src.m_stride.value );
1076 
1077  dst.m_ptr_on_device = reinterpret_cast< typename dst_type::value_type *>( src.m_ptr_on_device );
1078 
1079  dst.m_tracker = src.m_tracker ;
1080  }
1081 };
1082 
1083 //----------------------------------------------------------------------------
1084 //----------------------------------------------------------------------------
1085 
1086 } // namespace Impl
1087 
1088 } // namespace Kokkos
1089 
1090 //----------------------------------------------------------------------------
1091 //----------------------------------------------------------------------------
1092 
1093 #endif /* #ifndef KOKKOS_VIEW_MP_VECTOR_HPP */
View< typename traits::const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > const_type
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 4, iType0, iType1, iType2 >::type at(const iType0 &i0, const iType1 &i1, const iType2 &i2, int, int, int, int, int) const
Stokhos::StandardStorage< int, double > storage_type
Impl::LayoutStride< typename traits::shape_type, typename traits::array_layout > stride_type
Dynamic storage with view semantics and contiguous access.
KOKKOS_INLINE_FUNCTION View(const View< RT, RL, RD, RM, typename traits::specialize > &rhs)
KOKKOS_INLINE_FUNCTION ViewAssignment(typename View< ST, SL, SD, SM, ViewMPVectorInterlaced >::array_type &dst, const View< ST, SL, SD, SM, ViewMPVectorInterlaced > &src)
Compatible value and shape.
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 8, iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type at(const iType0 &i0, const iType1 &i1, const iType2 &i2, const iType3 &i3, const iType4 &i4, const iType5 &i5, const iType6 &i6, int) const
View< typename traits::array_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > array_type
Kokkos::DefaultExecutionSpace execution_space
ViewTraits< DataType, typename ViewTraits< DataType, Arg1Type, Arg2Type, Arg3Type >::array_layout, typename ViewTraits< DataType, Arg1Type, Arg2Type, Arg3Type >::device_type, typename ViewTraits< DataType, Arg1Type, Arg2Type, Arg3Type >::memory_traits > traits
View< typename traits::const_array_type, typename traits::array_layout, typename traits::host_mirror_space, typename traits::memory_traits > host_const_array_type
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 5, iType0, iType1, iType2, iType3 >::type at(const iType0 &i0, const iType1 &i1, const iType2 &i2, const iType3 &i3, int, int, int, int) const
std::conditional<(traits::rank==1), reference_type, Impl::ViewError::scalar_operator_called_from_non_scalar_view > if_scalar_operator
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 2, iType0 >::type at(const iType0 &i0, int, int, int, int, int, int, int) const
View< typename traits::array_type, typename traits::array_layout, typename traits::host_mirror_space, typename traits::memory_traits > host_array_type
View< typename traits::non_const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > non_const_type
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 6, iType0, iType1, iType2, iType3, iType4 >::type at(const iType0 &i0, const iType1 &i1, const iType2 &i2, const iType3 &i3, const iType4 &i4, int, int, int) const
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 3, iType0, iType1 >::type at(const iType0 &i0, const iType1 &i1, int, int, int, int, int, int) const
KOKKOS_INLINE_FUNCTION ViewAssignment(View< DT, DL, DD, DM, specialize > &dst, const View< ST, SL, SD, SM, specialize > &src, typename enable_if<(is_same< typename View< DT, DL, DD, DM, specialize >::intrinsic_scalar_type, typename View< ST, SL, SD, SM, specialize >::intrinsic_scalar_type >::value &&is_same< typename View< DT, DL, DD, DM, specialize >::memory_space, typename View< ST, SL, SD, SM, specialize >::memory_space >::value &&is_same< typename View< DT, DL, DD, DM, specialize >::array_layout, typename View< ST, SL, SD, SM, specialize >::array_layout >::value &&(unsigned(View< DT, DL, DD, DM, specialize >::Rank)==unsigned(View< ST, SL, SD, SM, specialize >::Rank)) &&! View< DT, DL, DD, DM, specialize >::is_managed), const Sacado::MP::VectorPartition & >::type part)
Partition of compatible value and shape.
integral_nonzero_constant< unsigned, StokhosStorageStaticDimension > sacado_size_type
View(const AllocationProperties &prop, const typename Impl::ViewAllocProp< traits, AllocationProperties >::size_type n0=0, const size_t n1=0, const size_t n2=0, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, const size_t n7=0)
View(T *ptr, const size_t n0=0, const size_t n1=0, const size_t n2=0, const size_t n3=0, const size_t n4=0, const size_t n5=0, const size_t n6=0, typename Impl::enable_if<((Impl::is_same< T, typename traits::value_type >::value||Impl::is_same< T, typename traits::const_value_type >::value) &&! traits::is_managed), const size_t >::type n7=0)
View< typename Impl::RebindStokhosStorageDevice< typename traits::data_type, typename traits::host_mirror_space::memory_space >::type, typename traits::array_layout, typename traits::host_mirror_space, void > HostMirror
std::conditional< StorageType::is_static, typename nested::array_intrinsic_type [StorageType::is_static ? StorageType::static_size :1], typename nested::array_intrinsic_type *>::type array_intrinsic_type
KOKKOS_FORCEINLINE_FUNCTION Impl::ViewEnableArrayOper< reference_type, traits, typename traits::array_layout, 7, iType0, iType1, iType2, iType3, iType4, iType5 >::type at(const iType0 &i0, const iType1 &i1, const iType2 &i2, const iType3 &i3, const iType4 &i4, const iType5 &i5, int, int) const
KOKKOS_INLINE_FUNCTION ViewAssignment(View< DT, DL, DD, DM, specialize > &dst, const View< ST, SL, SD, SM, specialize > &src, const typename enable_if<(ViewAssignable< ViewTraits< DT, DL, DD, DM >, ViewTraits< ST, SL, SD, SM > >::value)>::type *=0)
Compatible value and shape.
KOKKOS_INLINE_FUNCTION void verify_dimension_storage_size(const typename traits::execution_space &) const
View< typename traits::const_array_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > const_array_type
KOKKOS_FORCEINLINE_FUNCTION traits::value_type::storage_type::value_type * data() const
std::conditional< StorageType::is_static, typename nested::const_array_intrinsic_type [StorageType::is_static ? StorageType::static_size :1], typename nested::const_array_intrinsic_type *>::type const_array_intrinsic_type