51 const ExactGeometry &exactGeometry,
const ExactGeometryGradient &exactGeometryGradient)
53 const ordinal_type numCells = flatCellGeometry.
extent_int(0);
55 INTREPID2_TEST_FOR_EXCEPTION(spaceDim != targetHGradBasis->getBaseCellTopology().getDimension(), std::invalid_argument,
"spaceDim must match the cell topology on which target basis is defined");
56 INTREPID2_TEST_FOR_EXCEPTION(projectedBasisNodes.rank() != 3, std::invalid_argument,
"projectedBasisNodes must have shape (C,F,D)");
57 INTREPID2_TEST_FOR_EXCEPTION(projectedBasisNodes.extent_int(0) != numCells, std::invalid_argument,
"cell counts must match in projectedBasisNodes and cellNodesToMap");
58 INTREPID2_TEST_FOR_EXCEPTION(projectedBasisNodes.extent_int(1) != targetHGradBasis->getCardinality(), std::invalid_argument,
"projectedBasisNodes must have shape (C,F,D)");
59 INTREPID2_TEST_FOR_EXCEPTION(projectedBasisNodes.extent_int(2) != spaceDim, std::invalid_argument,
"projectedBasisNodes must have shape (C,F,D)");
61 using ExecutionSpace =
typename DeviceType::execution_space;
66 ordinal_type targetQuadratureDegree(targetHGradBasis->getDegree()), targetDerivativeQuadratureDegree(targetHGradBasis->getDegree());
71 const ordinal_type numPoints = evaluationPointsRefSpace.extent(0);
72 const ordinal_type numGradPoints = evaluationGradPointsRefSpace.extent(0);
79 ViewType evaluationPoints (
"ProjectedGeometry evaluation points (value)", numCells, numPoints, spaceDim);
80 ViewType evaluationGradPoints(
"ProjectedGeometry evaluation points (gradient)", numCells, numGradPoints, spaceDim);
83 BasisPtr hgradLinearBasisForFlatGeometry = flatCellGeometry.
basisForNodes();
88 if (numGradPoints > 0)
96 auto policy = Kokkos::MDRangePolicy<ExecutionSpace,Kokkos::Rank<2>>({0,0}, {numCells,numPoints});
97 auto gradPolicy = Kokkos::MDRangePolicy<ExecutionSpace,Kokkos::Rank<3>>({0,0,0},{numCells,numGradPoints,spaceDim});
99 ViewType evaluationValues (
"exact geometry values", numCells, numPoints);
100 ViewType evaluationGradients (
"exact geometry gradients", numCells, numGradPoints, spaceDim);
104 for (
int comp=0; comp<spaceDim; comp++)
106 Kokkos::parallel_for(
"evaluate geometry function for projection", policy,
107 KOKKOS_LAMBDA (
const int &cellOrdinal,
const int &pointOrdinal) {
108 Kokkos::Array<PointScalar,spaceDim> point;
109 for (
int d=0; d<spaceDim; d++)
111 point[d] = evaluationPoints(cellOrdinal,pointOrdinal,d);
113 evaluationValues(cellOrdinal,pointOrdinal) = exactGeometry(point,comp);
123 flatCellGeometry.
setJacobian(gradPointsJacobians,evaluationGradPoints,refData);
125 Kokkos::parallel_for(
"evaluate geometry gradients for projection", gradPolicy,
126 KOKKOS_LAMBDA (
const int &cellOrdinal,
const int &pointOrdinal,
const int &d2) {
127 Kokkos::Array<PointScalar,spaceDim> point;
128 for (
int d=0; d<spaceDim; d++)
130 point[d] = evaluationGradPoints(cellOrdinal,pointOrdinal,d);
132 evaluationGradients(cellOrdinal,pointOrdinal,d2) = exactGeometryGradient(point,comp,d2);
139 transformedGradientData.storeMatVec(gradPointsJacobians,gradientData);
141 auto projectedBasisNodesForComp = Kokkos::subview(projectedBasisNodes,Kokkos::ALL(),Kokkos::ALL(),comp);
145 transformedGradientData.getUnderlyingView(),
147 targetHGradBasis.get(),