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.
 
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::MaxTensorComponentsarguments_
 
Kokkos::Array< ordinal_type, Parameters::MaxTensorComponentsbounds_
 
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 62 of file Intrepid2_TensorArgumentIterator.hpp.

Constructor & Destructor Documentation

◆ TensorArgumentIterator() [1/4]

template<class Scalar , typename ExecSpaceType >
KOKKOS_INLINE_FUNCTION Intrepid2::TensorArgumentIterator::TensorArgumentIterator ( const TensorData< Scalar, ExecSpaceType > &  tensorData,
const ordinal_type  argumentOrdinal 
)
inline

Definition at line 69 of file Intrepid2_TensorArgumentIterator.hpp.

◆ TensorArgumentIterator() [2/4]

template<class Scalar , typename ExecSpaceType >
KOKKOS_INLINE_FUNCTION Intrepid2::TensorArgumentIterator::TensorArgumentIterator ( const TensorData< Scalar, ExecSpaceType > &  tensorData,
const ordinal_type  argumentOrdinal,
const ordinal_type  numTensorComponents 
)
inline

Variant that allows truncation of the tensor components at the specified number of components.

Definition at line 83 of file Intrepid2_TensorArgumentIterator.hpp.

References Intrepid2::Data< DataScalar, DeviceType >::extent_int(), and Intrepid2::TensorData< Scalar, DeviceType >::getTensorComponent().

◆ TensorArgumentIterator() [3/4]

Intrepid2::TensorArgumentIterator::TensorArgumentIterator ( const std::vector< ordinal_type >  tensorComponentBounds)
inline

Basic constructor in which only the bounds of the tensor components are required.

Definition at line 95 of file Intrepid2_TensorArgumentIterator.hpp.

◆ TensorArgumentIterator() [4/4]

template<size_t rank>
KOKKOS_INLINE_FUNCTION Intrepid2::TensorArgumentIterator::TensorArgumentIterator ( const Kokkos::Array< ordinal_type, rank > &  tensorComponentBounds)
inline

Basic constructor in which only the bounds of the tensor components are required.

Definition at line 109 of file Intrepid2_TensorArgumentIterator.hpp.

Member Function Documentation

◆ argument()

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 150 of file Intrepid2_TensorArgumentIterator.hpp.

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

◆ copyArguments()

KOKKOS_INLINE_FUNCTION void Intrepid2::TensorArgumentIterator::copyArguments ( TensorArgumentIterator otherArgumentIterator,
const ordinal_type &  r0_from,
const ordinal_type &  r0_to,
const ordinal_type &  numArguments 
)
inline

Sets a subset of this iterator's component arguments to match the component arguments from otherArgumentIterator.

Definition at line 255 of file Intrepid2_TensorArgumentIterator.hpp.

References argument().

◆ enumerationIndex()

KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorArgumentIterator::enumerationIndex ( ) const
inline

Note: enumerationIndex() matches the ordering in TensorData. This is different from the order in which this iterator proceeds through the tensor arguments.

Definition at line 156 of file Intrepid2_TensorArgumentIterator.hpp.

Referenced by setEnumerationIndex().

◆ increment()

KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorArgumentIterator::increment ( )
inline

Proceed to next entry.

Definition at line 121 of file Intrepid2_TensorArgumentIterator.hpp.

◆ nextIncrementResult()

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 137 of file Intrepid2_TensorArgumentIterator.hpp.

◆ relativeEnumerationIndex()

KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorArgumentIterator::relativeEnumerationIndex ( const ordinal_type &  startingComponent) const
inline

Note: relativeEnumerationIndex() matches the ordering in TensorData. This is different from the order in which this iterator proceeds through the tensor arguments.

Definition at line 181 of file Intrepid2_TensorArgumentIterator.hpp.

◆ relativeEnumerationSpan()

KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorArgumentIterator::relativeEnumerationSpan ( const ordinal_type &  startingComponent) const
inline

total number of enumeration indices with arguments prior to the startingComponent fixed

Definition at line 206 of file Intrepid2_TensorArgumentIterator.hpp.

◆ reset()

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 219 of file Intrepid2_TensorArgumentIterator.hpp.

◆ setArgumentForComponent()

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 231 of file Intrepid2_TensorArgumentIterator.hpp.

◆ setEnumerationIndex()

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 242 of file Intrepid2_TensorArgumentIterator.hpp.

References enumerationIndex().

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

Member Data Documentation

◆ arguments_

Kokkos::Array<ordinal_type,Parameters::MaxTensorComponents> Intrepid2::TensorArgumentIterator::arguments_
private

Definition at line 63 of file Intrepid2_TensorArgumentIterator.hpp.

◆ bounds_

Kokkos::Array<ordinal_type,Parameters::MaxTensorComponents> Intrepid2::TensorArgumentIterator::bounds_
private

Definition at line 64 of file Intrepid2_TensorArgumentIterator.hpp.

◆ numTensorComponents_

ordinal_type Intrepid2::TensorArgumentIterator::numTensorComponents_
private

Definition at line 65 of file Intrepid2_TensorArgumentIterator.hpp.


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