Intrepid2
Public Types | Public Member Functions | Protected Attributes | List of all members
Intrepid2::Basis_TensorBasis< BasisBase > Class Template Reference

Basis defined as the tensor product of two component bases. More...

#include <Intrepid2_TensorBasis.hpp>

Inheritance diagram for Intrepid2::Basis_TensorBasis< BasisBase >:

Public Types

using BasisBase = BasisBaseClass
 
using BasisPtr = Teuchos::RCP< BasisBase >
 
using DeviceType = typename BasisBase::DeviceType
 
using ExecutionSpace = typename BasisBase::ExecutionSpace
 
using OutputValueType = typename BasisBase::OutputValueType
 
using PointValueType = typename BasisBase::PointValueType
 
using OrdinalTypeArray1DHost = typename BasisBase::OrdinalTypeArray1DHost
 
using OrdinalTypeArray2DHost = typename BasisBase::OrdinalTypeArray2DHost
 
using OutputViewType = typename BasisBase::OutputViewType
 
using PointViewType = typename BasisBase::PointViewType
 
using TensorBasis = Basis_TensorBasis< BasisBaseClass >
 

Public Member Functions

 Basis_TensorBasis (BasisPtr basis1, BasisPtr basis2, EFunctionSpace functionSpace=FUNCTION_SPACE_MAX, const bool useShardsCellTopologyAndTags=false)
 Constructor. More...
 
void setShardsTopologyAndTags ()
 
virtual int getNumTensorialExtrusions () const override
 
ordinal_type getTensorDkEnumeration (ordinal_type dkEnum1, ordinal_type operatorOrder1, ordinal_type dkEnum2, ordinal_type operatorOrder2) const
 Given "Dk" enumeration indices for the component bases, returns a Dk enumeration index for the composite basis. More...
 
virtual OperatorTensorDecomposition getSimpleOperatorDecomposition (const EOperator &operatorType) const
 Returns a simple decomposition of the specified operator: what operator(s) should be applied to basis1, and what operator(s) to basis2. A one-element OperatorTensorDecomposition corresponds to a single TensorData entry; a multiple-element OperatorTensorDecomposition corresponds to a VectorData object with axialComponents = false. More...
 
virtual OperatorTensorDecomposition getOperatorDecomposition (const EOperator operatorType) const
 Returns a full decomposition of the specified operator. (Full meaning that all TensorBasis components are expanded into their non-TensorBasis components.)
 
virtual BasisValues
< OutputValueType, DeviceType > 
allocateBasisValues (TensorPoints< PointValueType, DeviceType > points, const EOperator operatorType=OPERATOR_VALUE) const override
 Allocate BasisValues container suitable for passing to the getValues() variant that takes a TensorPoints container as argument. More...
 
void getComponentPoints (const PointViewType inputPoints, const bool attemptTensorDecomposition, PointViewType &inputPoints1, PointViewType &inputPoints2, bool &tensorDecompositionSucceeded) const
 Method to extract component points from composite points. More...
 
virtual void getDofCoords (typename BasisBase::ScalarViewType dofCoords) const override
 Fills in spatial locations (coordinates) of degrees of freedom (nodes) on the reference cell. More...
 
virtual void getDofCoeffs (typename BasisBase::ScalarViewType dofCoeffs) const override
 Fills in coefficients of degrees of freedom on the reference cell. More...
 
virtual const char * getName () const override
 Returns basis name. More...
 
std::vector< BasisPtr > getTensorBasisComponents () const
 
virtual void getValues (BasisValues< OutputValueType, DeviceType > outputValues, const TensorPoints< PointValueType, DeviceType > inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
 Evaluation of a FEM basis on a reference cell, using point and output value containers that allow preservation of tensor-product structure. More...
 
void getValues (OutputViewType outputValues, const PointViewType inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
 Evaluation of a FEM basis on a reference cell. More...
 
virtual void getValues (OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, bool tensorPoints) const
 Evaluation of a tensor FEM basis on a reference cell; subclasses should override this. More...
 
void getValues (OutputViewType outputValues, const PointViewType inputPoints1, const EOperator operatorType1, const PointViewType inputPoints2, const EOperator operatorType2, bool tensorPoints, double weight=1.0) const
 Evaluation of a tensor FEM basis on a reference cell. More...
 
virtual HostBasisPtr
< OutputValueType,
PointValueType > 
getHostBasis () const override
 Creates and returns a Basis object whose DeviceType template argument is Kokkos::HostSpace::device_type, but is otherwise identical to this. More...
 

Protected Attributes

BasisPtr basis1_
 
BasisPtr basis2_
 
std::vector< BasisPtr > tensorComponents_
 
std::string name_
 
int numTensorialExtrusions_
 

Detailed Description

template<typename BasisBase>
class Intrepid2::Basis_TensorBasis< BasisBase >

Basis defined as the tensor product of two component bases.

The cell topology for the tensor basis is the tensor product of the cell topologies on which the component bases are defined;

See Also
Intrepid2::TensorTopologyMap.

The basis is ordered such that the Basis1 field ordinals are the fastest-moving index; the formula for the composite field ordinal is: compositeFieldOrdinal = componentFieldOrdinal2 * basis1Cardinality + componentFieldOrdinal1 This is done so that we can consider, e.g. Basis1 as the "x" dimension and Basis2 as the "y" dimension, and have the basis ordered in the same way that existing Intrepid2 bases on the quadrilateral are ordered, namely, one moves along the x dimension first, moving across the quadrilateral dofs "row-wise".

Definition at line 229 of file Intrepid2_TensorBasis.hpp.

Constructor & Destructor Documentation

template<typename BasisBase>
Intrepid2::Basis_TensorBasis< BasisBase >::Basis_TensorBasis ( BasisPtr  basis1,
BasisPtr  basis2,
EFunctionSpace  functionSpace = FUNCTION_SPACE_MAX,
const bool  useShardsCellTopologyAndTags = false 
)
inline

Constructor.

Parameters
[in]basis1- the first component basis
[in]basis2- the second component basis
[in]functionSpace- the function space to which the composite basis belongs (use FUNCTION_SPACE_MAX for unknown/unspecified function space)
[in]useShardsCellTopologyAndTags- if true, attempt to assign a shards CellTopology corresponding to the tensor topology (shards Quad and Hex do not have tensor structure; this will map dofs appropriately) – supported for 2D and 3D hypercubes

Definition at line 678 of file Intrepid2_TensorBasis.hpp.

Member Function Documentation

template<typename BasisBase>
virtual BasisValues<OutputValueType,DeviceType> Intrepid2::Basis_TensorBasis< BasisBase >::allocateBasisValues ( TensorPoints< PointValueType, DeviceType >  points,
const EOperator  operatorType = OPERATOR_VALUE 
) const
inlineoverridevirtual

Allocate BasisValues container suitable for passing to the getValues() variant that takes a TensorPoints container as argument.

The basic exact-sequence operators are supported (VALUE, GRAD, DIV, CURL), as are the Dn operators (OPERATOR_D1 through OPERATOR_D10).

Definition at line 1194 of file Intrepid2_TensorBasis.hpp.

template<typename BasisBase>
void Intrepid2::Basis_TensorBasis< BasisBase >::getComponentPoints ( const PointViewType  inputPoints,
const bool  attemptTensorDecomposition,
PointViewType &  inputPoints1,
PointViewType &  inputPoints2,
bool &  tensorDecompositionSucceeded 
) const
inline

Method to extract component points from composite points.

Parameters
[in]inputPoints- points defined on the composite cell topology
[in]attemptTensorDecomposition- if true, attempt to find a tensor decomposition.
[out]inputPoints1- points defined on the first component cell topology
[out]inputPoints2- points defined on the second component cell topology
[out]tensorDecompositionSucceeded- if true, the attempt to find a tensor decomposition succeeded.

At present, attemptTensorDecomposition is ignored, and tensorDecompositionSucceeded will always return false. However, we intend to support the tensor decomposition in the future, which will allow substantial optimizations in computation of tensor bases.

Definition at line 1314 of file Intrepid2_TensorBasis.hpp.

Referenced by Intrepid2::Basis_TensorBasis< BasisBaseClass >::getValues().

template<typename BasisBase>
virtual void Intrepid2::Basis_TensorBasis< BasisBase >::getDofCoeffs ( typename BasisBase::ScalarViewType  dofCoeffs) const
inlineoverridevirtual

Fills in coefficients of degrees of freedom on the reference cell.

Parameters
[out]dofCoeffs- the container into which to place the degrees of freedom.

dofCoeffs has the rank 1 or 2 and the first dimension equals the cardinality of the basis. dofCoeffs has rank 2 if either basis1 or basis2 is a vector basis, in which case the second dimension equals the number of vector components We do not support the case where both basis1 and basis2 are vector bases

Note that getDofCoeffs() is not supported by all bases; in particular, hierarchical bases do not generally support this.

Definition at line 1404 of file Intrepid2_TensorBasis.hpp.

Referenced by Intrepid2::Basis_Derived_HCURL_Family1_QUAD< HGRAD_LINE, HVOL_LINE >::getDofCoeffs(), Intrepid2::Basis_Derived_HDIV_Family1_QUAD< HGRAD_LINE, HVOL_LINE >::getDofCoeffs(), Intrepid2::Basis_Derived_HDIV_Family1_WEDGE< HDIV_TRI, HVOL_LINE >::getDofCoeffs(), Intrepid2::Basis_Derived_HCURL_Family1_WEDGE< HCURL_TRI, HGRAD_LINE >::getDofCoeffs(), Intrepid2::Basis_Derived_HCURL_Family2_QUAD< HGRAD_LINE, HVOL_LINE >::getDofCoeffs(), Intrepid2::Basis_Derived_HDIV_Family2_QUAD< HGRAD_LINE, HVOL_LINE >::getDofCoeffs(), Intrepid2::Basis_Derived_HDIV_Family2_WEDGE< HVOL_TRI, HGRAD_LINE >::getDofCoeffs(), and Intrepid2::Basis_Derived_HCURL_Family2_WEDGE< HGRAD_TRI, HVOL_LINE >::getDofCoeffs().

template<typename BasisBase>
virtual void Intrepid2::Basis_TensorBasis< BasisBase >::getDofCoords ( typename BasisBase::ScalarViewType  dofCoords) const
inlineoverridevirtual

Fills in spatial locations (coordinates) of degrees of freedom (nodes) on the reference cell.

Parameters
[out]dofCoords- the container into which to place the degrees of freedom.

dofCoords should have shape (F,D), where the field dimension matches the cardinality of the basis, and D is the spatial dimension of the topology on which the basis is defined.

Note that getDofCoords() is not supported by all bases; in particular, hierarchical bases do not generally support this.

Definition at line 1358 of file Intrepid2_TensorBasis.hpp.

template<typename BasisBase>
virtual HostBasisPtr<OutputValueType, PointValueType> Intrepid2::Basis_TensorBasis< BasisBase >::getHostBasis ( ) const
inlineoverridevirtual
template<typename BasisBase>
virtual const char* Intrepid2::Basis_TensorBasis< BasisBase >::getName ( ) const
inlineoverridevirtual
template<typename BasisBase>
virtual OperatorTensorDecomposition Intrepid2::Basis_TensorBasis< BasisBase >::getSimpleOperatorDecomposition ( const EOperator &  operatorType) const
inlinevirtual

Returns a simple decomposition of the specified operator: what operator(s) should be applied to basis1, and what operator(s) to basis2. A one-element OperatorTensorDecomposition corresponds to a single TensorData entry; a multiple-element OperatorTensorDecomposition corresponds to a VectorData object with axialComponents = false.

Subclasses must override this method.

Reimplemented in Intrepid2::Basis_Derived_HCURL_Family3_HEX< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HDIV_Family3_HEX< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HCURL_Family2_WEDGE< HGRAD_TRI, HVOL_LINE >, Intrepid2::Basis_Derived_HCURL_Family2_HEX< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HDIV_Family2_WEDGE< HVOL_TRI, HGRAD_LINE >, Intrepid2::Basis_Derived_HDIV_Family2_QUAD< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HDIV_Family2_HEX< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HCURL_Family2_QUAD< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HVOL_HEX< HVOL_LINE >, Intrepid2::Basis_Derived_HVOL_QUAD< HVOL_LINE >, Intrepid2::Basis_Derived_HCURL_Family1_WEDGE< HCURL_TRI, HGRAD_LINE >, Intrepid2::Basis_Derived_HDIV_Family1_WEDGE< HDIV_TRI, HVOL_LINE >, Intrepid2::Basis_Derived_HDIV_Family1_HEX< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HCURL_Family1_QUAD< HGRAD_LINE, HVOL_LINE >, Intrepid2::Basis_Derived_HDIV_Family1_QUAD< HGRAD_LINE, HVOL_LINE >, and Intrepid2::Basis_Derived_HCURL_Family1_HEX< HGRAD_LINE, HVOL_LINE >.

Definition at line 1047 of file Intrepid2_TensorBasis.hpp.

Referenced by Intrepid2::Basis_TensorBasis< BasisBaseClass >::getOperatorDecomposition().

template<typename BasisBase>
ordinal_type Intrepid2::Basis_TensorBasis< BasisBase >::getTensorDkEnumeration ( ordinal_type  dkEnum1,
ordinal_type  operatorOrder1,
ordinal_type  dkEnum2,
ordinal_type  operatorOrder2 
) const
inline

Given "Dk" enumeration indices for the component bases, returns a Dk enumeration index for the composite basis.

Parameters
[in]dkEnum1- Dk enumeration index for first component basis
[in]operatorOrder1- operator order for the first component basis
[in]dkEnum2- Dk enumeration index for second component basis
[in]operatorOrder2- operator order for the second component basis
Returns
Dk enumeration index for the composite basis, corresponding to operator order operatorOrder1 + operatorOrder2.

Definition at line 967 of file Intrepid2_TensorBasis.hpp.

Referenced by Intrepid2::Basis_TensorBasis< BasisBaseClass >::getValues().

template<typename BasisBase>
virtual void Intrepid2::Basis_TensorBasis< BasisBase >::getValues ( BasisValues< OutputValueType, DeviceType >  outputValues,
const TensorPoints< PointValueType, DeviceType >  inputPoints,
const EOperator  operatorType = OPERATOR_VALUE 
) const
inlineoverridevirtual

Evaluation of a FEM basis on a reference cell, using point and output value containers that allow preservation of tensor-product structure.

Returns values of operatorType acting on FEM basis functions for a set of points in the reference cell for which the basis is defined.

Parameters
outputValues[out] - variable rank array with the basis values. Should be allocated using Basis::allocateBasisValues().
inputPoints[in] - rank-2 array (P,D) with the evaluation points. This should be allocated using Cubature::allocateCubaturePoints() and filled using Cubature::getCubature().
operatorType[in] - the operator acting on the basis function

This is the preferred getValues() method for TensorBasis and DirectSumBasis and their subclasses. It allows a reduced memory footprint and optimized integration, etc.

Definition at line 1471 of file Intrepid2_TensorBasis.hpp.

Referenced by Intrepid2::Basis_Derived_HCURL_Family1_QUAD< HGRAD_LINE, HVOL_LINE >::getValues(), Intrepid2::Basis_Derived_HDIV_Family1_QUAD< HGRAD_LINE, HVOL_LINE >::getValues(), Intrepid2::Basis_Derived_HDIV_Family1_WEDGE< HDIV_TRI, HVOL_LINE >::getValues(), Intrepid2::Basis_Derived_HCURL_Family1_WEDGE< HCURL_TRI, HGRAD_LINE >::getValues(), Intrepid2::Basis_Derived_HCURL_Family2_QUAD< HGRAD_LINE, HVOL_LINE >::getValues(), Intrepid2::Basis_Derived_HDIV_Family2_QUAD< HGRAD_LINE, HVOL_LINE >::getValues(), Intrepid2::Basis_Derived_HDIV_Family2_WEDGE< HVOL_TRI, HGRAD_LINE >::getValues(), Intrepid2::Basis_Derived_HCURL_Family2_WEDGE< HGRAD_TRI, HVOL_LINE >::getValues(), and Intrepid2::Basis_TensorBasis< BasisBaseClass >::getValues().

template<typename BasisBase>
void Intrepid2::Basis_TensorBasis< BasisBase >::getValues ( OutputViewType  outputValues,
const PointViewType  inputPoints,
const EOperator  operatorType = OPERATOR_VALUE 
) const
inlineoverride

Evaluation of a FEM basis on a reference cell.

Returns values of operatorType acting on FEM basis functions for a set of points in the reference cell for which the basis is defined.

Parameters
outputValues[out] - variable rank array with the basis values
inputPoints[in] - rank-2 array (P,D) with the evaluation points
operatorType[in] - the operator acting on the basis functions
Remarks
For rank and dimension specifications of the output array see Section MD array template arguments for basis methods. Dimensions of ArrayScalar arguments are checked at runtime if HAVE_INTREPID2_DEBUG is defined.
A FEM basis spans a COMPLETE or INCOMPLETE polynomial space on the reference cell which is a smooth function space. Thus, all operator types that are meaningful for the approximated function space are admissible. When the order of the operator exceeds the degree of the basis, the output array is filled with the appropriate number of zeros.

Definition at line 1626 of file Intrepid2_TensorBasis.hpp.

template<typename BasisBase>
virtual void Intrepid2::Basis_TensorBasis< BasisBase >::getValues ( OutputViewType  outputValues,
const EOperator  operatorType,
const PointViewType  inputPoints1,
const PointViewType  inputPoints2,
bool  tensorPoints 
) const
inlinevirtual

Evaluation of a tensor FEM basis on a reference cell; subclasses should override this.

Returns values of operatorType acting on FEM basis functions for a set of points in the reference cell for which the basis is defined.

Parameters
outputValues[out] - variable rank array with the basis values
operatorType[in] - the operator acting on the basis functions
inputPoints1[in] - rank-2 array (P1,D1) with the evaluation points for basis1
inputPoints2[in] - rank-2 array (P2,D2) with the evaluation points for basis2
tensorPoints[in] - whether the points should be interpreted as tensor components of the evaluation points, or in a one-to-one correspondence

Subclasses should override this method; this gives them an opportunity to specify how operatorType should be decomposed into operators on the component bases.

If tensorPoints is true, then the points dimension of outputValues should be (P1*P2). If tensorPoints is false, then P1 should equal P2, and these should match the points dimension of outputValues.

There are three variants of getValues:

  1. The three-argument version defined by Intrepid2::Basis. TensorBasis provides an implementation of this, which calls the five-argument version (this one).
  2. The five-argument version (this method), which provides separate point sets for the component bases, and must be specified by subclasses. Typical implementations call the seven-argument version.
  3. The seven-argument version (below), implemented by TensorBasis, which provides separate point sets and operators for the component bases, as well as an optional weight.

The intent is that subclasses implement this five-argument version; in that implementation, they need to do little else than call the seven-argument version below.

Note that the three-argument implementation handles the OPERATOR_Dn operators directly; that is, subclasses can omit any consideration of OPERATOR_Dn operators in their implementation of the five-argument version.

Reimplemented in Intrepid2::Basis_TensorBasis3< BasisBaseClass >, and Intrepid2::Basis_TensorBasis3< HGRAD_LINE::BasisBase >.

Definition at line 1768 of file Intrepid2_TensorBasis.hpp.

template<typename BasisBase>
void Intrepid2::Basis_TensorBasis< BasisBase >::getValues ( OutputViewType  outputValues,
const PointViewType  inputPoints1,
const EOperator  operatorType1,
const PointViewType  inputPoints2,
const EOperator  operatorType2,
bool  tensorPoints,
double  weight = 1.0 
) const
inline

Evaluation of a tensor FEM basis on a reference cell.

Returns values of operatorType acting on FEM basis functions for a set of points in the reference cell for which the basis is defined.

Parameters
outputValues[out] - variable rank array with the basis values
inputPoints1[in] - rank-2 array (P1,D1) with the evaluation points for basis1
operatorType1[in] - the operator acting on basis1
inputPoints2[in] - rank-2 array (P2,D2) with the evaluation points for basis2
operatorType2[in] - the operator acting on basis2
tensorPoints[in] - whether the points should be interpreted as tensor components of the evaluation points, or in a one-to-one correspondence
weight[in] - optional weight (typically 1.0 or -1.0)

If tensorPoints is true, then the points dimension of outputValues should be (P1*P2). If tensorPoints is false, then P1 should equal P2, and these should match the points dimension of outputValues.

There are three variants of getValues:

  1. The three-argument version defined by Intrepid2::Basis. TensorBasis provides an implementation of this, which calls the five-argument version (this one).
  2. The five-argument version (above), which provides separate point sets for the component bases, and must be specified by subclasses. Typical implementations call the seven-argument version.
  3. The seven-argument version (this method), implemented by TensorBasis, which provides separate point sets and operators for the component bases, as well as an optional weight.

Subclasses should override the five-argument version above; in their implementation, they need to do little else than call this seven-argument version.

Definition at line 1798 of file Intrepid2_TensorBasis.hpp.


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