16 #ifndef __INTREPID2_BASIS_DEF_HPP__
17 #define __INTREPID2_BASIS_DEF_HPP__
33 KOKKOS_INLINE_FUNCTION
34 ordinal_type getFieldRank(
const EFunctionSpace spaceType) {
35 ordinal_type fieldRank = -1;
39 case FUNCTION_SPACE_HGRAD:
40 case FUNCTION_SPACE_HVOL:
44 case FUNCTION_SPACE_HCURL:
45 case FUNCTION_SPACE_HDIV:
46 case FUNCTION_SPACE_VECTOR_HGRAD:
50 case FUNCTION_SPACE_TENSOR_HGRAD:
55 INTREPID2_TEST_FOR_ABORT( !isValidFunctionSpace(spaceType),
56 ">>> ERROR (Intrepid2::getFieldRank): Invalid function space type");
62 KOKKOS_INLINE_FUNCTION
63 ordinal_type getOperatorRank(
const EFunctionSpace spaceType,
64 const EOperator operatorType,
65 const ordinal_type spaceDim) {
67 const auto fieldRank = Intrepid2::getFieldRank(spaceType);
68 #ifdef HAVE_INTREPID2_DEBUG
70 INTREPID2_TEST_FOR_ABORT( !(0 <= fieldRank && fieldRank <= 2),
71 ">>> ERROR (Intrepid2::getOperatorRank): Invalid field rank");
72 INTREPID2_TEST_FOR_ABORT( !(1 <= spaceDim && spaceDim <= 3),
73 ">>> ERROR (Intrepid2::getOperatorRank): Invalid space dimension");
75 ordinal_type operatorRank = -999;
81 if (operatorType == OPERATOR_VALUE) {
90 INTREPID2_TEST_FOR_ABORT( fieldRank > 0,
91 ">>> ERROR (getOperatorRank): Only scalar fields are allowed in 1D");
97 switch (operatorType) {
120 operatorRank = spaceDim - 3;
125 operatorRank = 3 - spaceDim;
130 INTREPID2_TEST_FOR_ABORT( ( (spaceDim == 3) && (fieldRank == 0) ),
131 ">>> ERROR (Intrepid2::getOperatorRank): CURL cannot be applied to scalar fields in 3D");
145 INTREPID2_TEST_FOR_ABORT( ( (spaceDim > 1) && (fieldRank == 0) ),
146 ">>> ERROR (Intrepid2::getOperatorRank): DIV cannot be applied to scalar fields in 2D and 3D");
151 INTREPID2_TEST_FOR_ABORT( !( isValidOperator(operatorType) ),
152 ">>> ERROR (Intrepid2::getOperatorRank): Invalid operator type");
160 KOKKOS_INLINE_FUNCTION
161 ordinal_type getOperatorOrder(
const EOperator operatorType) {
162 ordinal_type opOrder = -1;
164 switch (operatorType) {
186 opOrder = (ordinal_type)operatorType - (ordinal_type)OPERATOR_D1 + 1;
190 INTREPID2_TEST_FOR_ABORT( !( Intrepid2::isValidOperator(operatorType) ),
191 ">>> ERROR (Intrepid2::getOperatorOrder): Invalid operator type");
196 template<EOperator operatorType>
197 KOKKOS_INLINE_FUNCTION
198 constexpr ordinal_type getOperatorOrder() {
199 return (operatorType == OPERATOR_VALUE) ? 0 :
200 ((operatorType == OPERATOR_GRAD) || (operatorType == OPERATOR_CURL) || (operatorType == OPERATOR_DIV) || (operatorType == OPERATOR_D1)) ? 1 :
201 (ordinal_type)operatorType - (ordinal_type)OPERATOR_D1 + 1;
205 template<ordinal_type spaceDim>
206 KOKKOS_INLINE_FUNCTION
207 ordinal_type getDkEnumeration(
const ordinal_type ,
208 const ordinal_type yMult,
209 const ordinal_type zMult) {
213 case 2:
return yMult;
214 case 3:
return zMult + (yMult+zMult)*(yMult+zMult+1)/2;
217 INTREPID2_TEST_FOR_ABORT( !( (0 < spaceDim ) && (spaceDim < 4) ),
218 ">>> ERROR (Intrepid2::getDkEnumeration): Invalid space dimension");
224 template<ordinal_type spaceDim>
225 KOKKOS_INLINE_FUNCTION
226 ordinal_type getPnEnumeration(
const ordinal_type p,
227 const ordinal_type q ,
228 const ordinal_type r ) {
229 return (spaceDim==1) ? p :
230 (spaceDim==2) ? (p+q)*(p+q+1)/2+q :
231 (p+q+r)*(p+q+r+1)*(p+q+r+2)/6+(q+r)*(q+r+1)/2+r;
235 template<
typename value_type>
236 KOKKOS_INLINE_FUNCTION
237 void getJacobyRecurrenceCoeffs (
241 const ordinal_type alpha,
242 const ordinal_type beta ,
243 const ordinal_type n) {
244 an = ( (2.0 * n + 1.0 + alpha + beta) * ( 2.0 * n + 2.0 + alpha + beta ) /
245 value_type(2.0 * ( n + 1 ) * ( n + 1 + alpha + beta ) ) );
246 bn = ( (alpha*alpha-beta*beta)*(2.0*n+1.0+alpha+beta) /
247 value_type(2.0*(n+1.0)*(2.0*n+alpha+beta)*(n+1.0+alpha+beta) ) );
248 cn = ( (n+alpha)*(n+beta)*(2.0*n+2.0+alpha+beta) /
249 value_type( (n+1.0)*(n+1.0+alpha+beta)*(2.0*n+alpha+beta) ) );
362 KOKKOS_INLINE_FUNCTION
363 ordinal_type getDkCardinality(
const EOperator operatorType,
364 const ordinal_type spaceDim) {
366 #ifdef HAVE_INTREPID2_DEBUG
367 INTREPID2_TEST_FOR_ABORT( !( (0 < spaceDim ) && (spaceDim < 8) ),
368 ">>> ERROR (Intrepid2::getDkcardinality): Invalid space dimension");
369 switch (operatorType) {
384 INTREPID2_TEST_FOR_ABORT(
true,
">>> ERROR (Intrepid2::getDkCardinality): Cannot be used for this operator ");
389 ordinal_type n = Intrepid2::getOperatorOrder(operatorType);
390 return (spaceDim==1) ? 1 :
391 (spaceDim==2) ? n + 1 :
392 (spaceDim==3) ? (n + 1) * (n + 2) / 2 :
393 (spaceDim==4) ? (n + 1) * (n + 2) * (n + 3) / 6 :
394 (spaceDim==5) ? (n + 1) * (n + 2) * (n + 3) * (n + 4) / 24 :
395 (spaceDim==6) ? (n + 1) * (n + 2) * (n + 3) * (n + 4) * (n + 5) / 120 :
396 (n + 1) * (n + 2) * (n + 3) * (n + 4) * (n + 5) * (n + 6) / 720;
399 template<EOperator operatorType, ordinal_type spaceDim>
400 KOKKOS_INLINE_FUNCTION
401 constexpr ordinal_type getDkCardinality() {
402 return getPnCardinality<spaceDim-1,Intrepid2::getOperatorOrder<operatorType>()>();
405 template<ordinal_type spaceDim>
406 KOKKOS_INLINE_FUNCTION
407 ordinal_type getPnCardinality (ordinal_type n) {
409 #ifdef HAVE_INTREPID2_DEBUG
410 INTREPID2_TEST_FOR_ABORT( !( (0 <= spaceDim ) && (spaceDim < 4) ),
411 ">>> ERROR (Intrepid2::getPnCardinality): Invalid space dimension");
414 return (spaceDim==0) ? 1 :
415 (spaceDim==1) ? n+1 :
416 (spaceDim==2) ? (n + 1) * (n + 2) / 2 :
417 (n + 1) * (n + 2) * (n + 3) / 6;
421 template<ordinal_type spaceDim, ordinal_type n>
422 KOKKOS_INLINE_FUNCTION
423 constexpr ordinal_type getPnCardinality () {
425 return (spaceDim==0) ? 1 :
426 (spaceDim==1) ? n+1 :
427 (spaceDim==2) ? (n + 1) * (n + 2) / 2 :
428 (n + 1) * (n + 2) * (n + 3) / 6;
440 template<
typename outputValueViewType,
441 typename inputPointViewType>
442 void getValues_HGRAD_Args(
const outputValueViewType outputValues,
443 const inputPointViewType inputPoints,
444 const EOperator operatorType,
445 const shards::CellTopology cellTopo,
446 const ordinal_type basisCard ) {
447 const auto spaceDim = cellTopo.getDimension();
450 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
451 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for inputPoints array");
453 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
454 ">>> ERROR (Intrepid2::getValues_HGRAD_Args): dim 0 (number of points) > 0 required for inputPoints array");
456 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
457 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
469 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 2) && (operatorType == OPERATOR_DIV) ), std::invalid_argument,
470 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV is invalid operator for rank-0 (scalar) fields in 2D.");
472 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 3) && ( (operatorType == OPERATOR_DIV) ||
473 (operatorType == OPERATOR_CURL) ) ), std::invalid_argument,
474 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV and CURL are invalid operators for rank-0 (scalar) fields in 3D.");
481 switch(operatorType){
483 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
484 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
499 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
500 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 1D when operator = GRAD, CURL, DIV, or Dk.");
502 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == 1 ),
503 std::invalid_argument,
504 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal 1 when operator = GRAD, CURL, DIV, or Dk.");
507 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
510 else if(spaceDim > 1) {
511 switch(operatorType){
513 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
514 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
519 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
520 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
522 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
523 std::invalid_argument,
524 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cell dimension when operator = GRAD, CURL (in 2D), or D1.");
535 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
536 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
538 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(2)) == getDkCardinality(operatorType, spaceDim)),
539 std::invalid_argument,
540 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cardinality of the Dk multiset.");
543 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
549 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
550 std::invalid_argument,
551 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
553 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(0)) == basisCard ),
554 std::invalid_argument,
555 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
559 template<
typename outputValueViewType,
560 typename inputPointViewType>
561 void getValues_HCURL_Args(
const outputValueViewType outputValues,
562 const inputPointViewType inputPoints,
563 const EOperator operatorType,
564 const shards::CellTopology cellTopo,
565 const ordinal_type basisCard ) {
567 const auto spaceDim = cellTopo.getDimension();
571 INTREPID2_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument,
572 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) cell dimension = 2 or 3 required for HCURL basis");
576 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
577 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 2 required for inputPoints array");
578 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
579 ">>> ERROR (Intrepid2::getValues_HCURL_Args): dim 0 (number of points) > 0 required for inputPoints array");
581 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
582 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
592 INTREPID2_TEST_FOR_EXCEPTION( !( (operatorType == OPERATOR_VALUE) || (operatorType == OPERATOR_CURL) ), std::invalid_argument,
593 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) operator = VALUE or CURL required for HCURL fields.");
597 switch(operatorType) {
600 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
601 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 3 required for outputValues when operator is VALUE");
602 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
603 std::invalid_argument,
604 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 2 of outputValues must equal cell dimension when operator is VALUE.");
611 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3 ) ,
612 std::invalid_argument,
613 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 3 required for outputValues in 3D when operator is CURL");
614 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim),
615 std::invalid_argument,
616 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 2 of outputValues must equal cell dimension in 3D when operator is CURL.");
619 else if(spaceDim == 2) {
620 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2 ) ,
621 std::invalid_argument,
622 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) rank = 2 required for outputValues in 2D when operator is CURL");
627 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HCURL_Args) Invalid operator");
632 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
633 std::invalid_argument,
634 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
636 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(0)) == basisCard ),
637 std::invalid_argument,
638 ">>> ERROR: (Intrepid2::getValues_HCURL_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
644 template<
typename outputValueViewType,
645 typename inputPointViewType>
646 void getValues_HDIV_Args(
const outputValueViewType outputValues,
647 const inputPointViewType inputPoints,
648 const EOperator operatorType,
649 const shards::CellTopology cellTopo,
650 const ordinal_type basisCard ) {
652 const auto spaceDim = cellTopo.getDimension();
655 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
656 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) rank = 2 required for inputPoints array");
657 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
658 ">>> ERROR (Intrepid2::getValues_HDIV_Args): dim 0 (number of points) > 0 required for inputPoints array");
660 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
661 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
671 INTREPID2_TEST_FOR_EXCEPTION( !( (operatorType == OPERATOR_VALUE) || (operatorType == OPERATOR_DIV) ), std::invalid_argument,
672 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) operator = VALUE or DIV required for HDIV fields.");
676 switch(operatorType) {
678 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
679 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) rank = 3 required for outputValues when operator is VALUE.");
681 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
682 std::invalid_argument,
683 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 2 of outputValues must equal cell dimension for operator VALUE.");
686 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
687 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) rank = 2 required for outputValues when operator is DIV.");
691 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HDIV_Args) Invalid operator");
696 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
697 std::invalid_argument,
698 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
700 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(0) ==
static_cast<size_type
>(basisCard) ),
701 std::invalid_argument,
702 ">>> ERROR: (Intrepid2::getValues_HDIV_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
705 template<
typename outputValueViewType,
706 typename inputPointViewType>
707 void getValues_HVOL_Args(
const outputValueViewType outputValues,
708 const inputPointViewType inputPoints,
709 const EOperator operatorType,
710 const shards::CellTopology cellTopo,
711 const ordinal_type basisCard ) {
712 const auto spaceDim = cellTopo.getDimension();
715 INTREPID2_TEST_FOR_EXCEPTION( !(rank(inputPoints) == 2), std::invalid_argument,
716 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for inputPoints array");
718 INTREPID2_TEST_FOR_EXCEPTION( (inputPoints.extent(0) <= 0), std::invalid_argument,
719 ">>> ERROR (Intrepid2::getValues_HGRAD_Args): dim 0 (number of points) > 0 required for inputPoints array");
721 INTREPID2_TEST_FOR_EXCEPTION( !(inputPoints.extent(1) == spaceDim), std::invalid_argument,
722 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (spatial dimension) of inputPoints array does not match cell dimension");
734 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 2) && (operatorType == OPERATOR_DIV) ), std::invalid_argument,
735 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV is invalid operator for rank-0 (scalar) fields in 2D.");
737 INTREPID2_TEST_FOR_EXCEPTION( ( (spaceDim == 3) && ( (operatorType == OPERATOR_DIV) ||
738 (operatorType == OPERATOR_CURL) ) ), std::invalid_argument,
739 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) DIV and CURL are invalid operators for rank-0 (scalar) fields in 3D.");
746 switch(operatorType){
748 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
749 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
764 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
765 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 1D when operator = GRAD, CURL, DIV, or Dk.");
767 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == 1 ),
768 std::invalid_argument,
769 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal 1 when operator = GRAD, CURL, DIV, or Dk.");
772 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
775 else if(spaceDim > 1) {
776 switch(operatorType){
778 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 2), std::invalid_argument,
779 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 2 required for outputValues when operator = VALUE.");
784 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
785 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
787 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(2) == spaceDim ),
788 std::invalid_argument,
789 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cell dimension when operator = GRAD, CURL (in 2D), or D1.");
800 INTREPID2_TEST_FOR_EXCEPTION( !(rank(outputValues) == 3), std::invalid_argument,
801 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) rank = 3 required for outputValues in 2D and 3D when operator = GRAD, CURL (in 2D), or Dk.");
803 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(2)) == getDkCardinality(operatorType, spaceDim)),
804 std::invalid_argument,
805 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 2 of outputValues must equal cardinality of the Dk multiset.");
808 INTREPID2_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
">>> ERROR: (Intrepid2::getValues_HGRAD_Args) Invalid operator");
814 INTREPID2_TEST_FOR_EXCEPTION( !(outputValues.extent(1) == inputPoints.extent(0) ),
815 std::invalid_argument,
816 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 1 (number of points) of outputValues must equal dim 0 of inputPoints.");
818 INTREPID2_TEST_FOR_EXCEPTION( !(static_cast<ordinal_type>(outputValues.extent(0)) == basisCard ),
819 std::invalid_argument,
820 ">>> ERROR: (Intrepid2::getValues_HGRAD_Args) dim 0 (number of basis functions) of outputValues must equal basis cardinality.");
823 template<
typename Device,
824 typename outputValueType,
825 typename pointValueType>
826 Kokkos::DynRankView<outputValueType,Device>
829 const bool operatorIsDk = (operatorType >= OPERATOR_D1) && (operatorType <= OPERATOR_D10);
830 const bool operatorSupported = (operatorType == OPERATOR_VALUE) || (operatorType == OPERATOR_GRAD) || (operatorType == OPERATOR_CURL) || (operatorType == OPERATOR_DIV) || operatorIsDk;
831 INTREPID2_TEST_FOR_EXCEPTION(!operatorSupported, std::invalid_argument,
"operator is not supported by allocateOutputView()");
833 const int numFields = this->getCardinality();
834 const int spaceDim = this->getBaseCellTopology().getDimension() + this->getNumTensorialExtrusions();
836 using OutputViewAllocatable = Kokkos::DynRankView<outputValueType,DeviceType>;
838 switch (functionSpace_)
840 case FUNCTION_SPACE_HGRAD:
841 if (operatorType == OPERATOR_VALUE)
844 OutputViewAllocatable dataView(
"BasisValues HGRAD VALUE data", numFields, numPoints);
847 else if (operatorType == OPERATOR_GRAD)
849 OutputViewAllocatable dataView(
"BasisValues HGRAD GRAD data", numFields, numPoints, spaceDim);
852 else if (operatorIsDk)
854 ordinal_type dkCardinality = getDkCardinality(operatorType, spaceDim);
855 OutputViewAllocatable dataView(
"BasisValues HGRAD Dk data", numFields, numPoints, dkCardinality);
860 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
862 case FUNCTION_SPACE_HDIV:
863 if (operatorType == OPERATOR_VALUE)
866 OutputViewAllocatable dataView(
"BasisValues HDIV VALUE data", numFields, numPoints, spaceDim);
869 else if (operatorType == OPERATOR_DIV)
872 OutputViewAllocatable dataView(
"BasisValues HDIV DIV data", numFields, numPoints);
877 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
879 case FUNCTION_SPACE_HCURL:
880 if (operatorType == OPERATOR_VALUE)
882 OutputViewAllocatable dataView(
"BasisValues HCURL VALUE data", numFields, numPoints, spaceDim);
885 else if (operatorType == OPERATOR_CURL)
890 OutputViewAllocatable dataView(
"BasisValues HCURL CURL data", numFields, numPoints, spaceDim);
896 OutputViewAllocatable dataView(
"BasisValues HCURL CURL data (scalar)", numFields, numPoints);
902 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
904 case FUNCTION_SPACE_HVOL:
905 if (operatorType == OPERATOR_VALUE)
908 OutputViewAllocatable dataView(
"BasisValues HVOL VALUE data", numFields, numPoints);
911 else if (operatorIsDk || (operatorType == OPERATOR_GRAD))
913 ordinal_type dkCardinality = getDkCardinality(operatorType, spaceDim);
914 OutputViewAllocatable dataView(
"BasisValues HVOL Dk data", numFields, numPoints, dkCardinality);
919 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"operator/space combination not supported by allocateOutputView()");
922 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...