49 #ifndef __INTREPID2_CUBATURE_TENSOR_DEF_HPP__ 
   50 #define __INTREPID2_CUBATURE_TENSOR_DEF_HPP__ 
   54   template<
typename SpT, 
typename PT, 
typename WT>
 
   55   template<
typename cubPointValueType,  
class ...cubPointProperties,
 
   56            typename cubWeightValueType, 
class ...cubWeightProperties>
 
   58   CubatureTensor<SpT,PT,WT>::
 
   59   getCubatureImpl( Kokkos::DynRankView<cubPointValueType, cubPointProperties...>  cubPoints,
 
   60                    Kokkos::DynRankView<cubWeightValueType,cubWeightProperties...> cubWeights )
 const {
 
   61 #ifdef HAVE_INTREPID2_DEBUG 
   63     INTREPID2_TEST_FOR_EXCEPTION( static_cast<ordinal_type>(cubPoints.extent(0))  < this->getNumPoints() ||
 
   64                                   static_cast<ordinal_type
>(cubPoints.extent(1))  < this->getDimension() ||
 
   65                                   static_cast<ordinal_type
>(cubWeights.extent(0)) < this->getNumPoints(), std::out_of_range,
 
   66                                   ">>> ERROR (CubatureTensor): Insufficient space allocated for cubature points or weights.");
 
   68     typedef Kokkos::DynRankView<cubPointValueType, SpT>  cubPointViewType;
 
   69     typedef Kokkos::DynRankView<cubWeightValueType,SpT> cubWeightViewType; 
 
   77     for (
auto k=0;k<this->numCubatures_;++k) {
 
   78       const auto &cub = this->cubatures_[k];
 
   79       tmpPoints [k] = cubPointViewType (
"CubatureTensor::getCubature::tmpPoints",  cub.getNumPoints(), cub.getDimension());
 
   80       tmpWeights[k] = cubWeightViewType(
"CubatureTensor::getCubature::tmpWeights", cub.getNumPoints());
 
   81       cub.getCubature(tmpPoints[k], tmpWeights[k]);
 
   85       const auto npts = this->getNumPoints();
 
   86       const auto dim = this->getDimension();
 
   88       const Kokkos::pair<ordinal_type,ordinal_type> pointRange(0, npts);
 
   89       const Kokkos::pair<ordinal_type,ordinal_type> dimRange(0, dim);
 
   91       Kokkos::deep_copy(Kokkos::subdynrankview(cubPoints, pointRange, dimRange), 0.0);
 
   92       Kokkos::deep_copy(Kokkos::subdynrankview(cubWeights, pointRange), 1.0);
 
   99       for (
auto k=0;k<this->numCubatures_;++k) {
 
  100         offset[k+1] = offset[k] + this->cubatures_[k].getDimension();
 
  102       ordinal_type ii = 0, i[3] = {};
 
  103       switch (this->numCubatures_) {
 
  105         const ordinal_type npts[] = { this->cubatures_[0].getNumPoints(), this->cubatures_[1].getNumPoints() };
 
  106         const ordinal_type dim [] = { this->cubatures_[0].getDimension(), this->cubatures_[1].getDimension() };
 
  108         for (i[1]=0;i[1]<npts[1];++i[1])
 
  109           for (i[0]=0;i[0]<npts[0];++i[0]) {
 
  110             for (
auto nc=0;nc<2;++nc) {
 
  111               cubWeights(ii) *= tmpWeights[nc](i[nc]);
 
  112               for (ordinal_type j=0;j<dim[nc];++j)  
 
  113                 cubPoints(ii, offset[nc]+j) = tmpPoints[nc](i[nc], j);
 
  120         const ordinal_type npts[] = { this->cubatures_[0].getNumPoints(), this->cubatures_[1].getNumPoints(), this->cubatures_[2].getNumPoints() };
 
  121         const ordinal_type dim [] = { this->cubatures_[0].getDimension(), this->cubatures_[1].getDimension(), this->cubatures_[2].getDimension() };
 
  123         for (i[2]=0;i[2]<npts[2];++i[2])
 
  124           for (i[1]=0;i[1]<npts[1];++i[1])
 
  125             for (i[0]=0;i[0]<npts[0];++i[0]) {
 
  126               for (
auto nc=0;nc<3;++nc) {             
 
  127                 cubWeights(ii) *= tmpWeights[nc](i[nc]);
 
  128                 for (ordinal_type j=0;j<dim[nc];++j) 
 
  129                   cubPoints(ii, offset[nc]+j) = tmpPoints[nc](i[nc], j);
 
  136         INTREPID2_TEST_FOR_EXCEPTION( this->numCubatures_ != 2 || this->numCubatures_ != 3, std::runtime_error,
 
  137                                       ">>> ERROR (CubatureTensor::getCubature): CubatureTensor supports only 2 or 3 component direct cubatures.");
 
static constexpr ordinal_type MaxDimension
The maximum ambient space dimension.