49 #ifndef __INTREPID2_BASIS_DEF_HPP__
50 #define __INTREPID2_BASIS_DEF_HPP__
66 KOKKOS_INLINE_FUNCTION
67 ordinal_type getFieldRank(
const EFunctionSpace spaceType) {
68 ordinal_type fieldRank = -1;
72 case FUNCTION_SPACE_HGRAD:
73 case FUNCTION_SPACE_HVOL:
77 case FUNCTION_SPACE_HCURL:
78 case FUNCTION_SPACE_HDIV:
79 case FUNCTION_SPACE_VECTOR_HGRAD:
83 case FUNCTION_SPACE_TENSOR_HGRAD:
88 INTREPID2_TEST_FOR_ABORT( !isValidFunctionSpace(spaceType),
89 ">>> ERROR (Intrepid2::getFieldRank): Invalid function space type");
95 KOKKOS_INLINE_FUNCTION
96 ordinal_type getOperatorRank(
const EFunctionSpace spaceType,
97 const EOperator operatorType,
98 const ordinal_type spaceDim) {
100 const auto fieldRank = Intrepid2::getFieldRank(spaceType);
101 #ifdef HAVE_INTREPID2_DEBUG
103 INTREPID2_TEST_FOR_ABORT( !(0 <= fieldRank && fieldRank <= 2),
104 ">>> ERROR (Intrepid2::getOperatorRank): Invalid field rank");
105 INTREPID2_TEST_FOR_ABORT( !(1 <= spaceDim && spaceDim <= 3),
106 ">>> ERROR (Intrepid2::getOperatorRank): Invalid space dimension");
108 ordinal_type operatorRank = -999;
112 if (fieldRank == 0) {
114 if (operatorType == OPERATOR_VALUE) {
123 INTREPID2_TEST_FOR_ABORT( fieldRank > 0,
124 ">>> ERROR (getOperatorRank): Only scalar fields are allowed in 1D");
130 switch (operatorType) {
153 operatorRank = spaceDim - 3;
158 operatorRank = 3 - spaceDim;
163 INTREPID2_TEST_FOR_ABORT( ( (spaceDim == 3) && (fieldRank == 0) ),
164 ">>> ERROR (Intrepid2::getOperatorRank): CURL cannot be applied to scalar fields in 3D");
178 INTREPID2_TEST_FOR_ABORT( ( (spaceDim > 1) && (fieldRank == 0) ),
179 ">>> ERROR (Intrepid2::getOperatorRank): DIV cannot be applied to scalar fields in 2D and 3D");
184 INTREPID2_TEST_FOR_ABORT( !( isValidOperator(operatorType) ),
185 ">>> ERROR (Intrepid2::getOperatorRank): Invalid operator type");
193 KOKKOS_INLINE_FUNCTION
194 ordinal_type getOperatorOrder(
const EOperator operatorType) {
195 ordinal_type opOrder = -1;
197 switch (operatorType) {
219 opOrder = (ordinal_type)operatorType - (ordinal_type)OPERATOR_D1 + 1;
223 INTREPID2_TEST_FOR_ABORT( !( Intrepid2::isValidOperator(operatorType) ),
224 ">>> ERROR (Intrepid2::getOperatorOrder): Invalid operator type");
229 template<EOperator operatorType>
230 KOKKOS_INLINE_FUNCTION
231 constexpr ordinal_type getOperatorOrder() {
232 return (operatorType == OPERATOR_VALUE) ? 0 :
233 ((operatorType == OPERATOR_GRAD) || (operatorType == OPERATOR_CURL) || (operatorType == OPERATOR_DIV) || (operatorType == OPERATOR_D1)) ? 1 :
234 (ordinal_type)operatorType - (ordinal_type)OPERATOR_D1 + 1;
238 template<ordinal_type spaceDim>
239 KOKKOS_INLINE_FUNCTION
240 ordinal_type getDkEnumeration(
const ordinal_type ,
241 const ordinal_type yMult,
242 const ordinal_type zMult) {
246 case 2:
return yMult;
247 case 3:
return zMult + (yMult+zMult)*(yMult+zMult+1)/2;
250 INTREPID2_TEST_FOR_ABORT( !( (0 < spaceDim ) && (spaceDim < 4) ),
251 ">>> ERROR (Intrepid2::getDkEnumeration): Invalid space dimension");
257 template<ordinal_type spaceDim>
258 KOKKOS_INLINE_FUNCTION
259 ordinal_type getPnEnumeration(
const ordinal_type p,
260 const ordinal_type q ,
261 const ordinal_type r ) {
262 return (spaceDim==1) ? p :
263 (spaceDim==2) ? (p+q)*(p+q+1)/2+q :
264 (p+q+r)*(p+q+r+1)*(p+q+r+2)/6+(q+r)*(q+r+1)/2+r;
268 template<
typename value_type>
269 KOKKOS_INLINE_FUNCTION
270 void getJacobyRecurrenceCoeffs (
274 const ordinal_type alpha,
275 const ordinal_type beta ,
276 const ordinal_type n) {
277 an = ( (2.0 * n + 1.0 + alpha + beta) * ( 2.0 * n + 2.0 + alpha + beta ) /
278 value_type(2.0 * ( n + 1 ) * ( n + 1 + alpha + beta ) ) );
279 bn = ( (alpha*alpha-beta*beta)*(2.0*n+1.0+alpha+beta) /
280 value_type(2.0*(n+1.0)*(2.0*n+alpha+beta)*(n+1.0+alpha+beta) ) );
281 cn = ( (n+alpha)*(n+beta)*(2.0*n+2.0+alpha+beta) /
282 value_type( (n+1.0)*(n+1.0+alpha+beta)*(2.0*n+alpha+beta) ) );
395 KOKKOS_INLINE_FUNCTION
396 ordinal_type getDkCardinality(
const EOperator operatorType,
397 const ordinal_type spaceDim) {
399 #ifdef HAVE_INTREPID2_DEBUG
400 INTREPID2_TEST_FOR_ABORT( !( (0 < spaceDim ) && (spaceDim < 8) ),
401 ">>> ERROR (Intrepid2::getDkcardinality): Invalid space dimension");
402 switch (operatorType) {
417 INTREPID2_TEST_FOR_ABORT(
true,
">>> ERROR (Intrepid2::getDkCardinality): Cannot be used for this operator ");
422 ordinal_type n = Intrepid2::getOperatorOrder(operatorType);
423 return (spaceDim==1) ? 1 :
424 (spaceDim==2) ? n + 1 :
425 (spaceDim==3) ? (n + 1) * (n + 2) / 2 :
426 (spaceDim==4) ? (n + 1) * (n + 2) * (n + 3) / 6 :
427 (spaceDim==5) ? (n + 1) * (n + 2) * (n + 3) * (n + 4) / 24 :
428 (spaceDim==6) ? (n + 1) * (n + 2) * (n + 3) * (n + 4) * (n + 5) / 120 :
429 (n + 1) * (n + 2) * (n + 3) * (n + 4) * (n + 5) * (n + 6) / 720;
432 template<EOperator operatorType, ordinal_type spaceDim>
433 KOKKOS_INLINE_FUNCTION
434 constexpr ordinal_type getDkCardinality() {
435 return getPnCardinality<spaceDim-1,Intrepid2::getOperatorOrder<operatorType>()>();
438 template<ordinal_type spaceDim>
439 KOKKOS_INLINE_FUNCTION
440 ordinal_type getPnCardinality (ordinal_type n) {
442 #ifdef HAVE_INTREPID2_DEBUG
443 INTREPID2_TEST_FOR_ABORT( !( (0 <= spaceDim ) && (spaceDim < 4) ),
444 ">>> ERROR (Intrepid2::getPnCardinality): Invalid space dimension");
447 return (spaceDim==0) ? 1 :
448 (spaceDim==1) ? n+1 :
449 (spaceDim==2) ? (n + 1) * (n + 2) / 2 :
450 (n + 1) * (n + 2) * (n + 3) / 6;
454 template<ordinal_type spaceDim, ordinal_type n>
455 KOKKOS_INLINE_FUNCTION
456 constexpr ordinal_type getPnCardinality () {
458 return (spaceDim==0) ? 1 :
459 (spaceDim==1) ? n+1 :
460 (spaceDim==2) ? (n + 1) * (n + 2) / 2 :
461 (n + 1) * (n + 2) * (n + 3) / 6;
473 template<
typename outputValueViewType,
474 typename inputPointViewType>
475 void getValues_HGRAD_Args(
const outputValueViewType outputValues,
476 const inputPointViewType inputPoints,
477 const EOperator operatorType,
478 const shards::CellTopology cellTopo,
479 const ordinal_type basisCard ) {
480 const auto spaceDim = cellTopo.getDimension();
483 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
484 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for inputPoints array");
486 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
487 ">>> ERROR (Intrepid2::getValues_HGRAD_Args): dim 0 (number of points) > 0 required for inputPoints array");
489 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
490 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
502 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 2) && (operatorType == OPERATOR_DIV) ), std::invalid_argument,
503 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV is invalid operator for rank-0 (scalar) fields in 2D.");
505 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 3) && ( (operatorType == OPERATOR_DIV) ||
506 (operatorType == OPERATOR_CURL) ) ), std::invalid_argument,
507 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV and CURL are invalid operators for rank-0 (scalar) fields in 3D.");
514 switch(operatorType){
516 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
517 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
532 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
533 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 1D when operator = GRAD, CURL, DIV, or Dk.");
535 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == 1 ),
536 std::invalid_argument,
537 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal 1 when operator = GRAD, CURL, DIV, or Dk.");
540 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
543 else if(spaceDim > 1) {
544 switch(operatorType){
546 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
547 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
552 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
553 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
555 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
556 std::invalid_argument,
557 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cell dimension when operator = GRAD, CURL (in 2D), or D1.");
568 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
569 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
571 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(2)) == getDkCardinality(operatorType, spaceDim)),
572 std::invalid_argument,
573 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cardinality of the Dk multiset.");
576 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
582 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
583 std::invalid_argument,
584 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
586 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(0)) == basisCard ),
587 std::invalid_argument,
588 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
592 template<
typename outputValueViewType,
593 typename inputPointViewType>
594 void getValues_HCURL_Args(
const outputValueViewType outputValues,
595 const inputPointViewType inputPoints,
596 const EOperator operatorType,
597 const shards::CellTopology cellTopo,
598 const ordinal_type basisCard ) {
600 const auto spaceDim = cellTopo.getDimension();
604 INTREPID2_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument,
605 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) cell dimension = 2 or 3 required for HCURL basis");
609 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
610 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 2 required for inputPoints array");
611 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
612 ">>> ERROR (Intrepid2::getValues_HCURL_Args): dim 0 (number of points) > 0 required for inputPoints array");
614 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
615 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
625 INTREPID2_TEST_FOR_EXCEPTION( !( (operatorType == OPERATOR_VALUE) || (operatorType == OPERATOR_CURL) ), std::invalid_argument,
626 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) operator = VALUE or CURL required for HCURL fields.");
630 switch(operatorType) {
633 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
634 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 3 required for outputValues when operator is VALUE");
635 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
636 std::invalid_argument,
637 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 2 of outputValues must equal cell dimension when operator is VALUE.");
644 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3 ) ,
645 std::invalid_argument,
646 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 3 required for outputValues in 3D when operator is CURL");
647 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim),
648 std::invalid_argument,
649 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 2 of outputValues must equal cell dimension in 3D when operator is CURL.");
652 else if(spaceDim == 2) {
653 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2 ) ,
654 std::invalid_argument,
655 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 2 required for outputValues in 2D when operator is CURL");
660 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HCURL_Args) Invalid operator");
665 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
666 std::invalid_argument,
667 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
669 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(0)) == basisCard ),
670 std::invalid_argument,
671 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
677 template<
typename outputValueViewType,
678 typename inputPointViewType>
679 void getValues_HDIV_Args(
const outputValueViewType outputValues,
680 const inputPointViewType inputPoints,
681 const EOperator operatorType,
682 const shards::CellTopology cellTopo,
683 const ordinal_type basisCard ) {
685 const auto spaceDim = cellTopo.getDimension();
688 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
689 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) rank = 2 required for inputPoints array");
690 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
691 ">>> ERROR (Intrepid2::getValues_HDIV_Args): dim 0 (number of points) > 0 required for inputPoints array");
693 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
694 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
704 INTREPID2_TEST_FOR_EXCEPTION( !( (operatorType == OPERATOR_VALUE) || (operatorType == OPERATOR_DIV) ), std::invalid_argument,
705 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) operator = VALUE or DIV required for HDIV fields.");
709 switch(operatorType) {
711 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
712 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) rank = 3 required for outputValues when operator is VALUE.");
714 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
715 std::invalid_argument,
716 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 2 of outputValues must equal cell dimension for operator VALUE.");
719 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
720 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) rank = 2 required for outputValues when operator is DIV.");
724 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HDIV_Args) Invalid operator");
729 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
730 std::invalid_argument,
731 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
733 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(0) ==
static_cast<size_type
>(basisCard) ),
734 std::invalid_argument,
735 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
738 template<
typename outputValueViewType,
739 typename inputPointViewType>
740 void getValues_HVOL_Args(
const outputValueViewType outputValues,
741 const inputPointViewType inputPoints,
742 const EOperator operatorType,
743 const shards::CellTopology cellTopo,
744 const ordinal_type basisCard ) {
745 const auto spaceDim = cellTopo.getDimension();
748 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
749 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for inputPoints array");
751 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
752 ">>> ERROR (Intrepid2::getValues_HGRAD_Args): dim 0 (number of points) > 0 required for inputPoints array");
754 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
755 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
767 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 2) && (operatorType == OPERATOR_DIV) ), std::invalid_argument,
768 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV is invalid operator for rank-0 (scalar) fields in 2D.");
770 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 3) && ( (operatorType == OPERATOR_DIV) ||
771 (operatorType == OPERATOR_CURL) ) ), std::invalid_argument,
772 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV and CURL are invalid operators for rank-0 (scalar) fields in 3D.");
779 switch(operatorType){
781 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
782 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
797 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
798 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 1D when operator = GRAD, CURL, DIV, or Dk.");
800 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == 1 ),
801 std::invalid_argument,
802 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal 1 when operator = GRAD, CURL, DIV, or Dk.");
805 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
808 else if(spaceDim > 1) {
809 switch(operatorType){
811 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
812 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
817 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
818 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
820 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
821 std::invalid_argument,
822 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cell dimension when operator = GRAD, CURL (in 2D), or D1.");
833 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
834 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
836 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(2)) == getDkCardinality(operatorType, spaceDim)),
837 std::invalid_argument,
838 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cardinality of the Dk multiset.");
841 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
847 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
848 std::invalid_argument,
849 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
851 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(0)) == basisCard ),
852 std::invalid_argument,
853 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
856 template<
typename Device,
857 typename outputValueType,
858 typename pointValueType>
859 Kokkos::DynRankView<outputValueType,Device>
862 const bool operatorIsDk = (operatorType >= OPERATOR_D1) && (operatorType <= OPERATOR_D10);
863 const bool operatorSupported = (operatorType == OPERATOR_VALUE) || (operatorType == OPERATOR_GRAD) || (operatorType == OPERATOR_CURL) || (operatorType == OPERATOR_DIV) || operatorIsDk;
864 INTREPID2_TEST_FOR_EXCEPTION(!operatorSupported, std::invalid_argument,
"operator is not supported by allocateOutputView()");
866 const int numFields = this->getCardinality();
867 const int spaceDim = basisCellTopology_.getDimension() + this->getNumTensorialExtrusions();
869 using OutputViewAllocatable = Kokkos::DynRankView<outputValueType,DeviceType>;
871 switch (functionSpace_)
873 case FUNCTION_SPACE_HGRAD:
874 if (operatorType == OPERATOR_VALUE)
877 OutputViewAllocatable dataView(
"BasisValues HGRAD VALUE data", numFields, numPoints);
880 else if (operatorType == OPERATOR_GRAD)
882 OutputViewAllocatable dataView(
"BasisValues HGRAD GRAD data", numFields, numPoints, spaceDim);
885 else if (operatorIsDk)
887 ordinal_type dkCardinality = getDkCardinality(operatorType, spaceDim);
888 OutputViewAllocatable dataView(
"BasisValues HGRAD Dk data", numFields, numPoints, dkCardinality);
893 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
895 case FUNCTION_SPACE_HDIV:
896 if (operatorType == OPERATOR_VALUE)
899 OutputViewAllocatable dataView(
"BasisValues HDIV VALUE data", numFields, numPoints, spaceDim);
902 else if (operatorType == OPERATOR_DIV)
905 OutputViewAllocatable dataView(
"BasisValues HDIV DIV data", numFields, numPoints);
910 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
912 case FUNCTION_SPACE_HCURL:
913 if (operatorType == OPERATOR_VALUE)
915 OutputViewAllocatable dataView(
"BasisValues HCURL VALUE data", numFields, numPoints, spaceDim);
918 else if (operatorType == OPERATOR_CURL)
923 OutputViewAllocatable dataView(
"BasisValues HCURL CURL data", numFields, numPoints, spaceDim);
929 OutputViewAllocatable dataView(
"BasisValues HCURL CURL data (scalar)", numFields, numPoints);
935 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
937 case FUNCTION_SPACE_HVOL:
938 if (operatorType == OPERATOR_VALUE)
941 OutputViewAllocatable dataView(
"BasisValues HVOL VALUE data", numFields, numPoints);
944 else if (operatorIsDk || (operatorType == OPERATOR_GRAD))
946 ordinal_type dkCardinality = getDkCardinality(operatorType, spaceDim);
947 OutputViewAllocatable dataView(
"BasisValues HVOL Dk data", numFields, numPoints, dkCardinality);
952 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
955 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
Kokkos::DynRankView< OutputValueType, DeviceType > allocateOutputView(const int numPoints, const EOperator operatorType=OPERATOR_VALUE) const
Allocate a View container suitable for passing to the getValues() variant that accepts Kokkos DynRank...