Intrepid2
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Intrepid2::TensorData< Scalar, DeviceType > Class Template Reference

View-like interface to tensor data; tensor components are stored separately and multiplied together at access time. More...

#include <Intrepid2_TensorData.hpp>

Public Member Functions

template<size_t numTensorComponents>
 TensorData (Kokkos::Array< Data< Scalar, DeviceType >, numTensorComponents > tensorComponents, bool separateFirstComponent=false)
 Constructor with fixed-length Kokkos::Array argument.
 
 TensorData (std::vector< Data< Scalar, DeviceType > > tensorComponents, bool separateFirstComponent=false)
 Constructor with variable-length std::vector containing the components.
 
 TensorData (const TensorData &first, const TensorData &second, bool separateFirstComponent=false)
 Constructor to combine two other TensorData objects.
 
 TensorData (Data< Scalar, DeviceType > tensorComponent)
 Simple constructor for the case of trivial tensor-product structure (single component)
 
 TensorData ()
 Default constructor.
 
 TensorData (TensorData otherTensorData, std::vector< int > whichComps)
 Constructor that takes a subset of the tensorial components of another TensorData container.
 
template<typename OtherDeviceType , class = typename std::enable_if< std::is_same<typename DeviceType::memory_space, typename OtherDeviceType::memory_space>::value>::type, class = typename std::enable_if<!std::is_same<DeviceType,OtherDeviceType>::value>::type>
 TensorData (const TensorData< Scalar, OtherDeviceType > &tensorData)
 copy-like constructor for differing device type, but same memory space. This does a shallow copy of the underlying view.
 
template<typename OtherDeviceType , class = typename std::enable_if<!std::is_same<typename DeviceType::memory_space, typename OtherDeviceType::memory_space>::value>::type>
 TensorData (const TensorData< Scalar, OtherDeviceType > &tensorData)
 Copy-like constructor for differing execution spaces. This performs a deep copy of the underlying data.
 
KOKKOS_INLINE_FUNCTION const Data< Scalar, DeviceType > & getTensorComponent (const ordinal_type &r) const
 Returns the requested tensor component.
 
template<typename iType0 >
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType0 >::value, Scalar >::type operator() (const iType0 &tensorEntryIndex) const
 Accessor for rank-1 objects.
 
template<typename iType0 , ordinal_type numTensorComponents>
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType0 >::value, Scalar >::type operator() (const Kokkos::Array< iType0, numTensorComponents > &entryComponents) const
 Accessor that accepts a fixed-length array with entries corresponding to component indices.
 
KOKKOS_INLINE_FUNCTION ordinal_type getTensorComponentIndex (const ordinal_type &tensorComponent, const ordinal_type &dim, const ordinal_type &enumerationIndex) const
 return the index into the specified tensorial component in the dimension specified corresponding to the enumerationIndex given for that dimension.
 
template<typename iType0 , typename iType1 , ordinal_type numTensorComponents>
KOKKOS_INLINE_FUNCTION std::enable_if<(std::is_integral< iType0 >::value &&std::is_integral< iType1 >::value), Scalar >::type operator() (const Kokkos::Array< iType0, numTensorComponents > &entryComponents0, const Kokkos::Array< iType1, numTensorComponents > &entryComponents1) const
 Accessor for rank-2 objects that accepts fixed-length arrays with entries corresponding to component indices.
 
template<typename iType >
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType >::value, ordinal_type >::type extent_int (const iType &d) const
 Returns the logical extent in the requested dimension.
 
template<typename iType >
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type extent (const iType &d) const
 Returns the logical extent in the requested dimension.
 
KOKKOS_INLINE_FUNCTION constexpr bool isValid () const
 Returns true for containers that have data; false for those that don't (e.g., those that have been constructed by the default constructor).
 
KOKKOS_INLINE_FUNCTION ordinal_type rank () const
 Returns the rank of the container.
 
KOKKOS_INLINE_FUNCTION ordinal_type numTensorComponents () const
 Return the number of tensorial components.
 
KOKKOS_INLINE_FUNCTION bool separateFirstComponent () const
 Returns true if the first component is indexed separately; false if not.
 
void setFirstComponentExtentInDimension0 (const ordinal_type &newExtent)
 Sets the extent of the first component. Only valid when either there is only one component, or when separateFirstComponent() returns true. The intended use case is when the 0 dimension in first component represents a cell index, and the container is resized to match a workset size that does not evenly divide the number of cells.
 

Public Attributes

template<typename iType0 , typename iType1 >
KOKKOS_INLINE_FUNCTION std::enable_if<(std::is_integral< iType0 >::value &&std::is_integral< iType1 >::value), Scalar >::typ operator() )(const iType0 &tensorEntryIndex0, const iType1 &tensorEntryIndex1) const
 Accessor for rank-2 objects.
 
template<typename iType0 , typename iType1 , typename iType2 >
KOKKOS_INLINE_FUNCTION std::enable_if<(std::is_integral< iType0 >::value &&std::is_integral< iType1 >::value &&std::is_integral< iType2 >::value), Scalar >::typ operator() )(const iType0 &tensorEntryIndex0, const iType1 &tensorEntryIndex1, const iType2 &tensorEntryIndex2) const
 Accessor for rank-3 objects.
 

Protected Member Functions

void initialize ()
 Initialize members based on constructor parameters.
 

Protected Attributes

Kokkos::Array< Data< Scalar, DeviceType >, Parameters::MaxTensorComponentstensorComponents_
 
Kokkos::Array< ordinal_type, 7 > extents_
 
Kokkos::Array< Kokkos::Array< ordinal_type, Parameters::MaxTensorComponents >, 7 > entryModulus_
 
ordinal_type rank_
 
bool separateFirstComponent_ = false
 
ordinal_type numTensorComponents_ = 0
 

Detailed Description

template<class Scalar, typename DeviceType>
class Intrepid2::TensorData< Scalar, DeviceType >

View-like interface to tensor data; tensor components are stored separately and multiplied together at access time.

Definition at line 64 of file Intrepid2_TensorData.hpp.

Constructor & Destructor Documentation

◆ TensorData() [1/8]

template<class Scalar , typename DeviceType >
template<size_t numTensorComponents>
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( Kokkos::Array< Data< Scalar, DeviceType >, numTensorComponents > tensorComponents,
bool separateFirstComponent = false )
inline

Constructor with fixed-length Kokkos::Array argument.

Parameters
[in]tensorComponents- the data components that will be multiplied together. May not have more than Parameters::MaxTensorComponents entries.
[in]separateFirstComponent- if true, indicates that the first component will be indexed separately (this is used when the first index corresponds to a cell ordinal)

When separateFirstComponent is false, TensorData has rank equal to the maximum rank of the components in tensorComponents, and the logical index in rank r is a function of the indices in rank r of its components, where the function is such that the fastest-moving component index is the one for the final component. Components that have rank less than r are understood to have index 0 in that dimension.

When separateFirstComponent is true, all components are required to have rank 1, and TensorData has rank 2, with the first argument reserved for the first component. The second argument is indexed precisely as described above, omitting the first component.

Definition at line 125 of file Intrepid2_TensorData.hpp.

References Intrepid2::TensorData< Scalar, DeviceType >::initialize(), and Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents().

◆ TensorData() [2/8]

template<class Scalar , typename DeviceType >
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( std::vector< Data< Scalar, DeviceType > > tensorComponents,
bool separateFirstComponent = false )
inline

Constructor with variable-length std::vector containing the components.

Parameters
[in]tensorComponents- the data components that will be multiplied together. May not have more than Parameters::MaxTensorComponents entries.
[in]separateFirstComponent- if true, indicates that the first component will be indexed separately (this is used when the first index corresponds to a cell ordinal)

When separateFirstComponent is false, TensorData has rank equal to the maximum rank of the components in tensorComponents, and the logical index in rank r is a function of the indices in rank r of its components, where the function is such that the fastest-moving component index is the one for the final component. Components that have rank less than r are understood to have index 0 in that dimension.

When separateFirstComponent is true, all components are required to have rank 1, and TensorData has rank 2, with the first argument reserved for the first component. The second argument is indexed precisely as described above, omitting the first component.

Definition at line 147 of file Intrepid2_TensorData.hpp.

References Intrepid2::TensorData< Scalar, DeviceType >::initialize().

◆ TensorData() [3/8]

template<class Scalar , typename DeviceType >
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( const TensorData< Scalar, DeviceType > & first,
const TensorData< Scalar, DeviceType > & second,
bool separateFirstComponent = false )
inline

Constructor to combine two other TensorData objects.

Parameters
[in]first- TensorData object with the components for the first dimension(s)
[in]second- TensorData object with the components for the remaining dimension(s).
[in]separateFirstComponent- if true, indicates that the first component (from the first TensorData object) will be indexed separately (this is used when the first index corresponds to a cell ordinal)

When separateFirstComponent is true, all components are required to have rank 1, and TensorData has rank 2, with the first argument reserved for the first component. The second argument is indexed precisely as described above, omitting the first component.

Definition at line 168 of file Intrepid2_TensorData.hpp.

References Intrepid2::TensorData< Scalar, DeviceType >::getTensorComponent(), Intrepid2::TensorData< Scalar, DeviceType >::initialize(), and Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents().

◆ TensorData() [4/8]

template<class Scalar , typename DeviceType >
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( Data< Scalar, DeviceType > tensorComponent)
inline

Simple constructor for the case of trivial tensor-product structure (single component)

Parameters
[in]tensorComponent- the data component.

Simple constructor for trivial tensor-product structure. The TensorData object will have precisely the same logical data layout as the provided tensorComponent.

Definition at line 192 of file Intrepid2_TensorData.hpp.

◆ TensorData() [5/8]

template<class Scalar , typename DeviceType >
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( )
inline

Default constructor.

Default constructor provided to allow an indication of empty/zero data. TensorData::isValid() will return false.

Definition at line 202 of file Intrepid2_TensorData.hpp.

◆ TensorData() [6/8]

template<class Scalar , typename DeviceType >
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( TensorData< Scalar, DeviceType > otherTensorData,
std::vector< int > whichComps )
inline

Constructor that takes a subset of the tensorial components of another TensorData container.

Parameters
[in]otherTensorData- the original TensorData container
[in]whichComps- the tensorial component indices to take from the other container.
Note
this does not copy the data.

Definition at line 215 of file Intrepid2_TensorData.hpp.

References Intrepid2::TensorData< Scalar, DeviceType >::getTensorComponent(), and Intrepid2::TensorData< Scalar, DeviceType >::initialize().

◆ TensorData() [7/8]

template<class Scalar , typename DeviceType >
template<typename OtherDeviceType , class = typename std::enable_if< std::is_same<typename DeviceType::memory_space, typename OtherDeviceType::memory_space>::value>::type, class = typename std::enable_if<!std::is_same<DeviceType,OtherDeviceType>::value>::type>
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( const TensorData< Scalar, OtherDeviceType > & tensorData)
inline

copy-like constructor for differing device type, but same memory space. This does a shallow copy of the underlying view.

Definition at line 231 of file Intrepid2_TensorData.hpp.

References Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents().

◆ TensorData() [8/8]

template<class Scalar , typename DeviceType >
template<typename OtherDeviceType , class = typename std::enable_if<!std::is_same<typename DeviceType::memory_space, typename OtherDeviceType::memory_space>::value>::type>
Intrepid2::TensorData< Scalar, DeviceType >::TensorData ( const TensorData< Scalar, OtherDeviceType > & tensorData)
inline

Member Function Documentation

◆ extent()

template<class Scalar , typename DeviceType >
template<typename iType >
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type Intrepid2::TensorData< Scalar, DeviceType >::extent ( const iType & d) const
inlineconstexpr

Returns the logical extent in the requested dimension.

Parameters
[in]d- the dimension
Returns
the logical extent in the requested dimension.

Definition at line 530 of file Intrepid2_TensorData.hpp.

◆ extent_int()

template<class Scalar , typename DeviceType >
template<typename iType >
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType >::value, ordinal_type >::type Intrepid2::TensorData< Scalar, DeviceType >::extent_int ( const iType & d) const
inline

Returns the logical extent in the requested dimension.

Parameters
[in]d- the dimension
Returns
logical extent as an integer

Definition at line 518 of file Intrepid2_TensorData.hpp.

Referenced by Intrepid2::CellGeometry< PointScalar, spaceDim, DeviceType >::allocateCellMeasure(), Intrepid2::CellGeometry< PointScalar, spaceDim, DeviceType >::computeCellMeasure(), and Intrepid2::IntegrationTools< DeviceType >::integrate().

◆ getTensorComponent()

template<class Scalar , typename DeviceType >
KOKKOS_INLINE_FUNCTION const Data< Scalar, DeviceType > & Intrepid2::TensorData< Scalar, DeviceType >::getTensorComponent ( const ordinal_type & r) const
inline

◆ getTensorComponentIndex()

template<class Scalar , typename DeviceType >
KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorData< Scalar, DeviceType >::getTensorComponentIndex ( const ordinal_type & tensorComponent,
const ordinal_type & dim,
const ordinal_type & enumerationIndex ) const
inline

return the index into the specified tensorial component in the dimension specified corresponding to the enumerationIndex given for that dimension.

Definition at line 404 of file Intrepid2_TensorData.hpp.

◆ initialize()

template<class Scalar , typename DeviceType >
void Intrepid2::TensorData< Scalar, DeviceType >::initialize ( )
inlineprotected

◆ isValid()

template<class Scalar , typename DeviceType >
KOKKOS_INLINE_FUNCTION constexpr bool Intrepid2::TensorData< Scalar, DeviceType >::isValid ( ) const
inlineconstexpr

Returns true for containers that have data; false for those that don't (e.g., those that have been constructed by the default constructor).

Definition at line 535 of file Intrepid2_TensorData.hpp.

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

◆ numTensorComponents()

template<class Scalar , typename DeviceType >
KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents ( ) const
inline

◆ operator()() [1/3]

template<class Scalar , typename DeviceType >
template<typename iType0 >
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType0 >::value, Scalar >::type Intrepid2::TensorData< Scalar, DeviceType >::operator() ( const iType0 & tensorEntryIndex) const
inline

Accessor for rank-1 objects.

Parameters
[in]tensorEntryIndex- the composite entry index.
Returns
The product of tensorComponent values with component entry indices corresponding to tensorEntryIndex.

Definition at line 291 of file Intrepid2_TensorData.hpp.

References INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE.

◆ operator()() [2/3]

template<class Scalar , typename DeviceType >
template<typename iType0 , ordinal_type numTensorComponents>
KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType0 >::value, Scalar >::type Intrepid2::TensorData< Scalar, DeviceType >::operator() ( const Kokkos::Array< iType0, numTensorComponents > & entryComponents) const
inline

Accessor that accepts a fixed-length array with entries corresponding to component indices.

Parameters
[in]entryComponents- an array with one entry per tensorial component, each entry indicating the requested index into that component.
Returns
The product of tensor component values with the specified component entry indices.

Definition at line 316 of file Intrepid2_TensorData.hpp.

References INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE, and Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents().

◆ operator()() [3/3]

template<class Scalar , typename DeviceType >
template<typename iType0 , typename iType1 , ordinal_type numTensorComponents>
KOKKOS_INLINE_FUNCTION std::enable_if<(std::is_integral< iType0 >::value &&std::is_integral< iType1 >::value), Scalar >::type Intrepid2::TensorData< Scalar, DeviceType >::operator() ( const Kokkos::Array< iType0, numTensorComponents > & entryComponents0,
const Kokkos::Array< iType1, numTensorComponents > & entryComponents1 ) const
inline

Accessor for rank-2 objects that accepts fixed-length arrays with entries corresponding to component indices.

Parameters
[in]entryComponents0- an array with one entry per tensorial component, each entry indicating the requested index into that component's first dimension
[in]entryComponents1- an array with one entry per tensorial component, each entry indicating the requested index into that component's second dimension
Returns
The product of tensor component values with the specified component entry indices.

Definition at line 485 of file Intrepid2_TensorData.hpp.

References INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE, and Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents().

◆ rank()

template<class Scalar , typename DeviceType >
KOKKOS_INLINE_FUNCTION ordinal_type Intrepid2::TensorData< Scalar, DeviceType >::rank ( ) const
inline

◆ separateFirstComponent()

template<class Scalar , typename DeviceType >
KOKKOS_INLINE_FUNCTION bool Intrepid2::TensorData< Scalar, DeviceType >::separateFirstComponent ( ) const
inline

Returns true if the first component is indexed separately; false if not.

Definition at line 556 of file Intrepid2_TensorData.hpp.

◆ setFirstComponentExtentInDimension0()

template<class Scalar , typename DeviceType >
void Intrepid2::TensorData< Scalar, DeviceType >::setFirstComponentExtentInDimension0 ( const ordinal_type & newExtent)
inline

Sets the extent of the first component. Only valid when either there is only one component, or when separateFirstComponent() returns true. The intended use case is when the 0 dimension in first component represents a cell index, and the container is resized to match a workset size that does not evenly divide the number of cells.

Definition at line 562 of file Intrepid2_TensorData.hpp.

Member Data Documentation

◆ entryModulus_

template<class Scalar , typename DeviceType >
Kokkos::Array<Kokkos::Array<ordinal_type, Parameters::MaxTensorComponents>, 7> Intrepid2::TensorData< Scalar, DeviceType >::entryModulus_
protected

Definition at line 68 of file Intrepid2_TensorData.hpp.

◆ extents_

template<class Scalar , typename DeviceType >
Kokkos::Array<ordinal_type, 7> Intrepid2::TensorData< Scalar, DeviceType >::extents_
protected

Definition at line 67 of file Intrepid2_TensorData.hpp.

◆ numTensorComponents_

template<class Scalar , typename DeviceType >
ordinal_type Intrepid2::TensorData< Scalar, DeviceType >::numTensorComponents_ = 0
protected

Definition at line 71 of file Intrepid2_TensorData.hpp.

◆ operator() [1/2]

template<class Scalar , typename DeviceType >
template<typename iType0 , typename iType1 >
KOKKOS_INLINE_FUNCTION std::enable_if<(std::is_integral< iType0 >::value &&std::is_integral< iType1 >::value), Scalar >::typ Intrepid2::TensorData< Scalar, DeviceType >::operator()) (const Kokkos::Array< iType0, numTensorComponents > &entryComponents0, const Kokkos::Array< iType1, numTensorComponents > &entryComponents1) const
inline

Accessor for rank-2 objects.

Accessor for rank-2 objects that accepts fixed-length arrays with entries corresponding to component indices.

Parameters
[in]tensorEntryIndex0- the composite tensor index in the first dimension
[in]tensorEntryIndex1- the composite tensor index in the second dimension If constructed with separateFirstComponent = true, tensorEntryIndex0 corresponds to the index to be used for the first component. Otherwise, it corresponds to an enumeration of all valid combinations of first arguments to the tensorial components.

If constructed with separateFirstComponent = true, tensorEntryIndex1 corresponds to an enumeration of all valid combinations of second arguments to components after the first. Otherwise, it corresponds to an enumeration of all valid combinations of second arguments to all the tensorial components.

Returns
The product of tensor component values with the specified component entry indices.
Parameters
[in]entryComponents0- an array with one entry per tensorial component, each entry indicating the requested index into that component's first dimension
[in]entryComponents1- an array with one entry per tensorial component, each entry indicating the requested index into that component's second dimension
Returns
The product of tensor component values with the specified component entry indices.

Definition at line 343 of file Intrepid2_TensorData.hpp.

◆ operator() [2/2]

template<class Scalar , typename DeviceType >
template<typename iType0 , typename iType1 , typename iType2 >
KOKKOS_INLINE_FUNCTION std::enable_if<(std::is_integral< iType0 >::value &&std::is_integral< iType1 >::value &&std::is_integral< iType2 >::value), Scalar >::typ Intrepid2::TensorData< Scalar, DeviceType >::operator()) (const iType0 &tensorEntryIndex0, const iType1 &tensorEntryIndex1, const iType2 &tensorEntryIndex2) const
inline

Accessor for rank-3 objects.

Parameters
[in]tensorEntryIndex0- the composite tensor index in the first dimension
[in]tensorEntryIndex1- the composite tensor index in the second dimension
[in]tensorEntryIndex2- the composite tensor index in the third dimension tensorEntryIndex0 corresponds to an enumeration of all valid combinations of first arguments to the tensorial components. Similarly, tensorEntryIndex1 and tensorEntryIndex2 correspond to an enumeration of all valid second and third arguments to the tensorial components.
Returns
The product of tensor component values with the specified component entry indices.

Definition at line 430 of file Intrepid2_TensorData.hpp.

◆ rank_

template<class Scalar , typename DeviceType >
ordinal_type Intrepid2::TensorData< Scalar, DeviceType >::rank_
protected

Definition at line 69 of file Intrepid2_TensorData.hpp.

◆ separateFirstComponent_

template<class Scalar , typename DeviceType >
bool Intrepid2::TensorData< Scalar, DeviceType >::separateFirstComponent_ = false
protected

Definition at line 70 of file Intrepid2_TensorData.hpp.

◆ tensorComponents_

template<class Scalar , typename DeviceType >
Kokkos::Array< Data<Scalar,DeviceType>, Parameters::MaxTensorComponents> Intrepid2::TensorData< Scalar, DeviceType >::tensorComponents_
protected

Definition at line 66 of file Intrepid2_TensorData.hpp.


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