18 template <
typename DT,
typename PT,
typename WT>
19 CubaturePolylib<DT,PT,WT>::
20 CubaturePolylib(
const ordinal_type degree,
21 const EPolyType polytype,
24 : CubatureDirect<DT,PT,WT>(degree, 1) {
26 INTREPID2_TEST_FOR_EXCEPTION( degree < 0 ||
27 degree >
static_cast<ordinal_type
>(Parameters::MaxCubatureDegreeEdge), std::out_of_range,
28 ">>> ERROR (CubaturePolylib): No cubature rule implemented for the desired polynomial degree.");
29 INTREPID2_TEST_FOR_EXCEPTION( !
isValidPolyType(polytype), std::invalid_argument,
30 ">>> ERROR (CubaturePolylib): Invalid poly type.");
32 ordinal_type npts = 0;
34 case POLYTYPE_GAUSS: npts = (degree+2)/2;
break;
35 case POLYTYPE_GAUSS_RADAU_LEFT:
36 case POLYTYPE_GAUSS_RADAU_RIGHT: npts = (degree == 0 ? 2 : (degree+3)/2);
break;
37 case POLYTYPE_GAUSS_LOBATTO: npts = (degree+4)/2;
break;
38 case POLYTYPE_MAX:
break;
40 this->cubatureData_.numPoints_ = npts;
42 auto points = Kokkos::DynRankView<PT,Kokkos::HostSpace>(
"CubaturePolylib::points", npts);
43 auto weights = Kokkos::DynRankView<WT,Kokkos::HostSpace>(
"CubaturePolylib::weights", npts);
45 Polylib::Serial::getCubature( points,
52 this->cubatureData_.points_ = Kokkos::DynRankView<PT,DT>(
"CubaturePolylib::cubatureData_::points_", npts, 1);
53 this->cubatureData_.weights_ = Kokkos::DynRankView<WT,DT>(
"CubaturePolylib::cubatureData_::weights_", npts);
55 Kokkos::deep_copy(Kokkos::subdynrankview(this->cubatureData_.points_, Kokkos::ALL(), 0), points );
56 Kokkos::deep_copy(this->cubatureData_.weights_, weights );
KOKKOS_FORCEINLINE_FUNCTION bool isValidPolyType(const EPolyType polytype)
Verifies validity of a PolyType enum.