16 #ifndef __INTREPID2_PROJECTIONTOOLSDEFHVOL_HPP__
17 #define __INTREPID2_PROJECTIONTOOLSDEFHVOL_HPP__
26 template<
typename DeviceType>
27 template<
typename basisCoeffsValueType,
class ...basisCoeffsProperties,
28 typename funValsValueType,
class ...funValsProperties,
30 typename ortValueType,
class ...ortProperties>
33 const Kokkos::DynRankView<funValsValueType,funValsProperties...> targetAtTargetEPoints,
34 const Kokkos::DynRankView<ortValueType, ortProperties...> orts,
35 const BasisType* cellBasis,
36 ProjectionStruct<DeviceType, typename BasisType::scalarType> * projStruct){
38 typedef typename BasisType::scalarType scalarType;
39 typedef Kokkos::DynRankView<scalarType,DeviceType> ScalarViewType;
40 ordinal_type dim = cellBasis->getBaseCellTopology().getDimension();
42 ordinal_type basisCardinality = cellBasis->getCardinality();
44 ordinal_type numCells = targetAtTargetEPoints.extent(0);
46 auto refTargetEWeights = projStruct->getTargetEvalWeights(dim,0);
47 auto targetEPointsRange = projStruct->getTargetPointsRange();
49 auto refBasisEWeights = projStruct->getBasisEvalWeights(dim,0);
50 auto basisEPointsRange = projStruct->getBasisPointsRange();
52 ordinal_type numTargetEPoints = range_size(targetEPointsRange(dim,0));
53 ordinal_type numBasisEPoints = range_size(basisEPointsRange(dim,0));
55 ScalarViewType basisAtBasisEPoints(
"basisAtBasisEPoints", 1, basisCardinality, numBasisEPoints);
56 ScalarViewType basisAtTargetEPoints(
"basisAtTargetEPoints", basisCardinality, numTargetEPoints);
58 auto basisEPoints = projStruct->getAllEvalPoints(EvalPointsType::BASIS);
59 auto targetEPoints = projStruct->getAllEvalPoints(EvalPointsType::TARGET);
61 cellBasis->getValues(Kokkos::subview(basisAtBasisEPoints, 0, Kokkos::ALL(), Kokkos::ALL()), basisEPoints);
62 cellBasis->getValues(basisAtTargetEPoints, targetEPoints);
64 ScalarViewType weightedBasisAtTargetEPoints(
"weightedBasisAtTargetEPoints_",numCells, basisCardinality, numTargetEPoints);
65 ScalarViewType weightedBasisAtBasisEPoints(
"weightedBasisAtBasisEPoints", 1, basisCardinality, numBasisEPoints);
67 auto tagToOrdinal = Kokkos::create_mirror_view_and_copy(MemSpaceType(), cellBasis->getAllDofOrdinal());
68 auto cellDofs = Kokkos::subview(tagToOrdinal, dim, 0, Kokkos::ALL());
71 massMat0(
"massMat0", 1, basisCardinality, basisCardinality),
72 massMat(
"massMat", numCells, basisCardinality, basisCardinality),
73 rhsMat(
"rhsMat", numCells, basisCardinality );
75 ordinal_type offsetBasis = basisEPointsRange(dim,0).first;
76 ordinal_type offsetTarget = targetEPointsRange(dim,0).first;
78 using HostSpaceType = Kokkos::DefaultHostExecutionSpace;
79 auto hWeightedBasisAtBasisEPoints = Kokkos::create_mirror_view(weightedBasisAtBasisEPoints);
80 auto hWeightedBasisAtTargetEPoints = Kokkos::create_mirror_view(weightedBasisAtTargetEPoints);
81 auto hBasisAtBasisEPoints = Kokkos::create_mirror_view_and_copy(HostSpaceType(), basisAtBasisEPoints);
82 auto hBasisAtTargetEPoints = Kokkos::create_mirror_view_and_copy(HostSpaceType(), basisAtTargetEPoints);
84 for(ordinal_type j=0; j <basisCardinality; ++j) {
85 ordinal_type idof = cellBasis->getDofOrdinal(dim, 0, j);
86 for(ordinal_type iq=0; iq <ordinal_type(refBasisEWeights.extent(0)); ++iq)
87 hWeightedBasisAtBasisEPoints(0,j,iq) = hBasisAtBasisEPoints(0,idof,offsetBasis+iq) * refBasisEWeights(iq);
88 for(ordinal_type iq=0; iq <ordinal_type(refTargetEWeights.extent(0)); ++iq)
89 hWeightedBasisAtTargetEPoints(0,j,iq) = hBasisAtTargetEPoints(idof,offsetTarget+iq)* refTargetEWeights(iq);
91 Kokkos::deep_copy(weightedBasisAtBasisEPoints,hWeightedBasisAtBasisEPoints);
92 Kokkos::deep_copy(weightedBasisAtTargetEPoints,hWeightedBasisAtTargetEPoints);
98 typedef Kokkos::DynRankView<scalarType, Kokkos::LayoutRight, DeviceType> WorkArrayViewType;
99 ScalarViewType t_(
"t",numCells, basisCardinality);
100 WorkArrayViewType w_(
"w",numCells,basisCardinality);
102 ElemSystem cellSystem(
"cellSystem",
true);
103 cellSystem.solve(basisCoeffs, massMat, rhsMat, t_, w_, cellDofs, basisCardinality);
Header file for the abstract base class Intrepid2::DefaultCubatureFactory.