Intrepid2
Public Member Functions | Private Attributes | List of all members
Intrepid2::TensorArgumentIterator Class Reference

Allows systematic enumeration of all entries in a TensorData object, tracking indices for each tensor component. More...

#include <Intrepid2_TensorArgumentIterator.hpp>

Public Member Functions

template<class Scalar , typename ExecSpaceType >
KOKKOS_INLINE_FUNCTION TensorArgumentIterator (const TensorData< Scalar, ExecSpaceType > &tensorData, const ordinal_type argumentOrdinal)
 
template<class Scalar , typename ExecSpaceType >
KOKKOS_INLINE_FUNCTION TensorArgumentIterator (const TensorData< Scalar, ExecSpaceType > &tensorData, const ordinal_type argumentOrdinal, const ordinal_type numTensorComponents)
 Variant that allows truncation of the tensor components at the specified number of components.
 
 TensorArgumentIterator (const std::vector< ordinal_type > tensorComponentBounds)
 Basic constructor in which only the bounds of the tensor components are required.
 
template<size_t rank>
KOKKOS_INLINE_FUNCTION TensorArgumentIterator (const Kokkos::Array< ordinal_type, rank > &tensorComponentBounds)
 Basic constructor in which only the bounds of the tensor components are required.
 
KOKKOS_INLINE_FUNCTION ordinal_type increment ()
 Proceed to next entry.
 
KOKKOS_INLINE_FUNCTION ordinal_type nextIncrementResult () const
 
KOKKOS_INLINE_FUNCTION const
ordinal_type & 
argument (const ordinal_type &r) const
 
KOKKOS_INLINE_FUNCTION ordinal_type enumerationIndex () const
 Note: enumerationIndex() matches the ordering in TensorData. This is different from the order in which this iterator proceeds through the tensor arguments.
 
KOKKOS_INLINE_FUNCTION ordinal_type relativeEnumerationIndex (const ordinal_type &startingComponent) const
 Note: relativeEnumerationIndex() matches the ordering in TensorData. This is different from the order in which this iterator proceeds through the tensor arguments.
 
KOKKOS_INLINE_FUNCTION ordinal_type relativeEnumerationSpan (const ordinal_type &startingComponent) const
 total number of enumeration indices with arguments prior to the startingComponent fixed
 
KOKKOS_INLINE_FUNCTION void reset (ordinal_type from_component_number=0)
 
KOKKOS_INLINE_FUNCTION void setArgumentForComponent (const ordinal_type &r, const ordinal_type &i)
 
KOKKOS_INLINE_FUNCTION void setEnumerationIndex (const ordinal_type &enumerationIndex)
 Sets the enumeration index; this refers to a 1D enumeration of the possible in-bound arguments. More...
 
KOKKOS_INLINE_FUNCTION void copyArguments (TensorArgumentIterator &otherArgumentIterator, const ordinal_type &r0_from, const ordinal_type &r0_to, const ordinal_type &numArguments)
 Sets a subset of this iterator's component arguments to match the component arguments from otherArgumentIterator.
 

Private Attributes

Kokkos::Array< ordinal_type,
Parameters::MaxTensorComponents
arguments_
 
Kokkos::Array< ordinal_type,
Parameters::MaxTensorComponents
bounds_
 
ordinal_type numTensorComponents_
 

Detailed Description

Allows systematic enumeration of all entries in a TensorData object, tracking indices for each tensor component.

For example, you might have a 3D basis that is the product of 3 1D bases. The components might have shape (F_d,P_d), with N_F_d and N_P_d as the extents for each. If we think of the tensor container as having shape (F,P), then F = N_F_0 * N_F_1 * N_F_2, and P = N_P_0 * N_P_1 * N_P_2. TensorArgumentIterator lets you say that you want to iterate through all the point indices. When you want to move to the next point, call increment(); this will return the index of the most significant component whose argument changed. (Component indices that are greater than this one may also have had their argument changed; lower-indexed components will have stayed the same.)

Definition at line 28 of file Intrepid2_TensorArgumentIterator.hpp.

Member Function Documentation

KOKKOS_INLINE_FUNCTION const ordinal_type& Intrepid2::TensorArgumentIterator::argument ( const ordinal_type &  r) const
inline
Parameters
[in]r- component whose argument is being requested.
Returns
the current index into component r.

Definition at line 116 of file Intrepid2_TensorArgumentIterator.hpp.

Referenced by copyArguments(), and Intrepid2::IntegrationTools< DeviceType >::integrate().

KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorArgumentIterator::nextIncrementResult ( ) const
inline
Returns
the least tensor component ordinal whose index will change on next increment (-1 if next increment will go out of bounds)

Definition at line 103 of file Intrepid2_TensorArgumentIterator.hpp.

KOKKOS_INLINE_FUNCTION void Intrepid2::TensorArgumentIterator::reset ( ordinal_type  from_component_number = 0)
inline

Resets the location to index 0 in each dimension, starting from the specified dimension.

Parameters
[in]from_rank_number- the first dimension in which to set the index to 0.

Definition at line 185 of file Intrepid2_TensorArgumentIterator.hpp.

KOKKOS_INLINE_FUNCTION void Intrepid2::TensorArgumentIterator::setArgumentForComponent ( const ordinal_type &  r,
const ordinal_type &  i 
)
inline

Sets the current argument in the specified component.

Parameters
[in]r- the component index
[in]i- the argument to set for component r< >

Definition at line 197 of file Intrepid2_TensorArgumentIterator.hpp.

KOKKOS_INLINE_FUNCTION void Intrepid2::TensorArgumentIterator::setEnumerationIndex ( const ordinal_type &  enumerationIndex)
inline

Sets the enumeration index; this refers to a 1D enumeration of the possible in-bound arguments.

Parameters
[in]enumerationIndex- the index to corresponding to the arguments to set.
See Also
enumerationIndex()
Note
WARNING: this method does not have any tests against it. We should add a test.

Definition at line 208 of file Intrepid2_TensorArgumentIterator.hpp.

References enumerationIndex().

Referenced by Intrepid2::IntegrationTools< DeviceType >::integrate().


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