52 #ifndef __INTREPID2_UTILS_DEF_HPP__ 53 #define __INTREPID2_UTILS_DEF_HPP__ 65 KOKKOS_INLINE_FUNCTION
66 ordinal_type
getFieldRank(
const EFunctionSpace spaceType) {
67 ordinal_type fieldRank = -1;
71 case FUNCTION_SPACE_HGRAD:
72 case FUNCTION_SPACE_HVOL:
76 case FUNCTION_SPACE_HCURL:
77 case FUNCTION_SPACE_HDIV:
78 case FUNCTION_SPACE_VECTOR_HGRAD:
82 case FUNCTION_SPACE_TENSOR_HGRAD:
88 ">>> ERROR (Intrepid2::getFieldRank): Invalid function space type");
94 KOKKOS_INLINE_FUNCTION
96 const EOperator operatorType,
97 const ordinal_type spaceDim) {
100 #ifdef HAVE_INTREPID2_DEBUG 102 INTREPID2_TEST_FOR_ABORT( !(0 <= fieldRank && fieldRank <= 2),
103 ">>> ERROR (Intrepid2::getOperatorRank): Invalid field rank");
104 INTREPID2_TEST_FOR_ABORT( !(1 <= spaceDim && spaceDim <= 3),
105 ">>> ERROR (Intrepid2::getOperatorRank): Invalid space dimension");
107 ordinal_type operatorRank = -999;
111 if (fieldRank == 0) {
113 if (operatorType == OPERATOR_VALUE) {
122 INTREPID2_TEST_FOR_ABORT( fieldRank > 0,
123 ">>> ERROR (getOperatorRank): Only scalar fields are allowed in 1D");
129 switch (operatorType) {
152 operatorRank = spaceDim - 3;
157 operatorRank = 3 - spaceDim;
162 INTREPID2_TEST_FOR_ABORT( ( (spaceDim == 3) && (fieldRank == 0) ),
163 ">>> ERROR (Intrepid2::getOperatorRank): CURL cannot be applied to scalar fields in 3D");
177 INTREPID2_TEST_FOR_ABORT( ( (spaceDim > 1) && (fieldRank == 0) ),
178 ">>> ERROR (Intrepid2::getOperatorRank): DIV cannot be applied to scalar fields in 2D and 3D");
184 ">>> ERROR (Intrepid2::getOperatorRank): Invalid operator type");
192 KOKKOS_INLINE_FUNCTION
194 ordinal_type opOrder = -1;
196 switch (operatorType) {
218 opOrder = (ordinal_type)operatorType - (ordinal_type)OPERATOR_D1 + 1;
222 INTREPID2_TEST_FOR_ABORT( !( Intrepid2::isValidOperator(operatorType) ),
223 ">>> ERROR (Intrepid2::getOperatorOrder): Invalid operator type");
229 KOKKOS_INLINE_FUNCTION
231 const ordinal_type yMult,
232 const ordinal_type zMult) {
234 if (yMult < 0 && zMult < 0) {
236 #ifdef HAVE_INTREPID2_DEBUG 239 ">>> ERROR (Intrepid2::getDkEnumeration): Derivative order out of range");
247 #ifdef HAVE_INTREPID2_DEBUG 250 ">>> ERROR (Intrepid2::getDkEnumeration): Derivative order out of range");
259 const auto order = xMult + yMult + zMult;
260 #ifdef HAVE_INTREPID2_DEBUG 262 INTREPID2_TEST_FOR_ABORT( !( (0 <= xMult) && (0 <= yMult) && (0 <= zMult) &&
264 ">>> ERROR (Intrepid2::getDkEnumeration): Derivative order out of range");
266 ordinal_type enumeration = zMult;
267 const ordinal_type iend = order-xMult+1;
268 for(ordinal_type i=0;i<iend;++i) {
385 KOKKOS_INLINE_FUNCTION
387 const ordinal_type spaceDim) {
390 ordinal_type derivativeOrder;
391 switch(operatorType) {
403 derivativeOrder = Intrepid2::getOperatorOrder(operatorType);
407 INTREPID2_TEST_FOR_ABORT(
true,
408 ">>> ERROR (Intrepid2::getDkCardinality): operator type Dk required for this method");
411 ordinal_type cardinality = -999;
419 cardinality = derivativeOrder + 1;
423 cardinality = (derivativeOrder + 1)*(derivativeOrder + 2)/2;
427 INTREPID2_TEST_FOR_ABORT( !( (0 < spaceDim ) && (spaceDim < 4) ),
428 ">>> ERROR (Intrepid2::getDkcardinality): Invalid space dimension");
KOKKOS_FORCEINLINE_FUNCTION bool isValidFunctionSpace(const EFunctionSpace spaceType)
Verifies validity of a function space enum.
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 getOperatorRank(const EFunctionSpace spaceType, const EOperator operatorType, const ordinal_type spaceDim)
Returns rank of an operator.
Header function for Intrepid2::Util class and other utility functions.
KOKKOS_INLINE_FUNCTION ordinal_type getDkCardinality(const EOperator operatorType, const ordinal_type spaceDim)
Returns multiplicities of dx, dy, and dz based on the enumeration of the partial derivative, its order and the space dimension. Inverse of the getDkEnumeration() method.
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_INLINE_FUNCTION ordinal_type getOperatorOrder(const EOperator operatorType)
Returns order of an operator.
KOKKOS_FORCEINLINE_FUNCTION bool isValidOperator(const EOperator operatorType)
Verifies validity of an operator enum.
static constexpr ordinal_type MaxDerivative
Maximum order of derivatives allowed in intrepid.