15 #ifndef Intrepid2_TensorArgumentIterator_h
16 #define Intrepid2_TensorArgumentIterator_h
29 Kokkos::Array<ordinal_type,Parameters::MaxTensorComponents> arguments_;
30 Kokkos::Array<ordinal_type,Parameters::MaxTensorComponents> bounds_;
31 ordinal_type numTensorComponents_;
33 template<
class Scalar,
typename ExecSpaceType>
34 KOKKOS_INLINE_FUNCTION
39 for (ordinal_type r=0; r<numTensorComponents_; r++)
47 template<
class Scalar,
typename ExecSpaceType>
48 KOKKOS_INLINE_FUNCTION
51 numTensorComponents_(numTensorComponents)
53 for (ordinal_type r=0; r<numTensorComponents_; r++)
63 numTensorComponents_(tensorComponentBounds.size())
65 for (ordinal_type r=0; r<numTensorComponents_; r++)
68 bounds_[r] = tensorComponentBounds[r];
74 KOKKOS_INLINE_FUNCTION
77 numTensorComponents_(rank)
79 for (ordinal_type r=0; r<rank; r++)
82 bounds_[r] = tensorComponentBounds[r];
89 ordinal_type r = numTensorComponents_ - 1;
90 while (arguments_[r] + 1 >= bounds_[r])
96 if (r >= 0) ++arguments_[r];
102 KOKKOS_INLINE_FUNCTION
105 ordinal_type r = numTensorComponents_ - 1;
106 while (arguments_[r] + 1 >= bounds_[r])
116 KOKKOS_INLINE_FUNCTION
const ordinal_type &
argument(
const ordinal_type &r)
const
118 return arguments_[r];
137 for (ordinal_type r=numTensorComponents_-1; r>0; r--)
162 for (ordinal_type r=numTensorComponents_-1; r>startingComponent; r--)
167 i += arguments_[startingComponent];
175 for (ordinal_type r=startingComponent; r<numTensorComponents_; r++)
184 KOKKOS_INLINE_FUNCTION
185 void reset(ordinal_type from_component_number=0)
187 for (ordinal_type r=from_component_number; r<numTensorComponents_; r++)
196 KOKKOS_INLINE_FUNCTION
207 KOKKOS_INLINE_FUNCTION
211 for (ordinal_type d=0; d<numTensorComponents_; d++)
213 arguments_[d] = remainder % bounds_[d];
214 remainder /= bounds_[d];
220 KOKKOS_INLINE_FUNCTION
221 void copyArguments(TensorArgumentIterator &otherArgumentIterator,
const ordinal_type &r0_from,
const ordinal_type &r0_to,
const ordinal_type &numArguments)
223 for (ordinal_type i=0; i<numArguments; i++)
225 arguments_[r0_to + i] = otherArgumentIterator.
argument(r0_from + i);
KOKKOS_INLINE_FUNCTION const ordinal_type & argument(const ordinal_type &r) const
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...
KOKKOS_INLINE_FUNCTION ordinal_type nextIncrementResult() const
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 otherArgum...
TensorArgumentIterator(const std::vector< ordinal_type > tensorComponentBounds)
Basic constructor in which only the bounds of the tensor components are required. ...
KOKKOS_INLINE_FUNCTION void setArgumentForComponent(const ordinal_type &r, const ordinal_type &i)
KOKKOS_INLINE_FUNCTION ordinal_type enumerationIndex() const
Note: enumerationIndex() matches the ordering in TensorData. This is different from the order in whic...
KOKKOS_INLINE_FUNCTION const Data< Scalar, DeviceType > & getTensorComponent(const ordinal_type &r) const
Returns the requested tensor component.
KOKKOS_INLINE_FUNCTION void reset(ordinal_type from_component_number=0)
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 void setEnumerationIndex(const ordinal_type &enumerationIndex)
Sets the enumeration index; this refers to a 1D enumeration of the possible in-bound arguments...
Contains definitions of custom data types in Intrepid2.
KOKKOS_INLINE_FUNCTION ordinal_type relativeEnumerationIndex(const ordinal_type &startingComponent) const
Note: relativeEnumerationIndex() matches the ordering in TensorData. This is different from the order...
KOKKOS_INLINE_FUNCTION ordinal_type relativeEnumerationSpan(const ordinal_type &startingComponent) const
total number of enumeration indices with arguments prior to the startingComponent fixed ...
View-like interface to tensor data; tensor components are stored separately and multiplied together a...
View-like interface to tensor data; tensor components are stored separately and multiplied together a...
Allows systematic enumeration of all entries in a TensorData object, tracking indices for each tensor...
KOKKOS_INLINE_FUNCTION ordinal_type increment()
Proceed to next entry.
KOKKOS_INLINE_FUNCTION ordinal_type numTensorComponents() const
Return the number of tensorial components.