49 #ifndef __INTREPID2_BASIS_HPP__
50 #define __INTREPID2_BASIS_HPP__
52 #include "Intrepid2_ConfigDefs.hpp"
57 #include "Shards_CellTopology.hpp"
90 template<
typename ExecSpaceType = void,
91 typename outputValueType = double,
92 typename pointValueType =
double>
145 typedef typename ScalarTraits<pointValueType>::scalar_type
scalarType;
212 template<
typename OrdinalTypeView3D,
213 typename OrdinalTypeView2D,
214 typename OrdinalTypeView1D>
216 OrdinalTypeView2D &ordinalToTag,
217 const OrdinalTypeView1D tags,
218 const ordinal_type basisCard,
219 const ordinal_type tagSize,
220 const ordinal_type posScDim,
221 const ordinal_type posScOrd,
222 const ordinal_type posDfOrd ) {
224 ordinalToTag = OrdinalTypeView2D(
"ordinalToTag", basisCard, tagSize);
227 Kokkos::deep_copy( ordinalToTag, -1 );
230 for (ordinal_type i=0;i<basisCard;++i)
231 for (ordinal_type j=0;j<tagSize;++j)
232 ordinalToTag(i, j) = tags(i*tagSize + j);
236 for (ordinal_type i=0;i<basisCard;++i)
237 if (maxScDim < tags(i*tagSize + posScDim))
238 maxScDim = tags(i*tagSize + posScDim);
242 for (ordinal_type i=0;i<basisCard;++i)
243 if (maxScOrd < tags(i*tagSize + posScOrd))
244 maxScOrd = tags(i*tagSize + posScOrd);
248 for (ordinal_type i=0;i<basisCard;++i)
249 if (maxDfOrd < tags(i*tagSize + posDfOrd))
250 maxDfOrd = tags(i*tagSize + posDfOrd);
254 tagToOrdinal = OrdinalTypeView3D(
"tagToOrdinal", maxScDim, maxScOrd, maxDfOrd);
257 Kokkos::deep_copy( tagToOrdinal, -1 );
260 for (ordinal_type i=0;i<basisCard;++i)
261 tagToOrdinal(tags(i*tagSize), tags(i*tagSize+1), tags(i*tagSize+2)) = i;
282 virtual~
Basis() =
default;
295 typedef Kokkos::DynRankView<outputValueType,Kokkos::LayoutStride,ExecSpaceType>
outputViewType;
299 typedef Kokkos::DynRankView<pointValueType,Kokkos::LayoutStride,ExecSpaceType>
pointViewType;
303 typedef Kokkos::DynRankView<scalarType,Kokkos::LayoutStride,ExecSpaceType>
scalarViewType;
327 const EOperator operatorType = OPERATOR_VALUE )
const {
328 INTREPID2_TEST_FOR_EXCEPTION(
true, std::logic_error,
329 ">>> ERROR (Basis::getValues): this method (FEM) is not supported or should be over-riden accordingly by derived classes.");
356 const EOperator operatorType = OPERATOR_VALUE )
const {
357 INTREPID2_TEST_FOR_EXCEPTION(
true, std::logic_error,
358 ">>> ERROR (Basis::getValues): this method (FVM) is not supported or should be over-riden accordingly by derived classes.");
368 INTREPID2_TEST_FOR_EXCEPTION(
true, std::logic_error,
369 ">>> ERROR (Basis::getDofCoords): this method is not supported or should be over-riden accordingly by derived classes.");
383 INTREPID2_TEST_FOR_EXCEPTION(
true, std::logic_error,
384 ">>> ERROR (Basis::getDofCoeffs): this method is not supported or should be over-riden accordingly by derived classes.");
395 return "Intrepid2_Basis";
465 const ordinal_type subcOrd )
const {
466 if ( subcDim >= 0 && subcDim < static_cast<ordinal_type>(
tagToOrdinal_.extent(0)) &&
467 subcOrd >= 0 && subcOrd < static_cast<ordinal_type>(
tagToOrdinal_.extent(1)) )
470 if (firstDofOrdinal == -1)
return static_cast<ordinal_type>(0);
472 return static_cast<ordinal_type>(this->
getDofTag(firstDofOrdinal)[3]);
477 return static_cast<ordinal_type>(0);
491 const ordinal_type subcOrd,
492 const ordinal_type subcDofOrd )
const {
494 #ifdef HAVE_INTREPID2_DEBUG
495 INTREPID2_TEST_FOR_EXCEPTION( subcDim < 0 || subcDim >= static_cast<ordinal_type>(
tagToOrdinal_.extent(0)), std::out_of_range,
496 ">>> ERROR (Basis::getDofOrdinal): subcDim is out of range");
497 INTREPID2_TEST_FOR_EXCEPTION( subcOrd < 0 || subcOrd >= static_cast<ordinal_type>(
tagToOrdinal_.extent(1)), std::out_of_range,
498 ">>> ERROR (Basis::getDofOrdinal): subcOrd is out of range");
499 INTREPID2_TEST_FOR_EXCEPTION( subcDofOrd < 0 || subcDofOrd >= static_cast<ordinal_type>(
tagToOrdinal_.extent(2)), std::out_of_range,
500 ">>> ERROR (Basis::getDofOrdinal): subcDofOrd is out of range");
502 ordinal_type r_val = -1;
503 if ( subcDim < static_cast<ordinal_type>(
tagToOrdinal_.extent(0)) &&
504 subcOrd < static_cast<ordinal_type>(
tagToOrdinal_.extent(1)) &&
505 subcDofOrd < static_cast<ordinal_type>(
tagToOrdinal_.extent(2)) )
507 #ifdef HAVE_INTREPID2_DEBUG
508 INTREPID2_TEST_FOR_EXCEPTION( r_val == -1, std::runtime_error,
509 ">>> ERROR (Basis::getDofOrdinal): Invalid DoF tag is found.");
533 #ifdef HAVE_INTREPID2_DEBUG
534 INTREPID2_TEST_FOR_EXCEPTION( dofOrd < 0 || dofOrd >= static_cast<ordinal_type>(
ordinalToTag_.extent(0)), std::out_of_range,
535 ">>> ERROR (Basis::getDofTag): dofOrd is out of range");
537 return Kokkos::subview(
ordinalToTag_, dofOrd, Kokkos::ALL());
579 KOKKOS_INLINE_FUNCTION
580 ordinal_type getFieldRank(
const EFunctionSpace spaceType);
617 KOKKOS_INLINE_FUNCTION
618 ordinal_type getOperatorRank(
const EFunctionSpace spaceType,
619 const EOperator operatorType,
620 const ordinal_type spaceDim);
627 KOKKOS_INLINE_FUNCTION
628 ordinal_type getOperatorOrder(
const EOperator operatorType);
630 template<EOperator operatorType>
631 KOKKOS_INLINE_FUNCTION
632 constexpr ordinal_type getOperatorOrder();
657 template<ordinal_type spaceDim>
658 KOKKOS_INLINE_FUNCTION
659 ordinal_type getDkEnumeration(
const ordinal_type xMult,
660 const ordinal_type yMult = -1,
661 const ordinal_type zMult = -1);
674 template<ordinal_type spaceDim>
675 KOKKOS_INLINE_FUNCTION
676 ordinal_type getPnEnumeration(
const ordinal_type p,
677 const ordinal_type q = 0,
678 const ordinal_type r = 0);
700 template<
typename value_type>
701 KOKKOS_INLINE_FUNCTION
702 void getJacobyRecurrenceCoeffs (
706 const ordinal_type alpha,
707 const ordinal_type beta ,
708 const ordinal_type n);
747 KOKKOS_INLINE_FUNCTION
748 ordinal_type getDkCardinality(
const EOperator operatorType,
749 const ordinal_type spaceDim);
751 template<EOperator operatorType, ordinal_type spaceDim>
752 KOKKOS_INLINE_FUNCTION
753 constexpr ordinal_type getDkCardinality();
766 template<ordinal_type spaceDim>
767 KOKKOS_INLINE_FUNCTION
768 ordinal_type getPnCardinality (ordinal_type n);
770 template<ordinal_type spaceDim, ordinal_type n>
771 KOKKOS_INLINE_FUNCTION
772 constexpr ordinal_type getPnCardinality ();
791 template<
typename outputValueViewType,
792 typename inputPointViewType>
793 void getValues_HGRAD_Args(
const outputValueViewType outputValues,
794 const inputPointViewType inputPoints,
795 const EOperator operatorType,
796 const shards::CellTopology cellTopo,
797 const ordinal_type basisCard );
809 template<
typename outputValueViewType,
810 typename inputPointViewType>
811 void getValues_HCURL_Args(
const outputValueViewType outputValues,
812 const inputPointViewType inputPoints,
813 const EOperator operatorType,
814 const shards::CellTopology cellTopo,
815 const ordinal_type basisCard );
827 template<
typename outputValueViewType,
828 typename inputPointViewType>
829 void getValues_HDIV_Args(
const outputValueViewType outputValues,
830 const inputPointViewType inputPoints,
831 const EOperator operatorType,
832 const shards::CellTopology cellTopo,
833 const ordinal_type basisCard );
845 template<
typename outputValueViewType,
846 typename inputPointViewType>
847 void getValues_HVOL_Args(
const outputValueViewType outputValues,
848 const inputPointViewType inputPoints,
849 const EOperator operatorType,
850 const shards::CellTopology cellTopo,
851 const ordinal_type basisCard );