Intrepid2
Public Types | Public Member Functions | Protected Attributes | List of all members
Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType > Class Template Reference

A helper class that allows iteration over three Kokkos Views simultaneously, according to tensor combination rules: More...

#include <Intrepid2_TensorViewIterator.hpp>

Public Types

enum  RankCombinationType { DIMENSION_MATCH, TENSOR_PRODUCT, TENSOR_CONTRACTION }
 

Public Member Functions

KOKKOS_INLINE_FUNCTION TensorViewIterator (TensorViewType tensor_view, ViewType1 view1, ViewType2 view2, Kokkos::vector< RankCombinationType > rank_combination_types)
 Constructor. More...
 
KOKKOS_INLINE_FUNCTION int nextIncrementRank ()
 
KOKKOS_INLINE_FUNCTION int increment ()
 
KOKKOS_INLINE_FUNCTION void setLocation (const Kokkos::Array< int, 7 > location)
 
KOKKOS_INLINE_FUNCTION void setLocation (Kokkos::Array< int, 7 > location1, Kokkos::Array< int, 7 > location2)
 
KOKKOS_INLINE_FUNCTION ScalarType getView1Entry ()
 
KOKKOS_INLINE_FUNCTION ScalarType getView2Entry ()
 
KOKKOS_INLINE_FUNCTION void set (ScalarType value)
 

Protected Attributes

ViewIterator< TensorViewType,
ScalarType > 
tensor_view_iterator_
 
ViewIterator< ViewType1,
ScalarType > 
view1_iterator_
 
ViewIterator< ViewType2,
ScalarType > 
view2_iterator_
 
Kokkos::vector
< RankCombinationType > 
rank_combination_types_
 

Detailed Description

template<class TensorViewType, class ViewType1, class ViewType2, typename ScalarType>
class Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >

A helper class that allows iteration over three Kokkos Views simultaneously, according to tensor combination rules:

    - component view 1,
    - component view 2, and
    - the combination tensor view
See Also
Intrepid2::ViewIterator
Remarks
This class is under active development; its interface should be understood to be in flux. Furthermore, this may eventually move to another Trilinos package.

Definition at line 73 of file Intrepid2_TensorViewIterator.hpp.

Constructor & Destructor Documentation

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::TensorViewIterator ( TensorViewType  tensor_view,
ViewType1  view1,
ViewType2  view2,
Kokkos::vector< RankCombinationType >  rank_combination_types 
)
inline

Constructor.

Parameters
[in]tensor_view- the view that stores the tensor combination
[in]view1- first component view
[in]view2- second component view
[in]rank_combination_types- vector with length equal to the maximum rank of the views provided, specifying how component views should be combined to produce tensor view. rank_combination_types entries can be as follows:
  • DIMENSION_MATCH: component views and tensor view all have same extent in this rank, and should iterate in tandem.
  • TENSOR_PRODUCT: if component views have extents a and b in this rank, the tensor view has extent a*b.
  • TENSOR_CONTRACTION: component views have matching extents in this rank; tensor view has extent 1.

For TENSOR_PRODUCT combinations in a given rank, view1 increments first. For example, if view1 has entries [x,y] and view2 has entries [0,1] in a given TENSOR_PRODUCT rank, there will be four entries in the tensor_view, in the following order:

  • (x,0)
  • (y,0)
  • (x,1)
  • (y,1)

Tensor contractions are only allowed in the final dimension(s); if rank d has a TENSOR_CONTRACTION entry, then all subsequent ranks must also contract.

Definition at line 110 of file Intrepid2_TensorViewIterator.hpp.

Member Function Documentation

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION ScalarType Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::getView1Entry ( )
inline

Getter for view1.

Returns
the value at the current location in view1

Definition at line 289 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::get().

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION ScalarType Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::getView2Entry ( )
inline

Getter for view1.

Returns
the value at the current location in view2

Definition at line 297 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::get().

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION int Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::increment ( )
inline

Move to the next location. Note that during contractions, the tensor view location will not change; the returned rank corresponds to the other two views in that case.

Returns
the rank of the leftmost index that was changed in any of the views; -1 if increment reached the end of the views

Definition at line 181 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::increment(), Intrepid2::ViewIterator< ViewType, ScalarType >::nextIncrementRank(), and Intrepid2::ViewIterator< ViewType, ScalarType >::reset().

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION int Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::nextIncrementRank ( )
inline
Returns
the leftmost rank ordinal whose index will change on next increment in any of the views (-1 if next increment will go out of bounds)

Definition at line 170 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::nextIncrementRank().

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION void Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::set ( ScalarType  value)
inline

Setter for tensor view.

Parameters
[in]value- the value to set in the tensor view

Definition at line 305 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::set().

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION void Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::setLocation ( const Kokkos::Array< int, 7 >  location)
inline

Sets the current location in all three views to the specified location.

Parameters
[in]location- the location as a 7-element array value.

Definition at line 231 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::setLocation().

template<class TensorViewType , class ViewType1 , class ViewType2 , typename ScalarType >
KOKKOS_INLINE_FUNCTION void Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::setLocation ( Kokkos::Array< int, 7 >  location1,
Kokkos::Array< int, 7 >  location2 
)
inline

Sets the current location in the two component views to the specified locations, and sets the tensor view location to the location corresponding to the two component locations.

Parameters
[in]location1- the location in view1 as a 7-element array value.
[in]location2- the location in view2 as a 7-element array value.

Definition at line 242 of file Intrepid2_TensorViewIterator.hpp.

References Intrepid2::ViewIterator< ViewType, ScalarType >::getExtent(), and Intrepid2::ViewIterator< ViewType, ScalarType >::setLocation().


The documentation for this class was generated from the following file: