51 template <
typename DT,
typename PT,
typename WT>
52 CubaturePolylib<DT,PT,WT>::
53 CubaturePolylib(
const ordinal_type degree,
54 const EPolyType polytype,
57 : CubatureDirect<DT,PT,WT>(degree, 1) {
59 INTREPID2_TEST_FOR_EXCEPTION( degree < 0 ||
60 degree >
static_cast<ordinal_type
>(Parameters::MaxCubatureDegreeEdge), std::out_of_range,
61 ">>> ERROR (CubaturePolylib): No cubature rule implemented for the desired polynomial degree.");
62 INTREPID2_TEST_FOR_EXCEPTION( !
isValidPolyType(polytype), std::invalid_argument,
63 ">>> ERROR (CubaturePolylib): Invalid poly type.");
65 ordinal_type npts = 0;
67 case POLYTYPE_GAUSS: npts = (degree+2)/2;
break;
68 case POLYTYPE_GAUSS_RADAU_LEFT:
69 case POLYTYPE_GAUSS_RADAU_RIGHT: npts = (degree == 0 ? 2 : (degree+3)/2);
break;
70 case POLYTYPE_GAUSS_LOBATTO: npts = (degree+4)/2;
break;
71 case POLYTYPE_MAX:
break;
73 this->cubatureData_.numPoints_ = npts;
75 auto points = Kokkos::DynRankView<PT,Kokkos::HostSpace>(
"CubaturePolylib::points", npts);
76 auto weights = Kokkos::DynRankView<WT,Kokkos::HostSpace>(
"CubaturePolylib::weights", npts);
78 Polylib::Serial::getCubature( points,
85 this->cubatureData_.points_ = Kokkos::DynRankView<PT,DT>(
"CubaturePolylib::cubatureData_::points_", npts, 1);
86 this->cubatureData_.weights_ = Kokkos::DynRankView<WT,DT>(
"CubaturePolylib::cubatureData_::weights_", npts);
88 Kokkos::deep_copy(Kokkos::subdynrankview(this->cubatureData_.points_, Kokkos::ALL(), 0), points );
89 Kokkos::deep_copy(this->cubatureData_.weights_, weights );
KOKKOS_FORCEINLINE_FUNCTION bool isValidPolyType(const EPolyType polytype)
Verifies validity of a PolyType enum.