49 #ifndef __INTREPID2_PROJECTIONTOOLSDEFHGRAD_HPP__ 
   50 #define __INTREPID2_PROJECTIONTOOLSDEFHGRAD_HPP__ 
   58 namespace Experimental {
 
   60 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
   61 typename ViewType4, 
typename ViewType5>
 
   63   ViewType1 basisCoeffs_;
 
   64   const ViewType2 tagToOrdinal_;
 
   65   const ViewType3 targetEPointsRange_;
 
   66   const ViewType4 targetAtTargetEPoints_;
 
   67   const ViewType5 basisAtTargetEPoints_;
 
   68   ordinal_type numVertices_;
 
   72       ViewType4  targetAtTargetEPoints, ViewType5 basisAtTargetEPoints, ordinal_type numVertices) :
 
   73         basisCoeffs_(basisCoeffs), tagToOrdinal_(tagToOrdinal), targetEPointsRange_(targetEPointsRange),
 
   74         targetAtTargetEPoints_(targetAtTargetEPoints), basisAtTargetEPoints_(basisAtTargetEPoints), numVertices_(numVertices) {}
 
   77   KOKKOS_INLINE_FUNCTION
 
   78   operator()(
const ordinal_type ic)
 const {
 
   81     for(ordinal_type iv=0; iv<numVertices_; ++iv) {
 
   82       ordinal_type idof = tagToOrdinal_(0, iv, 0);
 
   83       ordinal_type pt = targetEPointsRange_(0,iv).first;
 
   85       basisCoeffs_(ic,idof) = targetAtTargetEPoints_(ic,pt)/basisAtTargetEPoints_(ic,idof,pt,0);
 
   90 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
   91 typename ViewType4, 
typename ViewType5, 
typename ViewType6>
 
   93   const ViewType1 basisCoeffs_;
 
   94   const ViewType2 negPartialProjGrad_;
 
   95   const ViewType2 basisTanAtEPoints_;
 
   96   const ViewType2 basisGradAtBasisGradEPoints_;
 
   97   const ViewType3 basisGradEWeights_;
 
   98   const ViewType2 wBasisAtBasisGradEPoints_;
 
   99   const ViewType3 targetGradEWeights_;
 
  100   const ViewType2 basisGradAtTargetGradEPoints_;
 
  101   const ViewType2 wBasisAtTargetGradEPoints_;
 
  102   const ViewType4 computedDofs_;
 
  103   const ViewType5 tagToOrdinal_;
 
  104   const ViewType2 targetGradTanAtTargetGradEPoints_;
 
  105   const ViewType6 targetGradAtTargetGradEPoints_;
 
  106   const ViewType2 refEdgesTan_;
 
  107   ordinal_type edgeCardinality_;
 
  108   ordinal_type offsetBasis_;
 
  109   ordinal_type offsetTarget_;
 
  110   ordinal_type numVertexDofs_;
 
  111   ordinal_type edgeDim_;
 
  116       const ViewType2 basisGradAtBasisGradEPoints, 
const ViewType3 basisGradEWeights,  
const ViewType2 wBasisAtBasisGradEPoints,   
const ViewType3 targetGradEWeights,
 
  117       const ViewType2 basisGradAtTargetGradEPoints, 
const ViewType2 wBasisAtTargetGradEPoints, 
const ViewType4 computedDofs, 
const ViewType5 tagToOrdinal,
 
  118       const ViewType2 targetGradTanAtTargetGradEPoints, 
const ViewType6 targetGradAtTargetGradEPoints, 
const ViewType2 refEdgesTan,
 
  119       ordinal_type edgeCardinality, ordinal_type offsetBasis,
 
  120       ordinal_type offsetTarget, ordinal_type numVertexDofs, ordinal_type edgeDim, ordinal_type dim, ordinal_type iedge) :
 
  121         basisCoeffs_(basisCoeffs), negPartialProjGrad_(negPartialProjGrad), basisTanAtEPoints_(basisTanAtEPoints),
 
  122         basisGradAtBasisGradEPoints_(basisGradAtBasisGradEPoints), basisGradEWeights_(basisGradEWeights), wBasisAtBasisGradEPoints_(wBasisAtBasisGradEPoints), targetGradEWeights_(targetGradEWeights),
 
  123         basisGradAtTargetGradEPoints_(basisGradAtTargetGradEPoints), wBasisAtTargetGradEPoints_(wBasisAtTargetGradEPoints),
 
  124         computedDofs_(computedDofs), tagToOrdinal_(tagToOrdinal), targetGradTanAtTargetGradEPoints_(targetGradTanAtTargetGradEPoints),
 
  125         targetGradAtTargetGradEPoints_(targetGradAtTargetGradEPoints), refEdgesTan_(refEdgesTan),
 
  126         edgeCardinality_(edgeCardinality), offsetBasis_(offsetBasis),
 
  127         offsetTarget_(offsetTarget), numVertexDofs_(numVertexDofs), edgeDim_(edgeDim), dim_(dim), iedge_(iedge)
 
  131   KOKKOS_INLINE_FUNCTION
 
  132   operator()(
const ordinal_type ic)
 const {
 
  134     ordinal_type numBasisGradEPoints = basisGradEWeights_.extent(0);
 
  135     ordinal_type numTargetGradEPoints = targetGradEWeights_.extent(0);
 
  136     for(ordinal_type j=0; j <edgeCardinality_; ++j) {
 
  137       ordinal_type jdof = tagToOrdinal_(edgeDim_, iedge_, j);
 
  140       for(ordinal_type iq=0; iq <numBasisGradEPoints; ++iq) {
 
  141         for(ordinal_type d=0; d <dim_; ++d)
 
  142           basisTanAtEPoints_(ic,j,iq) += basisGradAtBasisGradEPoints_(ic,jdof,offsetBasis_+iq,d)*refEdgesTan_(iedge_, d);
 
  143         wBasisAtBasisGradEPoints_(ic,j,iq) = basisTanAtEPoints_(ic,j,iq)*basisGradEWeights_(iq);
 
  145       for(ordinal_type iq=0; iq <numTargetGradEPoints; ++iq) {
 
  146         for(ordinal_type d=0; d <dim_; ++d)
 
  147           wBasisAtTargetGradEPoints_(ic,j,iq) += basisGradAtTargetGradEPoints_(ic,jdof,offsetTarget_+iq,d)*refEdgesTan_(iedge_, d)*targetGradEWeights_(iq);
 
  151     for(ordinal_type iq=0; iq <numTargetGradEPoints; ++iq)
 
  152       for(ordinal_type d=0; d <dim_; ++d)
 
  153         targetGradTanAtTargetGradEPoints_(ic,iq) += targetGradAtTargetGradEPoints_(ic,offsetTarget_+iq,d)*refEdgesTan_(iedge_, d);
 
  155     for(ordinal_type j=0; j <numVertexDofs_; ++j) {
 
  156       ordinal_type jdof = computedDofs_(j);
 
  157       for(ordinal_type iq=0; iq <numBasisGradEPoints; ++iq)
 
  158         for(ordinal_type d=0; d <dim_; ++d)
 
  159           negPartialProjGrad_(ic,iq) -=  basisCoeffs_(ic,jdof)*basisGradAtBasisGradEPoints_(ic,jdof,offsetBasis_+iq,d)*refEdgesTan_(iedge_, d);
 
  164 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
  165 typename ViewType4, 
typename ViewType5, 
typename ViewType6, 
typename ViewType7>
 
  167   const ViewType1 basisCoeffs_;
 
  168   const ViewType2 negPartialProjGrad_;
 
  169   const ViewType2 faceBasisGradAtGradEPoints_;
 
  170   const ViewType2 basisGradAtBasisGradEPoints_;
 
  171   const ViewType3 basisGradEWeights_;
 
  172   const ViewType2 wBasisGradAtGradEPoints_;
 
  173   const ViewType3 targetGradEWeights_;
 
  174   const ViewType2 basisGradAtTargetGradEPoints_;
 
  175   const ViewType2 wBasisGradBasisAtTargetGradEPoints_;
 
  176   const ViewType4 computedDofs_;
 
  177   const ViewType5 tagToOrdinal_;
 
  178   const ViewType6 orts_;
 
  179   const ViewType2 targetGradTanAtTargetGradEPoints_;
 
  180   const ViewType7 targetGradAtTargetGradEPoints_;
 
  181   const ViewType2 ortJacobian_;
 
  182   const ViewType2 faceCoeff_;
 
  183   const ViewType2 refFacesTangents_;
 
  184   ordinal_type faceCardinality_;
 
  185   ordinal_type offsetBasisGrad_;
 
  186   ordinal_type offsetTargetGrad_;
 
  187   ordinal_type numVertexEdgeDofs_;
 
  188   ordinal_type numFaces_;
 
  189   ordinal_type faceDim_;
 
  195       const ViewType2 basisGradAtBasisGradEPoints, 
const ViewType3 basisGradEWeights,  
const ViewType2 wBasisGradAtGradEPoints,   
const ViewType3 targetGradEWeights,
 
  196       const ViewType2 basisGradAtTargetGradEPoints, 
const ViewType2 wBasisGradBasisAtTargetGradEPoints, 
const ViewType4 computedDofs, 
const ViewType5 tagToOrdinal,
 
  197       const ViewType6 orts, 
const ViewType2 targetGradTanAtTargetGradEPoints, 
const ViewType7 targetGradAtTargetGradEPoints,
 
  198       const ViewType2 refFacesTangents, ordinal_type faceCardinality, ordinal_type offsetBasisGrad,
 
  199       ordinal_type offsetTargetGrad, ordinal_type numVertexEdgeDofs, ordinal_type numFaces, ordinal_type faceDim,
 
  200       ordinal_type dim, ordinal_type iface, 
unsigned topoKey) :
 
  201         basisCoeffs_(basisCoeffs), negPartialProjGrad_(negPartialProjGrad), faceBasisGradAtGradEPoints_(faceBasisGradAtGradEPoints),
 
  202         basisGradAtBasisGradEPoints_(basisGradAtBasisGradEPoints), basisGradEWeights_(basisGradEWeights), wBasisGradAtGradEPoints_(wBasisGradAtGradEPoints),
 
  203         targetGradEWeights_(targetGradEWeights),
 
  204         basisGradAtTargetGradEPoints_(basisGradAtTargetGradEPoints), wBasisGradBasisAtTargetGradEPoints_(wBasisGradBasisAtTargetGradEPoints),
 
  205         computedDofs_(computedDofs), tagToOrdinal_(tagToOrdinal), orts_(orts), targetGradTanAtTargetGradEPoints_(targetGradTanAtTargetGradEPoints),
 
  206         targetGradAtTargetGradEPoints_(targetGradAtTargetGradEPoints), refFacesTangents_(refFacesTangents),
 
  207         faceCardinality_(faceCardinality), offsetBasisGrad_(offsetBasisGrad),
 
  208         offsetTargetGrad_(offsetTargetGrad), numVertexEdgeDofs_(numVertexEdgeDofs), numFaces_(numFaces),
 
  209         faceDim_(faceDim), dim_(dim), iface_(iface), topoKey_(topoKey)
 
  213   KOKKOS_INLINE_FUNCTION
 
  214   operator()(
const ordinal_type ic)
 const {
 
  216     typename ViewType2::value_type ortJacData[2*2];
 
  217     auto ortJac = ViewType2(ortJacData, 2, 2);
 
  219     ordinal_type fOrt[6];
 
  220     orts_(ic).getFaceOrientation(fOrt, numFaces_);
 
  221     ordinal_type ort = fOrt[iface_];
 
  223     ordinal_type numBasisGradEPoints = basisGradEWeights_.extent(0);
 
  224     ordinal_type numTargetGradEPoints = targetGradEWeights_.extent(0);
 
  226     for(ordinal_type j=0; j <faceCardinality_; ++j) {
 
  227       ordinal_type jdof = tagToOrdinal_(faceDim_, iface_, j);
 
  228       for(ordinal_type itan=0; itan <faceDim_; ++itan) {
 
  229         for(ordinal_type iq=0; iq <numBasisGradEPoints; ++iq) {
 
  230           for(ordinal_type d=0; d <dim_; ++d)
 
  231             for(ordinal_type jtan=0; jtan <faceDim_; ++jtan)
 
  232               faceBasisGradAtGradEPoints_(ic,j,iq,itan) += refFacesTangents_(iface_, d, jtan)*ortJac(jtan,itan)*basisGradAtBasisGradEPoints_(ic,jdof,offsetBasisGrad_+iq,d);
 
  233           wBasisGradAtGradEPoints_(ic,j,iq,itan) = faceBasisGradAtGradEPoints_(ic,j,iq,itan) * basisGradEWeights_(iq);
 
  235         for(ordinal_type iq=0; iq <numTargetGradEPoints; ++iq) {
 
  236           typename ViewType2::value_type tmp=0;
 
  237           for(ordinal_type d=0; d <dim_; ++d) {
 
  238             for(ordinal_type jtan=0; jtan <faceDim_; ++jtan)
 
  239               tmp += refFacesTangents_(iface_, d, jtan)*ortJac(jtan,itan)*basisGradAtTargetGradEPoints_(ic,jdof,offsetTargetGrad_+iq,d);
 
  241           wBasisGradBasisAtTargetGradEPoints_(ic,j,iq,itan) = tmp * targetGradEWeights_(iq);
 
  246     for(ordinal_type d=0; d <dim_; ++d)
 
  247       for(ordinal_type itan=0; itan <faceDim_; ++itan)
 
  248         for(ordinal_type iq=0; iq <numTargetGradEPoints; ++iq)
 
  249           for(ordinal_type jtan=0; jtan <faceDim_; ++jtan)
 
  250             targetGradTanAtTargetGradEPoints_(ic,iq,itan) += refFacesTangents_(iface_, d, jtan)*ortJac(jtan,itan)*targetGradAtTargetGradEPoints_(ic,offsetTargetGrad_+iq,d);
 
  252     for(ordinal_type j=0; j <numVertexEdgeDofs_; ++j) {
 
  253       ordinal_type jdof = computedDofs_(j);
 
  254       for(ordinal_type iq=0; iq <numBasisGradEPoints; ++iq)
 
  255         for(ordinal_type d=0; d <dim_; ++d)
 
  256           for(ordinal_type itan=0; itan <faceDim_; ++itan)
 
  257             for(ordinal_type jtan=0; jtan <faceDim_; ++jtan)
 
  258               negPartialProjGrad_(ic,iq,itan) -=  basisCoeffs_(ic,jdof)*refFacesTangents_(iface_, d, jtan)*ortJac(jtan,itan)*basisGradAtBasisGradEPoints_(ic,jdof,offsetBasisGrad_+iq,d);
 
  264 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
  265 typename ViewType4, 
typename ViewType5>
 
  267   const ViewType1 basisCoeffs_;
 
  268   const ViewType2 negPartialProjGrad_;
 
  269   const ViewType2 cellBasisGradAtGradEPoints_;
 
  270   const ViewType2 basisGradAtBasisGradEPoints_;
 
  271   const ViewType3 basisGradEWeights_;
 
  272   const ViewType2 wBasisGradAtGradEPoints_;
 
  273   const ViewType3 targetGradEWeights_;
 
  274   const ViewType2 basisGradAtTargetGradEPoints_;
 
  275   const ViewType2 wBasisGradBasisAtTargetGradEPoints_;
 
  276   const ViewType4 computedDofs_;
 
  277   const ViewType5 elemDof_;
 
  279   ordinal_type numElemDofs_;
 
  280   ordinal_type offsetBasisGrad_;
 
  281   ordinal_type offsetTargetGrad_;
 
  282   ordinal_type numVertexEdgeFaceDofs_;
 
  285       const ViewType2 basisGradAtBasisGradEPoints, 
const ViewType3 basisGradEWeights,  
const ViewType2 wBasisGradAtGradEPoints,   
const ViewType3 targetGradEWeights,
 
  286       const ViewType2 basisGradAtTargetGradEPoints, 
const ViewType2 wBasisGradBasisAtTargetGradEPoints, 
const ViewType4 computedDofs, 
const ViewType5 elemDof,
 
  287       ordinal_type dim, ordinal_type numElemDofs, ordinal_type offsetBasisGrad, ordinal_type offsetTargetGrad, ordinal_type numVertexEdgeFaceDofs) :
 
  288         basisCoeffs_(basisCoeffs), negPartialProjGrad_(negPartialProjGrad), cellBasisGradAtGradEPoints_(cellBasisGradAtGradEPoints),
 
  289         basisGradAtBasisGradEPoints_(basisGradAtBasisGradEPoints), basisGradEWeights_(basisGradEWeights), wBasisGradAtGradEPoints_(wBasisGradAtGradEPoints), targetGradEWeights_(targetGradEWeights),
 
  290         basisGradAtTargetGradEPoints_(basisGradAtTargetGradEPoints), wBasisGradBasisAtTargetGradEPoints_(wBasisGradBasisAtTargetGradEPoints),
 
  291         computedDofs_(computedDofs), elemDof_(elemDof), dim_(dim), numElemDofs_(numElemDofs), offsetBasisGrad_(offsetBasisGrad),
 
  292         offsetTargetGrad_(offsetTargetGrad), numVertexEdgeFaceDofs_(numVertexEdgeFaceDofs) {}
 
  295   KOKKOS_INLINE_FUNCTION
 
  296   operator()(
const ordinal_type ic)
 const {
 
  297     ordinal_type numBasisGradEPoints = basisGradEWeights_.extent(0);
 
  298     ordinal_type numTargetGradEPoints = targetGradEWeights_.extent(0);
 
  299     for(ordinal_type j=0; j <numElemDofs_; ++j) {
 
  300       ordinal_type idof = elemDof_(j);
 
  301       for(ordinal_type d=0; d <dim_; ++d) {
 
  302         for(ordinal_type iq=0; iq <numBasisGradEPoints; ++iq) {
 
  303           cellBasisGradAtGradEPoints_(ic,j,iq,d) = basisGradAtBasisGradEPoints_(ic,idof,offsetBasisGrad_+iq,d);
 
  304           wBasisGradAtGradEPoints_(ic,j,iq,d) = cellBasisGradAtGradEPoints_(ic,j,iq,d) * basisGradEWeights_(iq);
 
  306         for(ordinal_type iq=0; iq <numTargetGradEPoints; ++iq) {
 
  307           wBasisGradBasisAtTargetGradEPoints_(ic,j,iq,d )= basisGradAtTargetGradEPoints_(ic,idof,offsetTargetGrad_+iq,d) * targetGradEWeights_(iq);
 
  311     for(ordinal_type j=0; j <numVertexEdgeFaceDofs_; ++j) {
 
  312       ordinal_type jdof = computedDofs_(j);
 
  313       for(ordinal_type iq=0; iq <numBasisGradEPoints; ++iq)
 
  314         for(ordinal_type d=0; d <dim_; ++d) {
 
  315           negPartialProjGrad_(ic,iq,d) -=  basisCoeffs_(ic,jdof)*basisGradAtBasisGradEPoints_(ic,jdof,offsetBasisGrad_+iq,d);
 
  322 template<
typename SpT>
 
  323 template<
typename BasisType,
 
  324 typename ortValueType,       
class ...ortProperties>
 
  327     typename BasisType::ScalarViewType gradEPoints,
 
  328     const Kokkos::DynRankView<ortValueType,   ortProperties...>  orts,
 
  329     const BasisType* cellBasis,
 
  331     const EvalPointsType evalPointType) {
 
  332   typedef typename BasisType::scalarType scalarType;
 
  333   typedef Kokkos::DynRankView<scalarType,SpT> ScalarViewType;
 
  334   typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
 
  335   const auto cellTopo = cellBasis->getBaseCellTopology();
 
  337   ordinal_type dim = cellTopo.getDimension();
 
  338   ordinal_type numCells = ePoints.extent(0);
 
  339   const ordinal_type edgeDim = 1;
 
  340   const ordinal_type faceDim = 2;
 
  342   ordinal_type numVertices = (cellBasis->getDofCount(0, 0) > 0) ? cellTopo.getVertexCount() : 0;
 
  343   ordinal_type numEdges = (cellBasis->getDofCount(1, 0) > 0) ? cellTopo.getEdgeCount() : 0;
 
  344   ordinal_type numFaces = (cellBasis->getDofCount(2, 0) > 0) ? cellTopo.getFaceCount() : 0;
 
  347   typename CellTools<SpT>::subcellParamViewType subcellParamEdge,  subcellParamFace;
 
  353   auto refTopologyKey =  Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getTopologyKey());
 
  355   auto ePointsRange = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getPointsRange(evalPointType));
 
  356   auto gradEPointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getDerivPointsRange(evalPointType));
 
  359     for(ordinal_type iv=0; iv<numVertices; ++iv) {
 
  360       auto vertexEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getEvalPoints(0,iv,evalPointType));
 
  362           ePointsRange(0, iv), Kokkos::ALL()), vertexEPoints);
 
  366   ScalarViewType workView(
"workView", numCells, projStruct->
getMaxNumDerivPoints(evalPointType), dim-1);
 
  367   for(ordinal_type ie=0; ie<numEdges; ++ie) {
 
  369     auto edgeGradEPointsRange = gradEPointsRange(edgeDim, ie);
 
  370     auto edgeRefGradEPointsRange = range_type(0, range_size(edgeGradEPointsRange));
 
  371     auto edgeGradEPoints =  Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getDerivEvalPoints(edgeDim,ie,evalPointType));
 
  373     const auto topoKey = refTopologyKey(edgeDim,ie);
 
  376     (
"Evaluate Points Edges ",
 
  377         Kokkos::RangePolicy<SpT, int> (0, numCells),
 
  378         KOKKOS_LAMBDA (
const size_t ic) {
 
  381       ordinal_type eOrt[12];
 
  382       orts(ic).getEdgeOrientation(eOrt, numEdges);
 
  383       ordinal_type ort = eOrt[ie];
 
  385       auto orientedEdgeEPoints = Kokkos::subview(workView, ic, edgeRefGradEPointsRange, range_type(0, edgeDim));
 
  392   for(ordinal_type iface=0; iface<numFaces; ++iface) {
 
  394     auto faceGradEPointsRange = gradEPointsRange(faceDim, iface);
 
  395     auto faceRefGradEPointsRange = range_type(0, range_size(faceGradEPointsRange));
 
  396     auto refGradEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getDerivEvalPoints(faceDim,iface,evalPointType));
 
  399     const auto topoKey = refTopologyKey(faceDim,iface);
 
  401     (
"Evaluate Points Faces ",
 
  402         Kokkos::RangePolicy<SpT, int> (0, numCells),
 
  403         KOKKOS_LAMBDA (
const size_t ic) {
 
  404       auto faceGradEPoints  = Kokkos::subview(workView, ic, faceRefGradEPointsRange, Kokkos::ALL());
 
  406       ordinal_type fOrt[6];
 
  407       orts(ic).getFaceOrientation(fOrt, numFaces);
 
  408       ordinal_type ort = fOrt[iface];
 
  415   if(cellBasis->getDofCount(dim,0)>0) {
 
  416     auto gradPointsRange = gradEPointsRange(dim, 0);
 
  418     auto refCellGradEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getDerivEvalPoints(dim,0,evalPointType));
 
  424 template<
typename SpT>
 
  425 template<
typename basisCoeffsValueType, 
class ...basisCoeffsProperties,
 
  426 typename funValsValueType, 
class ...funValsProperties,
 
  428 typename ortValueType,
class ...ortProperties>
 
  431     const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtTargetEPoints,
 
  432     const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetGradAtTargetGradEPoints,
 
  433     const typename BasisType::ScalarViewType targetEPoints,
 
  434     const typename BasisType::ScalarViewType targetGradEPoints,
 
  435     const Kokkos::DynRankView<ortValueType,   ortProperties...>  orts,
 
  436     const BasisType* cellBasis,
 
  437     ProjectionStruct<SpT, typename BasisType::scalarType> * projStruct){
 
  439   typedef typename Kokkos::Impl::is_space<SpT>::host_mirror_space::execution_space host_space_type;
 
  440   typedef typename BasisType::scalarType scalarType;
 
  441   typedef Kokkos::DynRankView<scalarType,SpT> ScalarViewType;
 
  442   typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
 
  443   const auto cellTopo = cellBasis->getBaseCellTopology();
 
  444   ordinal_type dim = cellTopo.getDimension();
 
  445   ordinal_type numTotalTargetEPoints(targetAtTargetEPoints.extent(1)),
 
  446       numTotalTargetGradEPoints(targetGradAtTargetGradEPoints.extent(1));
 
  447   ordinal_type basisCardinality = cellBasis->getCardinality();
 
  448   ordinal_type numCells = targetAtTargetEPoints.extent(0);
 
  449   const ordinal_type edgeDim = 1;
 
  450   const ordinal_type faceDim = 2;
 
  452   ordinal_type numVertices = (cellBasis->getDofCount(0, 0) > 0) ? cellTopo.getVertexCount() : 0;
 
  453   ordinal_type numEdges = (cellBasis->getDofCount(1, 0) > 0) ? cellTopo.getEdgeCount() : 0;
 
  454   ordinal_type numFaces = (cellBasis->getDofCount(2, 0) > 0) ? cellTopo.getFaceCount() : 0;
 
  456   ScalarViewType refEdgesTan(
"refEdgesTan",  numEdges, dim);
 
  457   ScalarViewType refFacesTangents(
"refFacesTangents", numFaces, dim, faceDim);
 
  459   ordinal_type numVertexDofs = numVertices;
 
  461   ordinal_type numEdgeDofs(0);
 
  462   for(ordinal_type ie=0; ie<numEdges; ++ie)
 
  463     numEdgeDofs += cellBasis->getDofCount(edgeDim,ie);
 
  465   ordinal_type numFaceDofs(0);
 
  466   for(ordinal_type iface=0; iface<numFaces; ++iface)
 
  467     numFaceDofs += cellBasis->getDofCount(faceDim,iface);
 
  469   Kokkos::View<ordinal_type*> computedDofs(
"computedDofs",numVertexDofs+numEdgeDofs+numFaceDofs);
 
  471   ordinal_type numTotalBasisEPoints = projStruct->getNumBasisEvalPoints(),
 
  472       numTotalBasisGradEPoints = projStruct->getNumBasisDerivEvalPoints();
 
  473   ScalarViewType basisEPoints(
"basisEPoints",numCells,numTotalBasisEPoints, dim);
 
  474   ScalarViewType basisGradEPoints(
"basisGradEPoints",numCells,numTotalBasisGradEPoints, dim);
 
  475   getHGradEvaluationPoints(basisEPoints, basisGradEPoints, orts, cellBasis, projStruct, EvalPointsType::BASIS);
 
  477   ScalarViewType basisAtTargetEPoints(
"basisAtTargetEPoints",numCells,basisCardinality, numTotalTargetEPoints);
 
  479     ScalarViewType nonOrientedBasisAtTargetEPoints(
"nonOrientedBasisAtTargetEPoints",numCells,basisCardinality, numTotalTargetEPoints);
 
  480     for(ordinal_type ic=0; ic<numCells; ++ic) {
 
  481       cellBasis->getValues(Kokkos::subview(nonOrientedBasisAtTargetEPoints,ic,Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(targetEPoints, ic, Kokkos::ALL(), Kokkos::ALL()));
 
  486   ScalarViewType basisGradAtBasisGradEPoints;
 
  487   ScalarViewType basisGradAtTargetGradEPoints;
 
  488   if(numTotalBasisGradEPoints>0) {
 
  489     ScalarViewType nonOrientedBasisGradAtTargetGradEPoints, nonOrientedBasisGradAtBasisGradEPoints;
 
  491     basisGradAtBasisGradEPoints = ScalarViewType (
"basisGradAtBasisGradEPoints",numCells,basisCardinality, numTotalBasisGradEPoints, dim);
 
  492     nonOrientedBasisGradAtBasisGradEPoints = ScalarViewType (
"nonOrientedBasisGradAtBasisGradEPoints",numCells,basisCardinality, numTotalBasisGradEPoints, dim);
 
  493     basisGradAtTargetGradEPoints = ScalarViewType(
"basisGradAtTargetGradEPoints",numCells,basisCardinality, numTotalTargetGradEPoints, dim);
 
  494     nonOrientedBasisGradAtTargetGradEPoints = ScalarViewType(
"nonOrientedBasisGradAtTargetGradEPoints",numCells,basisCardinality, numTotalTargetGradEPoints, dim);
 
  496     for(ordinal_type ic=0; ic<numCells; ++ic) {
 
  497       cellBasis->getValues(Kokkos::subview(nonOrientedBasisGradAtBasisGradEPoints,ic,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(basisGradEPoints, ic, Kokkos::ALL(), Kokkos::ALL()),OPERATOR_GRAD);
 
  498       cellBasis->getValues(Kokkos::subview(nonOrientedBasisGradAtTargetGradEPoints,ic,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(targetGradEPoints, ic, Kokkos::ALL(), Kokkos::ALL()),OPERATOR_GRAD);
 
  505   auto targetEPointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetPointsRange());
 
  506   auto targetGradEPointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetDerivPointsRange());
 
  508   auto basisGradEPointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisDerivPointsRange());
 
  510   auto refTopologyKey =  Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTopologyKey());
 
  512   auto tagToOrdinal = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(), cellBasis->getAllDofOrdinal());
 
  514   ordinal_type computedDofsCount = 0;
 
  515   for(ordinal_type iv=0; iv<numVertices; ++iv)
 
  516     computedDofs(computedDofsCount++) = tagToOrdinal(0, iv, 0);
 
  518   const Kokkos::RangePolicy<SpT> policy(0, numCells);
 
  519   typedef ComputeBasisCoeffsOnVertices_HGRAD<decltype(basisCoeffs), decltype(tagToOrdinal), decltype(targetEPointsRange),
 
  520       decltype(targetAtTargetEPoints), decltype(basisAtTargetEPoints)> functorType;
 
  521   Kokkos::parallel_for(policy, functorType(basisCoeffs, tagToOrdinal, targetEPointsRange,
 
  522       targetAtTargetEPoints, basisAtTargetEPoints, numVertices));
 
  524   for(ordinal_type ie=0; ie<numEdges; ++ie)  {
 
  526     ordinal_type edgeCardinality = cellBasis->getDofCount(edgeDim,ie);
 
  527     ordinal_type offsetBasis = basisGradEPointsRange(edgeDim, ie).first;
 
  528     ordinal_type offsetTarget = targetGradEPointsRange(edgeDim, ie).first;
 
  529     ordinal_type numBasisGradEPoints = range_size(basisGradEPointsRange(edgeDim, ie));
 
  530     ordinal_type numTargetGradEPoints = range_size(targetGradEPointsRange(edgeDim, ie));
 
  531     auto basisGradEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisDerivEvalWeights(edgeDim,ie));
 
  532     auto targetGradEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetDerivEvalWeights(edgeDim,ie));
 
  534     auto edgeTan = Kokkos::subview(refEdgesTan, ie, Kokkos::ALL());
 
  535     auto edgeTanHost = Kokkos::create_mirror_view(edgeTan);
 
  537     Kokkos::deep_copy(edgeTan,edgeTanHost);
 
  539     ScalarViewType basisTanAtEPoints(
"basisTanAtEPoints",numCells,edgeCardinality, numBasisGradEPoints);
 
  540     ScalarViewType targetGradTanAtTargetGradEPoints(
"tanBasisAtTargetGradEPoints",numCells, numTargetGradEPoints);
 
  541     ScalarViewType wBasisAtBasisGradEPoints(
"wTanBasisAtBasisGradEPoints",numCells,edgeCardinality, numBasisGradEPoints);
 
  542     ScalarViewType wBasisAtTargetGradEPoints(
"wTanBasisAtTargetGradEPoints",numCells,edgeCardinality, numTargetGradEPoints);
 
  543     ScalarViewType negPartialProjGrad(
"negPartialProjGrad", numCells, numBasisGradEPoints);
 
  545     typedef ComputeBasisCoeffsOnEdges_HGRAD<decltype(basisCoeffs), ScalarViewType,  decltype(basisGradEWeights),
 
  546         decltype(computedDofs), decltype(tagToOrdinal), decltype(targetGradAtTargetGradEPoints)> functorTypeEdge;
 
  548     Kokkos::parallel_for(policy, functorTypeEdge(basisCoeffs, negPartialProjGrad,  basisTanAtEPoints,
 
  549         basisGradAtBasisGradEPoints, basisGradEWeights,  wBasisAtBasisGradEPoints,   targetGradEWeights,
 
  550         basisGradAtTargetGradEPoints, wBasisAtTargetGradEPoints, computedDofs, tagToOrdinal,
 
  551         targetGradTanAtTargetGradEPoints, targetGradAtTargetGradEPoints, refEdgesTan,
 
  552         edgeCardinality, offsetBasis,
 
  553         offsetTarget, numVertexDofs, edgeDim, dim, ie));
 
  555     ScalarViewType edgeMassMat_(
"edgeMassMat_", numCells, edgeCardinality, edgeCardinality),
 
  556         edgeRhsMat_(
"rhsMat_", numCells, edgeCardinality);
 
  562     typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, SpT> WorkArrayViewType;
 
  563     ScalarViewType t_(
"t",numCells, edgeCardinality);
 
  564     WorkArrayViewType w_(
"w",numCells, edgeCardinality);
 
  566     auto edgeDofs = Kokkos::subview(tagToOrdinal, edgeDim, ie, Kokkos::ALL());
 
  568     ElemSystem edgeSystem(
"edgeSystem", 
false);
 
  569     edgeSystem.solve(basisCoeffs, edgeMassMat_, edgeRhsMat_, t_, w_, edgeDofs, edgeCardinality);
 
  571     for(ordinal_type i=0; i<edgeCardinality; ++i)
 
  572       computedDofs(computedDofsCount++) = tagToOrdinal(edgeDim, ie, i);
 
  575   for(ordinal_type iface=0; iface<numFaces; ++iface) {
 
  577     const auto topoKey = refTopologyKey(faceDim,iface);
 
  579     ordinal_type faceCardinality = cellBasis->getDofCount(faceDim,iface);
 
  581     ordinal_type numGradEPoints = range_size(basisGradEPointsRange(faceDim, iface));
 
  582     ordinal_type numTargetGradEPoints = range_size(targetGradEPointsRange(faceDim, iface));
 
  583     ordinal_type offsetBasisGrad = basisGradEPointsRange(faceDim, iface).first;
 
  584     ordinal_type offsetTargetGrad = targetGradEPointsRange(faceDim, iface).first;
 
  585     auto basisGradEWeights =  Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisDerivEvalWeights(faceDim,iface));
 
  586     auto targetGradEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetDerivEvalWeights(faceDim,iface));
 
  588     auto refFaceTanU = Kokkos::subview(refFacesTangents, iface, Kokkos::ALL, 0);
 
  589     auto refFaceTanV = Kokkos::subview(refFacesTangents, iface, Kokkos::ALL,1);
 
  590     auto refFaceTanUHost = Kokkos::create_mirror_view(refFaceTanU);
 
  591     auto refFaceTanVHost = Kokkos::create_mirror_view(refFaceTanV);
 
  593     Kokkos::deep_copy(refFaceTanU, refFaceTanUHost);
 
  594     Kokkos::deep_copy(refFaceTanV, refFaceTanVHost);
 
  596     ScalarViewType faceBasisGradAtGradEPoints(
"normaBasisGradAtGradEPoints",numCells,faceCardinality, numGradEPoints,faceDim);
 
  597     ScalarViewType wBasisGradAtGradEPoints(
"wNormalBasisGradAtGradEPoints",numCells,faceCardinality, numGradEPoints,faceDim);
 
  598     ScalarViewType wBasisGradBasisAtTargetGradEPoints(
"wNormalBasisGradAtTargetGradEPoints",numCells,faceCardinality, numTargetGradEPoints,faceDim);
 
  599     ScalarViewType targetGradTanAtTargetGradEPoints(
"targetGradTanAtTargetGradEPoints",numCells, numTargetGradEPoints,faceDim);
 
  600     ScalarViewType negPartialProjGrad(
"mNormalComputedProjection", numCells,numGradEPoints,faceDim);
 
  602     typedef ComputeBasisCoeffsOnFaces_HGRAD<decltype(basisCoeffs), ScalarViewType,  decltype(basisGradEWeights),
 
  603         decltype(computedDofs), decltype(tagToOrdinal), decltype(orts), decltype(targetGradAtTargetGradEPoints)> functorTypeFace_HGRAD;
 
  605     Kokkos::parallel_for(policy, functorTypeFace_HGRAD(basisCoeffs, negPartialProjGrad, faceBasisGradAtGradEPoints,
 
  606         basisGradAtBasisGradEPoints, basisGradEWeights, wBasisGradAtGradEPoints, targetGradEWeights,
 
  607         basisGradAtTargetGradEPoints,wBasisGradBasisAtTargetGradEPoints, computedDofs, tagToOrdinal,
 
  608         orts,targetGradTanAtTargetGradEPoints,targetGradAtTargetGradEPoints,
 
  609         refFacesTangents, faceCardinality, offsetBasisGrad,
 
  610         offsetTargetGrad, numVertexDofs+numEdgeDofs, numFaces, faceDim,
 
  611         dim, iface, topoKey));
 
  613     ScalarViewType faceMassMat_(
"faceMassMat_", numCells, faceCardinality, faceCardinality),
 
  614         faceRhsMat_(
"rhsMat_", numCells, faceCardinality);
 
  621     Kokkos::View<funValsValueType**,Kokkos::LayoutLeft,host_space_type> faceMassMat(
"faceMassMat", faceCardinality,faceCardinality);
 
  622     Kokkos::View<funValsValueType**,Kokkos::LayoutLeft,host_space_type> faceRhsMat(
"faceRhsMat",faceCardinality, 1);
 
  624     typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, SpT> WorkArrayViewType;
 
  625     ScalarViewType t_(
"t",numCells, faceCardinality);
 
  626     WorkArrayViewType w_(
"w",numCells, faceCardinality);
 
  628     auto faceDofs = Kokkos::subview(tagToOrdinal, faceDim, iface, Kokkos::ALL());
 
  630     ElemSystem faceSystem(
"faceSystem", 
false);
 
  631     faceSystem.solve(basisCoeffs, faceMassMat_, faceRhsMat_, t_, w_, faceDofs, faceCardinality);
 
  633     for(ordinal_type i=0; i<faceCardinality; ++i)
 
  634       computedDofs(computedDofsCount++) = tagToOrdinal(faceDim, iface, i);
 
  637   ordinal_type numElemDofs = cellBasis->getDofCount(dim,0);
 
  640     range_type cellTargetGradEPointsRange = targetGradEPointsRange(dim, 0);
 
  641     ordinal_type numTargetGradEPoints = range_size(cellTargetGradEPointsRange);
 
  642     ordinal_type numGradEPoints = range_size(basisGradEPointsRange(dim, 0));
 
  643     ordinal_type offsetBasisGrad = basisGradEPointsRange(dim, 0).first;
 
  644     ordinal_type offsetTargetGrad = cellTargetGradEPointsRange.first;
 
  645     auto targetGradEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetDerivEvalWeights(dim,0));
 
  646     auto basisGradEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisDerivEvalWeights(dim,0));
 
  648     ScalarViewType cellBasisGradAtGradEPoints(
"internalBasisGradAtEPoints",numCells,numElemDofs, numGradEPoints, dim);
 
  649     ScalarViewType negPartialProjGrad(
"negPartialProjGrad", numCells, numGradEPoints, dim);
 
  650     ScalarViewType wBasisGradAtGradEPoints(
"wBasisGradAtGradEPoints",numCells,numElemDofs, numGradEPoints,dim);
 
  651     ScalarViewType wBasisGradBasisAtTargetGradEPoints(
"wBasisGradAtTargetGradEPoints",numCells,numElemDofs, numTargetGradEPoints,dim);
 
  653     auto elemDof = Kokkos::subview(tagToOrdinal, dim, 0, Kokkos::ALL());
 
  654     typedef ComputeBasisCoeffsOnCells_HGRAD<decltype(basisCoeffs), ScalarViewType,  decltype(basisGradEWeights), decltype(computedDofs), decltype(elemDof)> functorTypeCell_HGRAD;
 
  655     Kokkos::parallel_for(policy, functorTypeCell_HGRAD(basisCoeffs, negPartialProjGrad,  cellBasisGradAtGradEPoints,
 
  656         basisGradAtBasisGradEPoints, basisGradEWeights,  wBasisGradAtGradEPoints,   targetGradEWeights,
 
  657         basisGradAtTargetGradEPoints, wBasisGradBasisAtTargetGradEPoints, computedDofs, elemDof,
 
  658         dim, numElemDofs, offsetBasisGrad, offsetTargetGrad, numVertexDofs+numEdgeDofs+numFaceDofs));
 
  659     ScalarViewType cellMassMat_(
"cellMassMat_", numCells, numElemDofs, numElemDofs),
 
  660         cellRhsMat_(
"rhsMat_", numCells, numElemDofs);
 
  663     FunctionSpaceTools<SpT >::integrate(cellRhsMat_, Kokkos::subview(targetGradAtTargetGradEPoints,Kokkos::ALL(),cellTargetGradEPointsRange,Kokkos::ALL()), wBasisGradBasisAtTargetGradEPoints);
 
  666     typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, SpT> WorkArrayViewType;
 
  667     ScalarViewType t_(
"t",numCells, numElemDofs);
 
  668     WorkArrayViewType w_(
"w",numCells, numElemDofs);
 
  670     auto cellDofs = Kokkos::subview(tagToOrdinal, dim, 0, Kokkos::ALL());
 
  671     ElemSystem cellSystem(
"cellSystem", 
true);
 
  672     cellSystem.solve(basisCoeffs, cellMassMat_, cellRhsMat_, t_, w_, cellDofs, numElemDofs);
 
Header file for the abstract base class Intrepid2::DefaultCubatureFactory. 
 
const range_tag getPointsRange(const EvalPointsType type) const 
Returns the range tag of the basis/target evaluation points in subcells. 
 
const range_tag getDerivPointsRange(const EvalPointsType type) const 
Returns the range tag of the basis/target derivative evaluation points on subcells. 
 
view_type getDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId, EvalPointsType type) const 
Returns the evaluation points for basis/target derivatives on a subcell. 
 
ordinal_type getMaxNumDerivPoints(const EvalPointsType type) const 
Returns the maximum number of derivative evaluation points across all the subcells. 
 
An helper class to compute the evaluation points and weights needed for performing projections...
 
const key_tag getTopologyKey() const 
Returns the key tag for subcells. 
 
view_type getEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId, EvalPointsType type) const 
Returns the basis/target evaluation points on a subcell.