Intrepid2
Public Member Functions | 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. More...
 
 TensorData (std::vector< Data< Scalar, DeviceType > > tensorComponents, bool separateFirstComponent=false)
 Constructor with variable-length std::vector containing the components. More...
 
 TensorData (const TensorData &first, const TensorData &second, bool separateFirstComponent=false)
 Constructor to combine two other TensorData objects. More...
 
 TensorData (Data< Scalar, DeviceType > tensorComponent)
 Simple constructor for the case of trivial tensor-product structure (single component) More...
 
 TensorData ()
 Default constructor. More...
 
 rank_ (0)
 
 TensorData (TensorData otherTensorData, std::vector< int > whichComps)
 Constructor that takes a subset of the tensorial components of another TensorData container. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename iType0 , typename iType1 >
KOKKOS_INLINE_FUNCTION
std::enable_if
< (std::is_integral< iType0 >
::value &&std::is_integral
< iType1 >::value), Scalar >
::type 
operator() (const iType0 &tensorEntryIndex0, const iType1 &tensorEntryIndex1) const
 Accessor for rank-2 objects. More...
 
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 , typename iType2 >
KOKKOS_INLINE_FUNCTION
std::enable_if
< (std::is_integral< iType0 >
::value &&std::is_integral
< iType1 >::value
&&std::is_integral< iType2 >
::value), Scalar >::type 
operator() (const iType0 &tensorEntryIndex0, const iType1 &tensorEntryIndex1, const iType2 &tensorEntryIndex2) const
 Accessor for rank-3 objects. More...
 
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. More...
 
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. More...
 
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. More...
 
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.
 

Protected Member Functions

void initialize ()
 Initialize members based on constructor parameters.
 

Protected Attributes

Kokkos::Array< Data< Scalar,
DeviceType >
, Parameters::MaxTensorComponents
tensorComponents_
 
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

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.

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.

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.

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.

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.

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.

Member Function Documentation

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
inline

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.

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().

template<class Scalar, typename DeviceType>
KOKKOS_INLINE_FUNCTION const Data<Scalar,DeviceType>& Intrepid2::TensorData< Scalar, DeviceType >::getTensorComponent ( const ordinal_type &  r) const
inline
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.

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.

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>::type Intrepid2::TensorData< Scalar, DeviceType >::operator() ( const iType0 &  tensorEntryIndex0,
const iType1 &  tensorEntryIndex1 
) const
inline

Accessor for rank-2 objects.

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.

Definition at line 343 of file Intrepid2_TensorData.hpp.

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>::type 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.

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.


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