49 #ifndef __INTREPID2_PROJECTIONTOOLSDEFL2_HPP__ 
   50 #define __INTREPID2_PROJECTIONTOOLSDEFL2_HPP__ 
   58 namespace Experimental {
 
   61 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
   62 typename ViewType4, 
typename ViewType5>
 
   64   ViewType1 basisCoeffs_;
 
   65   const ViewType2 tagToOrdinal_;
 
   66   const ViewType3 targetEPointsRange_;
 
   67   const ViewType4 targetAtTargetEPoints_;
 
   68   const ViewType5 basisAtTargetEPoints_;
 
   69   ordinal_type numVertices_;
 
   73       ViewType4  targetAtTargetEPoints, ViewType5 basisAtTargetEPoints, ordinal_type numVertices) :
 
   74         basisCoeffs_(basisCoeffs), tagToOrdinal_(tagToOrdinal), targetEPointsRange_(targetEPointsRange),
 
   75         targetAtTargetEPoints_(targetAtTargetEPoints), basisAtTargetEPoints_(basisAtTargetEPoints), numVertices_(numVertices) {}
 
   78   KOKKOS_INLINE_FUNCTION
 
   79   operator()(
const ordinal_type ic)
 const {
 
   80     for(ordinal_type iv=0; iv<numVertices_; ++iv) {
 
   81       ordinal_type idof = tagToOrdinal_(0, iv, 0);
 
   82       ordinal_type pt = targetEPointsRange_(0,iv).first;
 
   84       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 negPartialProj_;
 
   95   const ViewType2 basisDofDofAtBasisEPoints_;
 
   96   const ViewType2 basisAtBasisEPoints_;
 
   97   const ViewType3 basisEWeights_;
 
   98   const ViewType2 wBasisDofAtBasisEPoints_;
 
   99   const ViewType3 targetEWeights_;
 
  100   const ViewType2 basisAtTargetEPoints_;
 
  101   const ViewType2 wBasisDofAtTargetEPoints_;
 
  102   const ViewType4 computedDofs_;
 
  103   const ViewType5 tagToOrdinal_;
 
  104   const ViewType6 targetAtTargetEPoints_;
 
  105   const ViewType2 targetTanAtTargetEPoints_;
 
  106   const ViewType2 refEdgesVec_;
 
  107   ordinal_type fieldDim_;
 
  108   ordinal_type edgeCardinality_;
 
  109   ordinal_type offsetBasis_;
 
  110   ordinal_type offsetTarget_;
 
  111   ordinal_type numVertexDofs_;
 
  112   ordinal_type edgeDim_;
 
  116       const ViewType2 basisAtBasisEPoints, 
const ViewType3 basisEWeights,  
const ViewType2 wBasisDofAtBasisEPoints,   
const ViewType3 targetEWeights,
 
  117       const ViewType2 basisAtTargetEPoints, 
const ViewType2 wBasisDofAtTargetEPoints, 
const ViewType4 computedDofs, 
const ViewType5 tagToOrdinal,
 
  118       const ViewType6 targetAtTargetEPoints, 
const ViewType2 targetTanAtTargetEPoints, 
const ViewType2 refEdgesVec,
 
  119       ordinal_type fieldDim, ordinal_type edgeCardinality, ordinal_type offsetBasis,
 
  120       ordinal_type offsetTarget, ordinal_type numVertexDofs, ordinal_type edgeDim, ordinal_type iedge) :
 
  121         basisCoeffs_(basisCoeffs), negPartialProj_(negPartialProj), basisDofDofAtBasisEPoints_(basisDofDofAtBasisEPoints),
 
  122         basisAtBasisEPoints_(basisAtBasisEPoints), basisEWeights_(basisEWeights), wBasisDofAtBasisEPoints_(wBasisDofAtBasisEPoints), targetEWeights_(targetEWeights),
 
  123         basisAtTargetEPoints_(basisAtTargetEPoints), wBasisDofAtTargetEPoints_(wBasisDofAtTargetEPoints),
 
  124         computedDofs_(computedDofs), tagToOrdinal_(tagToOrdinal), targetAtTargetEPoints_(targetAtTargetEPoints),
 
  125         targetTanAtTargetEPoints_(targetTanAtTargetEPoints), refEdgesVec_(refEdgesVec),
 
  126         fieldDim_(fieldDim), edgeCardinality_(edgeCardinality), offsetBasis_(offsetBasis),
 
  127         offsetTarget_(offsetTarget), numVertexDofs_(numVertexDofs), edgeDim_(edgeDim), iedge_(iedge)
 
  131   KOKKOS_INLINE_FUNCTION
 
  132   operator()(
const ordinal_type ic)
 const {
 
  133     for(ordinal_type j=0; j <edgeCardinality_; ++j) {
 
  134       ordinal_type jdof =tagToOrdinal_(edgeDim_, iedge_, j);
 
  135       for(ordinal_type iq=0; iq <ordinal_type(basisEWeights_.extent(0)); ++iq) {
 
  136         for(ordinal_type d=0; d <fieldDim_; ++d)
 
  137           basisDofDofAtBasisEPoints_(ic,j,iq) += basisAtBasisEPoints_(ic,jdof,offsetBasis_+iq,d)*refEdgesVec_(iedge_,d);
 
  138         wBasisDofAtBasisEPoints_(ic,j,iq) = basisDofDofAtBasisEPoints_(ic,j,iq)*basisEWeights_(iq);
 
  140       for(ordinal_type iq=0; iq <ordinal_type(targetEWeights_.extent(0)); ++iq) {
 
  141         for(ordinal_type d=0; d <fieldDim_; ++d)
 
  142           wBasisDofAtTargetEPoints_(ic,j,iq) += basisAtTargetEPoints_(ic,jdof,offsetTarget_+iq,d)*refEdgesVec_(iedge_,d)*targetEWeights_(iq);
 
  146     for(ordinal_type iq=0; iq <ordinal_type(targetEWeights_.extent(0)); ++iq)
 
  147       for(ordinal_type d=0; d <fieldDim_; ++d)
 
  148         targetTanAtTargetEPoints_(ic,iq) += targetAtTargetEPoints_(ic,offsetTarget_+iq,d)*refEdgesVec_(iedge_,d);
 
  150     for(ordinal_type j=0; j <numVertexDofs_; ++j) {
 
  151       ordinal_type jdof = computedDofs_(j);
 
  152       for(ordinal_type iq=0; iq <ordinal_type(basisEWeights_.extent(0)); ++iq)
 
  153         for(ordinal_type d=0; d <fieldDim_; ++d)
 
  154           negPartialProj_(ic,iq) -=  basisCoeffs_(ic,jdof)*basisAtBasisEPoints_(ic,jdof,offsetBasis_+iq,d)*refEdgesVec_(iedge_,d);
 
  159 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
  160 typename ViewType4, 
typename ViewType5, 
typename ViewType6, 
typename ViewType7>
 
  162   const ViewType1 basisCoeffs_;
 
  163   const ViewType2 negPartialProj_;
 
  164   const ViewType2 faceBasisDofAtBasisEPoints_;
 
  165   const ViewType2 basisAtBasisEPoints_;
 
  166   const ViewType3 basisEWeights_;
 
  167   const ViewType2 wBasisDofAtBasisEPoints_;
 
  168   const ViewType3 targetEWeights_;
 
  169   const ViewType2 basisAtTargetEPoints_;
 
  170   const ViewType2 wBasisDofAtTargetEPoints_;
 
  171   const ViewType4 computedDofs_;
 
  172   const ViewType5 tagToOrdinal_;
 
  173   const ViewType6 orts_;
 
  174   const ViewType7 targetAtTargetEPoints_;
 
  175   const ViewType2 targetDofAtTargetEPoints_;
 
  176   const ViewType2 ortJacobian_;
 
  177   const ViewType2 faceCoeff_;
 
  178   const ViewType2 refFacesTangents_;
 
  179   const ViewType2 refFacesNormal_;
 
  180   ordinal_type fieldDim_;
 
  181   ordinal_type faceCardinality_;
 
  182   ordinal_type offsetBasis_;
 
  183   ordinal_type offsetTarget_;
 
  184   ordinal_type numVertexEdgeDofs_;
 
  185   ordinal_type numFaces_;
 
  186   ordinal_type faceDim_;
 
  187   ordinal_type faceDofDim_;
 
  191   bool isHCurlBasis_, isHDivBasis_;
 
  194       const ViewType2 basisAtBasisEPoints, 
const ViewType3 basisEWeights,  
const ViewType2 wBasisDofAtBasisEPoints,   
const ViewType3 targetEWeights,
 
  195       const ViewType2 basisAtTargetEPoints, 
const ViewType2 wBasisDofAtTargetEPoints, 
const ViewType4 computedDofs, 
const ViewType5 tagToOrdinal,
 
  196       const ViewType6 orts, 
const ViewType7 targetAtTargetEPoints, 
const ViewType2 targetDofAtTargetEPoints, 
const ViewType2 ortJacobian, 
const ViewType2 faceCoeff,
 
  197       const ViewType2 refFacesTangents, 
const ViewType2 refFacesNormal, ordinal_type fieldDim, ordinal_type faceCardinality, ordinal_type offsetBasis,
 
  198       ordinal_type offsetTarget, ordinal_type numVertexEdgeDofs, ordinal_type numFaces, ordinal_type faceDim, ordinal_type faceDofDim,
 
  199       ordinal_type dim, ordinal_type iface, 
unsigned topoKey, 
bool isHCurlBasis, 
bool isHDivBasis) :
 
  200         basisCoeffs_(basisCoeffs), negPartialProj_(negPartialProj), faceBasisDofAtBasisEPoints_(faceBasisDofAtBasisEPoints),
 
  201         basisAtBasisEPoints_(basisAtBasisEPoints), basisEWeights_(basisEWeights), wBasisDofAtBasisEPoints_(wBasisDofAtBasisEPoints), targetEWeights_(targetEWeights),
 
  202         basisAtTargetEPoints_(basisAtTargetEPoints), wBasisDofAtTargetEPoints_(wBasisDofAtTargetEPoints),
 
  203         computedDofs_(computedDofs), tagToOrdinal_(tagToOrdinal), orts_(orts), targetAtTargetEPoints_(targetAtTargetEPoints),
 
  204         targetDofAtTargetEPoints_(targetDofAtTargetEPoints), ortJacobian_(ortJacobian), faceCoeff_(faceCoeff),
 
  205         refFacesTangents_(refFacesTangents), refFacesNormal_(refFacesNormal),
 
  206         fieldDim_(fieldDim), faceCardinality_(faceCardinality), offsetBasis_(offsetBasis),
 
  207         offsetTarget_(offsetTarget), numVertexEdgeDofs_(numVertexEdgeDofs), numFaces_(numFaces),
 
  208         faceDim_(faceDim), faceDofDim_(faceDofDim), dim_(dim), iface_(iface), topoKey_(topoKey),
 
  209         isHCurlBasis_(isHCurlBasis), isHDivBasis_(isHDivBasis)
 
  213   KOKKOS_INLINE_FUNCTION
 
  214   operator()(
const ordinal_type ic)
 const {
 
  216     ordinal_type fOrt[6];
 
  217     orts_(ic).getFaceOrientation(fOrt, numFaces_);
 
  218     ordinal_type ort = fOrt[iface_];
 
  221     auto ortJacobian = Kokkos::subview(ortJacobian_, ic, Kokkos::ALL(), Kokkos::ALL());
 
  224       for(ordinal_type d=0; d <dim_; ++d)
 
  225         for(ordinal_type itan=0; itan <faceDim_; ++itan) {
 
  226           faceCoeff_(ic,d,itan) = 0;
 
  227           for(ordinal_type jtan=0; jtan <faceDim_; ++jtan)
 
  228             faceCoeff_(ic,d,itan) += refFacesTangents_(iface_,d, jtan)*ortJacobian(jtan,itan);
 
  230     } 
else if (isHDivBasis_) {
 
  231       for(ordinal_type d=0; d <dim_; ++d)
 
  232         faceCoeff_(ic,d,0) = refFacesNormal_(iface_,d);
 
  234       faceCoeff_(ic,0,0) = 1;
 
  235     for(ordinal_type j=0; j <faceCardinality_; ++j) {
 
  236       ordinal_type jdof = tagToOrdinal_(faceDim_, iface_, j);
 
  237       for(ordinal_type itan=0; itan <faceDofDim_; ++itan) {
 
  238         for(ordinal_type iq=0; iq <ordinal_type(basisEWeights_.extent(0)); ++iq) {
 
  239           for(ordinal_type d=0; d <fieldDim_; ++d)
 
  240             faceBasisDofAtBasisEPoints_(ic,j,iq,itan) += faceCoeff_(ic,d, itan)*basisAtBasisEPoints_(ic,jdof,offsetBasis_+iq,d);
 
  241           wBasisDofAtBasisEPoints_(ic,j,iq,itan) = faceBasisDofAtBasisEPoints_(ic,j,iq,itan) * basisEWeights_(iq);
 
  243         for(ordinal_type iq=0; iq <ordinal_type(targetEWeights_.extent(0)); ++iq) {
 
  244           typename ViewType2::value_type sum=0;
 
  245           for(ordinal_type d=0; d <fieldDim_; ++d)
 
  246             sum += faceCoeff_(ic, d, itan)*basisAtTargetEPoints_(ic,jdof,offsetTarget_+iq,d);
 
  247           wBasisDofAtTargetEPoints_(ic,j,iq,itan) = sum * targetEWeights_(iq);
 
  252     for(ordinal_type d=0; d <fieldDim_; ++d)
 
  253       for(ordinal_type itan=0; itan <faceDofDim_; ++itan) {
 
  254         for(ordinal_type iq=0; iq <ordinal_type(targetEWeights_.extent(0)); ++iq)
 
  255           targetDofAtTargetEPoints_(ic,iq,itan) += faceCoeff_(ic, d, itan)*targetAtTargetEPoints_(ic,offsetTarget_+iq,d);
 
  258     for(ordinal_type j=0; j <numVertexEdgeDofs_; ++j) {
 
  259       ordinal_type jdof = computedDofs_(j);
 
  260       for(ordinal_type iq=0; iq <ordinal_type(basisEWeights_.extent(0)); ++iq)
 
  261         for(ordinal_type d=0; d <fieldDim_; ++d)
 
  262           for(ordinal_type itan=0; itan <faceDofDim_; ++itan)
 
  263             negPartialProj_(ic,iq,itan) -=  basisCoeffs_(ic,jdof)*faceCoeff_(ic, d, itan)*basisAtBasisEPoints_(ic,jdof,offsetBasis_+iq,d);
 
  269 template<
typename ViewType1, 
typename ViewType2, 
typename ViewType3,
 
  270 typename ViewType4, 
typename ViewType5>
 
  272   const ViewType1 basisCoeffs_;
 
  273   const ViewType2 negPartialProj_;
 
  274   const ViewType2 internalBasisAtBasisEPoints_;
 
  275   const ViewType2 basisAtBasisEPoints_;
 
  276   const ViewType3 basisEWeights_;
 
  277   const ViewType2 wBasisAtBasisEPoints_;
 
  278   const ViewType3 targetEWeights_;
 
  279   const ViewType2 basisAtTargetEPoints_;
 
  280   const ViewType2 wBasisDofAtTargetEPoints_;
 
  281   const ViewType4 computedDofs_;
 
  282   const ViewType5 elemDof_;
 
  283   ordinal_type fieldDim_;
 
  284   ordinal_type numElemDofs_;
 
  285   ordinal_type offsetBasis_;
 
  286   ordinal_type offsetTarget_;
 
  287   ordinal_type numVertexEdgeFaceDofs_;
 
  290       const ViewType2 basisAtBasisEPoints, 
const ViewType3 basisEWeights,  
const ViewType2 wBasisAtBasisEPoints,   
const ViewType3 targetEWeights,
 
  291       const ViewType2 basisAtTargetEPoints, 
const ViewType2 wBasisDofAtTargetEPoints, 
const ViewType4 computedDofs, 
const ViewType5 elemDof,
 
  292       ordinal_type fieldDim, ordinal_type numElemDofs, ordinal_type offsetBasis, ordinal_type offsetTarget, ordinal_type numVertexEdgeFaceDofs) :
 
  293         basisCoeffs_(basisCoeffs), negPartialProj_(negPartialProj), internalBasisAtBasisEPoints_(internalBasisAtBasisEPoints),
 
  294         basisAtBasisEPoints_(basisAtBasisEPoints), basisEWeights_(basisEWeights), wBasisAtBasisEPoints_(wBasisAtBasisEPoints), targetEWeights_(targetEWeights),
 
  295         basisAtTargetEPoints_(basisAtTargetEPoints), wBasisDofAtTargetEPoints_(wBasisDofAtTargetEPoints),
 
  296         computedDofs_(computedDofs), elemDof_(elemDof), fieldDim_(fieldDim), numElemDofs_(numElemDofs), offsetBasis_(offsetBasis),
 
  297         offsetTarget_(offsetTarget), numVertexEdgeFaceDofs_(numVertexEdgeFaceDofs) {}
 
  300   KOKKOS_INLINE_FUNCTION
 
  301   operator()(
const ordinal_type ic)
 const {
 
  303     for(ordinal_type j=0; j <numElemDofs_; ++j) {
 
  304       ordinal_type idof = elemDof_(j);
 
  305       for(ordinal_type d=0; d <fieldDim_; ++d) {
 
  306         for(ordinal_type iq=0; iq <ordinal_type(basisEWeights_.extent(0)); ++iq) {
 
  307           internalBasisAtBasisEPoints_(ic,j,iq,d) = basisAtBasisEPoints_(ic,idof,offsetBasis_+iq,d);
 
  308           wBasisAtBasisEPoints_(ic,j,iq,d) = internalBasisAtBasisEPoints_(ic,j,iq,d) * basisEWeights_(iq);
 
  310         for(ordinal_type iq=0; iq <ordinal_type(targetEWeights_.extent(0)); ++iq) {
 
  311           wBasisDofAtTargetEPoints_(ic,j,iq,d) = basisAtTargetEPoints_(ic,idof,offsetTarget_+iq,d)* targetEWeights_(iq);
 
  315     for(ordinal_type j=0; j < numVertexEdgeFaceDofs_; ++j) {
 
  316       ordinal_type jdof = computedDofs_(j);
 
  317       for(ordinal_type iq=0; iq <ordinal_type(basisEWeights_.extent(0)); ++iq)
 
  318         for(ordinal_type d=0; d <fieldDim_; ++d) {
 
  319           negPartialProj_(ic,iq,d) -=  basisCoeffs_(ic,jdof)*basisAtBasisEPoints_(ic,jdof,offsetBasis_+iq,d);
 
  326 template<
typename SpT>
 
  327 template<
typename BasisType,
 
  328 typename ortValueType,       
class ...ortProperties>
 
  331     const Kokkos::DynRankView<ortValueType,   ortProperties...>  orts,
 
  332     const BasisType* cellBasis,
 
  334     const EvalPointsType ePointType) {
 
  335   typedef typename BasisType::scalarType scalarType;
 
  336   typedef Kokkos::DynRankView<scalarType,ortProperties...> ScalarViewType;
 
  337   typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
 
  338   const auto cellTopo = cellBasis->getBaseCellTopology();
 
  340   ordinal_type dim = cellTopo.getDimension();
 
  341   ordinal_type numCells = ePoints.extent(0);
 
  342   const ordinal_type edgeDim = 1;
 
  343   const ordinal_type faceDim = 2;
 
  345   ordinal_type numVertices = (cellBasis->getDofCount(0, 0) > 0) ? cellTopo.getVertexCount() : 0;
 
  346   ordinal_type numEdges = (cellBasis->getDofCount(edgeDim, 0) > 0) ? cellTopo.getEdgeCount() : 0;
 
  347   ordinal_type numFaces = (cellBasis->getDofCount(faceDim, 0) > 0) ? cellTopo.getFaceCount() : 0;
 
  348   ordinal_type numVols = (cellBasis->getDofCount(dim, 0) > 0);
 
  352   auto ePointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getPointsRange(ePointType));
 
  354   typename CellTools<SpT>::subcellParamViewType subcellParamEdge,  subcellParamFace;
 
  360   auto refTopologyKey =  Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getTopologyKey());
 
  362   ScalarViewType workView(
"workView", numCells, projStruct->
getMaxNumEvalPoints(ePointType), dim-1);
 
  365     for(ordinal_type iv=0; iv<numVertices; ++iv) {
 
  366       auto vertexEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getEvalPoints(0,iv,ePointType));
 
  368           ePointsRange(0, iv), Kokkos::ALL()), vertexEPoints);
 
  372   for(ordinal_type ie=0; ie<numEdges; ++ie) {
 
  373     auto edgePointsRange = ePointsRange(edgeDim, ie);
 
  374     auto edgeRefPointsRange = range_type(0, range_size(edgePointsRange));
 
  375     auto edgeEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getEvalPoints(edgeDim,ie,ePointType));
 
  379         Kokkos::RangePolicy<SpT, int> (0, numCells),
 
  380         KOKKOS_LAMBDA (
const size_t ic) {
 
  382       ordinal_type eOrt[12];
 
  383       orts(ic).getEdgeOrientation(eOrt, numEdges);
 
  384       ordinal_type ort = eOrt[ie];
 
  386       auto orientedEdgeEPoints = Kokkos::subview(workView, ic, edgeRefPointsRange, range_type(0,edgeDim));
 
  393   for(ordinal_type iface=0; iface<numFaces; ++iface) {
 
  394     auto facePointsRange = ePointsRange(faceDim, iface);
 
  395     auto faceRefPointsRange = range_type(0, range_size(facePointsRange));
 
  396     auto faceEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getEvalPoints(faceDim,iface,ePointType));
 
  400         Kokkos::RangePolicy<SpT, int> (0, numCells),
 
  401         KOKKOS_LAMBDA (
const size_t ic) {
 
  402       ordinal_type fOrt[6];
 
  403       orts(ic).getFaceOrientation(fOrt, numFaces);
 
  404       ordinal_type ort = fOrt[iface];
 
  406       auto orientedFaceEPoints = Kokkos::subview(workView, ic, faceRefPointsRange, Kokkos::ALL());
 
  415     auto pointsRange = ePointsRange(dim, 0);
 
  416     auto cellEPoints = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->
getEvalPoints(dim,0,ePointType));
 
  421 template<
typename SpT>
 
  422 template<
typename basisCoeffsValueType, 
class ...basisCoeffsProperties,
 
  423 typename funValsValueType, 
class ...funValsProperties,
 
  425 typename ortValueType,
class ...ortProperties>
 
  428     const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtTargetEPoints,
 
  429     const typename BasisType::ScalarViewType targetEPoints,
 
  430     const Kokkos::DynRankView<ortValueType,   ortProperties...>  orts,
 
  431     const BasisType* cellBasis,
 
  432     ProjectionStruct<SpT, typename BasisType::scalarType> * projStruct){
 
  434   typedef typename BasisType::scalarType scalarType;
 
  435   typedef Kokkos::DynRankView<scalarType,SpT> ScalarViewType;
 
  436   typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
 
  437   const auto cellTopo = cellBasis->getBaseCellTopology();
 
  438   ordinal_type dim = cellTopo.getDimension();
 
  439   ordinal_type numTotalTargetEPoints(targetAtTargetEPoints.extent(1));
 
  440   ordinal_type basisCardinality = cellBasis->getCardinality();
 
  441   ordinal_type numCells = targetAtTargetEPoints.extent(0);
 
  442   const ordinal_type edgeDim = 1;
 
  443   const ordinal_type faceDim = 2;
 
  444   const ordinal_type fieldDim = (targetAtTargetEPoints.rank()==2) ? 1 : targetAtTargetEPoints.extent(2);
 
  446   ordinal_type numVertices = (cellBasis->getDofCount(0, 0) > 0) ? cellTopo.getVertexCount() : 0;
 
  447   ordinal_type numEdges = (cellBasis->getDofCount(1, 0) > 0) ? cellTopo.getEdgeCount() : 0;
 
  448   ordinal_type numFaces = (cellBasis->getDofCount(2, 0) > 0) ? cellTopo.getFaceCount() : 0;
 
  450   ScalarViewType refEdgesVec(
"refEdgesVec", numEdges, dim);
 
  451   ScalarViewType refFacesTangents(
"refFaceTangents", numFaces, dim, 2);
 
  452   ScalarViewType refFacesNormal(
"refFaceNormal", numFaces, dim);
 
  454   ordinal_type numVertexDofs = numVertices;
 
  456   ordinal_type numEdgeDofs(0);
 
  457   for(ordinal_type ie=0; ie<numEdges; ++ie)
 
  458     numEdgeDofs += cellBasis->getDofCount(edgeDim,ie);
 
  460   ordinal_type numFaceDofs(0);
 
  461   for(ordinal_type iface=0; iface<numFaces; ++iface)
 
  462     numFaceDofs += cellBasis->getDofCount(faceDim,iface);
 
  464   Kokkos::View<ordinal_type*, SpT> computedDofs(
"computedDofs", numVertexDofs+numEdgeDofs+numFaceDofs);
 
  466   auto targetEPointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetPointsRange());
 
  467   auto basisEPointsRange  = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisPointsRange());
 
  469   auto refTopologyKey =  Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTopologyKey());
 
  471   ordinal_type numTotalBasisEPoints = projStruct->getNumBasisEvalPoints();
 
  472   ScalarViewType basisEPoints(
"basisEPoints",numCells,numTotalBasisEPoints, dim);
 
  473   getL2EvaluationPoints(basisEPoints, orts, cellBasis, projStruct, EvalPointsType::BASIS);
 
  475   auto tagToOrdinal = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(), cellBasis->getAllDofOrdinal());
 
  477   ScalarViewType basisAtBasisEPoints(
"basisAtBasisEPoints",numCells,basisCardinality, numTotalBasisEPoints, fieldDim);
 
  478   ScalarViewType basisAtTargetEPoints(
"basisAtTargetEPoints",numCells,basisCardinality, numTotalTargetEPoints, fieldDim);
 
  481       ScalarViewType nonOrientedBasisAtBasisEPoints(
"nonOrientedBasisAtBasisEPoints",numCells,basisCardinality, numTotalBasisEPoints);
 
  482       ScalarViewType nonOrientedBasisAtTargetEPoints(
"nonOrientedBasisAtTargetEPoints",numCells,basisCardinality, numTotalTargetEPoints);
 
  483       for(ordinal_type ic=0; ic<numCells; ++ic) {
 
  484         cellBasis->getValues(Kokkos::subview(nonOrientedBasisAtTargetEPoints,ic,Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(targetEPoints, ic, Kokkos::ALL(), Kokkos::ALL()));
 
  485         cellBasis->getValues(Kokkos::subview(nonOrientedBasisAtBasisEPoints,ic,Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(basisEPoints, ic, Kokkos::ALL(), Kokkos::ALL()));
 
  488           Kokkos::ALL(),0), nonOrientedBasisAtBasisEPoints, orts, cellBasis);
 
  490           Kokkos::ALL(), Kokkos::ALL(),0), nonOrientedBasisAtTargetEPoints, orts, cellBasis);
 
  493       ScalarViewType nonOrientedBasisAtBasisEPoints(
"nonOrientedBasisAtBasisEPoints",numCells,basisCardinality, numTotalBasisEPoints,fieldDim);
 
  494       ScalarViewType nonOrientedBasisAtTargetEPoints(
"nonOrientedBasisAtTargetEPoints",numCells,basisCardinality, numTotalTargetEPoints,fieldDim);
 
  495       for(ordinal_type ic=0; ic<numCells; ++ic) {
 
  496         cellBasis->getValues(Kokkos::subview(nonOrientedBasisAtTargetEPoints,ic,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(targetEPoints, ic, Kokkos::ALL(), Kokkos::ALL()));
 
  497         cellBasis->getValues(Kokkos::subview(nonOrientedBasisAtBasisEPoints,ic,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL()), Kokkos::subview(basisEPoints, ic, Kokkos::ALL(), Kokkos::ALL()));
 
  505     ordinal_type computedDofsCount = 0;
 
  506     for(ordinal_type iv=0; iv<numVertices; ++iv)
 
  507       computedDofs(computedDofsCount++) = tagToOrdinal(0, iv, 0);
 
  509     for(ordinal_type ie=0; ie<numEdges; ++ie)  {
 
  510       ordinal_type edgeCardinality = cellBasis->getDofCount(edgeDim,ie);
 
  511       for(ordinal_type i=0; i<edgeCardinality; ++i)
 
  512         computedDofs(computedDofsCount++) = tagToOrdinal(edgeDim, ie, i);
 
  515     for(ordinal_type iface=0; iface<numFaces; ++iface)  {
 
  516       ordinal_type faceCardinality = cellBasis->getDofCount(faceDim,iface);
 
  517       for(ordinal_type i=0; i<faceCardinality; ++i)
 
  518         computedDofs(computedDofsCount++) = tagToOrdinal(faceDim, iface, i);
 
  522   bool isHGradBasis = (cellBasis->getFunctionSpace() == FUNCTION_SPACE_HGRAD);
 
  523   bool isHCurlBasis = (cellBasis->getFunctionSpace() == FUNCTION_SPACE_HCURL);
 
  524   bool isHDivBasis = (cellBasis->getFunctionSpace() == FUNCTION_SPACE_HDIV);
 
  525   ordinal_type faceDofDim = isHCurlBasis ? 2 : 1;
 
  526   ScalarViewType edgeCoeff(
"edgeCoeff", fieldDim);
 
  529   const Kokkos::RangePolicy<SpT> policy(0, numCells);
 
  533     typedef ComputeBasisCoeffsOnVertices_L2<decltype(basisCoeffs), decltype(tagToOrdinal), decltype(targetEPointsRange),
 
  534         decltype(targetAtTargetEPoints), decltype(basisAtTargetEPoints)> functorType;
 
  535     Kokkos::parallel_for(policy, functorType(basisCoeffs, tagToOrdinal, targetEPointsRange,
 
  536         targetAtTargetEPoints, basisAtTargetEPoints, numVertices));
 
  539   for(ordinal_type ie=0; ie<numEdges; ++ie)  {
 
  540     auto edgeVec = Kokkos::subview(refEdgesVec, ie, Kokkos::ALL());
 
  541     auto edgeVecHost = Kokkos::create_mirror_view(edgeVec);
 
  545     } 
else if(isHDivBasis) {
 
  550     Kokkos::deep_copy(edgeVec,edgeVecHost);
 
  552     ordinal_type edgeCardinality = cellBasis->getDofCount(edgeDim,ie);
 
  553     ordinal_type numBasisEPoints = range_size(basisEPointsRange(edgeDim, ie));
 
  554     ordinal_type numTargetEPoints = range_size(targetEPointsRange(edgeDim, ie));
 
  556     ScalarViewType basisDofAtBasisEPoints(
"BasisDofAtBasisEPoints",numCells,edgeCardinality, numBasisEPoints);
 
  557     ScalarViewType tragetDofAtTargetEPoints(
"TargetDofAtTargetEPoints",numCells, numTargetEPoints);
 
  558     ScalarViewType weightedBasisAtBasisEPoints(
"weightedTanBasisAtBasisEPoints",numCells,edgeCardinality, numBasisEPoints);
 
  559     ScalarViewType weightedBasisAtTargetEPoints(
"weightedTanBasisAtTargetEPoints",numCells,edgeCardinality, numTargetEPoints);
 
  560     ScalarViewType negPartialProj(
"negPartialProj", numCells, numBasisEPoints);
 
  562     auto targetEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetEvalWeights(edgeDim,ie));
 
  563     auto basisEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisEvalWeights(edgeDim,ie));
 
  566     ordinal_type offsetBasis = basisEPointsRange(edgeDim, ie).first;
 
  567     ordinal_type offsetTarget = targetEPointsRange(edgeDim, ie).first;
 
  570     typedef ComputeBasisCoeffsOnEdges_L2<decltype(basisCoeffs), ScalarViewType,  decltype(basisEWeights),
 
  571         decltype(computedDofs), decltype(tagToOrdinal), decltype(targetAtTargetEPoints)> functorTypeEdge;
 
  573     Kokkos::parallel_for(policy, functorTypeEdge(basisCoeffs, negPartialProj, basisDofAtBasisEPoints,
 
  574         basisAtBasisEPoints, basisEWeights, weightedBasisAtBasisEPoints, targetEWeights,
 
  575         basisAtTargetEPoints, weightedBasisAtTargetEPoints, computedDofs, tagToOrdinal,
 
  576         targetAtTargetEPoints,tragetDofAtTargetEPoints, refEdgesVec, fieldDim,
 
  577         edgeCardinality, offsetBasis, offsetTarget, numVertexDofs, edgeDim, ie));
 
  580     ScalarViewType edgeMassMat_(
"edgeMassMat_", numCells, edgeCardinality, edgeCardinality),
 
  581         edgeRhsMat_(
"rhsMat_", numCells, edgeCardinality);
 
  588     typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, SpT> WorkArrayViewType;
 
  589     ScalarViewType t_(
"t",numCells, edgeCardinality);
 
  590     WorkArrayViewType w_(
"w",numCells, edgeCardinality);
 
  592     auto edgeDof = Kokkos::subview(tagToOrdinal, edgeDim, ie, Kokkos::ALL());
 
  594     ElemSystem edgeSystem(
"edgeSystem", 
false);
 
  595     edgeSystem.solve(basisCoeffs, edgeMassMat_, edgeRhsMat_, t_, w_, edgeDof, edgeCardinality);
 
  598   ScalarViewType ortJacobian_(
"ortJacobian", numCells, faceDim, faceDim);
 
  600   ScalarViewType faceCoeff(
"faceCoeff", numCells, fieldDim, faceDofDim);
 
  601   for(ordinal_type iface=0; iface<numFaces; ++iface) {
 
  604     const auto topoKey = refTopologyKey(faceDim,iface);
 
  607     ordinal_type faceCardinality = cellBasis->getDofCount(faceDim,iface);
 
  609     ordinal_type numTargetEPoints = range_size(targetEPointsRange(faceDim, iface));
 
  610     ordinal_type numBasisEPoints = range_size(basisEPointsRange(faceDim, iface));
 
  613       auto refFaceTanU = Kokkos::subview(refFacesTangents, iface, Kokkos::ALL, 0);
 
  614       auto refFaceTanV = Kokkos::subview(refFacesTangents, iface, Kokkos::ALL,1);
 
  615       auto refFaceTanUHost = Kokkos::create_mirror_view(refFaceTanU);
 
  616       auto refFaceTanVHost = Kokkos::create_mirror_view(refFaceTanV);
 
  618       Kokkos::deep_copy(refFaceTanU, refFaceTanUHost);
 
  619       Kokkos::deep_copy(refFaceTanV, refFaceTanVHost);
 
  620     } 
else if(isHDivBasis) {
 
  621       auto faceNormal = Kokkos::subview(refFacesNormal,iface,Kokkos::ALL());
 
  622       auto faceNormalHost = Kokkos::create_mirror_view(faceNormal);
 
  624       Kokkos::deep_copy(faceNormal, faceNormalHost);
 
  627     ScalarViewType faceBasisDofAtBasisEPoints(
"normaBasisAtBasisEPoints",numCells,faceCardinality, numBasisEPoints,faceDofDim);
 
  628     ScalarViewType wBasisDofAtBasisEPoints(
"weightedNormalBasisAtBasisEPoints",numCells,faceCardinality, numBasisEPoints,faceDofDim);
 
  630     ScalarViewType faceBasisAtTargetEPoints(
"normalBasisAtTargetEPoints",numCells,faceCardinality, numTargetEPoints,faceDofDim);
 
  631     ScalarViewType wBasisDofAtTargetEPoints(
"weightedNormalBasisAtTargetEPoints",numCells,faceCardinality, numTargetEPoints,faceDofDim);
 
  633     ScalarViewType targetDofAtTargetEPoints(
"targetDofAtTargetEPoints",numCells, numTargetEPoints,faceDofDim);
 
  634     ScalarViewType negPartialProj(
"mNormalComputedProjection", numCells,numBasisEPoints,faceDofDim);
 
  636     ordinal_type offsetBasis = basisEPointsRange(faceDim, iface).first;
 
  637     ordinal_type offsetTarget = targetEPointsRange(faceDim, iface).first;
 
  638     auto targetEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetEvalWeights(faceDim,iface));
 
  639     auto basisEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisEvalWeights(faceDim,iface));
 
  642     typedef ComputeBasisCoeffsOnFaces_L2<decltype(basisCoeffs), ScalarViewType,  decltype(basisEWeights),
 
  643         decltype(computedDofs), decltype(tagToOrdinal), decltype(orts), decltype(targetAtTargetEPoints)> functorTypeFace;
 
  645     Kokkos::parallel_for(policy, functorTypeFace(basisCoeffs, negPartialProj,faceBasisDofAtBasisEPoints,
 
  646         basisAtBasisEPoints, basisEWeights, wBasisDofAtBasisEPoints, targetEWeights,
 
  647         basisAtTargetEPoints, wBasisDofAtTargetEPoints, computedDofs, tagToOrdinal,
 
  648         orts, targetAtTargetEPoints,targetDofAtTargetEPoints, ortJacobian_, faceCoeff,
 
  649         refFacesTangents, refFacesNormal, fieldDim, faceCardinality, offsetBasis,
 
  650         offsetTarget, numVertexDofs+numEdgeDofs, numFaces, faceDim,faceDofDim,
 
  651         dim, iface, topoKey, isHCurlBasis, isHDivBasis));
 
  653     typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, SpT> WorkArrayViewType;
 
  654     ScalarViewType faceMassMat_(
"faceMassMat_", numCells, faceCardinality, faceCardinality),
 
  655         faceRhsMat_(
"rhsMat_", numCells, faceCardinality);
 
  661     ScalarViewType t_(
"t",numCells, faceCardinality);
 
  662     WorkArrayViewType w_(
"w",numCells,faceCardinality);
 
  664     auto faceDof = Kokkos::subview(tagToOrdinal, faceDim, iface, Kokkos::ALL());
 
  666     ElemSystem faceSystem(
"faceSystem", 
false);
 
  667     faceSystem.solve(basisCoeffs, faceMassMat_, faceRhsMat_, t_, w_, faceDof, faceCardinality);
 
  670   ordinal_type numElemDofs = cellBasis->getDofCount(dim,0);
 
  675     auto cellDofs = Kokkos::subview(tagToOrdinal, dim, 0, Kokkos::ALL());
 
  677     range_type cellPointsRange = targetEPointsRange(dim, 0);
 
  679     ordinal_type numTargetEPoints = range_size(targetEPointsRange(dim,0));
 
  680     ordinal_type numBasisEPoints = range_size(basisEPointsRange(dim,0));
 
  682     ScalarViewType internalBasisAtBasisEPoints(
"internalBasisAtBasisEPoints",numCells,numElemDofs, numBasisEPoints, fieldDim);
 
  683     ScalarViewType negPartialProj(
"negPartialProj", numCells, numBasisEPoints, fieldDim);
 
  685     auto targetEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getTargetEvalWeights(dim,0));
 
  686     auto basisEWeights = Kokkos::create_mirror_view_and_copy(
typename SpT::memory_space(),projStruct->getBasisEvalWeights(dim,0));
 
  687     ordinal_type offsetBasis = basisEPointsRange(dim, 0).first;
 
  688     ordinal_type offsetTarget = targetEPointsRange(dim, 0).first;
 
  691     ScalarViewType wBasisAtBasisEPoints(
"weightedBasisAtBasisEPoints",numCells,numElemDofs, numBasisEPoints,fieldDim);
 
  692     ScalarViewType wBasisDofAtTargetEPoints(
"weightedBasisAtTargetEPoints",numCells,numElemDofs, numTargetEPoints,fieldDim);
 
  694     typedef ComputeBasisCoeffsOnCells_L2<decltype(basisCoeffs), ScalarViewType,  decltype(basisEWeights), decltype(computedDofs), decltype(cellDofs)> functorType;
 
  695     Kokkos::parallel_for(policy, functorType( basisCoeffs, negPartialProj,  internalBasisAtBasisEPoints,
 
  696         basisAtBasisEPoints, basisEWeights,  wBasisAtBasisEPoints, targetEWeights, basisAtTargetEPoints, wBasisDofAtTargetEPoints,
 
  697         computedDofs, cellDofs, fieldDim, numElemDofs, offsetBasis, offsetTarget, numVertexDofs+numEdgeDofs+numFaceDofs));
 
  699     typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, SpT> WorkArrayViewType;
 
  700     ScalarViewType cellMassMat_(
"cellMassMat_", numCells, numElemDofs, numElemDofs),
 
  701         cellRhsMat_(
"rhsMat_", numCells, numElemDofs);
 
  706           Kokkos::subview(wBasisDofAtTargetEPoints,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL(),0));
 
  711     ScalarViewType t_(
"t",numCells, numElemDofs);
 
  712     WorkArrayViewType w_(
"w",numCells,numElemDofs);
 
  713     ElemSystem cellSystem(
"cellSystem", 
true);
 
  714     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. 
ordinal_type getMaxNumEvalPoints(const EvalPointsType type) const 
Returns the maximum number of 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.