Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  typedef Impl::if_c< traits::is_managed ,
354  std::string ,
355  Impl::ViewError::allocation_constructor_requires_managed >
357 
358  template< class AllocationProperties >
359  explicit inline
360  View( const AllocationProperties & prop ,
361  // Impl::ViewAllocProp::size_type exists when the traits and allocation properties
362  // are valid for allocating viewed memory.
363  const typename Impl::ViewAllocProp< traits , AllocationProperties >::size_type n0 = 0 ,
364  const size_t n1 = 0 ,
365  const size_t n2 = 0 ,
366  const size_t n3 = 0 ,
367  const size_t n4 = 0 ,
368  const size_t n5 = 0 ,
369  const size_t n6 = 0 ,
370  const size_t n7 = 0 )
371  : m_ptr_on_device(0)
372  {
373  typedef Impl::ViewAllocProp< traits , AllocationProperties > Alloc ;
374 
375  typedef typename traits::memory_space memory_space ;
376  typedef typename traits::shape_type shape_type ;
378 
379  shape_type::assign( m_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
380  array_shape_type::assign( m_array_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
381  stride_type::assign_with_padding( m_stride , m_array_shape );
382  m_storage_size = Impl::dimension( m_array_shape , unsigned(Rank) );
383  m_sacado_size = m_storage_size;
384 
385  verify_dimension_storage_static_size();
386 
387  m_tracker = memory_space::allocate_and_track( Alloc::label( prop ) , sizeof(scalar_type) * Impl::capacity( m_array_shape , m_stride ) );
388 
389  m_ptr_on_device = (scalar_type *) m_tracker.alloc_ptr();
390 
391  (void) Kokkos::Impl::ViewDefaultConstruct< typename traits::execution_space , scalar_type , Alloc::Initialize >
392  ( m_ptr_on_device , Impl::capacity( m_array_shape , m_stride ) );
393  }
394 
395  //------------------------------------
396  // Assign an unmanaged View from pointer, can be called in functors.
397  // No alignment padding is performed.
398 
399  template< typename T >
400  View( T * ptr ,
401  const size_t n0 = 0 ,
402  const size_t n1 = 0 ,
403  const size_t n2 = 0 ,
404  const size_t n3 = 0 ,
405  const size_t n4 = 0 ,
406  const size_t n5 = 0 ,
407  const size_t n6 = 0 ,
408  typename Impl::enable_if<(
409  ( Impl::is_same<T,typename traits::value_type>::value ||
410  Impl::is_same<T,typename traits::const_value_type>::value ) &&
411  ! traits::is_managed ),
412  const size_t >::type n7 = 0 )
413  : m_ptr_on_device(ptr)
414  {
415  typedef typename traits::shape_type shape_type ;
416 
417  shape_type::assign( m_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
418  array_shape_type::assign( m_array_shape, n0, n1, n2, n3, n4, n5, n6, n7 );
419  stride_type::assign_no_padding( m_stride , m_shape );
420  m_storage_size = Impl::dimension( m_array_shape , unsigned(Rank) );
421  m_sacado_size = m_storage_size;
422  m_management.set_unmanaged();
423 
424  verify_dimension_storage_static_size();
425  }
426 
427  //------------------------------------
428  // Is not allocated
429 
430  KOKKOS_FORCEINLINE_FUNCTION
431  bool is_null() const { return 0 == m_ptr_on_device ; }
432 
433  //------------------------------------
434  //------------------------------------
435  // Scalar operator on traits::rank == 1
436 
437  typedef Impl::if_c< ( traits::rank == 1 ),
438  reference_type ,
439  Impl::ViewError::scalar_operator_called_from_non_scalar_view >
441 
442  KOKKOS_FORCEINLINE_FUNCTION
443  typename if_scalar_operator::type
444  operator()() const
445  {
446  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
447 
449  m_ptr_on_device ,
450  m_shape.N0 , 1 ) );
451  }
452 
453  //------------------------------------
454  //------------------------------------
455  // Array operators, traits::rank 2:
456 
457  template< typename iType0 >
458  KOKKOS_FORCEINLINE_FUNCTION
459  typename Impl::ViewEnableArrayOper< reference_type , traits, LayoutLeft, 2, iType0 >::type
460  operator() ( const iType0 & i0 ) const
461  {
462  KOKKOS_ASSERT_SHAPE_BOUNDS_2( m_shape, i0, 0 );
463  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
464 
465  // Strided storage
467  m_ptr_on_device + i0 ,
468  m_shape.N1 ,
469  m_stride.value ) );
470  }
471 
472  template< typename iType0 >
473  KOKKOS_FORCEINLINE_FUNCTION
474  typename Impl::ViewEnableArrayOper< reference_type ,
475  traits, LayoutRight, 2, iType0 >::type
476  operator() ( const iType0 & i0 ) const
477  {
478  KOKKOS_ASSERT_SHAPE_BOUNDS_2( m_shape, i0, 0 );
479  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
480 
481  // Contiguous storage with right-most index as the stokhos dimension
483  m_ptr_on_device + ( m_stride.value * i0 ) ,
484  m_shape.N1 , 1 ) );
485  }
486 
487  template< typename iType0 >
488  KOKKOS_FORCEINLINE_FUNCTION
489  typename Impl::ViewEnableArrayOper< reference_type , traits, typename traits::array_layout, 2, iType0 >::type
490  operator[] ( const iType0 & i0 ) const
491  { return operator()( i0 ); }
492 
493  template< typename iType0 >
494  KOKKOS_FORCEINLINE_FUNCTION
495  typename Impl::ViewEnableArrayOper< reference_type ,
496  traits, typename traits::array_layout, 2,
497  iType0 >::type
498  at( const iType0 & i0 , int , int , int , int , int , int , int ) const
499  { return operator()(i0); }
500 
501  //------------------------------------
502  //------------------------------------
503  // Array operators, traits::rank 3:
504 
505  template< typename iType0 , typename iType1 >
506  KOKKOS_FORCEINLINE_FUNCTION
507  typename Impl::ViewEnableArrayOper< reference_type ,
508  traits, LayoutLeft, 3, iType0, iType1 >::type
509  operator() ( const iType0 & i0 , const iType1 & i1 ) const
510  {
511  KOKKOS_ASSERT_SHAPE_BOUNDS_3( m_shape, i0, i1, 0 );
512  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
513 
514  // Strided storage with right-most index as the stokhos dimension
516  m_ptr_on_device + ( i0 + m_stride.value * ( i1 )),
517  m_shape.N2 ,
518  m_stride.value * m_shape.N1 ) );
519  }
520 
521  template< typename iType0 , typename iType1 >
522  KOKKOS_FORCEINLINE_FUNCTION
523  typename Impl::ViewEnableArrayOper< reference_type ,
524  traits, LayoutRight, 3, iType0, iType1 >::type
525  operator() ( const iType0 & i0 , const iType1 & i1 ) const
526  {
527  KOKKOS_ASSERT_SHAPE_BOUNDS_3( m_shape, i0, i1, 0);
528  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
529 
530  // Contiguous storage with right-most index as the stokhos dimension
532  m_ptr_on_device + ( m_storage_size * ( i1 ) + m_stride.value * i0 ) ,
533  m_shape.N2 , 1 ) );
534  }
535 
536  template< typename iType0 , typename iType1 >
537  KOKKOS_FORCEINLINE_FUNCTION
538  typename Impl::ViewEnableArrayOper< reference_type ,
539  traits, typename traits::array_layout, 3,
540  iType0, iType1 >::type
541  at( const iType0 & i0 , const iType1 & i1 , int , int , int , int , int , int ) const
542  { return operator()(i0,i1); }
543 
544  //------------------------------------
545  //------------------------------------
546  // Array operators, traits::rank 4:
547 
548  template< typename iType0 , typename iType1 , typename iType2 >
549  KOKKOS_FORCEINLINE_FUNCTION
550  typename Impl::ViewEnableArrayOper< reference_type ,
551  traits, LayoutLeft, 4, iType0, iType1, iType2 >::type
552  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 ) const
553  {
554  KOKKOS_ASSERT_SHAPE_BOUNDS_4( m_shape, i0, i1, i2, 0 );
555  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
556 
557  // Strided storage with right-most index as the stokhos dimension
559  m_ptr_on_device + ( i0 + m_stride.value * (
560  i1 + m_shape.N1 * (
561  i2 ))),
562  m_shape.N3 ,
563  m_stride.value * m_shape.N1 * m_shape.N2 ) );
564  }
565 
566  template< typename iType0 , typename iType1 , typename iType2 >
567  KOKKOS_FORCEINLINE_FUNCTION
568  typename Impl::ViewEnableArrayOper< reference_type ,
569  traits, LayoutRight, 4, iType0, iType1, iType2 >::type
570  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 ) const
571  {
572  KOKKOS_ASSERT_SHAPE_BOUNDS_4( m_shape, i0, i1, i2, 0 );
573  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
574 
575  // Contiguous storage with right-most index as the stokhos dimension
577  m_ptr_on_device + ( m_storage_size * ( i2 +
578  m_shape.N2 * ( i1 )) +
579  m_stride.value * i0 ) ,
580  m_shape.N3 , 1 ) );
581  }
582 
583  template< typename iType0 , typename iType1 , typename iType2 >
584  KOKKOS_FORCEINLINE_FUNCTION
585  typename Impl::ViewEnableArrayOper< reference_type ,
586  traits, typename traits::array_layout, 4,
587  iType0, iType1, iType2 >::type
588  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , int , int , int , int , int ) const
589  { return operator()(i0,i1,i2); }
590 
591  //------------------------------------
592  //------------------------------------
593  // Array operators, traits::rank 5:
594 
595  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 >
596  KOKKOS_FORCEINLINE_FUNCTION
597  typename Impl::ViewEnableArrayOper< reference_type ,
598  traits, LayoutLeft, 5, iType0, iType1, iType2, iType3 >::type
599  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ) const
600  {
601  KOKKOS_ASSERT_SHAPE_BOUNDS_5( m_shape, i0, i1, i2, i3, 0 );
602  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
603 
604  // Strided storage with right-most index as the stokhos dimension
606  m_ptr_on_device + ( i0 + m_stride.value * (
607  i1 + m_shape.N1 * (
608  i2 + m_shape.N2 * (
609  i3 )))),
610  m_shape.N4 ,
611  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 ) );
612  }
613 
614  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 >
615  KOKKOS_FORCEINLINE_FUNCTION
616  typename Impl::ViewEnableArrayOper< reference_type ,
617  traits, LayoutRight, 5, iType0, iType1, iType2, iType3 >::type
618  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ) const
619  {
620  KOKKOS_ASSERT_SHAPE_BOUNDS_5( m_shape, i0, i1, i2, i3, 0 );
621  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
622 
623  // Contiguous storage with right-most index as the stokhos dimension
625  m_ptr_on_device + ( m_storage_size * ( i3 +
626  m_shape.N3 * ( i2 +
627  m_shape.N2 * ( i1 ))) +
628  m_stride.value * i0 ) ,
629  m_shape.N4 , 1 ) );
630  }
631 
632  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 >
633  KOKKOS_FORCEINLINE_FUNCTION
634  typename Impl::ViewEnableArrayOper< reference_type ,
635  traits, typename traits::array_layout, 5,
636  iType0, iType1, iType2, iType3 >::type
637  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 , int , int , int , int ) const
638  { return operator()(i0,i1,i2,i3); }
639 
640  //------------------------------------
641  //------------------------------------
642  // Array operators, traits::rank 6:
643 
644  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 , typename iType4 >
645  KOKKOS_FORCEINLINE_FUNCTION
646  typename Impl::ViewEnableArrayOper< reference_type ,
647  traits, LayoutLeft, 6, iType0, iType1, iType2, iType3, iType4 >::type
648  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 , const iType4 & i4 ) const
649  {
650  KOKKOS_ASSERT_SHAPE_BOUNDS_6( m_shape, i0, i1, i2, i3, i4, 0 );
651  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
652 
653  // Strided storage with right-most index as the stokhos dimension
655  m_ptr_on_device + ( i0 + m_stride.value * (
656  i1 + m_shape.N1 * (
657  i2 + m_shape.N2 * (
658  i3 + m_shape.N3 * (
659  i4 ))))),
660  m_shape.N5 ,
661  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 * m_shape.N4 ) );
662  }
663 
664  template< typename iType0 , typename iType1 , typename iType2 ,
665  typename iType3 , typename iType4 >
666  KOKKOS_FORCEINLINE_FUNCTION
667  typename Impl::ViewEnableArrayOper< reference_type ,
668  traits, LayoutRight, 6, iType0, iType1, iType2, iType3, iType4 >::type
669  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
670  const iType4 & i4 ) const
671  {
672  KOKKOS_ASSERT_SHAPE_BOUNDS_6( m_shape, i0, i1, i2, i3, i4, 0 );
673  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
674 
675  // Contiguous storage with right-most index as the stokhos dimension
677  m_ptr_on_device + ( m_storage_size * ( i4 +
678  m_shape.N4 * ( i3 +
679  m_shape.N3 * ( i2 +
680  m_shape.N2 * ( i1 )))) +
681  m_stride.value * i0 ) ,
682  m_shape.N5 , 1 ) );
683  }
684 
685  template< typename iType0 , typename iType1 , typename iType2 ,
686  typename iType3 , typename iType4 >
687  KOKKOS_FORCEINLINE_FUNCTION
688  typename Impl::ViewEnableArrayOper< reference_type ,
689  traits, typename traits::array_layout, 6,
690  iType0, iType1, iType2, iType3, iType4 >::type
691  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
692  const iType4 & i4 , int , int , int ) const
693  { return operator()(i0,i1,i2,i3,i4); }
694 
695  //------------------------------------
696  //------------------------------------
697  // Array operators, traits::rank 7:
698 
699  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 , typename iType4 , typename iType5 >
700  KOKKOS_FORCEINLINE_FUNCTION
701  typename Impl::ViewEnableArrayOper< reference_type ,
702  traits, LayoutLeft, 7, iType0, iType1, iType2, iType3, iType4, iType5 >::type
703  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 ,
704  const iType3 & i3 , const iType4 & i4 , const iType5 & i5 ) const
705  {
706  KOKKOS_ASSERT_SHAPE_BOUNDS_7( m_shape, i0, i1, i2, i3, i4, i5, 0 );
707  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
708 
709  // Strided storage with right-most index as the stokhos dimension
711  m_ptr_on_device + ( i0 + m_stride.value * (
712  i1 + m_shape.N1 * (
713  i2 + m_shape.N2 * (
714  i3 + m_shape.N3 * (
715  i4 + m_shape.N4 * (
716  i5 )))))),
717  m_shape.N6 ,
718  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 * m_shape.N4 * m_shape.N5 ) );
719  }
720 
721  template< typename iType0 , typename iType1 , typename iType2 ,
722  typename iType3 , typename iType4 , typename iType5 >
723  KOKKOS_FORCEINLINE_FUNCTION
724  typename Impl::ViewEnableArrayOper< reference_type ,
725  traits, LayoutRight, 7, iType0, iType1, iType2, iType3, iType4, iType5 >::type
726  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
727  const iType4 & i4 , const iType5 & i5 ) const
728  {
729  KOKKOS_ASSERT_SHAPE_BOUNDS_7( m_shape, i0, i1, i2, i3, i4, i5, 0 );
730  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
731 
732  // Contiguous storage with right-most index as the stokhos dimension
734  m_ptr_on_device + ( m_storage_size * ( i5 +
735  m_shape.N5 * ( i4 +
736  m_shape.N4 * ( i3 +
737  m_shape.N3 * ( i2 +
738  m_shape.N2 * ( i1 ))))) +
739  m_stride.value * i0 ) ,
740  m_shape.N6 , 1 ) );
741  }
742 
743  template< typename iType0 , typename iType1 , typename iType2 ,
744  typename iType3 , typename iType4 , typename iType5 >
745  KOKKOS_FORCEINLINE_FUNCTION
746  typename Impl::ViewEnableArrayOper< reference_type ,
747  traits, typename traits::array_layout, 7,
748  iType0, iType1, iType2, iType3, iType4, iType5 >::type
749  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
750  const iType4 & i4 , const iType5 & i5 , int , int ) const
751  { return operator()(i0,i1,i2,i3,i4,i5); }
752 
753  //------------------------------------
754  //------------------------------------
755  // Array operators, traits::rank 8:
756 
757  template< typename iType0 , typename iType1 , typename iType2 , typename iType3 ,
758  typename iType4 , typename iType5 , typename iType6 >
759  KOKKOS_FORCEINLINE_FUNCTION
760  typename Impl::ViewEnableArrayOper< reference_type ,
761  traits, LayoutLeft, 8, iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type
762  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
763  const iType4 & i4 , const iType5 & i5 , const iType6 & i6 ) const
764  {
765  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
766  KOKKOS_ASSERT_SHAPE_BOUNDS_8( m_shape, i0, i1, i2, i3, i4, i5, i6, 0 );
767 
768  // Strided storage with right-most index as the stokhos dimension
770  m_ptr_on_device + ( i0 + m_stride.value * (
771  i1 + m_shape.N1 * (
772  i2 + m_shape.N2 * (
773  i3 + m_shape.N3 * (
774  i4 + m_shape.N4 * (
775  i5 + m_shape.N5 * (
776  i6 ))))))),
777  m_shape.N7 ,
778  m_stride.value * m_shape.N1 * m_shape.N2 * m_shape.N3 * m_shape.N4 * m_shape.N5 * m_shape.N6 ) );
779  }
780 
781  template< typename iType0 , typename iType1 , typename iType2 ,
782  typename iType3 , typename iType4 , typename iType5, typename iType6 >
783  KOKKOS_FORCEINLINE_FUNCTION
784  typename Impl::ViewEnableArrayOper< reference_type ,
785  traits, LayoutRight, 8, iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type
786  operator() ( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
787  const iType4 & i4 , const iType5 & i5 , const iType6 & i6 ) const
788  {
789  KOKKOS_ASSERT_SHAPE_BOUNDS_8( m_shape, i0, i1, i2, i3, i4, i5, i6, 0 );
790  KOKKOS_RESTRICT_EXECUTION_TO_DATA( typename traits::memory_space , m_ptr_on_device );
791 
792  // Contiguous storage with right-most index as the stokhos dimension
794  m_ptr_on_device + ( m_storage_size * ( i6 +
795  m_shape.N6 * ( i5 +
796  m_shape.N5 * ( i4 +
797  m_shape.N4 * ( i3 +
798  m_shape.N3 * ( i2 +
799  m_shape.N2 * ( i1 )))))) +
800  m_stride.value * i0 ) ,
801  m_shape.N7 , 1 ) );
802  }
803 
804  template< typename iType0 , typename iType1 , typename iType2 ,
805  typename iType3 , typename iType4 , typename iType5, typename iType6 >
806  KOKKOS_FORCEINLINE_FUNCTION
807  typename Impl::ViewEnableArrayOper< reference_type ,
808  traits, typename traits::array_layout, 8,
809  iType0, iType1, iType2, iType3, iType4, iType5, iType6 >::type
810  at( const iType0 & i0 , const iType1 & i1 , const iType2 & i2 , const iType3 & i3 ,
811  const iType4 & i4 , const iType5 & i5 , const iType6 & i6 , int ) const
812  { return operator()(i0,i1,i2,i3,i4,i5,i6); }
813 
814  //------------------------------------
815  // Access to the underlying contiguous storage of this view specialization.
816  // These methods are specific to specialization of a view.
817 
818  KOKKOS_FORCEINLINE_FUNCTION
820  data() const { return m_ptr_on_device ; }
821 
822  // Stride of physical storage, dimensioned to at least Rank
823  template< typename iType >
824  KOKKOS_FORCEINLINE_FUNCTION
825  void stride( iType * const s ) const
826  { Impl::stride( s , m_array_shape , m_stride ); }
827 
828  // Count of contiguously allocated data members including padding.
829  KOKKOS_FORCEINLINE_FUNCTION
830  typename traits::size_type capacity() const
831  { return Impl::capacity( m_array_shape , m_stride ); }
832 
833  // Static storage size
834  KOKKOS_FORCEINLINE_FUNCTION
835  typename traits::size_type sacado_size() const
836  { return m_sacado_size.value; }
837 };
838 
842 template< class DT , class DL , class DD , class DM ,
843  class ST , class SL , class SD , class SM >
844 inline
845 void deep_copy( const View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced> & dst ,
846  const View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced> & src ,
847  typename Impl::enable_if<(
848  Impl::is_same< typename View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced>::intinsic_scalar_type ,
849  typename View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced>::intinsic_scalar_type >::value
850  &&
851  Impl::is_same< typename View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced>::array_layout ,
852  typename View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced>::array_layout >::value
853  &&
854  ( unsigned(View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced>::rank) ==
855  unsigned(View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced>::rank) )
856  )>::type * = 0 )
857 {
858  typedef View<DT,DL,DD,DM,Impl::ViewMPVectorInterlaced> dst_type ;
859  typedef View<ST,SL,SD,SM,Impl::ViewMPVectorInterlaced> src_type ;
860 
861  typedef typename dst_type::memory_space dst_memory_space ;
862  typedef typename src_type::memory_space src_memory_space ;
863 
864  if ( dst.data() != src.data() ) {
865 
866  Impl::assert_shapes_are_equal( dst.shape() , src.shape() );
867 
868  const size_t nbytes = sizeof(typename dst_type::value_type::storage_type::value_type) * dst.span();
869 
870  Impl::DeepCopy< dst_memory_space , src_memory_space >( dst.data() , src.data() , nbytes );
871  }
872 }
873 
874 } // namespace Kokkos
875 
876 //----------------------------------------------------------------------------
877 //----------------------------------------------------------------------------
878 
879 namespace Kokkos {
880 namespace Impl {
881 
888 template< class StorageType >
889 struct AnalyzeShape< Sacado::MP::Vector< StorageType > >
890  : Shape< sizeof(Sacado::MP::Vector< StorageType >) , 0 > // Treat as a scalar
891 {
892 private:
893 
894  typedef AnalyzeShape< typename StorageType::value_type > nested ;
895 
896 public:
897 
899 
900  typedef Shape< sizeof(Sacado::MP::Vector< StorageType >) , 0 > shape ;
901 
902  // If ( ! StorageType::is_static ) then 0 == StorageType::static_size and the first array declaration is not used.
903  // However, the compiler will still generate this type declaration and it must not have a zero length.
904  typedef typename
905  if_c< StorageType::is_static
906  , typename nested::array_intrinsic_type [ StorageType::is_static ? StorageType::static_size : 1 ]
907  , typename nested::array_intrinsic_type *
909 
910  typedef typename
911  if_c< StorageType::is_static
912  , typename nested::const_array_intrinsic_type [ StorageType::is_static ? StorageType::static_size : 1 ]
913  , typename nested::const_array_intrinsic_type *
915 
917 
921 
925 };
926 
927 //----------------------------------------------------------------------------
928 
929 template<>
930 struct ViewAssignment< ViewMPVectorInterlaced , ViewMPVectorInterlaced , void >
931 {
932  typedef ViewMPVectorContiguous specialize ;
933 
934  //------------------------------------
937  template< class DT , class DL , class DD , class DM ,
938  class ST , class SL , class SD , class SM >
939  KOKKOS_INLINE_FUNCTION
940  ViewAssignment( View<DT,DL,DD,DM,specialize> & dst
941  , const View<ST,SL,SD,SM,specialize> & src
942  , const typename enable_if<(
943  ViewAssignable< ViewTraits<DT,DL,DD,DM> ,
944  ViewTraits<ST,SL,SD,SM> >::value
945  )>::type * = 0
946  )
947  {
948  typedef ViewTraits<DT,DL,DD,DM> dst_traits ;
949  typedef View<DT,DL,DD,DM,specialize> dst_type ;
950  typedef typename dst_type::shape_type shape_type ;
951  typedef typename dst_type::array_shape_type array_shape_type ;
952  typedef typename dst_type::stride_type stride_type ;
953 
954  shape_type::assign( dst.m_shape,
955  src.m_shape.N0 , src.m_shape.N1 , src.m_shape.N2 , src.m_shape.N3 ,
956  src.m_shape.N4 , src.m_shape.N5 , src.m_shape.N6 , src.m_shape.N7 );
957  array_shape_type::assign( dst.m_array_shape,
958  src.m_array_shape.N0 , src.m_array_shape.N1 , src.m_array_shape.N2 , src.m_array_shape.N3 ,
959  src.m_array_shape.N4 , src.m_array_shape.N5 , src.m_array_shape.N6 , src.m_array_shape.N7 );
960 
961  stride_type::assign( dst.m_stride , src.m_stride.value );
962  dst.m_ptr_on_device = src.m_ptr_on_device ;
963  dst.m_storage_size = src.m_storage_size ;
964  dst.m_sacado_size = src.m_sacado_size ;
965  dst.m_tracker = src.m_tracker ;
966  }
967 
968  //------------------------------------
971  template< class DT , class DL , class DD , class DM ,
972  class ST , class SL , class SD , class SM >
973  KOKKOS_INLINE_FUNCTION
974  ViewAssignment( View<DT,DL,DD,DM,specialize> & dst
975  , const View<ST,SL,SD,SM,specialize> & src
976  , typename enable_if<(
977  // Same intrinsic scalar type
978  is_same< typename View<DT,DL,DD,DM,specialize>::intrinsic_scalar_type ,
979  typename View<ST,SL,SD,SM,specialize>::intrinsic_scalar_type >::value
980  &&
981  // Same memory space
982  is_same< typename View<DT,DL,DD,DM,specialize>::memory_space ,
983  typename View<ST,SL,SD,SM,specialize>::memory_space >::value
984  &&
985  // Same layout
986  is_same< typename View<DT,DL,DD,DM,specialize>::array_layout ,
987  typename View<ST,SL,SD,SM,specialize>::array_layout >::value
988  &&
989  // Same rank
990  ( unsigned(View<DT,DL,DD,DM,specialize>::Rank) ==
991  unsigned(View<ST,SL,SD,SM,specialize>::Rank) )
992  &&
993  // Destination is not managed
994  ! View<DT,DL,DD,DM,specialize>::is_managed
995  ), const Sacado::MP::VectorPartition & >::type part )
996  {
997  typedef ViewTraits<DT,DL,DD,DM> dst_traits ;
998  typedef View<DT,DL,DD,DM,specialize> dst_type ;
999  typedef typename dst_type::shape_type dst_shape_type ;
1000  typedef typename dst_type::array_shape_type dst_array_shape_type ;
1001  typedef typename dst_type::stride_type dst_stride_type ;
1002  typedef typename dst_traits::value_type dst_sacado_mp_vector_type ;
1003  typedef typename dst_sacado_mp_vector_type::storage_type dst_stokhos_storage_type ;
1004 
1005  enum { DstRank = dst_type::Rank };
1006  enum { DstStaticLength = dst_stokhos_storage_type::static_size };
1007 
1008  const int length = part.end - part.begin ;
1009 
1010  if ( DstStaticLength && DstStaticLength != length ) {
1011  Kokkos::abort("Kokkos::View< Sacado::MP::Vector ... > incompatible partitioning");
1012  }
1013 
1014  unsigned dims[8];
1015  dims[0] = src.m_array_shape.N0;
1016  dims[1] = src.m_array_shape.N1;
1017  dims[2] = src.m_array_shape.N2;
1018  dims[3] = src.m_array_shape.N3;
1019  dims[4] = src.m_array_shape.N4;
1020  dims[5] = src.m_array_shape.N5;
1021  dims[6] = src.m_array_shape.N6;
1022  dims[7] = src.m_array_shape.N7;
1023  unsigned rank = dst_type::Rank;
1024 
1025  dst_shape_type::assign( dst.m_shape,
1026  dims[0] , dims[1] , dims[2] , dims[3] ,
1027  dims[4] , dims[5] , dims[6] , dims[7] );
1028 
1029  dims[rank] = length;
1030  dst_array_shape_type::assign( dst.m_array_shape,
1031  dims[0] , dims[1] , dims[2] , dims[3] ,
1032  dims[4] , dims[5] , dims[6] , dims[7] );
1033 
1034  dst_stride_type::assign( dst.m_stride , src.m_stride.value );
1035 
1036  // Original Sacado::MP::Vector length
1037  dst.m_storage_size = src.m_storage_size ;
1038  dst.m_sacado_size = length;
1039 
1040  if ( Impl::is_same< typename dst_traits::array_layout , LayoutLeft >::value ) {
1041  dst.m_ptr_on_device = src.m_ptr_on_device + part.begin *
1042  ( 0 == DstRank ? 1 : dst.m_stride.value * (
1043  ( 1 == DstRank ? 1 : dst.m_shape.N1 * (
1044  ( 2 == DstRank ? 1 : dst.m_shape.N2 * (
1045  ( 3 == DstRank ? 1 : dst.m_shape.N3 * (
1046  ( 4 == DstRank ? 1 : dst.m_shape.N4 * (
1047  ( 5 == DstRank ? 1 : dst.m_shape.N5 * (
1048  ( 6 == DstRank ? 1 : dst.m_shape.N6 )))))))))))));
1049  }
1050  else { // if ( Impl::is_same< typename traits::array_layout , LayoutRight >::value )
1051  dst.m_ptr_on_device = src.m_ptr_on_device + part.begin ;
1052  }
1053  dst.m_tracker = src.m_tracker ;
1054  }
1055 };
1056 
1057 template<>
1058 struct ViewAssignment< ViewDefault , ViewMPVectorInterlaced , void >
1059 {
1060  //------------------------------------
1063  template< class ST , class SL , class SD , class SM >
1064  KOKKOS_INLINE_FUNCTION
1065  ViewAssignment( typename View<ST,SL,SD,SM,ViewMPVectorInterlaced>::array_type & dst
1066  , const View<ST,SL,SD,SM,ViewMPVectorInterlaced> & src )
1067  {
1068  typedef View<ST,SL,SD,SM,ViewMPVectorInterlaced> src_type ;
1069  typedef typename src_type::value_type src_sacado_mp_vector_type ;
1070  typedef typename src_sacado_mp_vector_type::storage_type src_stokhos_storage_type ;
1071 
1072  typedef typename src_type::array_type dst_type ;
1073  typedef typename dst_type::shape_type dst_shape_type ;
1074  typedef typename dst_type::stride_type dst_stride_type ;
1075 
1076  dst_shape_type::assign( dst.m_shape,
1077  src.m_array_shape.N0 , src.m_array_shape.N1 , src.m_array_shape.N2 , src.m_arrat_shape.N3 ,
1078  src.m_array_shape.N4 , src.m_array_shape.N5 , src.m_arrat_shape.N6 , src.m_arrat_shape.N7 );
1079 
1080  dst_stride_type::assign( dst.m_stride , src.m_stride.value );
1081 
1082  dst.m_ptr_on_device = reinterpret_cast< typename dst_type::value_type *>( src.m_ptr_on_device );
1083 
1084  dst.m_tracker = src.m_tracker ;
1085  }
1086 };
1087 
1088 //----------------------------------------------------------------------------
1089 //----------------------------------------------------------------------------
1090 
1091 } // namespace Impl
1092 
1093 } // namespace Kokkos
1094 
1095 //----------------------------------------------------------------------------
1096 //----------------------------------------------------------------------------
1097 
1098 #endif /* #ifndef KOKKOS_VIEW_MP_VECTOR_HPP */
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
View< typename traits::const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > const_type
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.
View< typename traits::array_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > array_type
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.
if_c< 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::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
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, 2, iType0 >::type at(const iType0 &i0, int, int, int, int, int, int, int) const
Impl::if_c< traits::is_managed, std::string, Impl::ViewError::allocation_constructor_requires_managed > if_allocation_constructor
KOKKOS_FORCEINLINE_FUNCTION traits::value_type::storage_type::value_type * data() 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, 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
KOKKOS_INLINE_FUNCTION void verify_dimension_storage_size(const typename traits::execution_space &) const
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)
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
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
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_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
View< typename traits::const_array_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits > const_array_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_FORCEINLINE_FUNCTION traits::size_type dimension(const iType &i) const
if_c< 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
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)
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
Impl::if_c< (traits::rank==1), reference_type, Impl::ViewError::scalar_operator_called_from_non_scalar_view > if_scalar_operator