19#ifndef __INTREPID2_UTILS_DEF_HPP__
20#define __INTREPID2_UTILS_DEF_HPP__
32 KOKKOS_INLINE_FUNCTION
33 ordinal_type
getFieldRank(
const EFunctionSpace spaceType) {
34 ordinal_type fieldRank = -1;
38 case FUNCTION_SPACE_HGRAD:
39 case FUNCTION_SPACE_HVOL:
43 case FUNCTION_SPACE_HCURL:
44 case FUNCTION_SPACE_HDIV:
45 case FUNCTION_SPACE_VECTOR_HGRAD:
49 case FUNCTION_SPACE_TENSOR_HGRAD:
55 ">>> ERROR (Intrepid2::getFieldRank): Invalid function space type");
61 KOKKOS_INLINE_FUNCTION
63 const EOperator operatorType,
64 const ordinal_type spaceDim) {
67#ifdef HAVE_INTREPID2_DEBUG
69 INTREPID2_TEST_FOR_ABORT( !(0 <= fieldRank && fieldRank <= 2),
70 ">>> ERROR (Intrepid2::getOperatorRank): Invalid field rank");
71 INTREPID2_TEST_FOR_ABORT( !(1 <= spaceDim && spaceDim <= 3),
72 ">>> ERROR (Intrepid2::getOperatorRank): Invalid space dimension");
74 ordinal_type operatorRank = -999;
80 if (operatorType == OPERATOR_VALUE) {
89 INTREPID2_TEST_FOR_ABORT( fieldRank > 0,
90 ">>> ERROR (getOperatorRank): Only scalar fields are allowed in 1D");
96 switch (operatorType) {
119 operatorRank = spaceDim - 3;
124 operatorRank = 3 - spaceDim;
129 INTREPID2_TEST_FOR_ABORT( ( (spaceDim == 3) && (fieldRank == 0) ),
130 ">>> ERROR (Intrepid2::getOperatorRank): CURL cannot be applied to scalar fields in 3D");
144 INTREPID2_TEST_FOR_ABORT( ( (spaceDim > 1) && (fieldRank == 0) ),
145 ">>> ERROR (Intrepid2::getOperatorRank): DIV cannot be applied to scalar fields in 2D and 3D");
151 ">>> ERROR (Intrepid2::getOperatorRank): Invalid operator type");
159 KOKKOS_INLINE_FUNCTION
161 ordinal_type opOrder = -1;
163 switch (operatorType) {
185 opOrder = (ordinal_type)operatorType - (ordinal_type)OPERATOR_D1 + 1;
189 INTREPID2_TEST_FOR_ABORT( !( Intrepid2::isValidOperator(operatorType) ),
190 ">>> ERROR (Intrepid2::getOperatorOrder): Invalid operator type");
196 KOKKOS_INLINE_FUNCTION
198 const ordinal_type yMult,
199 const ordinal_type zMult) {
201 if (yMult < 0 && zMult < 0) {
203#ifdef HAVE_INTREPID2_DEBUG
206 ">>> ERROR (Intrepid2::getDkEnumeration): Derivative order out of range");
214#ifdef HAVE_INTREPID2_DEBUG
217 ">>> ERROR (Intrepid2::getDkEnumeration): Derivative order out of range");
226 const auto order = xMult + yMult + zMult;
227#ifdef HAVE_INTREPID2_DEBUG
229 INTREPID2_TEST_FOR_ABORT( !( (0 <= xMult) && (0 <= yMult) && (0 <= zMult) &&
231 ">>> ERROR (Intrepid2::getDkEnumeration): Derivative order out of range");
233 ordinal_type enumeration = zMult;
234 const ordinal_type iend = order-xMult+1;
235 for(ordinal_type i=0;i<iend;++i) {
352 KOKKOS_INLINE_FUNCTION
354 const ordinal_type spaceDim) {
357 ordinal_type derivativeOrder;
358 switch(operatorType) {
374 INTREPID2_TEST_FOR_ABORT(
true,
375 ">>> ERROR (Intrepid2::getDkCardinality): operator type Dk required for this method");
378 ordinal_type cardinality = -999;
386 cardinality = derivativeOrder + 1;
390 cardinality = (derivativeOrder + 1)*(derivativeOrder + 2)/2;
394 INTREPID2_TEST_FOR_ABORT( !( (0 < spaceDim ) && (spaceDim < 4) ),
395 ">>> ERROR (Intrepid2::getDkcardinality): Invalid space dimension");
KOKKOS_INLINE_FUNCTION ordinal_type getOperatorRank(const EFunctionSpace spaceType, const EOperator operatorType, const ordinal_type spaceDim)
Returns rank of an operator.
KOKKOS_INLINE_FUNCTION ordinal_type getFieldRank(const EFunctionSpace spaceType)
Returns the rank of fields in a function space of the specified type.
KOKKOS_INLINE_FUNCTION ordinal_type getOperatorOrder(const EOperator operatorType)
Returns order of an operator.
KOKKOS_INLINE_FUNCTION ordinal_type getDkCardinality(const EOperator operatorType, const ordinal_type spaceDim)
Returns cardinality of Dk, i.e., the number of all derivatives of order k.
KOKKOS_INLINE_FUNCTION ordinal_type getDkEnumeration(const ordinal_type xMult, const ordinal_type yMult=-1, const ordinal_type zMult=-1)
Returns the ordinal of a partial derivative of order k based on the multiplicities of the partials dx...
KOKKOS_FORCEINLINE_FUNCTION bool isValidFunctionSpace(const EFunctionSpace spaceType)
Verifies validity of a function space enum.
KOKKOS_FORCEINLINE_FUNCTION bool isValidOperator(const EOperator operatorType)
Verifies validity of an operator enum.
Header function for Intrepid2::Util class and other utility functions.
static constexpr ordinal_type MaxDerivative
Maximum order of derivatives allowed in intrepid.