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:
87 INTREPID2_TEST_FOR_ABORT( !isValidFunctionSpace(spaceType),
88 ">>> ERROR (Intrepid2::getFieldRank): Invalid function space type");
94 KOKKOS_INLINE_FUNCTION
95 ordinal_type getOperatorRank(
const EFunctionSpace spaceType,
96 const EOperator operatorType,
97 const ordinal_type spaceDim) {
99 const auto fieldRank = Intrepid2::getFieldRank(spaceType);
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");
183 INTREPID2_TEST_FOR_ABORT( !( isValidOperator(operatorType) ),
184 ">>> ERROR (Intrepid2::getOperatorRank): Invalid operator type");
192 KOKKOS_INLINE_FUNCTION
193 ordinal_type getOperatorOrder(
const EOperator operatorType) {
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
230 ordinal_type getDkEnumeration(
const ordinal_type xMult,
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
386 ordinal_type getDkCardinality(
const EOperator operatorType,
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");
Header function for Intrepid2::Util class and other utility functions.
static constexpr ordinal_type MaxDerivative
Maximum order of derivatives allowed in intrepid.