49 #ifndef Intrepid2_TensorArgumentIterator_h
50 #define Intrepid2_TensorArgumentIterator_h
63 Kokkos::Array<ordinal_type,Parameters::MaxTensorComponents> arguments_;
64 Kokkos::Array<ordinal_type,Parameters::MaxTensorComponents> bounds_;
65 ordinal_type numTensorComponents_;
67 template<
class Scalar,
typename ExecSpaceType>
68 KOKKOS_INLINE_FUNCTION
73 for (ordinal_type r=0; r<numTensorComponents_; r++)
81 template<
class Scalar,
typename ExecSpaceType>
82 KOKKOS_INLINE_FUNCTION
85 numTensorComponents_(numTensorComponents)
87 for (ordinal_type r=0; r<numTensorComponents_; r++)
97 numTensorComponents_(tensorComponentBounds.size())
99 for (ordinal_type r=0; r<numTensorComponents_; r++)
102 bounds_[r] = tensorComponentBounds[r];
107 template<
size_t rank>
108 KOKKOS_INLINE_FUNCTION
111 numTensorComponents_(rank)
113 for (ordinal_type r=0; r<rank; r++)
116 bounds_[r] = tensorComponentBounds[r];
123 ordinal_type r = numTensorComponents_ - 1;
124 while (arguments_[r] + 1 >= bounds_[r])
130 if (r >= 0) ++arguments_[r];
136 KOKKOS_INLINE_FUNCTION
139 ordinal_type r = numTensorComponents_ - 1;
140 while (arguments_[r] + 1 >= bounds_[r])
150 KOKKOS_INLINE_FUNCTION
const ordinal_type &
argument(
const ordinal_type &r)
const
152 return arguments_[r];
171 for (ordinal_type r=numTensorComponents_-1; r>0; r--)
196 for (ordinal_type r=numTensorComponents_-1; r>startingComponent; r--)
201 i += arguments_[startingComponent];
209 for (ordinal_type r=startingComponent; r<numTensorComponents_; r++)
218 KOKKOS_INLINE_FUNCTION
219 void reset(ordinal_type from_component_number=0)
221 for (ordinal_type r=from_component_number; r<numTensorComponents_; r++)
230 KOKKOS_INLINE_FUNCTION
241 KOKKOS_INLINE_FUNCTION
245 for (ordinal_type d=0; d<numTensorComponents_; d++)
247 arguments_[d] = remainder % bounds_[d];
248 remainder /= bounds_[d];
254 KOKKOS_INLINE_FUNCTION
255 void copyArguments(TensorArgumentIterator &otherArgumentIterator,
const ordinal_type &r0_from,
const ordinal_type &r0_to,
const ordinal_type &numArguments)
257 for (ordinal_type i=0; i<numArguments; i++)
259 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.